ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilParticipants Class Reference
+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

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

Static Public Member Functions

static _getMembershipByType ($a_usr_id, $a_type)
 get membership by type Get course or group membership
static _isParticipant ($a_ref_id, $a_usr_id)
 Static function to check if a user is a participant of the container object.
static _isBlocked ($a_obj_id, $a_usr_id)
 Check if user is blocked.
static _hasPassed ($a_obj_id, $a_usr_id)
 Check if user has passed course.
static _deleteAllEntries ($a_obj_id)
 Delete all entries Normally called for course deletion.
static _deleteUser ($a_usr_id)
 Delete user data.
static getDefaultMemberRole ($a_ref_id)
static _isSubscriber ($a_obj_id, $a_usr_id)
 check if user is subscriber

Protected Member Functions

 readSubscribers ()
 read subscribers
 readSubscriberData ($a_usr_id)
 read subscribers

Protected Attributes

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

Private Member Functions

 readParticipants ()
 Read participants.
 readParticipantsStatus ()
 Read stati of participants (blocked, notification, passed)

Detailed Description

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

Constructor & Destructor Documentation

ilParticipants::__construct (   $a_obj_id)

Singleton Constructor.

public

Parameters
intobj_id of container

Reimplemented in ilGroupParticipants, and ilCourseParticipants.

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

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

{
global $ilDB,$lng;
$this->ilDB = $ilDB;
$this->lng = $lng;
$this->obj_id = $a_obj_id;
$this->type = ilObject::_lookupType($a_obj_id);
$ref_ids = ilObject::_getAllReferences($this->obj_id);
$this->ref_id = current($ref_ids);
$this->readParticipants();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilParticipants::_deleteAllEntries (   $a_obj_id)
static

Delete all entries Normally called for course deletion.

public

Parameters
intobj_id

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

References $ilDB, $query, and $res.

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

{
global $ilDB;
$query = "DELETE FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->manipulate($query);
$query = "DELETE FROM il_subscribers ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

static ilParticipants::_deleteUser (   $a_usr_id)
static

Delete user data.

public

Parameters
intuser id

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

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "DELETE FROM crs_members WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
$res = $ilDB->manipulate($query);
$query = "DELETE FROM il_subscribers WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
$res = $ilDB->manipulate($query);
include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
}
static ilParticipants::_getMembershipByType (   $a_usr_id,
  $a_type 
)
static

get membership by type Get course or group membership

public

Parameters
int$a_usr_idusr_id
string$a_typecrs or grp
Returns

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

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

Referenced by ilPDSelectedItemsBlockGUI\getObjectsByMembership(), ilTestEvaluationData\getParticipants(), ilCalendarCategories\readPDCalendars(), ilMailSearchCoursesGUI\showMyCourses(), and ilMailSearchGroupsGUI\showMyGroups().

{
global $ilDB;
$query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua ".
"JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
"JOIN tree t1 ON t1.child = fa.parent ".
"JOIN object_reference obr ON t1.parent = obr.ref_id ".
"JOIN object_data obd ON obr.obj_id = obd.obj_id ".
"WHERE obd.type = ".$ilDB->quote($a_type,'text')." ".
"AND fa.assign = 'y' ".
"AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ";
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$ref_ids[] = $row->obj_id;
}
return $ref_ids ? $ref_ids : array();
}

+ Here is the caller graph for this function:

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

References $ilDB, $query, and $res.

Referenced by ilObjCourse\_checkCondition().

{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND passed = '1'";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

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

Check if user is blocked.

public

Parameters
intcourse id
intusr_id

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

References $ilDB, $query, and $res.

Referenced by ilRepositoryExplorer\isClickable().

{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
"AND blocked = ".$ilDB->quote(1,'integer');
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

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

Reimplemented in ilGroupParticipants.

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

References $ilDB, $ilLog, and $title.

Referenced by ilObjCourseGUI\executeCommand().

{
global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
$rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
if(!isset($rolf['ref_id']) or !$rolf['ref_id'])
{
$title = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($a_ref_id));
$ilLog->write(__METHOD__.': Found object without role folder. Ref_id: '.$a_ref_id.', title: '.$title);
$ilLog->logStack();
return false;
}
$local_roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
}

+ Here is the caller graph for this function:

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

check if user is subscriber

public

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

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

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

{
global $ilDB;
$query = "SELECT * FROM il_subscribers ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilParticipants::add (   $a_usr_id,
  $a_role 
)

Add user to course.

public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

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

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

Referenced by ilGroupXMLParser\__assignMembers(), and assignSubscriber().

{
global $rbacadmin,$ilLog,$ilAppEventHandler;
if($this->isAssigned($a_usr_id))
{
return false;
}
switch($a_role)
{
$this->admins[] = $a_usr_id;
break;
$this->tutors[] = $a_usr_id;
break;
$this->members[] = $a_usr_id;
break;
$this->admins[] = $a_usr_id;
break;
$this->members[] = $a_usr_id;
break;
}
$this->participants[] = $a_usr_id;
$rbacadmin->assignUser($this->role_data[$a_role],$a_usr_id);
$this->addDesktopItem($a_usr_id);
// Delete subscription request
$this->deleteSubscriber($a_usr_id);
include_once './Services/Membership/classes/class.ilWaitingList.php';
ilWaitingList::deleteUserEntry($a_usr_id,$this->obj_id);
if($this->type == 'crs') {
// Add event: used for ecs accounts
$ilLog->write(__METHOD__.': Raise new event: Modules/Course addParticipant');
$ilAppEventHandler->raise("Modules/Course", "addParticipant", array('usr_id' => $a_usr_id,'role_id' => $a_role));
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::addDesktopItem (   $a_usr_id)

Add desktop item.

public

Parameters
intusr_id

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

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

Referenced by add().

{
if(!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
{
ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id,$this->type);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::addSubscriber (   $a_usr_id)

Add subscriber.

public

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

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) ".
" VALUES (".
$ilDB->quote($a_usr_id ,'integer').",".
$ilDB->quote($this->obj_id ,'integer').", ".
$ilDB->quote('','text').", ".
$ilDB->quote(time() ,'integer').
")";
$res = $ilDB->manipulate($query);
return true;
}
ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

public

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

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

Referenced by assignSubscribers(), and autoFillSubscribers().

{
global $ilErr;
$ilErr->setMessage("");
if(!$this->isSubscriber($a_usr_id))
{
$ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
return false;
}
if($this->isAssigned($a_usr_id))
{
$tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
$ilErr->appendMessage($tmp_obj->getLogin().": ".$this->lng->txt("crs_user_already_assigned"));
return false;
}
if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id))
{
$ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
return false;
}
// TODO: must be group or course member role
$this->add($tmp_obj->getId(),IL_CRS_MEMBER);
$this->deleteSubscriber($a_usr_id);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::assignSubscribers (   $a_usr_ids)

Assign subscribers.

public

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

References assignSubscriber().

{
if(!is_array($a_usr_ids) or !count($a_usr_ids))
{
return false;
}
foreach($a_usr_ids as $id)
{
if(!$this->assignSubscriber($id))
{
return false;
}
}
return true;
}

+ Here is the call graph for this function:

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

public

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

References assignSubscriber(), and readSubscribers().

{
$this->readSubscribers();
$counter = 0;
foreach($this->subscribers as $subscriber)
{
if(!$this->assignSubscriber($subscriber))
{
continue;
}
else
{
// TODO: notification
#$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
}
++$counter;
}
return $counter;
}

+ Here is the call graph for this function:

ilParticipants::checkLastAdmin (   $a_usr_ids)

Check if user for deletion are last admins.

public

Parameters
arrayarray of user ids for deletion

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

References getAdmins().

{
foreach($this->getAdmins() as $admin_id)
{
if(!in_array($admin_id,$a_usr_ids))
{
return true;
}
}
return false;
}

+ Here is the call graph for this function:

ilParticipants::delete (   $a_usr_id)

Drop user from all roles.

public

Parameters
intusr_id

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

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

{
global $rbacadmin,$ilDB;
$this->dropDesktopItem($a_usr_id);
foreach($this->roles as $role_id)
{
$rbacadmin->deassignUser($role_id,$a_usr_id);
}
$query = "DELETE FROM crs_members ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($this->obj_id ,'integer');
$res = $ilDB->manipulate($query);
$this->readParticipants();
return true;
}

+ Here is the call graph for this function:

ilParticipants::deleteParticipants (   $a_user_ids)

Delete users.

public

Parameters
arrayuser ids

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

{
foreach($a_user_ids as $user_id)
{
$this->delete($user_id);
}
return true;
}
ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

public

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

References $ilDB, $query, and $res.

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

{
global $ilDB;
$query = "DELETE FROM il_subscribers ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

public

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

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

{
global $ilErr,$ilDB;
if(!is_array($a_usr_ids) or !count($a_usr_ids))
{
$ilErr->setMessage('');
$ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
return false;
}
$query = "DELETE FROM il_subscribers ".
"WHERE ".$ilDB->in('usr_id',(array) $a_usr_ids,false,'integer')." ".
"AND obj_id = ".$ilDB->quote($this->obj_id,'integer');
$res = $ilDB->query($query);
return true;
}
ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

public

Parameters
intusr_id

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

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

Referenced by delete().

{
if(ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
{
ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id,$this->type);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::getAdmins ( )

Get all admins ids.

public

Returns
array array of user ids

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

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

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

+ Here is the caller graph for this function:

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

public

Parameters
intuser_id

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

{
global $rbacreview;
foreach($this->roles as $role)
{
if($rbacreview->isAssigned($a_usr_id,$role))
{
$assigned[] = $role;
}
}
return $assigned ? $assigned : array();
}
ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

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

References getAdmins().

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

+ Here is the call graph for this function:

ilParticipants::getCountMembers ( )

Get number of members (not participants)

public

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

{
return count($this->members);
}
ilParticipants::getCountParticipants ( )

Get number of participants.

public

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

{
return count($this->participants);
}
ilParticipants::getCountSubscribers ( )

get number of subscribers

public

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

References getSubscribers().

{
return count($this->getSubscribers());
}

+ Here is the call graph for this function:

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

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

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

Referenced by ilRbacSystem\initMemberView().

{
global $ilCtrl;
if(!in_array($type,array('crs','grp')))
{
return 0;
}
global $rbacreview;
$rolf = $rbacreview->getRoleFolderIdOfObject($a_ref_id);
$roles = $rbacreview->getRolesOfRoleFolder($rolf,false);
foreach($roles as $role)
{
if(substr($title, 0, 13) == ('il_'.$type.'_member'))
{
return $role;
}
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

{
return $this->members ? $this->members : array();
}
ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

public

Returns
array array of user ids

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

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

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

{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE notification = 1 ".
"AND obj_id = ".$ilDB->quote($this->obj_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id))
{
$recp[] = $row->usr_id;
}
}
return $recp ? $recp : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::getParticipants ( )

Get all participants ids.

public

Returns
array array of user ids

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

Referenced by isGroupingMember().

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

+ Here is the caller graph for this function:

ilParticipants::getRoles ( )

Get course roles.

public

Parameters

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

Referenced by updateRoleAssignments().

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

+ Here is the caller graph for this function:

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

public

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

References readSubscriberData().

{
return $this->readSubscriberData($a_usr_id);
}

+ Here is the call graph for this function:

ilParticipants::getSubscribers ( )

get all subscribers

public

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

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

{
$this->readSubscribers();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::getTutors ( )

Get all tutors ids.

public

Returns
array array of user ids

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

{
return $this->tutors ? $this->tutors : array();
}
ilParticipants::hasPassed (   $a_usr_id)

Check if user has passed course.

public

Parameters
intuser_id

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

Referenced by ilCourseParticipants\__buildStatusBody().

{
if(isset($this->participants_status[$a_usr_id]))
{
return $this->participants_status[$a_usr_id]['passed'] ? true : false;
}
return false;
}

+ Here is the caller graph for this function:

ilParticipants::isAdmin (   $a_usr_id)

is user admin

public

Parameters
intusr_id

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

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

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

+ Here is the caller graph for this function:

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

public

Parameters

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

Referenced by add(), and assignSubscriber().

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

+ Here is the caller graph for this function:

ilParticipants::isBlocked (   $a_usr_id)

Check if user is blocked.

public

Parameters
intuser_id

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

Referenced by ilCourseParticipants\__buildStatusBody().

{
if(isset($this->participants_status[$a_usr_id]))
{
return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
}
return false;
}

+ Here is the caller graph for this function:

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

Check grouping membership.

public

Parameters

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

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

{
global $rbacreview,$ilObjDataCache,$ilDB;
// Used for membership limitations -> check membership by given field
if($a_field)
{
include_once './Services/User/classes/class.ilObjUser.php';
$tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id);
switch($a_field)
{
case 'login':
$and = "AND login = ".$ilDB->quote($tmp_user->getLogin(),'text')." ";
break;
case 'email':
$and = "AND email = ".$ilDB->quote($tmp_user->getEmail(),'text')." ";
break;
case 'matriculation':
$and = "AND matriculation = ".$ilDB->quote($tmp_user->getMatriculation(),'text')." ";
break;
default:
$and = "AND usr_id = ".$ilDB->quote($a_usr_id,'integer'). " ";
break;
}
if(!$this->getParticipants())
{
return false;
}
$query = "SELECT * FROM usr_data ud ".
"WHERE ".$ilDB->in('usr_id',$this->getParticipants(),false,'integer')." ".
$and;
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}
}

+ Here is the call graph for this function:

ilParticipants::isLastAdmin (   $a_usr_id)

Check if user is last admin.

Parameters
int$a_usr_id
Returns
bool

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

References getAdmins().

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

+ Here is the call graph for this function:

ilParticipants::isMember (   $a_usr_id)

is user member

public

Parameters
intusr_id

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

Referenced by ilCourseParticipants\__buildStatusBody().

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

+ Here is the caller graph for this function:

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

public

Parameters

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

Referenced by ilCourseParticipants\__buildStatusBody().

{
if(isset($this->participants_status[$a_usr_id]))
{
return $this->participants_status[$a_usr_id]['notification'] ? true : false;
}
return false;
}

+ Here is the caller graph for this function:

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

public

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

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

Referenced by assignSubscriber().

{
global $ilDB;
$query = "SELECT * FROM il_subscribers ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')."";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilParticipants::isTutor (   $a_usr_id)

is user tutor

public

Parameters
intusr_id

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

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

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

+ Here is the caller graph for this function:

ilParticipants::readParticipants ( )
private

Read participants.

private

Parameters

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

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

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

{
global $rbacreview,$ilObjDataCache,$ilLog;
$rolf = $rbacreview->getRoleFolderOfObject($this->ref_id);
if(!isset($rolf['ref_id']) or !$rolf['ref_id'])
{
$title = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->ref_id));
$ilLog->write(__METHOD__.': Found object without role folder. Ref_id: '.$this->ref_id.', title: '.$title);
$ilLog->logStack();
return false;
}
$this->roles = $rbacreview->getRolesOfRoleFolder($rolf['ref_id'],false);
$users = array();
$this->participants = array();
$this->members = $this->admins = $this->tutors = array();
foreach($this->roles as $role_id)
{
$title = $ilObjDataCache->lookupTitle($role_id);
switch(substr($title,0,8))
{
case 'il_crs_m':
$this->role_data[IL_CRS_MEMBER] = $role_id;
$this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
$this->members = array_unique(array_merge($assigned,$this->members));
break;
case 'il_crs_a':
$this->role_data[IL_CRS_ADMIN] = $role_id;
$this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
$this->admins = $rbacreview->assignedUsers($role_id);
break;
case 'il_crs_t':
$this->role_data[IL_CRS_TUTOR] = $role_id;
$this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
$this->tutors = $rbacreview->assignedUsers($role_id);
break;
case 'il_grp_a':
$this->role_data[IL_GRP_ADMIN] = $role_id;
$this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
$this->admins = $rbacreview->assignedUsers($role_id);
break;
case 'il_grp_m':
$this->role_data[IL_GRP_MEMBER] = $role_id;
$this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
$this->members = $rbacreview->assignedUsers($role_id);
break;
default:
$this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
$this->members = array_unique(array_merge($assigned,$this->members));
break;
}
}
}

+ Here is the caller graph for this function:

ilParticipants::readParticipantsStatus ( )
private

Read stati of participants (blocked, notification, passed)

private

Parameters

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

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

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

{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
$res = $ilDB->query($query);
$this->participants_status = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
$this->participants_status[$row->usr_id]['notification'] = $row->notification;
$this->participants_status[$row->usr_id]['passed'] = $row->passed;
}
}

+ Here is the caller graph for this function:

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

protected

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

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

Referenced by getSubscriberData().

{
global $ilDB;
$query = "SELECT * FROM il_subscribers ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$data["time"] = $row->sub_time;
$data["usr_id"] = $row->usr_id;
$data['subject'] = $row->subject;
}
return $data ? $data : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::readSubscribers ( )
protected

read subscribers

protected

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

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

Referenced by autoFillSubscribers(), and getSubscribers().

{
global $ilDB;
$this->subscribers = array();
$query = "SELECT usr_id FROM il_subscribers ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
"ORDER BY sub_time ";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
// DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
{
$this->deleteSubscriber($row->usr_id);
}
$this->subscribers[] = $row->usr_id;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

public

Parameters
intusr_id
boolblocked

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

References $ilDB, $query, and $res.

{
global $ilDB;
$this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
$res = $ilDB->query($query);
if($res->numRows())
{
$query = "UPDATE crs_members SET ".
"blocked = ".$ilDB->quote((int) $a_blocked ,'integer')." ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
}
else
{
$query = "INSERT INTO crs_members (blocked,obj_id,usr_id,notification,passed) ".
"VALUES ( ".
$ilDB->quote((int) $a_blocked ,'integer').", ".
$ilDB->quote($this->obj_id ,'integer').", ".
$ilDB->quote($a_usr_id ,'integer').", ".
$ilDB->quote(0,'integer').", ".
$ilDB->quote(0,'integer').
")";
}
$res = $ilDB->manipulate($query);
return true;
}
ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

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

References $ilDB, $query, and $res.

{
global $ilDB;
$this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
$res = $ilDB->query($query);
if($res->numRows())
{
$query = "UPDATE crs_members SET ".
"notification = ".$ilDB->quote((int) $a_notification ,'integer')." ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
}
else
{
$query = "INSERT INTO crs_members (notification,obj_id,usr_id,passed,blocked) ".
"VALUES ( ".
$ilDB->quote((int) $a_notification ,'integer').", ".
$ilDB->quote($this->obj_id ,'integer').", ".
$ilDB->quote($a_usr_id ,'integer').", ".
$ilDB->quote(0,'integer').", ".
$ilDB->quote(0,'integer').
")";
}
$res = $ilDB->manipulate($query);
return true;
}
ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

public

Parameters
intusr_id
arrayarray of new roles

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

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

{
global $rbacreview,$rbacadmin;
$roles = $a_roles ? $a_roles : array();
foreach($this->getRoles() as $role_id)
{
if($rbacreview->isAssigned($a_usr_id,$role_id))
{
if(!in_array($role_id,$roles))
{
$rbacadmin->deassignUser($role_id,$a_usr_id);
}
}
else
{
if(in_array($role_id,$roles))
{
$rbacadmin->assignUser($role_id,$a_usr_id);
}
}
}
$this->readParticipants();
}

+ Here is the call graph for this function:

ilParticipants::updateSubject (   $a_usr_id,
  $a_subject 
)

update subject

public

Parameters
@return

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

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "UPDATE il_subscribers ".
"SET subject = ".$ilDB->quote($a_subject ,'text')." ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}
ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

public

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

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "UPDATE il_subscribers ".
"SET sub_time = ".$ilDB->quote($a_subtime ,'integer')." ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

Field Documentation

ilParticipants::$admins = array()
protected

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

ilParticipants::$lng
protected

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

Referenced by __construct().

ilParticipants::$members = array()
protected

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

ilParticipants::$obj_id = 0
protected

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

Referenced by getDefaultMemberRole().

ilParticipants::$participants = array()
protected

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

Referenced by readParticipants().

ilParticipants::$participants_status = array()
protected

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

ilParticipants::$ref_id = 0
protected

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

ilParticipants::$role_data = array()
protected

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

ilParticipants::$roles = array()
protected

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

Referenced by getDefaultMemberRole(), and updateRoleAssignments().

ilParticipants::$subscribers = array()
protected

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

Referenced by getSubscribers().

ilParticipants::$tutors = array()
protected

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

ilParticipants::$type = ''
protected

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

Referenced by getDefaultMemberRole().


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