ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilParticipants Class Reference
+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

 __construct ($a_component_name, $a_ref_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 object. 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...
 
 getAutoGeneratedRoleId ($a_role_type)
 Get role id of auto generated role type. 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...
 
 setRoleOrderPosition ($a_user_id)
 Set role order position. More...
 

Static Public Member Functions

static getInstance ($a_ref_id)
 Get instance by ref_id. More...
 
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 getUserMembershipAssignmentsByType ($a_user_ids, $a_type, $a_only_member_roles)
 Get user membership assignments by type. 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()
 
 $roles_sorted = []
 
 $role_assignments = []
 
 $participants = array()
 
 $participants_status = array()
 
 $members = array()
 
 $tutors = array()
 
 $admins = array()
 
 $subscribers = array()
 
 $ilDB
 
 $lng
 
 $logger = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilParticipants::__construct (   $a_component_name,
  $a_ref_id 
)

Singleton Constructor.

public

Parameters
stringcomponent definition e.g Modules/Course
intobj_id of container

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

References $GLOBALS, ilObject\_lookupObjId(), ilObject\_lookupType(), readParticipants(), and readParticipantsStatus().

76  {
77  $this->ilDB = $GLOBALS['DIC']->database();
78  $this->lng = $GLOBALS['DIC']->language();
79  $this->logger = $GLOBALS['DIC']->logger()->mem();
80 
81  $this->component = $a_component_name;
82 
83  $this->ref_id = $a_ref_id;
84  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
85  $this->type = ilObject::_lookupType($this->obj_id);
86 
87  $this->readParticipants();
88  $this->readParticipantsStatus();
89  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
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 436 of file class.ilParticipants.php.

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

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

437  {
438  global $DIC;
439 
440  $ilDB = $DIC['ilDB'];
441 
442  $query = "DELETE FROM obj_members " .
443  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
444  $res = $ilDB->manipulate($query);
445 
446  $query = "DELETE FROM il_subscribers " .
447  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
448  $res = $ilDB->manipulate($query);
449 
450  $query = 'DELETE FROM crs_waiting_list ' .
451  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
452  $ilDB->manipulate($query);
453 
454  return true;
455  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
+ 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 465 of file class.ilParticipants.php.

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

Referenced by ilObjCourse\_deleteUser().

466  {
467  global $DIC;
468 
469  $ilDB = $DIC['ilDB'];
470 
471  $query = "DELETE FROM obj_members WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
472  $res = $ilDB->manipulate($query);
473 
474  $query = "DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
475  $res = $ilDB->manipulate($query);
476 
477  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
479  }
global $DIC
Definition: saml.php:7
static _deleteUser($a_usr_id)
Delete user.
foreach($_POST as $key=> $value) $res
$query
+ 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 1688 of file class.ilParticipants.php.

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

Referenced by ilAwarenessUserProviderCourseContacts\getInitialUserSet().

1689  {
1690  global $DIC;
1691 
1692  $ilDB = $DIC['ilDB'];
1693 
1694  // todo: join the two queries or alternatively reuse _getMembershipByType
1695  // for the first part
1696 
1697  // this will also dismiss local roles!
1698  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1699  $a2 = "AND obd2.title LIKE 'il_" . $a_type . "_mem%' ";
1700 
1701  // #14290 - no role folder anymore
1702  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
1703  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
1704  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
1705  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1706  $j2 .
1707  "WHERE obd.type = " . $ilDB->quote($a_type, 'text') . " " .
1708  "AND fa.assign = 'y' " .
1709  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1710  $a2;
1711 
1712  $res = $ilDB->query($query);
1713  $obj_ids = array();
1714  while ($row = $ilDB->fetchObject($res)) {
1715  $obj_ids[] = $row->obj_id;
1716  }
1717 
1718  $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members " .
1719  " WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer") .
1720  " AND contact = " . $ilDB->quote(1, "integer"));
1721  $res = array();
1722  while ($rec = $ilDB->fetchAssoc($set)) {
1723  $res[] = $rec;
1724  }
1725 
1726  return $res;
1727  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
+ 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 262 of file class.ilParticipants.php.

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

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilMailSearchGroupsGUI\cancel(), ilMailSearchCoursesGUI\cancel(), ilCertificateMigrationJob\getCourseCertificates(), ilPortfolioPageGUI\getCoursesOfUser(), ilAwarenessUserProviderMemberships\getInitialUserSet(), ilPDSelectedItemsBlockMembershipsProvider\getObjectsByMembership(), ilTestEvaluationData\getParticipants(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), ilCalendarCategories\readReposCalendars(), ilWorkspaceAccessGUI\share(), and ilObjectCopyGUI\showSourceSelectionMembership().

263  {
264  global $DIC;
265 
266  $ilDB = $DIC['ilDB'];
267 
268  if (!is_array($a_type)) {
269  $a_type = array($a_type);
270  }
271 
272  // this will also dismiss local roles!
273  if ($a_only_member_role) {
274  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
275  $a2 = 'AND obd2.title = ' . $ilDB->concat(
276  array(
277  array($ilDB->quote('il_', 'text')),
278  array('obd.type'),
279  array($ilDB->quote('_member_', 'text')),
280  array('obr.ref_id'),
281  ),
282  false
283  );
284  }
285 
286  // #14290 - no role folder anymore
287  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
288  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
289  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
290  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
291  $j2 .
292  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
293  "AND fa.assign = 'y' " .
294  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
295  $a2;
296  $res = $ilDB->query($query);
297  while ($row = $ilDB->fetchObject($res)) {
298  $ref_ids[] = $row->obj_id;
299  }
300 
301  return $ref_ids ? $ref_ids : array();
302  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
+ 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 413 of file class.ilParticipants.php.

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

Referenced by ilObjCourseAccess\checkCondition().

414  {
415  global $DIC;
416 
417  $ilDB = $DIC['ilDB'];
418 
419  $query = "SELECT * FROM obj_members " .
420  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
421  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
422  "AND passed = '1'";
423  $res = $ilDB->query($query);
424  return $res->numRows() ? true : false;
425  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
+ 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 390 of file class.ilParticipants.php.

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

391  {
392  global $DIC;
393 
394  $ilDB = $DIC['ilDB'];
395 
396  $query = "SELECT * FROM obj_members " .
397  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
398  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
399  "AND blocked = " . $ilDB->quote(1, 'integer');
400  $res = $ilDB->query($query);
401  return $res->numRows() ? true : false;
402  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query

◆ _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 314 of file class.ilParticipants.php.

References $DIC.

Referenced by ilForumModeratorsGUI\detachModeratorRole(), ilObjCourseGUI\executeCommand(), ilMembershipGUI\filterUserIdsByRbacOrPositionOfCurrentUser(), ilAwarenessUserProviderMemberships\getInitialUserSet(), ilObjCourseGUI\getTabs(), ilNotification\hasNotification(), and ilObjCourseGUI\initHeaderAction().

315  {
316  global $DIC;
317 
318  $rbacreview = $DIC['rbacreview'];
319 
320  $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
321 
322  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
323  }
global $DIC
Definition: saml.php:7
+ 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 1593 of file class.ilParticipants.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

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

1594  {
1595  global $DIC;
1596 
1597  $ilDB = $DIC['ilDB'];
1598 
1599  $query = "SELECT * FROM il_subscribers " .
1600  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1601  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
1602 
1603  $res = $ilDB->query($query);
1604  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1605  return true;
1606  }
1607  return false;
1608  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ add()

ilParticipants::add (   $a_usr_id,
  $a_role 
)

Add user to object.

public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

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

References $DIC, deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, IL_LSO_ADMIN, IL_LSO_MEMBER, IL_SESS_MEMBER, and isAssigned().

Referenced by assignSubscriber().

977  {
978  global $DIC;
979 
980  $rbacadmin = $DIC['rbacadmin'];
981  $ilAppEventHandler = $DIC['ilAppEventHandler'];
982 
983  if ($this->isAssigned($a_usr_id)) {
984  return false;
985  }
986 
987  switch ($a_role) {
988  case IL_CRS_ADMIN:
989  $this->admins[] = $a_usr_id;
990  break;
991 
992  case IL_CRS_TUTOR:
993  $this->tutors[] = $a_usr_id;
994  break;
995 
996  case IL_CRS_MEMBER:
997  $this->members[] = $a_usr_id;
998  break;
999 
1000  case IL_GRP_ADMIN:
1001  $this->admins[] = $a_usr_id;
1002  break;
1003 
1004  case IL_GRP_MEMBER:
1005  $this->members[] = $a_usr_id;
1006  break;
1007 
1008  case IL_LSO_ADMIN:
1009  $this->admins[] = $a_usr_id;
1010  break;
1011 
1012  case IL_LSO_MEMBER:
1013  $this->members[] = $a_usr_id;
1014  break;
1015 
1016  case IL_SESS_MEMBER:
1017  $this->members[] = $a_usr_id;
1018  break;
1019  }
1020 
1021  $this->participants[] = $a_usr_id;
1022  $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
1023 
1024  // Delete subscription request
1025  $this->deleteSubscriber($a_usr_id);
1026 
1027  include_once './Services/Membership/classes/class.ilWaitingList.php';
1028  ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
1029 
1030  $ilAppEventHandler->raise(
1031  $this->getComponent(),
1032  "addParticipant",
1033  array(
1034  'obj_id' => $this->obj_id,
1035  'usr_id' => $a_usr_id,
1036  'role_id' => $a_role)
1037  );
1038  return true;
1039  }
isAssigned($a_usr_id)
check if user is assigned
global $DIC
Definition: saml.php:7
const IL_LSO_MEMBER
const IL_GRP_ADMIN
const IL_CRS_TUTOR
deleteSubscriber($a_usr_id)
Delete subsciber.
const IL_GRP_MEMBER
const IL_LSO_ADMIN
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.
const IL_SESS_MEMBER
+ 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 1064 of file class.ilParticipants.php.

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

Referenced by ilLearningSequenceParticipants\add(), ilCourseParticipants\add(), and ilGroupParticipants\add().

1065  {
1066  if (!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id, $this->type)) {
1067  ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id, $this->type);
1068  }
1069  return true;
1070  }
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 1458 of file class.ilParticipants.php.

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

1459  {
1460  global $DIC;
1461 
1462  $ilDB = $DIC['ilDB'];
1463 
1464  $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
1465  " VALUES (" .
1466  $ilDB->quote($a_usr_id, 'integer') . "," .
1467  $ilDB->quote($this->obj_id, 'integer') . ", " .
1468  $ilDB->quote('', 'text') . ", " .
1469  $ilDB->quote(time(), 'integer') .
1470  ")";
1471  $res = $ilDB->manipulate($query);
1472 
1473  return true;
1474  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

public

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

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

Referenced by assignSubscribers(), and autoFillSubscribers().

1389  {
1390  global $DIC;
1391 
1392  $ilErr = $DIC['ilErr'];
1393 
1394  $ilErr->setMessage("");
1395  if (!$this->isSubscriber($a_usr_id)) {
1396  $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1397 
1398  return false;
1399  }
1400  if ($this->isAssigned($a_usr_id)) {
1401  $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1402  $ilErr->appendMessage($tmp_obj->getLogin() . ": " . $this->lng->txt("crs_user_already_assigned"));
1403 
1404  return false;
1405  }
1406 
1407  if (!$tmp_obj = &ilObjectFactory::getInstanceByObjId($a_usr_id)) {
1408  $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1409 
1410  return false;
1411  }
1412 
1413  // TODO: must be group or course member role
1414  if ($this instanceof ilCourseParticipants) {
1415  $this->add($tmp_obj->getId(), IL_CRS_MEMBER);
1416  }
1417  if ($this instanceof ilGroupParticipants) {
1418  $this->add($tmp_obj->getId(), IL_GRP_MEMBER);
1419  }
1420  if ($this instanceof ilLearningSequenceParticipants) {
1421  $this->add($tmp_obj->getId(), IL_LSO_MEMBER);
1422  }
1423  if ($this instanceof ilSessionParticipants) {
1424  $this->register($tmp_obj->getId());
1425  }
1426  $this->deleteSubscriber($a_usr_id);
1427  return true;
1428  }
Session participation handling.
isAssigned($a_usr_id)
check if user is assigned
global $DIC
Definition: saml.php:7
const IL_LSO_MEMBER
deleteSubscriber($a_usr_id)
Delete subsciber.
const IL_GRP_MEMBER
add($a_usr_id, $a_role)
Add user to object.
$ilErr
Definition: raiseError.php:18
const IL_CRS_MEMBER
isSubscriber($a_usr_id)
check if is subscriber
static 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 1370 of file class.ilParticipants.php.

References $id, and assignSubscriber().

1371  {
1372  if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1373  return false;
1374  }
1375  foreach ($a_usr_ids as $id) {
1376  if (!$this->assignSubscriber($id)) {
1377  return false;
1378  }
1379  }
1380  return true;
1381  }
assignSubscriber($a_usr_id)
Assign subscriber.
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

public

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

References assignSubscriber(), and readSubscribers().

1436  {
1437  $this->readSubscribers();
1438 
1439  $counter = 0;
1440  foreach ($this->subscribers as $subscriber) {
1441  if (!$this->assignSubscriber($subscriber)) {
1442  continue;
1443  } else {
1444  // TODO: notification
1445  #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1446  }
1447  ++$counter;
1448  }
1449 
1450  return $counter;
1451  }
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 766 of file class.ilParticipants.php.

References getAdmins().

767  {
768  foreach ($this->getAdmins() as $admin_id) {
769  if (!in_array($admin_id, $a_usr_ids)) {
770  return true;
771  }
772  }
773  return false;
774  }
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 813 of file class.ilParticipants.php.

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

814  {
815  global $DIC;
816 
817  $rbacadmin = $DIC['rbacadmin'];
818  $ilDB = $DIC['ilDB'];
819 
820  $this->dropDesktopItem($a_usr_id);
821  foreach ($this->roles as $role_id) {
822  $rbacadmin->deassignUser($role_id, $a_usr_id);
823  }
824 
825  $query = "DELETE FROM obj_members " .
826  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
827  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
828  $res = $ilDB->manipulate($query);
829 
830  $this->readParticipants();
831  $this->readParticipantsStatus();
832 
833  $GLOBALS['DIC']['ilAppEventHandler']->raise(
834  $this->getComponent(),
835  "deleteParticipant",
836  array(
837  'obj_id' => $this->obj_id,
838  'usr_id' => $a_usr_id)
839  );
840 
841  return true;
842  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
global $DIC
Definition: saml.php:7
dropDesktopItem($a_usr_id)
Drop desktop item.
foreach($_POST as $key=> $value) $res
$query
getComponent()
Get component name Used for raising events.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
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 1049 of file class.ilParticipants.php.

1050  {
1051  foreach ($a_user_ids as $user_id) {
1052  $this->delete($user_id);
1053  }
1054  return true;
1055  }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

public

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

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

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

1525  {
1526  global $DIC;
1527 
1528  $ilDB = $DIC['ilDB'];
1529 
1530  $query = "DELETE FROM il_subscribers " .
1531  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1532  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1533  $res = $ilDB->manipulate($query);
1534 
1535  return true;
1536  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

public

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

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

1545  {
1546  global $DIC;
1547 
1548  $ilErr = $DIC['ilErr'];
1549  $ilDB = $DIC['ilDB'];
1550 
1551  if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1552  $ilErr->setMessage('');
1553  $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1554 
1555  return false;
1556  }
1557  $query = "DELETE FROM il_subscribers " .
1558  "WHERE " . $ilDB->in('usr_id', (array) $a_usr_ids, false, 'integer') . " " .
1559  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
1560  $res = $ilDB->query($query);
1561  return true;
1562  }
global $DIC
Definition: saml.php:7
$ilErr
Definition: raiseError.php:18
foreach($_POST as $key=> $value) $res
$query

◆ dropDesktopItem()

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

public

Parameters
intusr_id

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

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

Referenced by delete().

1080  {
1081  if (ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id, $this->type)) {
1082  ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id, $this->type);
1083  }
1084 
1085  return true;
1086  }
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 605 of file class.ilParticipants.php.

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

606  {
607  return $this->admins ? $this->admins : array();
608  }
+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

public

Parameters
intuser_id

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

References $DIC.

713  {
714  global $DIC;
715 
716  $rbacreview = $DIC['rbacreview'];
717 
718  foreach ($this->roles as $role) {
719  if ($rbacreview->isAssigned($a_usr_id, $role)) {
720  $assigned[] = $role;
721  }
722  }
723  return $assigned ? $assigned : array();
724  }
global $DIC
Definition: saml.php:7

◆ getAutoGeneratedRoleId()

ilParticipants::getAutoGeneratedRoleId (   $a_role_type)

Get role id of auto generated role type.

Parameters
type$a_role_type

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

1125  {
1126  if (array_key_exists($a_role_type, $this->role_data)) {
1127  return $this->role_data[$a_role_type];
1128  }
1129 
1130  return 0;
1131  }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

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

References $component.

Referenced by add(), and delete().

153  {
154  return $this->component;
155  }
+ Here is the caller graph for this function:

◆ getContacts()

ilParticipants::getContacts ( )

get user ids which are confirgured as contact

Returns
array

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

913  {
914  $contacts = array();
915  foreach ((array) $this->participants_status as $usr_id => $status) {
916  if ($status['contact']) {
917  $contacts[] = $usr_id;
918  }
919  }
920  return $contacts;
921  }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

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

References getAdmins().

615  {
616  return count($this->getAdmins());
617  }
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 558 of file class.ilParticipants.php.

559  {
560  return count($this->members);
561  }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

public

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

570  {
571  return count($this->participants);
572  }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

public

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

References getSubscribers().

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

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

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

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

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

482  {
483  global $DIC;
484 
485  $ilCtrl = $DIC['ilCtrl'];
486 
487  $obj_id = ilObject::_lookupObjId($a_ref_id);
489 
490  if (!in_array($type, array('crs','grp'))) {
491  return 0;
492  }
493 
494  global $DIC;
495 
496  $rbacreview = $DIC['rbacreview'];
497 
498 
499  $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
500 
501  foreach ($roles as $role) {
503  if (substr($title, 0, 13) == ('il_' . $type . '_member')) {
504  return $role;
505  }
506  }
507  return 0;
508  }
global $DIC
Definition: saml.php:7
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:

◆ getInstance()

static ilParticipants::getInstance (   $a_ref_id)
static

Get instance by ref_id.

Parameters
int$a_ref_id
Returns
ilParticipants

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

References $GLOBALS, $obj_id, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), and ilSessionParticipants\getInstance().

Referenced by ilSessionParticipantsTableGUI\__construct(), ilSessionParticipantsTableGUI\collectParticipants(), ilMembershipGUI\filterUserIdsByRbacOrPositionOfCurrentUser(), ilMembershipGUI\getMembersObject(), ilLearningSequenceMembershipGUI\getMembersObject(), ilSessionParticipantsTableGUI\getParentLocalRoles(), ilTrQuery\getParticipantsForObject(), ilECSAppEventListener\handleMembership(), ilObjSessionGUI\infoScreen(), ilObjGroupGUI\infoScreen(), ilMembershipGUI\jump2UsersGallery(), ilObjSessionGUI\registerObject(), ilObjSessionGUI\showJoinRequestButton(), and ilSessionMembershipGUI\updateMembers().

97  {
98  $obj_id = ilObject::_lookupObjId($a_ref_id);
100 
101  switch ($type) {
102  case 'crs':
103  case 'grp':
104  case 'lso':
105  return self::getInstanceByObjId($obj_id);
106  case 'sess':
107  include_once './Modules/Session/classes/class.ilSessionParticipants.php';
108  return ilSessionParticipants::getInstance($a_ref_id);
109  default:
110  $GLOBALS['DIC']->logger()->mem()->logStack();
111  $GLOBALS['DIC']->logger()->mem()->warning('Invalid ref_id -> obj_id given: ' . $a_ref_id . ' -> ' . $obj_id);
112  throw new \InvalidArgumentException('Invalid obj_id given.');
113  }
114  }
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstance($a_ref_id)
Get instance.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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
Deprecated:
since version 5.4 use getInstance() (ref_id based)

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

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

Referenced by ilGroupParticipantsTableGUI\__construct(), ilCourseParticipantsTableGUI\__construct(), ilGroupAddToGroupActionGUI\addUser(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilGroupAddToGroupActionGUI\confirmAddUser(), ilGroupAddToGroupActionGUI\createGroupAndAddUser(), ilWorkspaceAccessHandler\findSharedObjects(), ilPortfolioAccessHandler\findSharedObjects(), ilContSkillMemberTableGUI\getMembers(), ilLPStatusEvent\getMembers(), ilLPStatusManualByTutor\getMembers(), ilObjCourseGUI\infoScreen(), ilRepositorySearchGUI\listUsers(), ilMembershipGUI\membersMap(), and ilRepositoryObjectResultTableGUI\parseObjectIds().

125  {
126  $type = ilObject::_lookupType($a_obj_id);
127  switch ($type) {
128  case 'crs':
129  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
131 
132  case 'grp':
133  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
135 
136  case 'sess':
137  include_once './Modules/Session/classes/class.ilSessionParticipants.php';
139  case 'lso':
141  default:
142  $GLOBALS['DIC']->logger()->mmbr()->logStack(ilLogLevel::WARNING);
143  $GLOBALS['DIC']->logger()->mmbr()->warning(': Invalid obj_id given: ' . $a_obj_id);
144  throw new InvalidArgumentException('Invalid obj id given');
145  }
146  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 595 of file class.ilParticipants.php.

Referenced by ilSessionParticipants\readParticipantsStatus().

596  {
597  return $this->members ? $this->members : array();
598  }
+ 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 534 of file class.ilParticipants.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, isAdmin(), and isTutor().

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

535  {
536  global $DIC;
537 
538  $ilDB = $DIC['ilDB'];
539 
540  $query = "SELECT * FROM obj_members " .
541  "WHERE notification = 1 " .
542  "AND obj_id = " . $ilDB->quote($this->obj_id) . " ";
543  $res = $ilDB->query($query);
544  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
545  if ($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id)) {
546  $recp[] = $row->usr_id;
547  }
548  }
549  return $recp ? $recp : array();
550  }
global $DIC
Definition: saml.php:7
isAdmin($a_usr_id)
is user admin
foreach($_POST as $key=> $value) $res
$query
$row
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 514 of file class.ilParticipants.php.

References $obj_id.

Referenced by ilLearningSequenceParticipants\addSubscriber(), ilGroupParticipants\addSubscriber(), ilCourseParticipants\addSubscriber(), and ilSessionParticipants\register().

515  {
516  return $this->obj_id;
517  }
+ 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 583 of file class.ilParticipants.php.

Referenced by isGroupingMember().

584  {
585  return $this->participants ? $this->participants : array();
586  }
+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

public

Parameters

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

Referenced by updateRoleAssignments().

701  {
702  return $this->roles ? $this->roles : array();
703  }
+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

public

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

References readSubscriberData().

1359  {
1360  return $this->readSubscriberData($a_usr_id);
1361  }
readSubscriberData($a_usr_id)
read subscribers
+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers

public

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

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

1336  {
1337  $this->readSubscribers();
1338 
1339  return $this->subscribers;
1340  }
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 626 of file class.ilParticipants.php.

627  {
628  return $this->tutors ? $this->tutors : array();
629  }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

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

References $type.

524  {
525  return $this->type;
526  }

◆ getUserMembershipAssignmentsByType()

static ilParticipants::getUserMembershipAssignmentsByType (   $a_user_ids,
  $a_type,
  $a_only_member_roles 
)
static

Get user membership assignments by type.

Parameters
int[]$a_user_ids
string[]$a_type
bool$a_only_member_roles

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

References $a_type, $DIC, $ilDB, $logger, $query, $res, $row, and ilLogLevel\DEBUG.

Referenced by ilTimingsUser\lookupTimings().

208  {
209  global $DIC;
210 
211  $logger = $DIC->logger()->mmbr();
212  $ilDB = $DIC->database();
213 
214  if ($a_only_member_roles) {
215  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
216  $a2 = 'AND obd2.title = ' . $ilDB->concat(
217  array(
218  array($ilDB->quote('il_', 'text')),
219  array('obd.type'),
220  array($ilDB->quote('_member_', 'text')),
221  array('obr.ref_id'),
222  ),
223  false
224  );
225  }
226 
227  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_id FROM rbac_ua ua " .
228  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
229  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
230  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
231  $j2 .
232  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
233  "AND fa.assign = 'y' " .
234  'AND ' . $ilDB->in('ua.usr_id', $a_user_ids, false, 'integer') . ' ' .
235  $a2;
236 
237  $logger->debug($query);
238 
239 
240  $obj_ids = [];
241  $res = $ilDB->query($query);
242  while ($row = $ilDB->fetchObject($res)) {
243  $obj_ids[$row->obj_id][] = $row->usr_id;
244  }
245 
246  $logger->dump($obj_ids, \ilLogLevel::DEBUG);
247 
248  return $obj_ids;
249  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ hasParticipantListAccess()

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

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

Parameters
int$a_obj
int$a_usr_id

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

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

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

165  {
166  global $DIC;
167 
168  $access = $DIC->access();
169 
170  if (!$a_usr_id) {
171  $a_usr_id = $GLOBALS['DIC']['ilUser']->getId();
172  }
173 
174  // if write access granted => return true
175  $refs = ilObject::_getAllReferences($a_obj_id);
176  $ref_id = end($refs);
177 
178  if ($access->checkAccess('manage_members', '', $ref_id)) {
179  return true;
180  }
181  $part = self::getInstance($ref_id);
182  if ($part->isAssigned($a_usr_id)) {
183  if ($part->getType() == 'crs') {
184  if (!ilObjCourse::lookupShowMembersEnabled($a_obj_id)) {
185  return false;
186  }
187  }
188  if ($part->getType() == 'grp') {
189  if (!ilObjGroup::lookupShowMembersEnabled($a_obj_id)) {
190  return false;
191  }
192  }
193  return true;
194  }
195  // User is not assigned to course/group => no read access
196  return false;
197  }
global $DIC
Definition: saml.php:7
static _getAllReferences($a_id)
get all reference ids of object
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
static lookupShowMembersEnabled(int $a_obj_id)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 798 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

799  {
800  if (isset($this->participants_status[$a_usr_id])) {
801  return $this->participants_status[$a_usr_id]['passed'] ? true : false;
802  }
803  return false;
804  }
+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipants::isAdmin (   $a_usr_id)

is user admin

public

Parameters
intusr_id

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

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

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

◆ isAssigned()

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

public

Parameters

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

Referenced by add(), and assignSubscriber().

678  {
679  return in_array($a_usr_id, $this->participants);
680  }
+ 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 783 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

784  {
785  if (isset($this->participants_status[$a_usr_id])) {
786  return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
787  }
788  return false;
789  }
+ 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 1110 of file class.ilParticipants.php.

1111  {
1112  if (isset($this->participants_status[$a_usr_id])) {
1113  return (bool) $this->participants_status[$a_usr_id]['contact'];
1114  }
1115  return false;
1116  }

◆ isGroupingMember()

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

Check grouping membership.

public

Parameters

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

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

1271  {
1272  global $DIC;
1273 
1274  $rbacreview = $DIC['rbacreview'];
1275  $ilObjDataCache = $DIC['ilObjDataCache'];
1276  $ilDB = $DIC['ilDB'];
1277 
1278  // Used for membership limitations -> check membership by given field
1279  if ($a_field) {
1280  include_once './Services/User/classes/class.ilObjUser.php';
1281 
1282  $tmp_user = &ilObjectFactory::getInstanceByObjId($a_usr_id);
1283  switch ($a_field) {
1284  case 'login':
1285  $and = "AND login = " . $ilDB->quote($tmp_user->getLogin(), 'text') . " ";
1286  break;
1287  case 'email':
1288  $and = "AND email = " . $ilDB->quote($tmp_user->getEmail(), 'text') . " ";
1289  break;
1290  case 'matriculation':
1291  $and = "AND matriculation = " . $ilDB->quote($tmp_user->getMatriculation(), 'text') . " ";
1292  break;
1293 
1294  default:
1295  $and = "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
1296  break;
1297  }
1298 
1299  if (!$this->getParticipants()) {
1300  return false;
1301  }
1302 
1303  $query = "SELECT * FROM usr_data ud " .
1304  "WHERE " . $ilDB->in('usr_id', $this->getParticipants(), false, 'integer') . " " .
1305  $and;
1306 
1307  $res = $ilDB->query($query);
1308  return $res->numRows() ? true : false;
1309  }
1310  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
getParticipants()
Get all participants ids.
$query
static 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 687 of file class.ilParticipants.php.

References getAdmins().

688  {
689  return in_array($a_usr_id, $this->getAdmins()) and count($this->getAdmins()) == 1;
690  }
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 662 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

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

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

public

Parameters

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

Referenced by ilCourseParticipants\__buildStatusBody().

1098  {
1099  if (isset($this->participants_status[$a_usr_id])) {
1100  return $this->participants_status[$a_usr_id]['notification'] ? true : false;
1101  }
1102  return false;
1103  }
+ Here is the caller graph for this function:

◆ isSubscriber()

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

public

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

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by assignSubscriber().

1571  {
1572  global $DIC;
1573 
1574  $ilDB = $DIC['ilDB'];
1575 
1576  $query = "SELECT * FROM il_subscribers " .
1577  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1578  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . "";
1579 
1580  $res = $ilDB->query($query);
1581  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1582  return true;
1583  }
1584  return false;
1585  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor (   $a_usr_id)

is user tutor

public

Parameters
intusr_id

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

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

651  {
652  return in_array($a_usr_id, $this->tutors) ? true : false;
653  }
+ 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 349 of file class.ilParticipants.php.

References $DIC, and $title.

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

350  {
351  global $DIC;
352 
353  $rbacreview = $DIC->rbac()->review();
354  $ilObjDataCache = $DIC['ilObjDataCache'];
355 
356  $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
357 
358  if (!$has_policies) {
359  return 0;
360  }
361  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
362 
363  $memberRoles = array();
364  foreach ($lroles as $role_id) {
365  $title = $ilObjDataCache->lookupTitle($role_id);
366  switch (substr($title, 0, 8)) {
367  case 'il_crs_a':
368  case 'il_crs_t':
369  case 'il_grp_a':
370  break;
371 
372  default:
373  $memberRoles[] = $role_id;
374  break;
375  }
376  }
377  return $rbacreview->getNumberOfAssignedUsers($memberRoles);
378  }
global $DIC
Definition: saml.php:7
+ 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 332 of file class.ilParticipants.php.

References $DIC.

333  {
334  global $DIC;
335 
336  $rbacreview = $DIC['rbacreview'];
337 
338  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
339  return $rbacreview->getNumberOfAssignedUsers($lroles);
340  }
global $DIC
Definition: saml.php:7

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

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

References $DIC, $ilDB, $query, $res, $row, $subscribers, and ilDBConstants\FETCHMODE_OBJECT.

1313  {
1314  global $DIC;
1315 
1316  $ilDB = $DIC['ilDB'];
1317 
1318  $subscribers = array();
1319  $query = "SELECT usr_id FROM il_subscribers " .
1320  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
1321  "ORDER BY sub_time ";
1322 
1323  $res = $ilDB->query($query);
1324  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1325  $subscribers[] = $row->usr_id;
1326  }
1327  return $subscribers;
1328  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

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

References $data, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSubscriberTableGUI\readSubscriberData().

1663  {
1664  global $DIC;
1665 
1666  $ilDB = $DIC['ilDB'];
1667 
1668  $query = 'SELECT * FROM il_subscribers ' .
1669  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
1670  $res = $ilDB->query($query);
1671 
1672  $data = array();
1673  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1674  $data[$row->usr_id]['time'] = $row->sub_time;
1675  $data[$row->usr_id]['usr_id'] = $row->usr_id;
1676  $data[$row->usr_id]['subject'] = $row->subject;
1677  }
1678  return $data;
1679  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
$data
Definition: bench.php:6
+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

Read participants.

private

Parameters

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

References $DIC, $GLOBALS, $ilLog, $participants, $title, $users, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, IL_LSO_ADMIN, IL_LSO_MEMBER, IL_ROLE_POSITION_ADMIN, IL_ROLE_POSITION_MEMBER, IL_ROLE_POSITION_TUTOR, and IL_SESS_MEMBER.

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

1142  {
1143  global $DIC;
1144 
1145  $rbacreview = $DIC['rbacreview'];
1146  $ilObjDataCache = $DIC['ilObjDataCache'];
1147  $ilLog = $DIC['ilLog'];
1148 
1149  $GLOBALS['DIC']['rbacreview']->clearCaches();
1150  $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, false);
1151 
1152  $users = array();
1153  $this->participants = array();
1154  $this->members = $this->admins = $this->tutors = array();
1155 
1156  $additional_roles = [];
1157  $auto_generated_roles = [];
1158  foreach ($this->roles as $role_id) {
1159  $title = $ilObjDataCache->lookupTitle($role_id);
1160  switch (substr($title, 0, 8)) {
1161  case 'il_crs_m':
1162  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1163  $this->role_data[IL_CRS_MEMBER] = $role_id;
1164  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1165  $this->members = array_unique(array_merge($assigned, $this->members));
1166  $this->role_assignments[$role_id] = $assigned;
1167  break;
1168 
1169  case 'il_crs_a':
1170  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1171  $this->role_data[IL_CRS_ADMIN] = $role_id;
1172  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1173  $this->admins = $rbacreview->assignedUsers($role_id);
1174  $this->role_assignments[$role_id] = $assigned;
1175  break;
1176 
1177  case 'il_crs_t':
1178  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_TUTOR;
1179  $this->role_data[IL_CRS_TUTOR] = $role_id;
1180  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1181  $this->tutors = $rbacreview->assignedUsers($role_id);
1182  $this->role_assignments[$role_id] = $assigned;
1183  break;
1184 
1185  case 'il_grp_a':
1186  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1187  $this->role_data[IL_GRP_ADMIN] = $role_id;
1188  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1189  $this->admins = $rbacreview->assignedUsers($role_id);
1190  $this->role_assignments[$role_id] = $assigned;
1191  break;
1192 
1193  case 'il_grp_m':
1194  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1195  $this->role_data[IL_GRP_MEMBER] = $role_id;
1196  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1197  $this->members = $rbacreview->assignedUsers($role_id);
1198  $this->role_assignments[$role_id] = $assigned;
1199  break;
1200 
1201  case 'il_sess_':
1202  $this->role_data[IL_SESS_MEMBER] = $role_id;
1203  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1204  $this->members = $rbacreview->assignedUsers($role_id);
1205  break;
1206 
1207  case 'il_lso_m':
1208  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1209  $this->role_data[IL_LSO_MEMBER] = $role_id;
1210  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1211  $this->members = $rbacreview->assignedUsers($role_id);
1212  $this->role_assignments[$role_id] = $assigned;
1213  break;
1214 
1215  case 'il_lso_a':
1216  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1217  $this->role_data[IL_LSO_ADMIN] = $role_id;
1218  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1219  $this->admins = $rbacreview->assignedUsers($role_id);
1220  $this->role_assignments[$role_id] = $assigned;
1221  break;
1222 
1223  default:
1224  $additional_roles[$role_id] = $title;
1225  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1226  $this->members = array_unique(array_merge($assigned, $this->members));
1227  $this->role_assignments[$role_id] = $assigned;
1228  break;
1229  }
1230  }
1231  asort($auto_generated_roles);
1232  asort($additional_roles);
1233  $this->roles_sorted = $auto_generated_roles + $additional_roles;
1234  }
global $DIC
Definition: saml.php:7
const IL_LSO_MEMBER
const IL_GRP_ADMIN
const IL_CRS_TUTOR
const IL_GRP_MEMBER
const IL_ROLE_POSITION_MEMBER
const IL_LSO_ADMIN
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
$users
Definition: authpage.php:44
const IL_ROLE_POSITION_ADMIN
const IL_SESS_MEMBER
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
const IL_ROLE_POSITION_TUTOR
+ Here is the caller graph for this function:

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
protected

Read status of participants (blocked, notification, passed)

private

Parameters

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

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

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

1244  {
1245  global $DIC;
1246 
1247  $ilDB = $DIC['ilDB'];
1248 
1249  $query = "SELECT * FROM obj_members " .
1250  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1251  $res = $ilDB->query($query);
1252  $this->participants_status = array();
1253  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1254  $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1255  $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1256  $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1257  // cognos-blu-patch: begin
1258  $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1259  // cognos-blu-patch: end
1260  }
1261  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

protected

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

References $data, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by getSubscriberData().

1644  {
1645  global $DIC;
1646 
1647  $ilDB = $DIC['ilDB'];
1648 
1649  $query = "SELECT * FROM il_subscribers " .
1650  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1651  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
1652 
1653  $res = $this->ilDB->query($query);
1654  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1655  $data["time"] = $row->sub_time;
1656  $data["usr_id"] = $row->usr_id;
1657  $data['subject'] = $row->subject;
1658  }
1659  return $data ? $data : array();
1660  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
$data
Definition: bench.php:6
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected

read subscribers

protected

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

References $DIC, $ilDB, $query, $res, $row, deleteSubscriber(), ilDBConstants\FETCHMODE_OBJECT, and ilObjectFactory\getInstanceByObjId().

Referenced by autoFillSubscribers(), and getSubscribers().

1616  {
1617  global $DIC;
1618 
1619  $ilDB = $DIC['ilDB'];
1620 
1621  $this->subscribers = array();
1622 
1623  $query = "SELECT usr_id FROM il_subscribers " .
1624  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1625  "ORDER BY sub_time ";
1626 
1627  $res = $this->ilDB->query($query);
1628  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1629  // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1630  if (!ilObjectFactory::getInstanceByObjId($row->usr_id, false)) {
1631  $this->deleteSubscriber($row->usr_id);
1632  }
1633  $this->subscribers[] = $row->usr_id;
1634  }
1635  return true;
1636  }
global $DIC
Definition: saml.php:7
deleteSubscriber($a_usr_id)
Delete subsciber.
foreach($_POST as $key=> $value) $res
$query
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRoleOrderPosition()

ilParticipants::setRoleOrderPosition (   $a_user_id)

Set role order position.

Parameters
int$a_user_id
Returns
string

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

1735  {
1736  $counter = 0;
1737  $sortable_assignments = '9999999999';
1738  foreach ($this->roles_sorted as $role_id => $trash) {
1739  if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
1740  $sortable_assignments = substr_replace($sortable_assignments, '1', $counter, 1);
1741  }
1742  ++$counter;
1743  }
1744  return $sortable_assignments;
1745  }

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

public

Parameters
intusr_id
boolblocked

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

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

853  {
854  global $DIC;
855 
856  $ilDB = $DIC['ilDB'];
857 
858  $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
859 
860  $query = "SELECT * FROM obj_members " .
861  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
862  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
863  $res = $ilDB->query($query);
864  if ($res->numRows()) {
865  $query = "UPDATE obj_members SET " .
866  "blocked = " . $ilDB->quote((int) $a_blocked, 'integer') . " " .
867  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
868  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
869  } else {
870  $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
871  "VALUES ( " .
872  $ilDB->quote((int) $a_blocked, 'integer') . ", " .
873  $ilDB->quote($this->obj_id, 'integer') . ", " .
874  $ilDB->quote($a_usr_id, 'integer') . ", " .
875  $ilDB->quote(0, 'integer') . ", " .
876  $ilDB->quote(0, 'integer') .
877  ")";
878  }
879  $res = $ilDB->manipulate($query);
880  return true;
881  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query

◆ 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 891 of file class.ilParticipants.php.

References $DIC, and $ilDB.

892  {
893  global $DIC;
894 
895  $ilDB = $DIC['ilDB'];
896 
897  $ilDB->manipulate(
898  'UPDATE obj_members SET ' .
899  'contact = ' . $ilDB->quote($a_contact, 'integer') . ' ' .
900  'WHERE obj_id = ' . $ilDB->quote($this->obj_id, 'integer') . ' ' .
901  'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer')
902  );
903 
904  $this->participants_status[$a_usr_id]['contact'] = $a_contact;
905  return true;
906  }
global $DIC
Definition: saml.php:7

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

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

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

935  {
936  global $DIC;
937 
938  $ilDB = $DIC['ilDB'];
939 
940  $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
941 
942  $query = "SELECT * FROM obj_members " .
943  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
944  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
945  $res = $ilDB->query($query);
946  if ($res->numRows()) {
947  $query = "UPDATE obj_members SET " .
948  "notification = " . $ilDB->quote((int) $a_notification, 'integer') . " " .
949  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
950  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
951  } else {
952  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
953  "VALUES ( " .
954  $ilDB->quote((int) $a_notification, 'integer') . ", " .
955  $ilDB->quote($this->obj_id, 'integer') . ", " .
956  $ilDB->quote($a_usr_id, 'integer') . ", " .
957  $ilDB->quote(0, 'integer') . ", " .
958  $ilDB->quote(0, 'integer') .
959  ")";
960  }
961  $res = $ilDB->manipulate($query);
962  return true;
963  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

public

Parameters
intusr_id
arrayarray of new roles

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

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

735  {
736  global $DIC;
737 
738  $rbacreview = $DIC['rbacreview'];
739  $rbacadmin = $DIC['rbacadmin'];
740 
741  $roles = $a_roles ? $a_roles : array();
742 
743  foreach ($this->getRoles() as $role_id) {
744  if ($rbacreview->isAssigned($a_usr_id, $role_id)) {
745  if (!in_array($role_id, $roles)) {
746  $rbacadmin->deassignUser($role_id, $a_usr_id);
747  }
748  } else {
749  if (in_array($role_id, $roles)) {
750  $rbacadmin->assignUser($role_id, $a_usr_id);
751  }
752  }
753  }
754  $rbacreview->clearCaches();
755  $this->readParticipants();
756  $this->readParticipantsStatus();
757  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
global $DIC
Definition: saml.php:7
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 1504 of file class.ilParticipants.php.

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

1505  {
1506  global $DIC;
1507 
1508  $ilDB = $DIC['ilDB'];
1509 
1510  $query = "UPDATE il_subscribers " .
1511  "SET subject = " . $ilDB->quote($a_subject, 'text') . " " .
1512  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1513  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1514  $res = $ilDB->manipulate($query);
1515  return true;
1516  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

public

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

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

1483  {
1484  global $DIC;
1485 
1486  $ilDB = $DIC['ilDB'];
1487 
1488  $query = "UPDATE il_subscribers " .
1489  "SET sub_time = " . $ilDB->quote($a_subtime, 'integer') . " " .
1490  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1491  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1492  $res = $ilDB->manipulate($query);
1493 
1494  return true;
1495  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query

Field Documentation

◆ $admins

ilParticipants::$admins = array()
protected

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

◆ $component

ilParticipants::$component = ''
protected

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

Referenced by getComponent().

◆ $ilDB

◆ $lng

ilParticipants::$lng
protected

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

◆ $logger

◆ $members

ilParticipants::$members = array()
protected

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

◆ $obj_id

◆ $participants

ilParticipants::$participants = array()
protected

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

Referenced by readParticipants().

◆ $participants_status

ilParticipants::$participants_status = array()
protected

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

◆ $ref_id

◆ $role_assignments

ilParticipants::$role_assignments = []
protected

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

◆ $role_data

ilParticipants::$role_data = array()
protected

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

◆ $roles

◆ $roles_sorted

ilParticipants::$roles_sorted = []
protected

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

◆ $subscribers

ilParticipants::$subscribers = array()
protected

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

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

ilParticipants::$tutors = array()
protected

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

◆ $type

ilParticipants::$type = ''
protected

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