25include_once 
'./Services/Membership/classes/class.ilParticipants.php';
 
   70    protected function __construct($a_component_name, $a_obj_id, $a_usr_id)
 
   77        $this->obj_id = $a_obj_id;
 
   78        $this->usr_id = $a_usr_id;
 
   81        $this->ref_id = current($ref_ids);
 
   83        $this->component = $a_component_name;
 
  106        switch ($a_membership_role_type) {
 
  108                $update_fields = array(
'admin' => array(
'integer', $a_status ? 1 : 0));
 
  109                $update_string = (
'admin = ' . 
$ilDB->quote($a_status ? 1 : 0, 
'integer'));
 
  113                $update_fields = array(
'tutor' => array(
'integer', $a_status ? 1 : 0));
 
  114                $update_string = (
'tutor = ' . 
$ilDB->quote($a_status ? 1 : 0, 
'integer'));
 
  122                    $new_status = $current_status + 1;
 
  125                    $new_status = $current_status - 1;
 
  126                    if ($new_status < 0) {
 
  131                $update_fields = array(
'member' => array(
'integer', $new_status));
 
  132                $update_string = (
'member = ' . 
$ilDB->quote($new_status, 
'integer'));
 
  136        $query = 
'SELECT count(*) num FROM obj_members  ' .
 
  137                'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
 
  138                'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer');
 
  151                        'obj_id' => array(
'integer',$a_obj_id),
 
  152                        'usr_id' => array(
'integer',$a_usr_id)
 
  157            $query = 
'UPDATE obj_members SET ' .
 
  158                    $update_string . 
' ' .
 
  159                    'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
 
  160                    'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer');
 
  165        $query = 
'DELETE from obj_members ' .
 
  166            'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
 
  167            'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer') . 
' ' .
 
  168            'AND admin = ' . 
$ilDB->quote(0, 
'integer') . 
' ' .
 
  169            'AND tutor = ' . 
$ilDB->quote(0, 
'integer') . 
' ' .
 
  170            'AND member = ' . 
$ilDB->quote(0, 
'integer');
 
  181        switch (substr($title, 0, 8)) {
 
  210        $query = 
'SELECT * FROM obj_members ' .
 
  211                'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer') . 
' ' .
 
  212                'AND usr_id = ' . 
$ilDB->quote($a_usr_id) . 
' ';
 
  215            switch ($a_membership_role_type) {
 
  251        return (
bool) $this->participants_status[$this->
getUserId()][
'blocked'];
 
  261        return (
bool) $this->participants_status[$this->
getUserId()][
'contact'];
 
  294        $rbacreview = 
$DIC[
'rbacreview'];
 
  296        if ($this->numMembers === 
null) {
 
  297            $this->numMembers = $rbacreview->getNumberOfAssignedUsers($this->member_roles);
 
  311        $rbacreview = 
$DIC[
'rbacreview'];
 
  312        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  314        $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, 
false);
 
  317        $this->participants = array();
 
  318        $this->members = $this->admins = $this->tutors = array();
 
  319        $this->member_roles = [];
 
  321        foreach ($this->roles as $role_id) {
 
  322            $title = $ilObjDataCache->lookupTitle($role_id);
 
  323            switch (substr($title, 0, 8)) {
 
  325                    $this->member_roles[] = $role_id;
 
  327                    if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
 
  328                        $this->participants = 
true;
 
  329                        $this->members = 
true;
 
  335                    if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
 
  336                        $this->participants = 
true;
 
  337                        $this->admins = 
true;
 
  343                    if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
 
  344                        $this->participants = 
true;
 
  345                        $this->tutors = 
true;
 
  351                    if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
 
  352                        $this->participants = 
true;
 
  353                        $this->admins = 
true;
 
  358                    $this->member_roles[] = $role_id;
 
  360                    if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
 
  361                        $this->participants = 
true;
 
  362                        $this->members = 
true;
 
  368                    $this->member_roles[] = $role_id;
 
  369                    if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
 
  370                        $this->participants = 
true;
 
  371                        $this->members = 
true;
 
  388        $query = 
"SELECT * FROM obj_members " .
 
  389            "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
  393        $this->participants_status = array();
 
  395            $this->participants_status[$this->
getUserId()][
'blocked'] = $row->blocked;
 
  396            $this->participants_status[$this->
getUserId()][
'notification'] = $row->notification;
 
  397            $this->participants_status[$this->
getUserId()][
'passed'] = $row->passed;
 
  399            $this->participants_status[$this->
getUserId()][
'contact'] = $row->contact;
 
  414    public function add($a_usr_id, $a_role)
 
  418        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  420        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
  421        $rbacreview = 
$DIC[
'rbacreview'];
 
  424        if ($rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $this->roles)) {
 
  430                $this->admins = 
true;
 
  434                $this->tutors = 
true;
 
  438                $this->members = 
true;
 
  442                $this->admins = 
true;
 
  446                $this->members = 
true;
 
  450        $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
 
  456        include_once 
'./Services/Membership/classes/class.ilWaitingList.php';
 
  460        $ilAppEventHandler->raise(
 
  464                    'obj_id' => $this->obj_id,
 
  465                    'usr_id' => $a_usr_id,
 
  466                    'role_id' => $a_role)
 
  478    public function delete($a_usr_id)
 
  482        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  484        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
  486        $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
 
  488        foreach ($this->roles as $role_id) {
 
  489            $rbacadmin->deassignUser($role_id, $a_usr_id);
 
  492        $query = 
"DELETE FROM obj_members " .
 
  493            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
  494            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer');
 
  497        $ilAppEventHandler->raise(
 
  501                    'obj_id' => $this->obj_id,
 
  502                    'usr_id' => $a_usr_id)
 
  518        $query = 
"DELETE FROM il_subscribers " .
 
  519            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
  520            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" ";
 
  557            'UPDATE obj_members SET ' .
 
  558                'contact = ' . 
$ilDB->quote($a_contact, 
'integer') . 
' ' .
 
  559                'WHERE obj_id = ' . 
$ilDB->quote($this->obj_id, 
'integer') . 
' ' .
 
  560                'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer')
 
  563        $this->participants_status[$a_usr_id][
'contact'] = $a_contact;
 
  582        $this->participants_status[$a_usr_id][
'notification'] = (int) $a_notification;
 
  584        $query = 
"SELECT * FROM obj_members " .
 
  585            "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
  586            "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer');
 
  588        if (
$res->numRows()) {
 
  589            $query = 
"UPDATE obj_members SET " .
 
  590                "notification = " . 
$ilDB->quote((
int) $a_notification, 
'integer') . 
" " .
 
  591                "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
  592                "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer');
 
  594            $query = 
"INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
 
  596                $ilDB->quote((
int) $a_notification, 
'integer') . 
", " .
 
  597                $ilDB->quote($this->obj_id, 
'integer') . 
", " .
 
  598                $ilDB->quote($a_usr_id, 
'integer') . 
", " .
 
  599                $ilDB->quote(0, 
'integer') . 
", " .
 
  600                $ilDB->quote(0, 
'integer') .
 
  621            $this->type == 
'crs' ?
 
  627                SELECT                  COUNT(rolesusers.usr_id) cnt 
  629                FROM                    object_data rdata 
  631                LEFT JOIN               rbac_ua  rolesusers              
  632                ON                              rolesusers.rol_id = rdata.obj_id 
  634                WHERE                   rdata.obj_id = %s 
  637        $query .= 
' AND ' . 
$ilDB->in(
'rolesusers.usr_id', $a_usr_ids, 
true, 
'integer');
 
  642        return (
int) 
$data[
'cnt'] > 0;
 
An exception for terminatinating execution or to throw for unit testing.
const IL_CRS_ADMIN
Base class for course and group participants.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Base class for course and group participant.
checkLastAdmin($a_usr_ids)
Check if user for deletion are last admins.
updateContact($a_usr_id, $a_contact)
@global ilDB $ilDB
deleteSubscriber($a_usr_id)
Delete subsciber.
addRecommendation($a_usr_id)
Add desktop item.
readParticipantStatus()
Read participant status @global ilDB $ilDB.
static updateMemberRoles($a_obj_id, $a_usr_id, $a_role_id, $a_status)
Update member roles @global ilDB $ilDB.
getComponent()
Get component name Used for event handling.
static lookupStatusByMembershipRoleType($a_obj_id, $a_usr_id, $a_membership_role_type)
lookup assignment status @global ilDB $ilDB
__construct($a_component_name, $a_obj_id, $a_usr_id)
Singleton Constructor.
static getMembershipRoleType($a_role_id)
add($a_usr_id, $a_role)
Add user to course/group.
isContact()
Check if user is contact for current object.
$recommended_content_manager
updateNotification($a_usr_id, $a_notification)
Update notification status.
readParticipant()
Read participant.
Recommended content manager (business logic)
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
foreach($_POST as $key=> $value) $res