25 include_once
'./Services/Membership/classes/class.ilParticipants.php';
58 $this->obj_id = $a_obj_id;
59 $this->usr_id = $a_usr_id;
62 $this->ref_id = current($ref_ids);
79 return (
bool) $this->participants_status[$this->
getUserId()][
'blocked'];
114 global $rbacreview,$ilObjDataCache,
$ilLog;
116 $rolf = $rbacreview->getRoleFolderOfObject($this->ref_id);
118 if(!isset($rolf[
'ref_id']) or !$rolf[
'ref_id'])
120 $title = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->ref_id));
121 #$ilLog->write(__METHOD__.': Found object without role folder. Ref_id: '.$this->ref_id.', title: '.$title);
126 $this->roles = $rbacreview->getRolesOfRoleFolder($rolf[
'ref_id'],
false);
129 $this->participants = array();
130 $this->members = $this->admins = $this->tutors = array();
132 foreach($this->roles as $role_id)
134 $title = $ilObjDataCache->lookupTitle($role_id);
135 switch(substr(
$title,0,8))
139 if($rbacreview->isAssigned($this->getUserId(),$role_id))
141 $this->participants =
true;
142 $this->members =
true;
148 if($rbacreview->isAssigned($this->getUserId(),$role_id))
150 $this->participants =
true;
151 $this->admins =
true;
157 if($rbacreview->isAssigned($this->getUserId(),$role_id))
159 $this->participants =
true;
160 $this->tutors =
true;
166 if($rbacreview->isAssigned($this->getUserId(),$role_id))
168 $this->participants =
true;
169 $this->admins =
true;
175 if($rbacreview->isAssigned($this->getUserId(),$role_id))
177 $this->participants =
true;
178 $this->members =
true;
183 if($rbacreview->isAssigned($this->getUserId(),$role_id))
185 $this->participants =
true;
186 $this->members =
true;
201 $query =
"SELECT * FROM crs_members ".
202 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,
'integer').
" ".
203 'AND usr_id = '.$ilDB->quote($this->
getUserId(),
'integer');
206 $this->participants_status = array();
209 $this->participants_status[$this->
getUserId()][
'blocked'] =
$row->blocked;
210 $this->participants_status[$this->
getUserId()][
'notification'] =
$row->notification;
211 $this->participants_status[$this->
getUserId()][
'passed'] =
$row->passed;
225 public function add($a_usr_id,$a_role)
227 global $rbacadmin,
$ilLog,$ilAppEventHandler,$rbacreview;
230 if($rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id,$this->roles))
238 $this->admins =
true;
242 $this->tutors =
true;
246 $this->members =
true;
250 $this->admins =
true;
254 $this->members =
true;
258 $rbacadmin->assignUser($this->role_data[$a_role],$a_usr_id);
264 include_once
'./Services/Membership/classes/class.ilWaitingList.php';
267 if($this->type ==
'crs')
270 $ilLog->write(__METHOD__.
': Raise new event: Modules/Course addParticipant');
271 $ilAppEventHandler->raise(
"Modules/Course",
"addParticipant", array(
'obj_id' => $this->obj_id,
'usr_id' => $a_usr_id,
'role_id' => $a_role));
283 public function delete($a_usr_id)
285 global $rbacadmin,
$ilDB, $ilAppEventHandler;
288 foreach($this->roles as $role_id)
290 $rbacadmin->deassignUser($role_id,$a_usr_id);
293 $query =
"DELETE FROM crs_members ".
294 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,
'integer').
" ".
295 "AND obj_id = ".$ilDB->quote($this->obj_id ,
'integer');
298 if($this->type ==
'crs')
301 $ilAppEventHandler->raise(
"Modules/Course",
"deleteParticipant", array(
'obj_id' => $this->obj_id,
'usr_id' => $a_usr_id));
316 $query =
"DELETE FROM il_subscribers ".
317 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,
'integer').
" ".
318 "AND obj_id = ".$ilDB->quote($this->obj_id ,
'integer').
" ";
369 $this->participants_status[$a_usr_id][
'notification'] = (int) $a_notification;
371 $query =
"SELECT * FROM crs_members ".
372 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,
'integer').
" ".
373 "AND usr_id = ".$ilDB->quote($a_usr_id ,
'integer');
377 $query =
"UPDATE crs_members SET ".
378 "notification = ".$ilDB->quote((
int) $a_notification ,
'integer').
" ".
379 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,
'integer').
" ".
380 "AND usr_id = ".$ilDB->quote($a_usr_id ,
'integer');
384 $query =
"INSERT INTO crs_members (notification,obj_id,usr_id,passed,blocked) ".
386 $ilDB->quote((
int) $a_notification ,
'integer').
", ".
387 $ilDB->quote($this->obj_id ,
'integer').
", ".
388 $ilDB->quote($a_usr_id ,
'integer').
", ".
389 $ilDB->quote(0,
'integer').
", ".
390 $ilDB->quote(0,
'integer').
410 $this->type ==
'crs' ?
416 SELECT COUNT(rolesusers.usr_id) cnt
418 FROM object_data rdata
420 LEFT JOIN rbac_ua rolesusers
421 ON rolesusers.rol_id = rdata.obj_id
423 WHERE rdata.obj_id = %s
426 $query .=
' AND '.$ilDB->in(
'rolesusers.usr_id', $a_usr_ids,
true,
'integer');
427 $res = $ilDB->queryF(
$query, array(
'integer'), array($admin_role_id));
431 return (
int)
$data[
'cnt'] > 0;