Base class for course and group participant.  
 More...
Base class for course and group participant. 
- Author
 - Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e 
 
- Version
 - $Id$ 
 
Definition at line 26 of file class.ilParticipant.php.
 
◆ __construct()
  
  
      
        
          | ilParticipant::__construct  | 
          ( | 
          string  | 
          $a_component_name,  | 
         
        
           | 
           | 
          int  | 
          $a_obj_id,  | 
         
        
           | 
           | 
          int  | 
          $a_usr_id  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protected   | 
  
 
 
◆ add()
      
        
          | ilParticipant::add  | 
          ( | 
          int  | 
          $a_usr_id,  | 
        
        
           | 
           | 
          int  | 
          $a_role  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 335 of file class.ilParticipant.php.
References addRecommendation(), deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), ilParticipants\IL_CRS_ADMIN, ilParticipants\IL_CRS_MEMBER, ilParticipants\IL_CRS_TUTOR, ilParticipants\IL_GRP_ADMIN, and ilParticipants\IL_GRP_MEMBER.
  337         if ($this->rbacReview->isAssignedToAtLeastOneGivenRole($a_usr_id, $this->roles)) {
   344                 $this->admins = 
true;
   348                 $this->tutors = 
true;
   353                 $this->members = 
true;
   357         $this->rbacAdmin->assignUser($this->role_data[$a_role], $a_usr_id);
   365         $this->eventHandler->raise(
   369                 'obj_id' => $this->obj_id,
   370                 'usr_id' => $a_usr_id,
 
getComponent()
Get component name Used for event handling. 
 
addRecommendation($a_usr_id)
 
static deleteUserEntry(int $a_usr_id, int $a_obj_id)
 
deleteSubscriber(int $a_usr_id)
 
 
 
 
◆ addRecommendation()
      
        
          | ilParticipant::addRecommendation  | 
          ( | 
            | 
          $a_usr_id | ) | 
           | 
        
      
 
 
◆ checkLastAdmin()
      
        
          | ilParticipant::checkLastAdmin  | 
          ( | 
          array  | 
          $a_usr_ids | ) | 
           | 
        
      
 
Definition at line 451 of file class.ilParticipant.php.
References $data, $res, ilParticipants\IL_CRS_ADMIN, and ilParticipants\IL_GRP_ADMIN.
  454             $this->type === 
'crs' ?
   459                 SELECT                  COUNT(rolesusers.usr_id) cnt   461                 FROM                    object_data rdata   463                 LEFT JOIN               rbac_ua  rolesusers                464                 ON                              rolesusers.rol_id = rdata.obj_id   466                 WHERE                   rdata.obj_id = %s   469         $query .= 
' AND ' . $this->db->in(
'rolesusers.usr_id', $a_usr_ids, 
true, 
'integer');
   470         $res = $this->db->queryF($query, array(
'integer'), array($admin_role_id));
   473         return $data[
'cnt'] > 0;
 
 
 
 
◆ delete()
      
        
          | ilParticipant::delete  | 
          ( | 
          int  | 
          $a_usr_id | ) | 
           | 
        
      
 
Definition at line 377 of file class.ilParticipant.php.
References $res, and getComponent().
  379         $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
   380         foreach ($this->roles as $role_id) {
   381             $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
   384         $query = 
"DELETE FROM obj_members " .
   385             "WHERE usr_id = " . $this->db->quote($a_usr_id, 
'integer') . 
" " .
   386             "AND obj_id = " . $this->db->quote($this->obj_id, 
'integer');
   387         $res = $this->db->manipulate($query);
   389         $this->eventHandler->raise(
   393                 'obj_id' => $this->obj_id,
   394                 'usr_id' => $a_usr_id
 
getComponent()
Get component name Used for event handling. 
 
 
 
 
◆ deleteSubscriber()
      
        
          | ilParticipant::deleteSubscriber  | 
          ( | 
          int  | 
          $a_usr_id | ) | 
           | 
        
      
 
Definition at line 399 of file class.ilParticipant.php.
References $res.
Referenced by add().
  401         $query = 
"DELETE FROM il_subscribers " .
   402             "WHERE usr_id = " . $this->db->quote($a_usr_id, 
'integer') . 
" " .
   403             "AND obj_id = " . $this->db->quote($this->obj_id, 
'integer') . 
" ";
   404         $res = $this->db->manipulate($query);
 
 
 
 
◆ getComponent()
  
  
      
        
          | ilParticipant::getComponent  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ getMembershipRoleType()
  
  
      
        
          | static ilParticipant::getMembershipRoleType  | 
          ( | 
          int  | 
          $a_role_id | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Definition at line 154 of file class.ilParticipant.php.
References ilObject\_lookupTitle().
  157         switch (substr($title, 0, 8)) {
   160                 return self::MEMBERSHIP_ADMIN;
   163                 return self::MEMBERSHIP_TUTOR;
   167                 return self::MEMBERSHIP_MEMBER;
 static _lookupTitle(int $obj_id)
 
 
 
 
◆ getNumberOfMembers()
      
        
          | ilParticipant::getNumberOfMembers  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 250 of file class.ilParticipant.php.
References $numMembers.
  252         if ($this->numMembers === null) {
   253             $this->numMembers = $this->rbacReview->getNumberOfAssignedUsers($this->member_roles);
 
 
 
 
◆ getUserId()
      
        
          | ilParticipant::getUserId  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isAdmin()
      
        
          | ilParticipant::isAdmin  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isAssigned()
      
        
          | ilParticipant::isAssigned  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isBlocked()
      
        
          | ilParticipant::isBlocked  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isContact()
      
        
          | ilParticipant::isContact  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isMember()
      
        
          | ilParticipant::isMember  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isParticipant()
      
        
          | ilParticipant::isParticipant  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isTutor()
      
        
          | ilParticipant::isTutor  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ lookupStatusByMembershipRoleType()
  
  
      
        
          | static ilParticipant::lookupStatusByMembershipRoleType  | 
          ( | 
          int  | 
          $a_obj_id,  | 
         
        
           | 
           | 
          int  | 
          $a_usr_id,  | 
         
        
           | 
           | 
          int  | 
          $a_membership_role_type  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 171 of file class.ilParticipant.php.
References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ilDBConstants\T_INTEGER.
  178         $ilDB = $DIC->database();
   179         $query = 
'SELECT * FROM obj_members ' .
   180             'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
   184             switch ($a_membership_role_type) {
   185                 case self::MEMBERSHIP_ADMIN:
   186                     return (
int) $row->admin;
   188                 case self::MEMBERSHIP_TUTOR:
   189                     return (
int) $row->tutor;
   191                 case self::MEMBERSHIP_MEMBER:
   192                     return (
int) $row->member;
 
 
 
 
◆ readParticipant()
  
  
      
        
          | ilParticipant::readParticipant  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Definition at line 258 of file class.ilParticipant.php.
References ilParticipants\IL_CRS_ADMIN, ilParticipants\IL_CRS_MEMBER, ilParticipants\IL_CRS_TUTOR, ilParticipants\IL_GRP_ADMIN, ilParticipants\IL_GRP_MEMBER, and ILIAS\Repository\objectDataCache().
Referenced by __construct().
  260         $this->roles = $this->rbacReview->getRolesOfRoleFolder($this->ref_id, 
false);
   261         $this->member_roles = [];
   262         foreach ($this->roles as $role_id) {
   264             switch (substr($title, 0, 8)) {
   266                     $this->member_roles[] = $role_id;
   268                     if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
   269                         $this->participants = 
true;
   270                         $this->members = 
true;
   276                     if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
   277                         $this->participants = 
true;
   278                         $this->admins = 
true;
   284                     if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
   285                         $this->participants = 
true;
   286                         $this->tutors = 
true;
   292                     if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
   293                         $this->participants = 
true;
   294                         $this->admins = 
true;
   299                     $this->member_roles[] = $role_id;
   301                     if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
   302                         $this->participants = 
true;
   303                         $this->members = 
true;
   309                     $this->member_roles[] = $role_id;
   310                     if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
   311                         $this->participants = 
true;
   312                         $this->members = 
true;
 
 
 
 
◆ readParticipantStatus()
  
  
      
        
          | ilParticipant::readParticipantStatus  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Definition at line 319 of file class.ilParticipant.php.
References $res, ilDBConstants\FETCHMODE_OBJECT, and getUserId().
Referenced by __construct().
  321         $query = 
"SELECT * FROM obj_members " .
   322             "WHERE obj_id = " . $this->db->quote($this->obj_id, 
'integer') . 
" " .
   323             'AND usr_id = ' . $this->db->quote($this->
getUserId(), 
'integer');
   325         $res = $this->db->query($query);
   326         $this->participants_status = array();
   328             $this->participants_status[$this->
getUserId()][
'blocked'] = (bool) $row->blocked;
   329             $this->participants_status[$this->getUserId()][
'notification'] = (bool) $row->notification;
   330             $this->participants_status[$this->getUserId()][
'passed'] = (bool) $row->passed;
   331             $this->participants_status[$this->getUserId()][
'contact'] = (bool) $row->contact;
 
 
 
 
◆ updateContact()
      
        
          | ilParticipant::updateContact  | 
          ( | 
          int  | 
          $a_usr_id,  | 
        
        
           | 
           | 
          bool  | 
          $a_contact  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 414 of file class.ilParticipant.php.
  416         $this->db->manipulate(
   417             'UPDATE obj_members SET ' .
   418             'contact = ' . $this->db->quote($a_contact, 
'integer') . 
' ' .
   419             'WHERE obj_id = ' . $this->db->quote($this->obj_id, 
'integer') . 
' ' .
   420             'AND usr_id = ' . $this->db->quote($a_usr_id, 
'integer')
   422         $this->participants_status[$a_usr_id][
'contact'] = $a_contact;
  
 
 
◆ updateMemberRoles()
  
  
      
        
          | static ilParticipant::updateMemberRoles  | 
          ( | 
          int  | 
          $a_obj_id,  | 
         
        
           | 
           | 
          int  | 
          $a_usr_id,  | 
         
        
           | 
           | 
          int  | 
          $a_role_id,  | 
         
        
           | 
           | 
          int  | 
          $a_status  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 79 of file class.ilParticipant.php.
References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.
Referenced by ilGroupAppEventListener\handleUserAssignments(), and ilCourseAppEventListener\handleUserAssignments().
   83         $ilDB = $DIC->database();
    85         $a_membership_role_type = self::getMembershipRoleType($a_role_id);
    86         switch ($a_membership_role_type) {
    87             case self::MEMBERSHIP_ADMIN:
    88                 $update_fields = array(
'admin' => array(
'integer', $a_status ? 1 : 0));
    89                 $update_string = (
'admin = ' . 
$ilDB->quote($a_status ? 1 : 0, 
'integer'));
    92             case self::MEMBERSHIP_TUTOR:
    93                 $update_fields = array(
'tutor' => array(
'integer', $a_status ? 1 : 0));
    94                 $update_string = (
'tutor = ' . 
$ilDB->quote($a_status ? 1 : 0, 
'integer'));
    97             case self::MEMBERSHIP_MEMBER:
    99                 $current_status = self::lookupStatusByMembershipRoleType($a_obj_id, $a_usr_id, $a_membership_role_type);
   102                     $new_status = $current_status + 1;
   105                     $new_status = $current_status - 1;
   106                     if ($new_status < 0) {
   111                 $update_fields = array(
'member' => array(
'integer', $new_status));
   112                 $update_string = (
'member = ' . 
$ilDB->quote($new_status, 
'integer'));
   116         $query = 
'SELECT count(*) num FROM obj_members  ' .
   117             'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
   118             'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer');
   131                     'obj_id' => array(
'integer', $a_obj_id),
   132                     'usr_id' => array(
'integer', $a_usr_id)
   137             $query = 
'UPDATE obj_members SET ' .
   138                 $update_string . 
' ' .
   139                 'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
   140                 'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer');
   142             $ilDB->manipulate($query);
   145         $query = 
'DELETE from obj_members ' .
   146             'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
   147             'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer') . 
' ' .
   148             'AND admin = ' . 
$ilDB->quote(0, 
'integer') . 
' ' .
   149             'AND tutor = ' . 
$ilDB->quote(0, 
'integer') . 
' ' .
   150             'AND member = ' . 
$ilDB->quote(0, 
'integer');
   151         $ilDB->manipulate($query);
 
 
 
 
◆ updateNotification()
      
        
          | ilParticipant::updateNotification  | 
          ( | 
          int  | 
          $a_usr_id,  | 
        
        
           | 
           | 
          bool  | 
          $a_notification  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 425 of file class.ilParticipant.php.
References $res.
  427         $this->participants_status[$a_usr_id][
'notification'] = $a_notification;
   429         $query = 
"SELECT * FROM obj_members " .
   430             "WHERE obj_id = " . $this->db->quote($this->obj_id, 
'integer') . 
" " .
   431             "AND usr_id = " . $this->db->quote($a_usr_id, 
'integer');
   432         $res = $this->db->query($query);
   433         if (
$res->numRows()) {
   434             $query = 
"UPDATE obj_members SET " .
   435                 "notification = " . $this->db->quote((
int) $a_notification, 
'integer') . 
" " .
   436                 "WHERE obj_id = " . $this->db->quote($this->obj_id, 
'integer') . 
" " .
   437                 "AND usr_id = " . $this->db->quote($a_usr_id, 
'integer');
   439             $query = 
"INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
   441                 $this->db->quote((
int) $a_notification, 
'integer') . 
", " .
   442                 $this->db->quote($this->obj_id, 
'integer') . 
", " .
   443                 $this->db->quote($a_usr_id, 
'integer') . 
", " .
   444                 $this->db->quote(0, 
'integer') . 
", " .
   445                 $this->db->quote(0, 
'integer') .
   446                 ") ON DUPLICATE KEY UPDATE notification = VALUES(notification)";
   448         $this->db->manipulate($query);
 
 
 
 
◆ $admins
  
  
      
        
          | bool ilParticipant::$admins = false | 
         
       
   | 
  
private   | 
  
 
 
◆ $component
  
  
      
        
          | string ilParticipant::$component = '' | 
         
       
   | 
  
private   | 
  
 
 
◆ $db
◆ $eventHandler
◆ $member_roles
  
  
      
        
          | array ilParticipant::$member_roles = [] | 
         
       
   | 
  
private   | 
  
 
 
◆ $members
  
  
      
        
          | bool ilParticipant::$members = false | 
         
       
   | 
  
private   | 
  
 
 
◆ $numMembers
  
  
      
        
          | int ilParticipant::$numMembers = null | 
         
       
   | 
  
private   | 
  
 
 
◆ $obj_id
  
  
      
        
          | int ilParticipant::$obj_id = 0 | 
         
       
   | 
  
private   | 
  
 
 
◆ $objectDataCache
◆ $participants
  
  
      
        
          | bool ilParticipant::$participants = false | 
         
       
   | 
  
private   | 
  
 
 
◆ $participants_status
  
  
      
        
          | array ilParticipant::$participants_status = array() | 
         
       
   | 
  
private   | 
  
 
 
◆ $rbacAdmin
◆ $rbacReview
◆ $recommended_content_manager
◆ $ref_id
  
  
      
        
          | int ilParticipant::$ref_id = 0 | 
         
       
   | 
  
private   | 
  
 
 
◆ $role_data
  
  
      
        
          | array ilParticipant::$role_data = [] | 
         
       
   | 
  
private   | 
  
 
 
◆ $roles
  
  
      
        
          | array ilParticipant::$roles = [] | 
         
       
   | 
  
private   | 
  
 
 
◆ $tutors
  
  
      
        
          | bool ilParticipant::$tutors = false | 
         
       
   | 
  
private   | 
  
 
 
◆ $type
  
  
      
        
          | string ilParticipant::$type = '' | 
         
       
   | 
  
protected   | 
  
 
 
◆ $usr_id
  
  
      
        
          | int ilParticipant::$usr_id = 0 | 
         
       
   | 
  
private   | 
  
 
 
◆ MEMBERSHIP_ADMIN
  
  
      
        
          | const ilParticipant::MEMBERSHIP_ADMIN = 1 | 
         
       
   | 
  
protected   | 
  
 
 
◆ MEMBERSHIP_MEMBER
  
  
      
        
          | const ilParticipant::MEMBERSHIP_MEMBER = 3 | 
         
       
   | 
  
protected   | 
  
 
 
◆ MEMBERSHIP_TUTOR
  
  
      
        
          | const ilParticipant::MEMBERSHIP_TUTOR = 2 | 
         
       
   | 
  
protected   | 
  
 
 
The documentation for this class was generated from the following file: