ILIAS  Release_4_4_x_branch Revision 61816
 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.
 getType ()
 Get object type.
 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 getInstanceByObjId ($a_obj_id)
 Get instance by obj type.
static hasParticipantListAccess ($a_obj_id, $a_usr_id=null)
 Check if (current) user has access to the participant list.
static _getMembershipByType ($a_usr_id, $a_type, $a_only_member_role=false)
 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 lookupNumberOfParticipants ($a_ref_id)
 Lookup the number of participants (crs admins, tutors, members, grp admins, members)
static lookupNumberOfMembers ($a_ref_id)
 Lookup number of members ilRbacReview $rbacreview <type> $ilObjDataCache.
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 lookupSubscribers ($a_obj_id)
static _isSubscriber ($a_obj_id, $a_usr_id)
 check if user is subscriber
static lookupSubscribersData ($a_obj_id)

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 20 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 48 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 303 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

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

{
global $ilDB;
$query = "DELETE FROM obj_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);
$query = 'DELETE FROM crs_waiting_list '.
'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
$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 330 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "DELETE FROM obj_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,
  $a_only_member_role = false 
)
static

get membership by type Get course or group membership

public

Parameters
int$a_usr_idusr_id
string$a_typecrs or grp
bool$a_only_member_role
Returns

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

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

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilBasicSkill\getCompletionDateForTriggerRefId(), ilCourseVerificationTableGUI\getItems(), ilLPProgressTableGUI\getItems(), ilPDSelectedItemsBlockGUI\getObjectsByMembership(), ilTestEvaluationData\getParticipants(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), ilWorkspaceAccessGUI\share(), and ilMailSearchGroupsGUI\showMyGroups().

{
global $ilDB;
// this will also dismiss local roles!
if ($a_only_member_role)
{
$j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
$a2 = "AND obd2.title LIKE 'il_".$a_type."_mem%' ";
}
$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 ".
$j2.
"WHERE obd.type = ".$ilDB->quote($a_type,'text')." ".
"AND fa.assign = 'y' ".
"AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
$a2;
$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 282 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

Referenced by ilObjCourse\_checkCondition().

{
global $ilDB;
$query = "SELECT * FROM obj_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 261 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "SELECT * FROM obj_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;
}
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 179 of file class.ilParticipants.php.

References $ilDB, and $ilLog.

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

{
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 1328 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 794 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(
'obj_id' => $this->obj_id,
'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 875 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 1204 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 1139 of file class.ilParticipants.php.

References $ilErr, add(), deleteSubscriber(), getInstanceByObjId(), 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 1118 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 1177 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 622 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 673 of file class.ilParticipants.php.

References $GLOBALS, $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 obj_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();
if($this->type == 'crs')
{
// Add event: used for ecs accounts
$GLOBALS['ilAppEventHandler']->raise("Modules/Course", "deleteParticipant", array('obj_id' => $this->obj_id, 'usr_id' => $a_usr_id));
}
return true;
}

+ Here is the call graph for this function:

ilParticipants::deleteParticipants (   $a_user_ids)

Delete users.

public

Parameters
arrayuser ids

Definition at line 859 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 1264 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 1282 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 891 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 459 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 566 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 468 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 412 of file class.ilParticipants.php.

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

Get number of participants.

public

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

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

get number of subscribers

public

Definition at line 1096 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 344 of file class.ilParticipants.php.

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

Referenced by ilStartUpGUI\_checkGoto(), and 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)
{
$title = ilObject::_lookupTitle($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:

static ilParticipants::getInstanceByObjId (   $a_obj_id)
static

Get instance by obj type.

Parameters
int$a_obj_id
Returns
ilParticipants

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

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

Referenced by assignSubscriber(), hasParticipantListAccess(), isGroupingMember(), ilRepositorySearchGUI\listUsers(), and ilRepositoryObjectResultTableGUI\parseObjectIds().

{
switch($type)
{
case 'crs':
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
case 'grp':
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
}
// @todo proper error handling
return null;
}

+ 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 449 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 388 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 obj_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 437 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 554 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 1106 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 1083 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 480 of file class.ilParticipants.php.

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

Get object type.

Returns
string obj_type

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

References $type.

{
return $this->type;
}
static ilParticipants::hasParticipantListAccess (   $a_obj_id,
  $a_usr_id = null 
)
static

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

Parameters
type$a_obj
type$a_usr_id

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

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

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

{
if(!$a_usr_id)
{
$a_usr_id = $GLOBALS['ilUser']->getId();
}
// if write access granted => return true
$refs = ilObject::_getAllReferences($a_obj_id);
$ref_id = end($refs);
if($GLOBALS['ilAccess']->checkAccess('write','',$ref_id))
{
return true;
}
$part = self::getInstanceByObjId($a_obj_id);
if($part->isAssigned($a_usr_id))
{
if($part->getType() == 'crs')
{
// Check for show_members
include_once './Modules/Course/classes/class.ilObjCourse.php';
{
return false;
}
}
return true;
}
// User is not assigned to course/group => no read access
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParticipants::hasPassed (   $a_usr_id)

Check if user has passed course.

public

Parameters
intuser_id

Definition at line 657 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 492 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 531 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 641 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 1020 of file class.ilParticipants.php.

References $ilDB, $query, $res, 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 541 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 516 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 910 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 1306 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 504 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:

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

Referenced by ilObjCourseGUI\infoScreen().

{
global $rbacreview, $ilObjDataCache;
$rolf = $rbacreview->getRoleFolderIdOfObject($a_ref_id);
if(!$rolf)
{
return 0;
}
$lroles = $rbacreview->getRolesOfRoleFolder($rolf,false);
$memberRoles = array();
foreach($lroles as $role_id)
{
$title = $ilObjDataCache->lookupTitle($role_id);
switch(substr($title,0,8))
{
case 'il_crs_a':
case 'il_crs_t':
case 'il_grp_a':
break;
default:
$memberRoles[] = $role_id;
break;
}
}
return $rbacreview->getNumberOfAssignedUsers($memberRoles);
}

+ Here is the caller graph for this function:

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

{
global $rbacreview;
$rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
$lroles = $rbacreview->getRolesOfRoleFolder($rolf['ref_id'],false);
return $rbacreview->getNumberOfAssignedUsers($lroles);
}
static ilParticipants::lookupSubscribers (   $a_obj_id)
static

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

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

Referenced by ilObjCourseGUI\membersObject().

{
global $ilDB;
$subscribers = array();
$query = "SELECT usr_id FROM il_subscribers ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
"ORDER BY sub_time ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$subscribers[] = $row->usr_id;
}
return $subscribers;
}

+ Here is the caller graph for this function:

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

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

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

Referenced by ilSubscriberTableGUI\readSubscriberData().

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

+ Here is the caller graph for this function:

ilParticipants::readParticipants ( )
private

Read participants.

private

Parameters

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

References $ilLog, $participants, 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 997 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 obj_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 1377 of file class.ilParticipants.php.

References $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 1349 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 709 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 obj_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 obj_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 obj_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 750 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 obj_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 obj_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 obj_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 588 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 1246 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 1226 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 33 of file class.ilParticipants.php.

ilParticipants::$lng
protected

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

Referenced by __construct().

ilParticipants::$members = array()
protected

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

ilParticipants::$obj_id = 0
protected

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

Referenced by getDefaultMemberRole().

ilParticipants::$participants = array()
protected

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

Referenced by readParticipants().

ilParticipants::$participants_status = array()
protected

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

ilParticipants::$ref_id = 0
protected

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

Referenced by hasParticipantListAccess().

ilParticipants::$role_data = array()
protected

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

ilParticipants::$roles = array()
protected
ilParticipants::$subscribers = array()
protected

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

Referenced by getSubscribers(), and lookupSubscribers().

ilParticipants::$tutors = array()
protected

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

ilParticipants::$type = ''
protected

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

Referenced by getDefaultMemberRole(), getInstanceByObjId(), and getType().


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