ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilGroupMembershipGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once './Services/Membership/classes/class.ilMembershipGUI.php';
6 
19 {
23  public function assignMembers($user_ids, $a_type)
24  {
25  if(empty($user_ids[0]))
26  {
27  $this->lng->loadLanguageModule('search');
28  ilUtil::sendFailure($this->lng->txt('search_err_user_not_exist'),true);
29  return false;
30  }
31 
32  $assigned = FALSE;
33  foreach((array) $user_ids as $new_member)
34  {
35  if($this->getMembersObject()->isAssigned($new_member))
36  {
37  continue;
38  }
39  switch($a_type)
40  {
41  case $this->getParentObject()->getDefaultAdminRole():
42  $this->getMembersObject()->add($new_member, IL_GRP_ADMIN);
43  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
44  $this->getMembersObject()->sendNotification(
46  $new_member
47  );
48  $assigned = TRUE;
49  break;
50 
51  case $this->getParentObject()->getDefaultMemberRole();
52  $this->getMembersObject()->add($new_member, IL_GRP_MEMBER);
53  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
54  $this->getMembersObject()->sendNotification(
56  $new_member
57  );
58  $assigned = TRUE;
59  break;
60 
61  default:
62  if(in_array($a_type,$this->getParentObject()->getLocalGroupRoles(true)))
63  {
64  $this->getMembersObject()->add($new_member,IL_GRP_MEMBER);
65  $this->getMembersObject()->updateRoleAssignments($new_member,(array) $a_type);
66  }
67  else
68  {
69  ilLoggerFactory::getLogger('crs')->notice('Can not find role with id .' . $a_type. ' to assign users.');
70  ilUtil::sendFailure($this->lng->txt("crs_cannot_find_role"),true);
71  return false;
72  }
73  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
74  $this->getMembersObject()->sendNotification(
76  $new_member
77  );
78  $assigned = TRUE;
79  break;
80  }
81  }
82 
83  if($assigned)
84  {
85  ilUtil::sendSuccess($this->lng->txt("grp_msg_member_assigned"),true);
86  }
87  else
88  {
89  ilUtil::sendSuccess($this->lng->txt('grp_users_already_assigned'),TRUE);
90  }
91  $this->ctrl->redirect($this,'participants');
92  }
93 
97  protected function updateParticipantsStatus()
98  {
99  $participants = (array) $_POST['visible_member_ids'];
100  $notification = (array) $_POST['notification'];
101  foreach($participants as $mem_id)
102  {
103  if($this->getMembersObject()->isAdmin($mem_id))
104  {
105  $this->getMembersObject()->updateNotification($mem_id, in_array($mem_id, $notification));
106  }
107  else
108  {
109  $this->getMembersObject()->updateNotification($mem_id, false);
110  }
111  }
112  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
113  $this->ctrl->redirect($this, 'participants');
114  }
115 
116 
120  protected function initParticipantTableGUI()
121  {
122  include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
123  $show_tracking =
125  ;
126  if($show_tracking)
127  {
128  include_once('./Services/Object/classes/class.ilObjectLP.php');
129  $olp = ilObjectLP::getInstance($this->getParentObject()->getId());
130  $show_tracking = $olp->isActive();
131  }
132 
133  include_once './Modules/Group/classes/class.ilGroupParticipantsTableGUI.php';
134  return new ilGroupParticipantsTableGUI(
135  $this,
136  $this->getParentObject(),
137  $show_tracking
138  );
139  }
140 
146  protected function initEditParticipantTableGUI(array $participants)
147  {
148  include_once './Modules/Group/classes/class.ilGroupEditParticipantsTableGUI.php';
149  $table = new ilGroupEditParticipantsTableGUI($this, $this->getParentObject());
150  $table->setTitle($this->lng->txt($this->getParentObject()->getType().'_header_edit_members'));
151  $table->setData($this->getParentGUI()->readMemberData($participants));
152 
153  return $table;
154  }
155 
156 
157 
161  protected function initParticipantTemplate()
162  {
163  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.grp_edit_members.html','Modules/Group');
164  }
165 
169  public function getLocalTypeRole($a_translation = false)
170  {
171  return $this->getParentObject()->getLocalGroupRoles($a_translation);
172  }
173 
177  protected function updateLPFromStatus()
178  {
179  return null;
180  }
181 
186  protected function initWaitingList()
187  {
188  include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
189  $wait = new ilGroupWaitingList($this->getParentObject()->getId());
190  return $wait;
191  }
192 
196  protected function getDefaultRole()
197  {
198  return $this->getParentGUI()->object->getDefaultMemberRole();
199  }
200 
205  public function getPrintMemberData($a_members)
206  {
207  $member_data = $this->readMemberData($a_members, array());
208  $member_data = $this->getParentGUI()->addCustomData($member_data);
209 
210  $this->logger->dump($member_data);
211 
212  return $member_data;
213  }
214 
220  public function getAttendanceListUserData($a_user_id)
221  {
222  $data = $this->member_data[$a_user_id];
223 
224  $this->logger->dump($data);
225 
226  $data['access'] = $data['access_time'];
227  $data['progress'] = $this->lng->txt($data['progress']);
228 
229  return $data;
230  }
231 
232 
233 
234 }
235 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
readMemberData(array $usr_ids, array $columns)
Required for member table guis.
Base class for member tab content.
updateLPFromStatus()
Update lp from status.
getMembersObject()
Get member object.
const IL_GRP_ADMIN
initParticipantTemplate()
Init participant view template.
const IL_GRP_MEMBER
assignMembers($user_ids, $a_type)
public
$a_type
Definition: workflow.php:93
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _enabledLearningProgress()
check wether learing progress is enabled or not
initWaitingList()
init waiting list
updateParticipantsStatus()
save in participants table
Waiting list for groups.
initEditParticipantTableGUI(array $participants)
init edit participants table gui
getParentGUI()
Get parent gui.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
GUI class for membership features.
static getLogger($a_component_id)
Get component logger.
getParentObject()
Get parent object.
static getInstance($a_obj_id)
getLocalTypeRole($a_translation=false)
$_POST["username"]
getAttendanceListUserData($a_user_id)
Callback from attendance list.