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

Public Member Functions

 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.
 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
 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 _isSubscriber ($a_obj_id, $a_usr_id)
 check if user is subscriber

Protected Member Functions

 __construct ($a_obj_id)
 Singleton Constructor.
 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)
protected

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

References $ilDB.

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

{
global $ilDB;
$query = "DELETE FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ";
$ilDB->query($query);
$query = "DELETE FROM il_subscribers ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)."";
$ilDB->query($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 221 of file class.ilParticipants.php.

References $ilDB.

{
global $ilDB;
$query = "DELETE FROM crs_members WHERE usr_id = ".$ilDB->quote($a_usr_id)."";
$ilDB->query($query);
$query = "DELETE FROM il_subscribers WHERE usr_id = ".$ilDB->quote($a_usr_id)."";
$ilDB->query($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 95 of file class.ilParticipants.php.

References $ilDB, $res, and DB_FETCHMODE_OBJECT.

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

{
global $ilDB;
$query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua AS ua ".
"JOIN rbac_fa AS fa ON ua.rol_id = fa.rol_id ".
"JOIN tree AS t1 ON t1.child = fa.parent ".
"JOIN object_reference AS obr ON t1.parent = obr.ref_id ".
"JOIN object_data AS obd ON obr.obj_id = obd.obj_id ".
"WHERE obd.type = ".$ilDB->quote($a_type)." ".
"AND fa.assign = 'y' ".
"AND ua.usr_id = ".$ilDB->quote($a_usr_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$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 175 of file class.ilParticipants.php.

References $ilDB, and $res.

Referenced by ilObjCourse\_checkCondition().

{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id)." ".
"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 154 of file class.ilParticipants.php.

References $ilDB, and $res.

Referenced by ilObjCourseAccess\_checkAccess(), and ilRepositoryExplorer\isClickable().

{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id)." ".
"AND blocked = '1'";
$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 127 of file class.ilParticipants.php.

References $ilDB, $ilLog, and $title.

Referenced by ilObjCourseAccess\_checkAccess(), and 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 1114 of file class.ilParticipants.php.

References $ilDB, $res, and DB_FETCHMODE_OBJECT.

Referenced by ilObjCourseListGUI\getProperties().

{
global $ilDB;
$query = "SELECT * FROM il_subscribers ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id)." ".
"AND obj_id = ".$ilDB->quote($a_obj_id)."";
$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 611 of file class.ilParticipants.php.

References $ilLog, addDesktopItem(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, and isAssigned().

Referenced by 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);
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 678 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 987 of file class.ilParticipants.php.

References $ilDB, and $res.

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

Assign subscriber.

public

Definition at line 922 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 901 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 960 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 453 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 504 of file class.ilParticipants.php.

References $ilDB, 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)." ".
"AND obj_id = ".$ilDB->quote($this->obj_id);
$ilDB->query($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 662 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 1043 of file class.ilParticipants.php.

References $ilDB, and $res.

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

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

+ Here is the caller graph for this function:

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

public

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

References $ilErr, and deleteSubscriber().

{
global $ilErr;
if(!is_array($a_usr_ids) or !count($a_usr_ids))
{
$ilErr->setMessage('');
$ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
return false;
}
foreach($a_usr_ids as $id)
{
if(!$this->deleteSubscriber($id))
{
$ilErr->appendMessage($this->lng->txt("error_delete_subscriber"));
return false;
}
}
return true;
}

+ Here is the call graph for this function:

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

public

Parameters
intusr_id

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

Referenced by checkLastAdmin().

{
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 397 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::getCountMembers ( )

Get number of members (not participants)

public

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

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

Get number of participants.

public

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

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

get number of subscribers

public

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

References getSubscribers().

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

+ Here is the call 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 302 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 241 of file class.ilParticipants.php.

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

Referenced by 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 290 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 385 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 889 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 866 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 322 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 488 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 334 of file class.ilParticipants.php.

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

{
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 373 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 472 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 821 of file class.ilParticipants.php.

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

{
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())." ";
break;
case 'email':
$and = "AND email = ".$ilDB->quote($tmp_user->getEmail())." ";
break;
case 'matriculation':
$and = "AND matriculation = ".$ilDB->quote($tmp_user->getMatriculation())." ";
break;
default:
$and = "AND usr_id = '".$a_usr_id."'";
break;
}
if(!$this->getParticipants())
{
return false;
}
$query = "SELECT * FROM usr_data as ud ".
"WHERE usr_id IN (".implode(",",ilUtil::quoteArray($this->getParticipants())).") ".
$and;
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}
}

+ Here is the call graph for this function:

ilParticipants::isMember (   $a_usr_id)

is user member

public

Parameters
intusr_id

Definition at line 358 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 713 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 1091 of file class.ilParticipants.php.

References $ilDB, $res, and DB_FETCHMODE_OBJECT.

Referenced by assignSubscriber().

{
global $ilDB;
$query = "SELECT * FROM il_subscribers ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id)." ".
"AND obj_id = ".$ilDB->quote($this->obj_id)."";
$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 346 of file class.ilParticipants.php.

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

{
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 730 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 798 of file class.ilParticipants.php.

References $ilDB, $res, 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)." ";
$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 1164 of file class.ilParticipants.php.

References $data, $ilDB, $res, and DB_FETCHMODE_OBJECT.

Referenced by getSubscriberData().

{
global $ilDB;
$query = "SELECT * FROM il_subscribers ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id)."";
$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 caller graph for this function:

ilParticipants::readSubscribers ( )
protected

read subscribers

protected

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

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

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)." ".
"ORDER BY sub_time ";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
// DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
if(!ilObjectFactory::getInstanceByObjId($row->usr_id,false))
{
$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 533 of file class.ilParticipants.php.

References $ilDB, 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)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id);
$res = $ilDB->query($query);
if($res->numRows())
{
$query = "UPDATE crs_members SET ".
"blocked = ".$ilDB->quote((int) $a_blocked)." ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id);
}
else
{
$query = "INSERT INTO crs_members SET ".
"blocked = ".$ilDB->quote((int) $a_blocked).", ".
"obj_id = ".$ilDB->quote($this->obj_id).", ".
"usr_id = ".$ilDB->quote($a_usr_id);
}
$res = $ilDB->query($query);
return true;
}
ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

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

References $ilDB, 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)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id);
$res = $ilDB->query($query);
if($res->numRows())
{
$query = "UPDATE crs_members SET ".
"notification = ".$ilDB->quote((int) $a_notification)." ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id);
}
else
{
$query = "INSERT INTO crs_members SET ".
"notification = ".$ilDB->quote((int) $a_notification).", ".
"obj_id = ".$ilDB->quote($this->obj_id).", ".
"usr_id = ".$ilDB->quote($a_usr_id).", ".
"passed = 0 ";
}
$res = $ilDB->query($query);
return true;
}
ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

public

Parameters
intusr_id
arrayarray of new roles

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

References $ilDB.

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

Update subscription time.

public

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

References $ilDB.

{
global $ilDB;
$query = "UPDATE il_subscribers ".
"SET sub_time = ".$ilDB->quote($a_subtime)." ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id)." ".
"AND obj_id = ".$ilDB->quote($this->obj_id)." ";
$ilDB->query($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.

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 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.


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