ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 updateContact ($a_usr_id, $a_contact)
 Update contact setting type $ilDB. More...
 
 getContacts ()
 get user ids which are confirgured as contact 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...
 
 isContact ($a_usr_id)
 Check if user is contact. 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 ilRbacReview $rbacreview <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)
 
static _getAllSupportContactsOfUser ($a_usr_id, $a_type)
 Get all support contacts for a user. More...
 

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.

public

Parameters
intobj_id of container

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

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

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();
65  $this->readParticipantsStatus();
66  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Database Wrapper.
Definition: class.ilDB.php:28
readParticipants()
Read participants.
+ 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.

public

Parameters
intobj_id

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

References $ilDB, $query, and $res.

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

327  {
328  global $ilDB;
329 
330  $query = "DELETE FROM obj_members ".
331  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
332  $res = $ilDB->manipulate($query);
333 
334  $query = "DELETE FROM il_subscribers ".
335  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
336  $res = $ilDB->manipulate($query);
337 
338  $query = 'DELETE FROM crs_waiting_list '.
339  'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
340  $ilDB->manipulate($query);
341 
342  return true;
343  }
+ Here is the caller graph for this function:

◆ _deleteUser()

static ilParticipants::_deleteUser (   $a_usr_id)
static

Delete user data.

public

Parameters
intuser id

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

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

Referenced by ilObjCourse\_deleteUser().

354  {
355  global $ilDB;
356 
357  $query = "DELETE FROM obj_members WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
358  $res = $ilDB->manipulate($query);
359 
360  $query = "DELETE FROM il_subscribers WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
361  $res = $ilDB->manipulate($query);
362 
363  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
365  }
static _deleteUser($a_usr_id)
Delete user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAllSupportContactsOfUser()

static ilParticipants::_getAllSupportContactsOfUser (   $a_usr_id,
  $a_type 
)
static

Get all support contacts for a user.

Parameters
int$a_usr_idusr_id
string$a_typecrs or grp
Returns
array array of contacts (keys are usr_id and obj_id)

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

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

Referenced by ilAwarenessUserProviderCourseContacts\getInitialUserSet().

1503  {
1504  global $ilDB;
1505 
1506  // todo: join the two queries or alternatively reuse _getMembershipByType
1507  // for the first part
1508 
1509  // this will also dismiss local roles!
1510  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1511  $a2 = "AND obd2.title LIKE 'il_".$a_type."_mem%' ";
1512 
1513  // #14290 - no role folder anymore
1514  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua ".
1515  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
1516  "JOIN object_reference obr ON fa.parent = obr.ref_id ".
1517  "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
1518  $j2.
1519  "WHERE obd.type = ".$ilDB->quote($a_type,'text')." ".
1520  "AND fa.assign = 'y' ".
1521  "AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
1522  $a2;
1523 
1524  $res = $ilDB->query($query);
1525  $obj_ids = array();
1526  while($row = $ilDB->fetchObject($res))
1527  {
1528  $obj_ids[] = $row->obj_id;
1529  }
1530 
1531  $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members ".
1532  " WHERE ".$ilDB->in("obj_id", $obj_ids, false, "integer").
1533  " AND contact = ".$ilDB->quote(1, "integer"));
1534  $res = array();
1535  while ($rec = $ilDB->fetchAssoc($set))
1536  {
1537  $res[] = $rec;
1538  }
1539 
1540  return $res;
1541  }
+ 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

public

Parameters
int$a_usr_idusr_id
string | array$a_typecrs or grp | array of strings
bool$a_only_member_role
Returns

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

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

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

160  {
161  global $ilDB;
162 
163  if (!is_array($a_type))
164  {
165  $a_type = array($a_type);
166  }
167 
168  // this will also dismiss local roles!
169  if ($a_only_member_role)
170  {
171  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
172  $a2 = 'AND obd2.title = '.$ilDB->concat(
173  array(
174  array($ilDB->quote('il_','text')),
175  array('obd.type'),
176  array($ilDB->quote('_member_','text')),
177  array('obr.ref_id'),
178  ),
179  false
180  );
181  }
182 
183  // #14290 - no role folder anymore
184  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua ".
185  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
186  "JOIN object_reference obr ON fa.parent = obr.ref_id ".
187  "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
188  $j2.
189  "WHERE ".$ilDB->in("obd.type", $a_type, false, "text").
190  "AND fa.assign = 'y' ".
191  "AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
192  $a2;
193  $res = $ilDB->query($query);
194  while($row = $ilDB->fetchObject($res))
195  {
196  $ref_ids[] = $row->obj_id;
197  }
198 
199  return $ref_ids ? $ref_ids : array();
200  }
+ 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.

public

Parameters
intobj_id
intuser id

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

References $ilDB, $query, and $res.

Referenced by ilObjCourseAccess\checkCondition().

306  {
307  global $ilDB;
308 
309  $query = "SELECT * FROM obj_members ".
310  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
311  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
312  "AND passed = '1'";
313  $res = $ilDB->query($query);
314  return $res->numRows() ? true : false;
315  }
+ Here is the caller graph for this function:

◆ _isBlocked()

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

Check if user is blocked.

public

Parameters
intcourse id
intusr_id

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

References $ilDB, $query, and $res.

285  {
286  global $ilDB;
287 
288  $query = "SELECT * FROM obj_members ".
289  "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
290  "AND usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
291  "AND blocked = ".$ilDB->quote(1,'integer');
292  $res = $ilDB->query($query);
293  return $res->numRows() ? true : false;
294  }

◆ _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.

public

Parameters
intref_id
intuser id

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

References $ilDB, and $ilLog.

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

213  {
214  global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
215 
216  $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
217 
218  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
219  }
+ Here is the caller graph for this function:

◆ _isSubscriber()

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

check if user is subscriber

public

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

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

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

1411  {
1412  global $ilDB;
1413 
1414  $query = "SELECT * FROM il_subscribers ".
1415  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1416  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
1417 
1418  $res = $ilDB->query($query);
1419  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1420  {
1421  return true;
1422  }
1423  return false;
1424  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ add()

ilParticipants::add (   $a_usr_id,
  $a_role 
)

Add user to course.

public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

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

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 ilGroupXMLParser\__assignMembers(), and assignSubscriber().

870  {
871  global $rbacadmin,$ilLog,$ilAppEventHandler;
872 
873  if($this->isAssigned($a_usr_id))
874  {
875  return false;
876  }
877 
878  switch($a_role)
879  {
880  case IL_CRS_ADMIN:
881  $this->admins[] = $a_usr_id;
882  break;
883 
884  case IL_CRS_TUTOR:
885  $this->tutors[] = $a_usr_id;
886  break;
887 
888  case IL_CRS_MEMBER:
889  $this->members[] = $a_usr_id;
890  break;
891 
892  case IL_GRP_ADMIN:
893  $this->admins[] = $a_usr_id;
894  break;
895 
896  case IL_GRP_MEMBER:
897  $this->members[] = $a_usr_id;
898  break;
899  }
900 
901  $this->participants[] = $a_usr_id;
902  $rbacadmin->assignUser($this->role_data[$a_role],$a_usr_id);
903  $this->addDesktopItem($a_usr_id);
904 
905  // Delete subscription request
906  $this->deleteSubscriber($a_usr_id);
907 
908  include_once './Services/Membership/classes/class.ilWaitingList.php';
909  ilWaitingList::deleteUserEntry($a_usr_id,$this->obj_id);
910 
911  $ilLog->write(__METHOD__.': Raise new event: '.$this->getComponent().' addParticipant');
912  $ilAppEventHandler->raise(
913  $this->getComponent(),
914  "addParticipant",
915  array(
916  'obj_id' => $this->obj_id,
917  'usr_id' => $a_usr_id,
918  'role_id' => $a_role)
919  );
920  return true;
921  }
addDesktopItem($a_usr_id)
Add desktop item.
isAssigned($a_usr_id)
check if user is assigned
const IL_GRP_ADMIN
const IL_CRS_TUTOR
deleteSubscriber($a_usr_id)
Delete subsciber.
const IL_GRP_MEMBER
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
getComponent()
Get component name Used for raising events.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
+ 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.

public

Parameters
intusr_id

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

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

Referenced by add().

948  {
949  if(!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
950  {
951  ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id,$this->type);
952  }
953  return true;
954  }
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user&#39;s personal desktop
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubscriber()

ilParticipants::addSubscriber (   $a_usr_id)

Add subscriber.

public

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

References $ilDB, $query, and $res.

1287  {
1288  global $ilDB;
1289 
1290  $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) ".
1291  " VALUES (".
1292  $ilDB->quote($a_usr_id ,'integer').",".
1293  $ilDB->quote($this->obj_id ,'integer').", ".
1294  $ilDB->quote('','text').", ".
1295  $ilDB->quote(time() ,'integer').
1296  ")";
1297  $res = $ilDB->manipulate($query);
1298 
1299  return true;
1300  }

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

public

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

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

Referenced by assignSubscribers(), and autoFillSubscribers().

1222  {
1223  global $ilErr;
1224 
1225  $ilErr->setMessage("");
1226  if(!$this->isSubscriber($a_usr_id))
1227  {
1228  $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1229 
1230  return false;
1231  }
1232  if($this->isAssigned($a_usr_id))
1233  {
1234  $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1235  $ilErr->appendMessage($tmp_obj->getLogin().": ".$this->lng->txt("crs_user_already_assigned"));
1236 
1237  return false;
1238  }
1239 
1240  if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id))
1241  {
1242  $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1243 
1244  return false;
1245  }
1246 
1247  // TODO: must be group or course member role
1248  $this->add($tmp_obj->getId(),IL_CRS_MEMBER);
1249  $this->deleteSubscriber($a_usr_id);
1250 
1251  return true;
1252  }
isAssigned($a_usr_id)
check if user is assigned
deleteSubscriber($a_usr_id)
Delete subsciber.
add($a_usr_id, $a_role)
Add user to course.
const IL_CRS_MEMBER
isSubscriber($a_usr_id)
check if is subscriber
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignSubscribers()

ilParticipants::assignSubscribers (   $a_usr_ids)

Assign subscribers.

public

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

References assignSubscriber().

1201  {
1202  if(!is_array($a_usr_ids) or !count($a_usr_ids))
1203  {
1204  return false;
1205  }
1206  foreach($a_usr_ids as $id)
1207  {
1208  if(!$this->assignSubscriber($id))
1209  {
1210  return false;
1211  }
1212  }
1213  return true;
1214  }
assignSubscriber($a_usr_id)
Assign subscriber.
+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

public

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

References assignSubscriber(), and readSubscribers().

1260  {
1261  $this->readSubscribers();
1262 
1263  $counter = 0;
1264  foreach($this->subscribers as $subscriber)
1265  {
1266  if(!$this->assignSubscriber($subscriber))
1267  {
1268  continue;
1269  }
1270  else
1271  {
1272  // TODO: notification
1273  #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1274  }
1275  ++$counter;
1276  }
1277 
1278  return $counter;
1279  }
assignSubscriber($a_usr_id)
Assign subscriber.
readSubscribers()
read subscribers
+ Here is the call graph for this function:

◆ checkLastAdmin()

ilParticipants::checkLastAdmin (   $a_usr_ids)

Check if user for deletion are last admins.

public

Parameters
arrayarray of user ids for deletion

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

References getAdmins().

655  {
656  foreach($this->getAdmins() as $admin_id)
657  {
658  if(!in_array($admin_id,$a_usr_ids))
659  {
660  return true;
661  }
662  }
663  return false;
664  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ delete()

ilParticipants::delete (   $a_usr_id)

Drop user from all roles.

public

Parameters
intusr_id

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

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

706  {
707  global $rbacadmin,$ilDB;
708 
709  $this->dropDesktopItem($a_usr_id);
710  foreach($this->roles as $role_id)
711  {
712  $rbacadmin->deassignUser($role_id,$a_usr_id);
713  }
714 
715  $query = "DELETE FROM obj_members ".
716  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
717  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer');
718  $res = $ilDB->manipulate($query);
719 
720  $this->readParticipants();
721  $this->readParticipantsStatus();
722 
723  $GLOBALS['ilAppEventHandler']->raise(
724  $this->getComponent(),
725  "deleteParticipant",
726  array(
727  'obj_id' => $this->obj_id,
728  'usr_id' => $a_usr_id)
729  );
730 
731  return true;
732  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
dropDesktopItem($a_usr_id)
Drop desktop item.
getComponent()
Get component name Used for raising events.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
readParticipants()
Read participants.
+ Here is the call graph for this function:

◆ deleteParticipants()

ilParticipants::deleteParticipants (   $a_user_ids)

Delete users.

public

Parameters
arrayuser ids

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

932  {
933  foreach($a_user_ids as $user_id)
934  {
935  $this->delete($user_id);
936  }
937  return true;
938  }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

public

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

References $ilDB, $query, and $res.

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

1347  {
1348  global $ilDB;
1349 
1350  $query = "DELETE FROM il_subscribers ".
1351  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1352  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1353  $res = $ilDB->manipulate($query);
1354 
1355  return true;
1356  }
+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

public

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

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

1365  {
1366  global $ilErr,$ilDB;
1367 
1368  if(!is_array($a_usr_ids) or !count($a_usr_ids))
1369  {
1370  $ilErr->setMessage('');
1371  $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1372 
1373  return false;
1374  }
1375  $query = "DELETE FROM il_subscribers ".
1376  "WHERE ".$ilDB->in('usr_id',(array) $a_usr_ids,false,'integer')." ".
1377  "AND obj_id = ".$ilDB->quote($this->obj_id,'integer');
1378  $res = $ilDB->query($query);
1379  return true;
1380  }

◆ dropDesktopItem()

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

public

Parameters
intusr_id

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

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

Referenced by delete().

964  {
965  if(ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
966  {
967  ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id,$this->type);
968  }
969 
970  return true;
971  }
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user&#39;s personal desktop
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

public

Returns
array array of user ids

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

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

491  {
492  return $this->admins ? $this->admins : array();
493  }
+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

public

Parameters
intuser_id

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

598  {
599  global $rbacreview;
600 
601  foreach($this->roles as $role)
602  {
603  if($rbacreview->isAssigned($a_usr_id,$role))
604  {
605  $assigned[] = $role;
606  }
607  }
608  return $assigned ? $assigned : array();
609  }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

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

References $component.

Referenced by add(), and delete().

104  {
105  return $this->component;
106  }
+ Here is the caller graph for this function:

◆ getContacts()

ilParticipants::getContacts ( )

get user ids which are confirgured as contact

Returns
array

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

802  {
803  $contacts = array();
804  foreach((array) $this->participants_status as $usr_id => $status)
805  {
806  if($status['contact'])
807  {
808  $contacts[] = $usr_id;
809  }
810  }
811  return $contacts;
812  }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

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

References getAdmins().

500  {
501  return count($this->getAdmins());
502  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

public

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

444  {
445  return count($this->members);
446  }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

public

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

455  {
456  return count($this->participants);
457  }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

public

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

References getSubscribers().

1179  {
1180  return count($this->getSubscribers());
1181  }
getSubscribers()
get all subscribers
+ Here is the call graph for this function:

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

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

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

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

368  {
369  global $ilCtrl;
370 
371  $obj_id = ilObject::_lookupObjId($a_ref_id);
373 
374  if(!in_array($type,array('crs','grp')))
375  {
376  return 0;
377  }
378 
379  global $rbacreview;
380 
381 
382  $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
383 
384  foreach($roles as $role)
385  {
386  $title = ilObject::_lookupTitle($role);
387  if(substr($title, 0, 13) == ('il_'.$type.'_member'))
388  {
389  return $role;
390  }
391  }
392  return 0;
393  }
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ 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.

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

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

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.
static _lookupType($a_id, $a_reference=false)
lookup object type
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ 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.

public

Returns
array array of user ids

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

Referenced by ilSessionParticipants\readParticipantsStatus().

481  {
482  return $this->members ? $this->members : array();
483  }
+ Here is the caller graph for this function:

◆ getNotificationRecipients()

ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

public

Returns
array array of user ids

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

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

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

420  {
421  global $ilDB;
422 
423  $query = "SELECT * FROM obj_members ".
424  "WHERE notification = 1 ".
425  "AND obj_id = ".$ilDB->quote($this->obj_id)." ";
426  $res = $ilDB->query($query);
427  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
428  {
429  if($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id))
430  {
431  $recp[] = $row->usr_id;
432  }
433  }
434  return $recp ? $recp : array();
435  }
isAdmin($a_usr_id)
is user admin
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
isTutor($a_usr_id)
is user tutor
+ 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 399 of file class.ilParticipants.php.

References $obj_id.

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

400  {
401  return $this->obj_id;
402  }
+ Here is the caller graph for this function:

◆ getParticipants()

ilParticipants::getParticipants ( )

Get all participants ids.

public

Returns
array array of user ids

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

Referenced by isGroupingMember().

469  {
470  return $this->participants ? $this->participants : array();
471  }
+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

public

Parameters

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

Referenced by updateRoleAssignments().

586  {
587  return $this->roles ? $this->roles : array();
588  }
+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

public

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

References readSubscriberData().

1189  {
1190  return $this->readSubscriberData($a_usr_id);
1191  }
readSubscriberData($a_usr_id)
read subscribers
+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers

public

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

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

1166  {
1167  $this->readSubscribers();
1168 
1169  return $this->subscribers;
1170  }
readSubscribers()
read subscribers
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTutors()

ilParticipants::getTutors ( )

Get all tutors ids.

public

Returns
array array of user ids

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

512  {
513  return $this->tutors ? $this->tutors : array();
514  }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

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

References $type.

409  {
410  return $this->type;
411  }

◆ 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.

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

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

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 _getAllReferences($a_id)
get all reference ids of object
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ 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.

public

Parameters
intuser_id

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

Referenced by ilCourseParticipants\__buildStatusBody().

690  {
691  if(isset($this->participants_status[$a_usr_id]))
692  {
693  return $this->participants_status[$a_usr_id]['passed'] ? true : false;
694  }
695  return false;
696  }
+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipants::isAdmin (   $a_usr_id)

is user admin

public

Parameters
intusr_id

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

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

524  {
525  return in_array($a_usr_id,$this->admins) ? true : false;
526  }
+ Here is the caller graph for this function:

◆ isAssigned()

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

public

Parameters

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

Referenced by add(), and assignSubscriber().

563  {
564  return in_array($a_usr_id,$this->participants);
565  }
+ Here is the caller graph for this function:

◆ isBlocked()

ilParticipants::isBlocked (   $a_usr_id)

Check if user is blocked.

public

Parameters
intuser_id

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

Referenced by ilCourseParticipants\__buildStatusBody().

674  {
675  if(isset($this->participants_status[$a_usr_id]))
676  {
677  return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
678  }
679  return false;
680  }
+ Here is the caller graph for this function:

◆ isContact()

ilParticipants::isContact (   $a_usr_id)

Check if user is contact.

Parameters
intusr_id

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

997  {
998  if(isset($this->participants_status[$a_usr_id]))
999  {
1000  return (bool) $this->participants_status[$a_usr_id]['contact'];
1001  }
1002  return FALSE;
1003  }

◆ isGroupingMember()

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

Check grouping membership.

public

Parameters

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

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

1103  {
1104  global $rbacreview,$ilObjDataCache,$ilDB;
1105 
1106  // Used for membership limitations -> check membership by given field
1107  if($a_field)
1108  {
1109  include_once './Services/User/classes/class.ilObjUser.php';
1110 
1111  $tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id);
1112  switch($a_field)
1113  {
1114  case 'login':
1115  $and = "AND login = ".$ilDB->quote($tmp_user->getLogin(),'text')." ";
1116  break;
1117  case 'email':
1118  $and = "AND email = ".$ilDB->quote($tmp_user->getEmail(),'text')." ";
1119  break;
1120  case 'matriculation':
1121  $and = "AND matriculation = ".$ilDB->quote($tmp_user->getMatriculation(),'text')." ";
1122  break;
1123 
1124  default:
1125  $and = "AND usr_id = ".$ilDB->quote($a_usr_id,'integer'). " ";
1126  break;
1127  }
1128 
1129  if(!$this->getParticipants())
1130  {
1131  return false;
1132  }
1133 
1134  $query = "SELECT * FROM usr_data ud ".
1135  "WHERE ".$ilDB->in('usr_id',$this->getParticipants(),false,'integer')." ".
1136  $and;
1137 
1138  $res = $ilDB->query($query);
1139  return $res->numRows() ? true : false;
1140  }
1141  }
getParticipants()
Get all participants ids.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ 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 572 of file class.ilParticipants.php.

References getAdmins().

573  {
574  return in_array($a_usr_id,$this->getAdmins()) and count($this->getAdmins()) == 1;
575  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ isMember()

ilParticipants::isMember (   $a_usr_id)

is user member

public

Parameters
intusr_id

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

Referenced by ilCourseParticipants\__buildStatusBody().

548  {
549  return in_array($a_usr_id,$this->members) ? true : false;
550  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

public

Parameters

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

Referenced by ilCourseParticipants\__buildStatusBody().

983  {
984  if(isset($this->participants_status[$a_usr_id]))
985  {
986  return $this->participants_status[$a_usr_id]['notification'] ? true : false;
987  }
988  return false;
989  }
+ Here is the caller graph for this function:

◆ isSubscriber()

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

public

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

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

Referenced by assignSubscriber().

1389  {
1390  global $ilDB;
1391 
1392  $query = "SELECT * FROM il_subscribers ".
1393  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1394  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')."";
1395 
1396  $res = $ilDB->query($query);
1397  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1398  {
1399  return true;
1400  }
1401  return false;
1402  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor (   $a_usr_id)

is user tutor

public

Parameters
intusr_id

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

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

536  {
537  return in_array($a_usr_id,$this->tutors) ? true : false;
538  }
+ Here is the caller graph for this function:

◆ lookupNumberOfMembers()

static ilParticipants::lookupNumberOfMembers (   $a_ref_id)
static

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

Parameters
<type>$a_ref_id
Returns
int

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

Referenced by ilObjGroup\handleAutoFill(), and ilObjCourse\handleAutoFill().

244  {
245  global $rbacreview, $ilObjDataCache;
246 
247  $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
248 
249  if(!$has_policies)
250  {
251  return 0;
252  }
253  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
254 
255  $memberRoles = array();
256  foreach($lroles as $role_id)
257  {
258  $title = $ilObjDataCache->lookupTitle($role_id);
259  switch(substr($title,0,8))
260  {
261  case 'il_crs_a':
262  case 'il_crs_t':
263  case 'il_grp_a':
264  break;
265 
266  default:
267  $memberRoles[] = $role_id;
268  break;
269  }
270  }
271  return $rbacreview->getNumberOfAssignedUsers($memberRoles);
272  }
+ Here is the caller graph for this function:

◆ lookupNumberOfParticipants()

static ilParticipants::lookupNumberOfParticipants (   $a_ref_id)
static

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

ilRbacReview $rbacreview

Parameters
int$a_ref_id

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

229  {
230  global $rbacreview;
231 
232  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
233  return $rbacreview->getNumberOfAssignedUsers($lroles);
234  }

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

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

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

Referenced by ilObjCourseGUI\membersObject().

1144  {
1145  global $ilDB;
1146 
1147  $subscribers = array();
1148  $query = "SELECT usr_id FROM il_subscribers ".
1149  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
1150  "ORDER BY sub_time ";
1151 
1152  $res = $ilDB->query($query);
1153  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1154  {
1155  $subscribers[] = $row->usr_id;
1156  }
1157  return $subscribers;
1158  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

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

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

Referenced by ilSubscriberTableGUI\readSubscriberData().

1478  {
1479  global $ilDB;
1480 
1481  $query = 'SELECT * FROM il_subscribers '.
1482  'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
1483  $res = $ilDB->query($query);
1484 
1485  $data = array();
1486  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1487  {
1488  $data[$row->usr_id]['time'] = $row->sub_time;
1489  $data[$row->usr_id]['usr_id'] = $row->usr_id;
1490  $data[$row->usr_id]['subject'] = $row->subject;
1491  }
1492  return $data;
1493  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
$data
+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

Read participants.

private

Parameters

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

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

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

1016  {
1017  global $rbacreview,$ilObjDataCache,$ilLog;
1018 
1019  $GLOBALS['rbacreview']->clearCaches();
1020  $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id,false);
1021 
1022  $users = array();
1023  $this->participants = array();
1024  $this->members = $this->admins = $this->tutors = array();
1025 
1026  foreach($this->roles as $role_id)
1027  {
1028  $title = $ilObjDataCache->lookupTitle($role_id);
1029  switch(substr($title,0,8))
1030  {
1031  case 'il_crs_m':
1032  $this->role_data[IL_CRS_MEMBER] = $role_id;
1033  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1034  $this->members = array_unique(array_merge($assigned,$this->members));
1035  break;
1036 
1037  case 'il_crs_a':
1038  $this->role_data[IL_CRS_ADMIN] = $role_id;
1039  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1040  $this->admins = $rbacreview->assignedUsers($role_id);
1041  break;
1042 
1043  case 'il_crs_t':
1044  $this->role_data[IL_CRS_TUTOR] = $role_id;
1045  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1046  $this->tutors = $rbacreview->assignedUsers($role_id);
1047  break;
1048 
1049  case 'il_grp_a':
1050  $this->role_data[IL_GRP_ADMIN] = $role_id;
1051  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1052  $this->admins = $rbacreview->assignedUsers($role_id);
1053  break;
1054 
1055  case 'il_grp_m':
1056  $this->role_data[IL_GRP_MEMBER] = $role_id;
1057  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1058  $this->members = $rbacreview->assignedUsers($role_id);
1059  break;
1060 
1061  default:
1062  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1063  $this->members = array_unique(array_merge($assigned,$this->members));
1064  break;
1065  }
1066  }
1067  }
const IL_GRP_ADMIN
const IL_CRS_TUTOR
const IL_GRP_MEMBER
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ Here is the caller graph for this function:

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
protected

Read status of participants (blocked, notification, passed)

private

Parameters

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

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

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

1077  {
1078  global $ilDB;
1079 
1080  $query = "SELECT * FROM obj_members ".
1081  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1082  $res = $ilDB->query($query);
1083  $this->participants_status = array();
1084  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1085  {
1086  $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1087  $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1088  $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1089  // cognos-blu-patch: begin
1090  $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1091  // cognos-blu-patch: end
1092  }
1093  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

protected

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

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

Referenced by getSubscriberData().

1460  {
1461  global $ilDB;
1462 
1463  $query = "SELECT * FROM il_subscribers ".
1464  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1465  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
1466 
1467  $res = $this->ilDB->query($query);
1468  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1469  {
1470  $data["time"] = $row->sub_time;
1471  $data["usr_id"] = $row->usr_id;
1472  $data['subject'] = $row->subject;
1473  }
1474  return $data ? $data : array();
1475  }
query($sql, $a_handle_error=true)
Query.
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
$data
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected

read subscribers

protected

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

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

Referenced by autoFillSubscribers(), and getSubscribers().

1432  {
1433  global $ilDB;
1434 
1435  $this->subscribers = array();
1436 
1437  $query = "SELECT usr_id FROM il_subscribers ".
1438  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1439  "ORDER BY sub_time ";
1440 
1441  $res = $this->ilDB->query($query);
1442  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1443  {
1444  // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1445  if(!ilObjectFactory::getInstanceByObjId($row->usr_id,false))
1446  {
1447  $this->deleteSubscriber($row->usr_id);
1448  }
1449  $this->subscribers[] = $row->usr_id;
1450  }
1451  return true;
1452  }
query($sql, $a_handle_error=true)
Query.
deleteSubscriber($a_usr_id)
Delete subsciber.
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Database Wrapper.
Definition: class.ilDB.php:28
+ 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.

public

Parameters
intusr_id
boolblocked

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

References $ilDB, $query, and $res.

743  {
744  global $ilDB;
745 
746  $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
747 
748  $query = "SELECT * FROM obj_members ".
749  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
750  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
751  $res = $ilDB->query($query);
752  if($res->numRows())
753  {
754  $query = "UPDATE obj_members SET ".
755  "blocked = ".$ilDB->quote((int) $a_blocked ,'integer')." ".
756  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
757  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
758  }
759  else
760  {
761  $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) ".
762  "VALUES ( ".
763  $ilDB->quote((int) $a_blocked ,'integer').", ".
764  $ilDB->quote($this->obj_id ,'integer').", ".
765  $ilDB->quote($a_usr_id ,'integer').", ".
766  $ilDB->quote(0,'integer').", ".
767  $ilDB->quote(0,'integer').
768  ")";
769 
770  }
771  $res = $ilDB->manipulate($query);
772  return true;
773  }

◆ updateContact()

ilParticipants::updateContact (   $a_usr_id,
  $a_contact 
)

Update contact setting type $ilDB.

Parameters
type$a_usr_id
type$a_contact
Returns
boolean

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

References $ilDB.

784  {
785  global $ilDB;
786 
787  $ilDB->manipulate(
788  'UPDATE obj_members SET '.
789  'contact = '.$ilDB->quote($a_contact,'integer').' '.
790  'WHERE obj_id = '.$ilDB->quote($this->obj_id,'integer').' '.
791  'AND usr_id = '.$ilDB->quote($a_usr_id,'integer'));
792 
793  $this->participants_status[$a_usr_id]['contact'] = $a_contact;
794  return TRUE;
795  }

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

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

References $ilDB, $query, and $res.

826  {
827  global $ilDB;
828 
829  $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
830 
831  $query = "SELECT * FROM obj_members ".
832  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
833  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
834  $res = $ilDB->query($query);
835  if($res->numRows())
836  {
837  $query = "UPDATE obj_members SET ".
838  "notification = ".$ilDB->quote((int) $a_notification ,'integer')." ".
839  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
840  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
841  }
842  else
843  {
844  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) ".
845  "VALUES ( ".
846  $ilDB->quote((int) $a_notification ,'integer').", ".
847  $ilDB->quote($this->obj_id ,'integer').", ".
848  $ilDB->quote($a_usr_id ,'integer').", ".
849  $ilDB->quote(0,'integer').", ".
850  $ilDB->quote(0,'integer').
851  ")";
852 
853  }
854  $res = $ilDB->manipulate($query);
855  return true;
856  }

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

public

Parameters
intusr_id
arrayarray of new roles

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

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

620  {
621  global $rbacreview,$rbacadmin;
622 
623  $roles = $a_roles ? $a_roles : array();
624 
625  foreach($this->getRoles() as $role_id)
626  {
627  if($rbacreview->isAssigned($a_usr_id,$role_id))
628  {
629  if(!in_array($role_id,$roles))
630  {
631  $rbacadmin->deassignUser($role_id,$a_usr_id);
632  }
633  }
634  else
635  {
636  if(in_array($role_id,$roles))
637  {
638  $rbacadmin->assignUser($role_id,$a_usr_id);
639  }
640  }
641  }
642  $rbacreview->clearCaches();
643  $this->readParticipants();
644  $this->readParticipantsStatus();
645  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
getRoles()
Get course roles.
readParticipants()
Read participants.
+ Here is the call graph for this function:

◆ updateSubject()

ilParticipants::updateSubject (   $a_usr_id,
  $a_subject 
)

update subject

public

Parameters

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

References $ilDB, $query, and $res.

1329  {
1330  global $ilDB;
1331 
1332  $query = "UPDATE il_subscribers ".
1333  "SET subject = ".$ilDB->quote($a_subject ,'text')." ".
1334  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1335  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1336  $res = $ilDB->manipulate($query);
1337  return true;
1338  }

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

public

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

References $ilDB, $query, and $res.

1309  {
1310  global $ilDB;
1311 
1312  $query = "UPDATE il_subscribers ".
1313  "SET sub_time = ".$ilDB->quote($a_subtime ,'integer')." ".
1314  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1315  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1316  $res = $ilDB->manipulate($query);
1317 
1318  return true;
1319  }

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.

Referenced by readParticipants().

◆ $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: