ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilParticipants Class Reference
+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

 __construct ($a_component_name, $a_obj_id)
 Singleton Constructor. More...
 
 getObjId ()
 get current obj_id More...
 
 getType ()
 Get object type. More...
 
 getNotificationRecipients ()
 Get admin, tutor which have notification enabled. More...
 
 getCountMembers ()
 Get number of members (not participants) More...
 
 getCountParticipants ()
 Get number of participants. More...
 
 getParticipants ()
 Get all participants ids. More...
 
 getMembers ()
 Get all members ids (admins and tutors are not members) Use get participants to fetch all. More...
 
 getAdmins ()
 Get all admins ids. More...
 
 getCountAdmins ()
 Get number of admins. More...
 
 getTutors ()
 Get all tutors ids. More...
 
 isAdmin ($a_usr_id)
 is user admin More...
 
 isTutor ($a_usr_id)
 is user tutor More...
 
 isMember ($a_usr_id)
 is user member More...
 
 isAssigned ($a_usr_id)
 check if user is assigned More...
 
 isLastAdmin ($a_usr_id)
 Check if user is last admin. More...
 
 getRoles ()
 Get course roles. More...
 
 getAssignedRoles ($a_usr_id)
 Get assigned roles. More...
 
 updateRoleAssignments ($a_usr_id, $a_roles)
 Update role assignments. More...
 
 checkLastAdmin ($a_usr_ids)
 Check if user for deletion are last admins. More...
 
 isBlocked ($a_usr_id)
 Check if user is blocked. More...
 
 hasPassed ($a_usr_id)
 Check if user has passed course. More...
 
 delete ($a_usr_id)
 Drop user from all roles. More...
 
 updateBlocked ($a_usr_id, $a_blocked)
 Update blocked status. More...
 
 updateNotification ($a_usr_id, $a_notification)
 Update notification status. More...
 
 add ($a_usr_id, $a_role)
 Add user to course. More...
 
 deleteParticipants ($a_user_ids)
 Delete users. More...
 
 addDesktopItem ($a_usr_id)
 Add desktop item. More...
 
 dropDesktopItem ($a_usr_id)
 Drop desktop item. More...
 
 isNotificationEnabled ($a_usr_id)
 check if notification is enabled More...
 
 isGroupingMember ($a_usr_id, $a_field='')
 Check grouping membership. More...
 
 getSubscribers ()
 get all subscribers More...
 
 getCountSubscribers ()
 get number of subscribers More...
 
 getSubscriberData ($a_usr_id)
 get subscriber data More...
 
 assignSubscribers ($a_usr_ids)
 Assign subscribers. More...
 
 assignSubscriber ($a_usr_id)
 Assign subscriber. More...
 
 autoFillSubscribers ()
 Assign subscriber. More...
 
 addSubscriber ($a_usr_id)
 Add subscriber. More...
 
 updateSubscriptionTime ($a_usr_id, $a_subtime)
 Update subscription time. More...
 
 updateSubject ($a_usr_id, $a_subject)
 update subject More...
 
 deleteSubscriber ($a_usr_id)
 Delete subsciber. More...
 
 deleteSubscribers ($a_usr_ids)
 Delete subscibers. More...
 
 isSubscriber ($a_usr_id)
 check if is subscriber More...
 

Static Public Member Functions

static getInstanceByObjId ($a_obj_id)
 Get instance by obj type. More...
 
static hasParticipantListAccess ($a_obj_id, $a_usr_id=null)
 Check if (current) user has access to the participant list. More...
 
static _getMembershipByType ($a_usr_id, $a_type, $a_only_member_role=false)
 get membership by type Get course or group membership More...
 
static _isParticipant ($a_ref_id, $a_usr_id)
 Static function to check if a user is a participant of the container object. More...
 
static lookupNumberOfParticipants ($a_ref_id)
 Lookup the number of participants (crs admins, tutors, members, grp admins, members) More...
 
static lookupNumberOfMembers ($a_ref_id)
 Lookup number of members @global ilRbacReview $rbacreview @global <type> $ilObjDataCache. More...
 
static _isBlocked ($a_obj_id, $a_usr_id)
 Check if user is blocked. More...
 
static _hasPassed ($a_obj_id, $a_usr_id)
 Check if user has passed course. More...
 
static _deleteAllEntries ($a_obj_id)
 Delete all entries Normally called for course deletion. More...
 
static _deleteUser ($a_usr_id)
 Delete user data. More...
 
static getDefaultMemberRole ($a_ref_id)
 
static lookupSubscribers ($a_obj_id)
 
static _isSubscriber ($a_obj_id, $a_usr_id)
 check if user is subscriber More...
 
static lookupSubscribersData ($a_obj_id)
 

Protected Member Functions

 getComponent ()
 Get component name Used for raising events. More...
 
 readParticipants ()
 Read participants. More...
 
 readParticipantsStatus ()
 Read status of participants (blocked, notification, passed) More...
 
 readSubscribers ()
 read subscribers More...
 
 readSubscriberData ($a_usr_id)
 read subscribers More...
 

Protected Attributes

 $component = ''
 
 $obj_id = 0
 
 $type = ''
 
 $ref_id = 0
 
 $roles = array()
 
 $role_data = array()
 
 $participants = array()
 
 $participants_status = array()
 
 $members = array()
 
 $tutors = array()
 
 $admins = array()
 
 $subscribers = array()
 
 $ilDB
 
 $lng
 

Detailed Description

Definition at line 20 of file class.ilParticipants.php.

Constructor & Destructor Documentation

◆ __construct()

ilParticipants::__construct (   $a_component_name,
  $a_obj_id 
)

Singleton Constructor.

@access public

Parameters
intobj_id of container

Definition at line 50 of file class.ilParticipants.php.

51 {
52 global $ilDB,$lng;
53
54 $this->ilDB = $ilDB;
55 $this->lng = $lng;
56
57 $this->component = $a_component_name;
58
59 $this->obj_id = $a_obj_id;
60 $this->type = ilObject::_lookupType($a_obj_id);
61 $ref_ids = ilObject::_getAllReferences($this->obj_id);
62 $this->ref_id = current($ref_ids);
63
64 $this->readParticipants();
66 }
Database Wrapper.
Definition: class.ilDB.php:29
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
readParticipants()
Read participants.
readParticipantsStatus()
Read status of participants (blocked, notification, passed)

References $ilDB, $lng, ilObject\_getAllReferences(), ilObject\_lookupType(), readParticipants(), and readParticipantsStatus().

+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllEntries()

static ilParticipants::_deleteAllEntries (   $a_obj_id)
static

Delete all entries Normally called for course deletion.

@access public

Parameters
intobj_id

Definition at line 314 of file class.ilParticipants.php.

315 {
316 global $ilDB;
317
318 $query = "DELETE FROM obj_members ".
319 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
320 $res = $ilDB->manipulate($query);
321
322 $query = "DELETE FROM il_subscribers ".
323 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
324 $res = $ilDB->manipulate($query);
325
326 $query = 'DELETE FROM crs_waiting_list '.
327 'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
328 $ilDB->manipulate($query);
329
330 return true;
331 }

References $ilDB, $query, and $res.

Referenced by ilObjCourse\delete(), ilObjGroup\delete(), and ilSoapCourseAdministration\updateCourse().

+ Here is the caller graph for this function:

◆ _deleteUser()

static ilParticipants::_deleteUser (   $a_usr_id)
static

Delete user data.

@access public

Parameters
intuser id

Definition at line 341 of file class.ilParticipants.php.

342 {
343 global $ilDB;
344
345 $query = "DELETE FROM obj_members WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
346 $res = $ilDB->manipulate($query);
347
348 $query = "DELETE FROM il_subscribers WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
349 $res = $ilDB->manipulate($query);
350
351 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
353 }
static _deleteUser($a_usr_id)
Delete user.

References $ilDB, $query, $res, and ilWaitingList\_deleteUser().

Referenced by ilObjCourse\_deleteUser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMembershipByType()

static ilParticipants::_getMembershipByType (   $a_usr_id,
  $a_type,
  $a_only_member_role = false 
)
static

get membership by type Get course or group membership

@access public

Parameters
int$a_usr_idusr_id
string$a_typecrs or grp
bool$a_only_member_role
Returns

Definition at line 159 of file class.ilParticipants.php.

160 {
161 global $ilDB;
162
163 // this will also dismiss local roles!
164 if ($a_only_member_role)
165 {
166 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
167 $a2 = "AND obd2.title LIKE 'il_".$a_type."_mem%' ";
168 }
169
170 // #14290 - no role folder anymore
171 $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua ".
172 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
173 "JOIN object_reference obr ON fa.parent = obr.ref_id ".
174 "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
175 $j2.
176 "WHERE obd.type = ".$ilDB->quote($a_type,'text')." ".
177 "AND fa.assign = 'y' ".
178 "AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
179 $a2;
180
181 $res = $ilDB->query($query);
182 while($row = $ilDB->fetchObject($res))
183 {
184 $ref_ids[] = $row->obj_id;
185 }
186
187 return $ref_ids ? $ref_ids : array();
188 }

References $ilDB, $query, $res, and $row.

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilBasicSkill\getCompletionDateForTriggerRefId(), ilPortfolioPageGUI\getCoursesOfUser(), ilCourseVerificationTableGUI\getItems(), ilLPProgressTableGUI\getItems(), ilPDSelectedItemsBlockGUI\getObjectsByMembership(), ilTestEvaluationData\getParticipants(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), ilWorkspaceAccessGUI\share(), and ilMailSearchGroupsGUI\showMyGroups().

+ Here is the caller graph for this function:

◆ _hasPassed()

static ilParticipants::_hasPassed (   $a_obj_id,
  $a_usr_id 
)
static

Check if user has passed course.

@access public

Parameters
intobj_id
intuser id

Definition at line 293 of file class.ilParticipants.php.

294 {
295 global $ilDB;
296
297 $query = "SELECT * FROM obj_members ".
298 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
299 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
300 "AND passed = '1'";
301 $res = $ilDB->query($query);
302 return $res->numRows() ? true : false;
303 }

References $ilDB, $query, and $res.

Referenced by ilObjCourseAccess\checkCondition().

+ Here is the caller graph for this function:

◆ _isBlocked()

static ilParticipants::_isBlocked (   $a_obj_id,
  $a_usr_id 
)
static

Check if user is blocked.

@access public

Parameters
intcourse id
intusr_id

Definition at line 272 of file class.ilParticipants.php.

273 {
274 global $ilDB;
275
276 $query = "SELECT * FROM obj_members ".
277 "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
278 "AND usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
279 "AND blocked = ".$ilDB->quote(1,'integer');
280 $res = $ilDB->query($query);
281 return $res->numRows() ? true : false;
282 }

References $ilDB, $query, and $res.

◆ _isParticipant()

static ilParticipants::_isParticipant (   $a_ref_id,
  $a_usr_id 
)
static

Static function to check if a user is a participant of the container object.

@access public

Parameters
intref_id
intuser id

Reimplemented in ilGroupParticipants, and ilSessionParticipants.

Definition at line 200 of file class.ilParticipants.php.

201 {
202 global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
203
204 $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
205
206 return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
207 }

References $ilDB, and $ilLog.

Referenced by ilForumModeratorsGUI\detachModeratorRole(), ilObjCourseGUI\executeCommand(), ilObjCourseGUI\getTabs(), and ilObjCourseGUI\initHeaderAction().

+ Here is the caller graph for this function:

◆ _isSubscriber()

static ilParticipants::_isSubscriber (   $a_obj_id,
  $a_usr_id 
)
static

check if user is subscriber

@access public

Definition at line 1336 of file class.ilParticipants.php.

1337 {
1338 global $ilDB;
1339
1340 $query = "SELECT * FROM il_subscribers ".
1341 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1342 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
1343
1344 $res = $ilDB->query($query);
1345 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1346 {
1347 return true;
1348 }
1349 return false;
1350 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjCourseListGUI\getProperties(), and ilMembershipTest\testSubscription().

+ Here is the caller graph for this function:

◆ add()

ilParticipants::add (   $a_usr_id,
  $a_role 
)

Add user to course.

@access public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

Definition at line 814 of file class.ilParticipants.php.

815 {
816 global $rbacadmin,$ilLog,$ilAppEventHandler;
817
818 if($this->isAssigned($a_usr_id))
819 {
820 return false;
821 }
822
823 switch($a_role)
824 {
825 case IL_CRS_ADMIN:
826 $this->admins[] = $a_usr_id;
827 break;
828
829 case IL_CRS_TUTOR:
830 $this->tutors[] = $a_usr_id;
831 break;
832
833 case IL_CRS_MEMBER:
834 $this->members[] = $a_usr_id;
835 break;
836
837 case IL_GRP_ADMIN:
838 $this->admins[] = $a_usr_id;
839 break;
840
841 case IL_GRP_MEMBER:
842 $this->members[] = $a_usr_id;
843 break;
844 }
845
846 $this->participants[] = $a_usr_id;
847 $rbacadmin->assignUser($this->role_data[$a_role],$a_usr_id);
848 $this->addDesktopItem($a_usr_id);
849
850 // Delete subscription request
851 $this->deleteSubscriber($a_usr_id);
852
853 include_once './Services/Membership/classes/class.ilWaitingList.php';
854 ilWaitingList::deleteUserEntry($a_usr_id,$this->obj_id);
855
856 $ilLog->write(__METHOD__.': Raise new event: Modules/Course|Group addParticipant');
857 $ilAppEventHandler->raise(
858 $this->getComponent(),
859 "addParticipant",
860 array(
861 'obj_id' => $this->obj_id,
862 'usr_id' => $a_usr_id,
863 'role_id' => $a_role)
864 );
865 return true;
866 }
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
const IL_GRP_MEMBER
const IL_CRS_TUTOR
const IL_GRP_ADMIN
getComponent()
Get component name Used for raising events.
isAssigned($a_usr_id)
check if user is assigned
deleteSubscriber($a_usr_id)
Delete subsciber.
addDesktopItem($a_usr_id)
Add desktop item.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.

References $ilLog, addDesktopItem(), deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, and isAssigned().

Referenced by assignSubscriber().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addDesktopItem()

ilParticipants::addDesktopItem (   $a_usr_id)

Add desktop item.

@access public

Parameters
intusr_id

Definition at line 892 of file class.ilParticipants.php.

893 {
894 if(!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
895 {
896 ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id,$this->type);
897 }
898 return true;
899 }
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop

References ilObjUser\_addDesktopItem(), and ilObjUser\_isDesktopItem().

Referenced by add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubscriber()

ilParticipants::addSubscriber (   $a_usr_id)

Add subscriber.

@access public

Reimplemented in ilCourseParticipants, and ilGroupParticipants.

Definition at line 1212 of file class.ilParticipants.php.

1213 {
1214 global $ilDB;
1215
1216 $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) ".
1217 " VALUES (".
1218 $ilDB->quote($a_usr_id ,'integer').",".
1219 $ilDB->quote($this->obj_id ,'integer').", ".
1220 $ilDB->quote('','text').", ".
1221 $ilDB->quote(time() ,'integer').
1222 ")";
1223 $res = $ilDB->manipulate($query);
1224
1225 return true;
1226 }

References $ilDB, $query, and $res.

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

@access public

Definition at line 1147 of file class.ilParticipants.php.

1148 {
1149 global $ilErr;
1150
1151 $ilErr->setMessage("");
1152 if(!$this->isSubscriber($a_usr_id))
1153 {
1154 $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1155
1156 return false;
1157 }
1158 if($this->isAssigned($a_usr_id))
1159 {
1160 $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1161 $ilErr->appendMessage($tmp_obj->getLogin().": ".$this->lng->txt("crs_user_already_assigned"));
1162
1163 return false;
1164 }
1165
1166 if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id))
1167 {
1168 $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1169
1170 return false;
1171 }
1172
1173 // TODO: must be group or course member role
1174 $this->add($tmp_obj->getId(),IL_CRS_MEMBER);
1175 $this->deleteSubscriber($a_usr_id);
1176
1177 return true;
1178 }
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
add($a_usr_id, $a_role)
Add user to course.
isSubscriber($a_usr_id)
check if is subscriber

References $ilErr, add(), deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), IL_CRS_MEMBER, isAssigned(), and isSubscriber().

Referenced by assignSubscribers(), and autoFillSubscribers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignSubscribers()

ilParticipants::assignSubscribers (   $a_usr_ids)

Assign subscribers.

@access public

Definition at line 1126 of file class.ilParticipants.php.

1127 {
1128 if(!is_array($a_usr_ids) or !count($a_usr_ids))
1129 {
1130 return false;
1131 }
1132 foreach($a_usr_ids as $id)
1133 {
1134 if(!$this->assignSubscriber($id))
1135 {
1136 return false;
1137 }
1138 }
1139 return true;
1140 }
assignSubscriber($a_usr_id)
Assign subscriber.

References assignSubscriber().

+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

@access public

Definition at line 1185 of file class.ilParticipants.php.

1186 {
1187 $this->readSubscribers();
1188
1189 $counter = 0;
1190 foreach($this->subscribers as $subscriber)
1191 {
1192 if(!$this->assignSubscriber($subscriber))
1193 {
1194 continue;
1195 }
1196 else
1197 {
1198 // TODO: notification
1199 #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1200 }
1201 ++$counter;
1202 }
1203
1204 return $counter;
1205 }
readSubscribers()
read subscribers

References assignSubscriber(), and readSubscribers().

+ Here is the call graph for this function:

◆ checkLastAdmin()

ilParticipants::checkLastAdmin (   $a_usr_ids)

Check if user for deletion are last admins.

@access public

Parameters
arrayarray of user ids for deletion

Definition at line 641 of file class.ilParticipants.php.

642 {
643 foreach($this->getAdmins() as $admin_id)
644 {
645 if(!in_array($admin_id,$a_usr_ids))
646 {
647 return true;
648 }
649 }
650 return false;
651 }
getAdmins()
Get all admins ids.

References getAdmins().

+ Here is the call graph for this function:

◆ delete()

ilParticipants::delete (   $a_usr_id)

Drop user from all roles.

@access public

Parameters
intusr_id

Reimplemented in ilSessionParticipants.

Definition at line 692 of file class.ilParticipants.php.

693 {
694 global $rbacadmin,$ilDB;
695
696 $this->dropDesktopItem($a_usr_id);
697 foreach($this->roles as $role_id)
698 {
699 $rbacadmin->deassignUser($role_id,$a_usr_id);
700 }
701
702 $query = "DELETE FROM obj_members ".
703 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
704 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer');
705 $res = $ilDB->manipulate($query);
706
707 $this->readParticipants();
708 $this->readParticipantsStatus();
709
710 $GLOBALS['ilAppEventHandler']->raise(
711 $this->getComponent(),
712 "deleteParticipant",
713 array(
714 'obj_id' => $this->obj_id,
715 'usr_id' => $a_usr_id)
716 );
717
718 return true;
719 }
dropDesktopItem($a_usr_id)
Drop desktop item.
$GLOBALS['ct_recipient']

References $GLOBALS, $ilDB, $query, $res, dropDesktopItem(), getComponent(), readParticipants(), and readParticipantsStatus().

+ Here is the call graph for this function:

◆ deleteParticipants()

ilParticipants::deleteParticipants (   $a_user_ids)

Delete users.

@access public

Parameters
arrayuser ids

Definition at line 876 of file class.ilParticipants.php.

877 {
878 foreach($a_user_ids as $user_id)
879 {
880 $this->delete($user_id);
881 }
882 return true;
883 }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

@access public

Definition at line 1272 of file class.ilParticipants.php.

1273 {
1274 global $ilDB;
1275
1276 $query = "DELETE FROM il_subscribers ".
1277 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1278 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1279 $res = $ilDB->manipulate($query);
1280
1281 return true;
1282 }

References $ilDB, $query, and $res.

Referenced by add(), assignSubscriber(), and readSubscribers().

+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

@access public

Definition at line 1290 of file class.ilParticipants.php.

1291 {
1292 global $ilErr,$ilDB;
1293
1294 if(!is_array($a_usr_ids) or !count($a_usr_ids))
1295 {
1296 $ilErr->setMessage('');
1297 $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1298
1299 return false;
1300 }
1301 $query = "DELETE FROM il_subscribers ".
1302 "WHERE ".$ilDB->in('usr_id',(array) $a_usr_ids,false,'integer')." ".
1303 "AND obj_id = ".$ilDB->quote($this->obj_id,'integer');
1304 $res = $ilDB->query($query);
1305 return true;
1306 }

References $ilDB, $ilErr, $query, and $res.

◆ dropDesktopItem()

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

@access public

Parameters
intusr_id

Definition at line 908 of file class.ilParticipants.php.

909 {
910 if(ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
911 {
912 ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id,$this->type);
913 }
914
915 return true;
916 }
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop

References ilObjUser\_dropDesktopItem(), and ilObjUser\_isDesktopItem().

Referenced by delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

@access public

Returns
array array of user ids

Definition at line 478 of file class.ilParticipants.php.

479 {
480 return $this->admins ? $this->admins : array();
481 }

Referenced by checkLastAdmin(), getCountAdmins(), and isLastAdmin().

+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

@access public

Parameters
intuser_id

Definition at line 585 of file class.ilParticipants.php.

586 {
587 global $rbacreview;
588
589 foreach($this->roles as $role)
590 {
591 if($rbacreview->isAssigned($a_usr_id,$role))
592 {
593 $assigned[] = $role;
594 }
595 }
596 return $assigned ? $assigned : array();
597 }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

Definition at line 103 of file class.ilParticipants.php.

104 {
105 return $this->component;
106 }

References $component.

Referenced by add(), and delete().

+ Here is the caller graph for this function:

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

Definition at line 487 of file class.ilParticipants.php.

488 {
489 return count($this->getAdmins());
490 }

References getAdmins().

+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

@access public

Definition at line 431 of file class.ilParticipants.php.

432 {
433 return count($this->members);
434 }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

@access public

Definition at line 442 of file class.ilParticipants.php.

443 {
444 return count($this->participants);
445 }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

@access public

Definition at line 1104 of file class.ilParticipants.php.

1105 {
1106 return count($this->getSubscribers());
1107 }
getSubscribers()
get all subscribers

References getSubscribers().

+ Here is the call graph for this function:

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

Definition at line 355 of file class.ilParticipants.php.

356 {
357 global $ilCtrl;
358
359 $obj_id = ilObject::_lookupObjId($a_ref_id);
361
362 if(!in_array($type,array('crs','grp')))
363 {
364 return 0;
365 }
366
367 global $rbacreview;
368
369
370 $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
371
372 foreach($roles as $role)
373 {
374 $title = ilObject::_lookupTitle($role);
375 if(substr($title, 0, 13) == ('il_'.$type.'_member'))
376 {
377 return $role;
378 }
379 }
380 return 0;
381 }
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $obj_id, $roles, $type, ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by ilStartUpGUI\_checkGoto(), ilCourseRegistrationGUI\add(), and ilRbacSystem\initMemberView().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByObjId()

static ilParticipants::getInstanceByObjId (   $a_obj_id)
static

Get instance by obj type.

Parameters
int$a_obj_id
Returns
ilParticipants
Exceptions
InvalidArgumentException

Definition at line 75 of file class.ilParticipants.php.

76 {
77 $type = ilObject::_lookupType($a_obj_id);
78 switch($type)
79 {
80 case 'crs':
81 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
83
84 case 'grp':
85 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
87
88 case 'sess':
89 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
91
92 default:
93 $GLOBALS['ilLog']->logStack();
94 $GLOBALS['ilLog']->write(__METHOD__.': Invalid obj_id given: '.$a_obj_id);
95 throw new InvalidArgumentException('Invalid obj id given');
96 }
97 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.

References $GLOBALS, $type, ilCourseParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), ilSessionParticipants\_getInstanceByObjId(), and ilObject\_lookupType().

Referenced by ilObjSessionGUI\assignSubscribersObject(), ilPortfolioAccessHandler\findSharedObjects(), ilWorkspaceAccessHandler\findSharedObjects(), ilECSAppEventListener\handleMembership(), hasParticipantListAccess(), ilRepositorySearchGUI\listUsers(), ilObjSessionGUI\membersObject(), ilRepositoryObjectResultTableGUI\parseObjectIds(), ilObjSessionGUI\refuseSubscribersObject(), ilObjSessionGUI\registerObject(), and ilObjSessionGUI\showJoinRequestButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMembers()

ilParticipants::getMembers ( )

Get all members ids (admins and tutors are not members) Use get participants to fetch all.

@access public

Returns
array array of user ids

Definition at line 468 of file class.ilParticipants.php.

469 {
470 return $this->members ? $this->members : array();
471 }

Referenced by ilSessionParticipants\readParticipantsStatus().

+ Here is the caller graph for this function:

◆ getNotificationRecipients()

ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

@access public

Returns
array array of user ids

Definition at line 407 of file class.ilParticipants.php.

408 {
409 global $ilDB;
410
411 $query = "SELECT * FROM obj_members ".
412 "WHERE notification = 1 ".
413 "AND obj_id = ".$ilDB->quote($this->obj_id)." ";
414 $res = $ilDB->query($query);
415 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
416 {
417 if($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id))
418 {
419 $recp[] = $row->usr_id;
420 }
421 }
422 return $recp ? $recp : array();
423 }
isAdmin($a_usr_id)
is user admin

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and isAdmin().

Referenced by ilGroupParticipants\sendNotification(), ilCourseParticipants\sendNotificationToAdmins(), ilCourseParticipants\sendSubscriptionRequestToAdmins(), and ilCourseParticipants\sendUnsubscribeNotificationToAdmins().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjId()

ilParticipants::getObjId ( )

get current obj_id

Returns
type

Definition at line 387 of file class.ilParticipants.php.

388 {
389 return $this->obj_id;
390 }

References $obj_id.

Referenced by ilCourseParticipants\addSubscriber(), and ilGroupParticipants\addSubscriber().

+ Here is the caller graph for this function:

◆ getParticipants()

ilParticipants::getParticipants ( )

Get all participants ids.

@access public

Returns
array array of user ids

Definition at line 456 of file class.ilParticipants.php.

457 {
458 return $this->participants ? $this->participants : array();
459 }

Referenced by isGroupingMember().

+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

@access public

Parameters

Definition at line 573 of file class.ilParticipants.php.

574 {
575 return $this->roles ? $this->roles : array();
576 }

Referenced by updateRoleAssignments().

+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

@access public

Definition at line 1114 of file class.ilParticipants.php.

1115 {
1116 return $this->readSubscriberData($a_usr_id);
1117 }
readSubscriberData($a_usr_id)
read subscribers

References readSubscriberData().

+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers

@access public

Definition at line 1091 of file class.ilParticipants.php.

1092 {
1093 $this->readSubscribers();
1094
1095 return $this->subscribers;
1096 }

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTutors()

ilParticipants::getTutors ( )

Get all tutors ids.

@access public

Returns
array array of user ids

Definition at line 499 of file class.ilParticipants.php.

500 {
501 return $this->tutors ? $this->tutors : array();
502 }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

Definition at line 396 of file class.ilParticipants.php.

397 {
398 return $this->type;
399 }

References $type.

◆ hasParticipantListAccess()

static ilParticipants::hasParticipantListAccess (   $a_obj_id,
  $a_usr_id = null 
)
static

Check if (current) user has access to the participant list.

Parameters
type$a_obj
type$a_usr_id

Definition at line 115 of file class.ilParticipants.php.

116 {
117 if(!$a_usr_id)
118 {
119 $a_usr_id = $GLOBALS['ilUser']->getId();
120 }
121
122 // if write access granted => return true
123 $refs = ilObject::_getAllReferences($a_obj_id);
124 $ref_id = end($refs);
125
126 if($GLOBALS['ilAccess']->checkAccess('write','',$ref_id))
127 {
128 return true;
129 }
130 $part = self::getInstanceByObjId($a_obj_id);
131 if($part->isAssigned($a_usr_id))
132 {
133 if($part->getType() == 'crs')
134 {
135 // Check for show_members
136 include_once './Modules/Course/classes/class.ilObjCourse.php';
138 {
139 return false;
140 }
141 }
142 return true;
143 }
144 // User is not assigned to course/group => no read access
145 return false;
146 }
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
static getInstanceByObjId($a_obj_id)
Get instance by obj type.

References $GLOBALS, $ref_id, ilObject\_getAllReferences(), getInstanceByObjId(), and ilObjCourse\lookupShowMembersEnabled().

Referenced by ilRepositorySearchGUI\listUsers(), ilRepositoryObjectResultTableGUI\parseObjectIds(), and ilMailSearchGUI\showResults().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPassed()

ilParticipants::hasPassed (   $a_usr_id)

Check if user has passed course.

@access public

Parameters
intuser_id

Definition at line 676 of file class.ilParticipants.php.

677 {
678 if(isset($this->participants_status[$a_usr_id]))
679 {
680 return $this->participants_status[$a_usr_id]['passed'] ? true : false;
681 }
682 return false;
683 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipants::isAdmin (   $a_usr_id)

is user admin

@access public

Parameters
intusr_id

Definition at line 511 of file class.ilParticipants.php.

512 {
513 return in_array($a_usr_id,$this->admins) ? true : false;
514 }

Referenced by ilCourseParticipants\__buildStatusBody(), and getNotificationRecipients().

+ Here is the caller graph for this function:

◆ isAssigned()

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

@access public

Parameters

Definition at line 550 of file class.ilParticipants.php.

551 {
552 return in_array($a_usr_id,$this->participants);
553 }

Referenced by add(), and assignSubscriber().

+ Here is the caller graph for this function:

◆ isBlocked()

ilParticipants::isBlocked (   $a_usr_id)

Check if user is blocked.

@access public

Parameters
intuser_id

Definition at line 660 of file class.ilParticipants.php.

661 {
662 if(isset($this->participants_status[$a_usr_id]))
663 {
664 return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
665 }
666 return false;
667 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isGroupingMember()

ilParticipants::isGroupingMember (   $a_usr_id,
  $a_field = '' 
)

Check grouping membership.

@access public

Parameters

Definition at line 1028 of file class.ilParticipants.php.

1029 {
1030 global $rbacreview,$ilObjDataCache,$ilDB;
1031
1032 // Used for membership limitations -> check membership by given field
1033 if($a_field)
1034 {
1035 include_once './Services/User/classes/class.ilObjUser.php';
1036
1037 $tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id);
1038 switch($a_field)
1039 {
1040 case 'login':
1041 $and = "AND login = ".$ilDB->quote($tmp_user->getLogin(),'text')." ";
1042 break;
1043 case 'email':
1044 $and = "AND email = ".$ilDB->quote($tmp_user->getEmail(),'text')." ";
1045 break;
1046 case 'matriculation':
1047 $and = "AND matriculation = ".$ilDB->quote($tmp_user->getMatriculation(),'text')." ";
1048 break;
1049
1050 default:
1051 $and = "AND usr_id = ".$ilDB->quote($a_usr_id,'integer'). " ";
1052 break;
1053 }
1054
1055 if(!$this->getParticipants())
1056 {
1057 return false;
1058 }
1059
1060 $query = "SELECT * FROM usr_data ud ".
1061 "WHERE ".$ilDB->in('usr_id',$this->getParticipants(),false,'integer')." ".
1062 $and;
1063
1064 $res = $ilDB->query($query);
1065 return $res->numRows() ? true : false;
1066 }
1067 }
getParticipants()
Get all participants ids.

References $ilDB, $query, $res, ilObjectFactory\getInstanceByObjId(), and getParticipants().

+ Here is the call graph for this function:

◆ isLastAdmin()

ilParticipants::isLastAdmin (   $a_usr_id)

Check if user is last admin.

Parameters
int$a_usr_id
Returns
bool

Definition at line 560 of file class.ilParticipants.php.

561 {
562 return in_array($a_usr_id,$this->getAdmins()) and count($this->getAdmins()) == 1;
563 }

References getAdmins().

+ Here is the call graph for this function:

◆ isMember()

ilParticipants::isMember (   $a_usr_id)

is user member

@access public

Parameters
intusr_id

Definition at line 535 of file class.ilParticipants.php.

536 {
537 return in_array($a_usr_id,$this->members) ? true : false;
538 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

@access public

Parameters

Definition at line 927 of file class.ilParticipants.php.

928 {
929 if(isset($this->participants_status[$a_usr_id]))
930 {
931 return $this->participants_status[$a_usr_id]['notification'] ? true : false;
932 }
933 return false;
934 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isSubscriber()

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

@access public

Definition at line 1314 of file class.ilParticipants.php.

1315 {
1316 global $ilDB;
1317
1318 $query = "SELECT * FROM il_subscribers ".
1319 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1320 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')."";
1321
1322 $res = $ilDB->query($query);
1323 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1324 {
1325 return true;
1326 }
1327 return false;
1328 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by assignSubscriber().

+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor (   $a_usr_id)

is user tutor

@access public

Parameters
intusr_id

Definition at line 523 of file class.ilParticipants.php.

524 {
525 return in_array($a_usr_id,$this->tutors) ? true : false;
526 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ lookupNumberOfMembers()

static ilParticipants::lookupNumberOfMembers (   $a_ref_id)
static

Lookup number of members @global ilRbacReview $rbacreview @global <type> $ilObjDataCache.

Parameters
<type>$a_ref_id
Returns
int

Definition at line 231 of file class.ilParticipants.php.

232 {
233 global $rbacreview, $ilObjDataCache;
234
235 $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
236
237 if(!$has_policies)
238 {
239 return 0;
240 }
241 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
242
243 $memberRoles = array();
244 foreach($lroles as $role_id)
245 {
246 $title = $ilObjDataCache->lookupTitle($role_id);
247 switch(substr($title,0,8))
248 {
249 case 'il_crs_a':
250 case 'il_crs_t':
251 case 'il_grp_a':
252 break;
253
254 default:
255 $memberRoles[] = $role_id;
256 break;
257 }
258 }
259 return $rbacreview->getNumberOfAssignedUsers($memberRoles);
260 }

◆ lookupNumberOfParticipants()

static ilParticipants::lookupNumberOfParticipants (   $a_ref_id)
static

Lookup the number of participants (crs admins, tutors, members, grp admins, members)

@global ilRbacReview $rbacreview

Parameters
int$a_ref_id

Definition at line 216 of file class.ilParticipants.php.

217 {
218 global $rbacreview;
219
220 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
221 return $rbacreview->getNumberOfAssignedUsers($lroles);
222 }

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

Definition at line 1069 of file class.ilParticipants.php.

1070 {
1071 global $ilDB;
1072
1073 $subscribers = array();
1074 $query = "SELECT usr_id FROM il_subscribers ".
1075 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
1076 "ORDER BY sub_time ";
1077
1078 $res = $ilDB->query($query);
1079 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1080 {
1081 $subscribers[] = $row->usr_id;
1082 }
1083 return $subscribers;
1084 }

References $ilDB, $query, $res, $row, $subscribers, and DB_FETCHMODE_OBJECT.

Referenced by ilObjCourseGUI\membersObject().

+ Here is the caller graph for this function:

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

Definition at line 1403 of file class.ilParticipants.php.

1404 {
1405 global $ilDB;
1406
1407 $query = 'SELECT * FROM il_subscribers '.
1408 'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
1409 $res = $ilDB->query($query);
1410
1411 $data = array();
1412 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1413 {
1414 $data[$row->usr_id]['time'] = $row->sub_time;
1415 $data[$row->usr_id]['usr_id'] = $row->usr_id;
1416 $data[$row->usr_id]['subject'] = $row->subject;
1417 }
1418 return $data;
1419 }

References $data, $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilSubscriberTableGUI\readSubscriberData().

+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

Read participants.

@access private

Parameters

Reimplemented in ilSessionParticipants.

Definition at line 944 of file class.ilParticipants.php.

945 {
946 global $rbacreview,$ilObjDataCache,$ilLog;
947
948 $GLOBALS['rbacreview']->clearCaches();
949 $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id,false);
950
951 $users = array();
952 $this->participants = array();
953 $this->members = $this->admins = $this->tutors = array();
954
955 foreach($this->roles as $role_id)
956 {
957 $title = $ilObjDataCache->lookupTitle($role_id);
958 switch(substr($title,0,8))
959 {
960 case 'il_crs_m':
961 $this->role_data[IL_CRS_MEMBER] = $role_id;
962 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
963 $this->members = array_unique(array_merge($assigned,$this->members));
964 break;
965
966 case 'il_crs_a':
967 $this->role_data[IL_CRS_ADMIN] = $role_id;
968 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
969 $this->admins = $rbacreview->assignedUsers($role_id);
970 break;
971
972 case 'il_crs_t':
973 $this->role_data[IL_CRS_TUTOR] = $role_id;
974 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
975 $this->tutors = $rbacreview->assignedUsers($role_id);
976 break;
977
978 case 'il_grp_a':
979 $this->role_data[IL_GRP_ADMIN] = $role_id;
980 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
981 $this->admins = $rbacreview->assignedUsers($role_id);
982 break;
983
984 case 'il_grp_m':
985 $this->role_data[IL_GRP_MEMBER] = $role_id;
986 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
987 $this->members = $rbacreview->assignedUsers($role_id);
988 break;
989
990 default:
991 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
992 $this->members = array_unique(array_merge($assigned,$this->members));
993 break;
994 }
995 }
996 }

References $GLOBALS, $ilLog, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, and IL_GRP_MEMBER.

Referenced by __construct(), delete(), and updateRoleAssignments().

+ Here is the caller graph for this function:

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
protected

Read status of participants (blocked, notification, passed)

@access private

Parameters

Reimplemented in ilSessionParticipants.

Definition at line 1005 of file class.ilParticipants.php.

1006 {
1007 global $ilDB;
1008
1009 $query = "SELECT * FROM obj_members ".
1010 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1011 $res = $ilDB->query($query);
1012 $this->participants_status = array();
1013 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1014 {
1015 $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1016 $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1017 $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1018 }
1019 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct(), delete(), and updateRoleAssignments().

+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

@access protected

Definition at line 1385 of file class.ilParticipants.php.

1386 {
1387 global $ilDB;
1388
1389 $query = "SELECT * FROM il_subscribers ".
1390 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1391 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
1392
1393 $res = $this->ilDB->query($query);
1394 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1395 {
1396 $data["time"] = $row->sub_time;
1397 $data["usr_id"] = $row->usr_id;
1398 $data['subject'] = $row->subject;
1399 }
1400 return $data ? $data : array();
1401 }
query($sql, $a_handle_error=true)
Query.

References $data, $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and ilDB\query().

Referenced by getSubscriberData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected

read subscribers

@access protected

Definition at line 1357 of file class.ilParticipants.php.

1358 {
1359 global $ilDB;
1360
1361 $this->subscribers = array();
1362
1363 $query = "SELECT usr_id FROM il_subscribers ".
1364 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1365 "ORDER BY sub_time ";
1366
1367 $res = $this->ilDB->query($query);
1368 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1369 {
1370 // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1371 if(!ilObjectFactory::getInstanceByObjId($row->usr_id,false))
1372 {
1373 $this->deleteSubscriber($row->usr_id);
1374 }
1375 $this->subscribers[] = $row->usr_id;
1376 }
1377 return true;
1378 }

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), and ilDB\query().

Referenced by autoFillSubscribers(), and getSubscribers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

@access public

Parameters
intusr_id
boolblocked

Definition at line 729 of file class.ilParticipants.php.

730 {
731 global $ilDB;
732
733 $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
734
735 $query = "SELECT * FROM obj_members ".
736 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
737 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
738 $res = $ilDB->query($query);
739 if($res->numRows())
740 {
741 $query = "UPDATE obj_members SET ".
742 "blocked = ".$ilDB->quote((int) $a_blocked ,'integer')." ".
743 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
744 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
745 }
746 else
747 {
748 $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) ".
749 "VALUES ( ".
750 $ilDB->quote((int) $a_blocked ,'integer').", ".
751 $ilDB->quote($this->obj_id ,'integer').", ".
752 $ilDB->quote($a_usr_id ,'integer').", ".
753 $ilDB->quote(0,'integer').", ".
754 $ilDB->quote(0,'integer').
755 ")";
756
757 }
758 $res = $ilDB->manipulate($query);
759 return true;
760 }

References $ilDB, $query, and $res.

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

@access public

Parameters
intusr_id
boolpassed

Definition at line 770 of file class.ilParticipants.php.

771 {
772 global $ilDB;
773
774 $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
775
776 $query = "SELECT * FROM obj_members ".
777 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
778 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
779 $res = $ilDB->query($query);
780 if($res->numRows())
781 {
782 $query = "UPDATE obj_members SET ".
783 "notification = ".$ilDB->quote((int) $a_notification ,'integer')." ".
784 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
785 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
786 }
787 else
788 {
789 $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) ".
790 "VALUES ( ".
791 $ilDB->quote((int) $a_notification ,'integer').", ".
792 $ilDB->quote($this->obj_id ,'integer').", ".
793 $ilDB->quote($a_usr_id ,'integer').", ".
794 $ilDB->quote(0,'integer').", ".
795 $ilDB->quote(0,'integer').
796 ")";
797
798 }
799 $res = $ilDB->manipulate($query);
800 return true;
801 }

References $ilDB, $query, and $res.

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

@access public

Parameters
intusr_id
arrayarray of new roles

Definition at line 607 of file class.ilParticipants.php.

608 {
609 global $rbacreview,$rbacadmin;
610
611 $roles = $a_roles ? $a_roles : array();
612
613 foreach($this->getRoles() as $role_id)
614 {
615 if($rbacreview->isAssigned($a_usr_id,$role_id))
616 {
617 if(!in_array($role_id,$roles))
618 {
619 $rbacadmin->deassignUser($role_id,$a_usr_id);
620 }
621 }
622 else
623 {
624 if(in_array($role_id,$roles))
625 {
626 $rbacadmin->assignUser($role_id,$a_usr_id);
627 }
628 }
629 }
630 $this->readParticipants();
631 $this->readParticipantsStatus();
632 }
getRoles()
Get course roles.

References $roles, getRoles(), readParticipants(), and readParticipantsStatus().

+ Here is the call graph for this function:

◆ updateSubject()

ilParticipants::updateSubject (   $a_usr_id,
  $a_subject 
)

update subject

@access public

Parameters

return

Definition at line 1254 of file class.ilParticipants.php.

1255 {
1256 global $ilDB;
1257
1258 $query = "UPDATE il_subscribers ".
1259 "SET subject = ".$ilDB->quote($a_subject ,'text')." ".
1260 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1261 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1262 $res = $ilDB->manipulate($query);
1263 return true;
1264 }

References $ilDB, $query, and $res.

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

@access public

Definition at line 1234 of file class.ilParticipants.php.

1235 {
1236 global $ilDB;
1237
1238 $query = "UPDATE il_subscribers ".
1239 "SET sub_time = ".$ilDB->quote($a_subtime ,'integer')." ".
1240 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1241 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1242 $res = $ilDB->manipulate($query);
1243
1244 return true;
1245 }

References $ilDB, $query, and $res.

Field Documentation

◆ $admins

ilParticipants::$admins = array()
protected

Definition at line 35 of file class.ilParticipants.php.

◆ $component

ilParticipants::$component = ''
protected

Definition at line 22 of file class.ilParticipants.php.

Referenced by getComponent().

◆ $ilDB

◆ $lng

ilParticipants::$lng
protected

Definition at line 40 of file class.ilParticipants.php.

Referenced by __construct().

◆ $members

ilParticipants::$members = array()
protected

Definition at line 33 of file class.ilParticipants.php.

◆ $obj_id

ilParticipants::$obj_id = 0
protected

◆ $participants

ilParticipants::$participants = array()
protected

Definition at line 31 of file class.ilParticipants.php.

◆ $participants_status

ilParticipants::$participants_status = array()
protected

Definition at line 32 of file class.ilParticipants.php.

◆ $ref_id

ilParticipants::$ref_id = 0
protected

Definition at line 26 of file class.ilParticipants.php.

Referenced by hasParticipantListAccess().

◆ $role_data

ilParticipants::$role_data = array()
protected

Definition at line 29 of file class.ilParticipants.php.

◆ $roles

ilParticipants::$roles = array()
protected

◆ $subscribers

ilParticipants::$subscribers = array()
protected

Definition at line 37 of file class.ilParticipants.php.

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

ilParticipants::$tutors = array()
protected

Definition at line 34 of file class.ilParticipants.php.

◆ $type

ilParticipants::$type = ''
protected

Definition at line 25 of file class.ilParticipants.php.

Referenced by getDefaultMemberRole(), getInstanceByObjId(), and getType().


The documentation for this class was generated from the following file: