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
5include_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';
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?>
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_GRP_MEMBER
const IL_GRP_ADMIN
GUI class for membership features.
updateLPFromStatus()
Update lp from status.
getLocalTypeRole($a_translation=false)
assignMembers($user_ids, $a_type)
@access public
getAttendanceListUserData($a_user_id)
Callback from attendance list.
initEditParticipantTableGUI(array $participants)
init edit participants table gui
initParticipantTemplate()
Init participant view template.
updateParticipantsStatus()
save in participants table
Waiting list for groups.
static getLogger($a_component_id)
Get component logger.
Base class for member tab content.
getParentGUI()
Get parent gui.
getParentObject()
Get parent object.
getMembersObject()
Get member object.
readMemberData(array $usr_ids, array $columns)
Required for member table guis.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static getInstance($a_obj_id)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$a_type
Definition: workflow.php:93