ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCourseParticipants Class Reference
+ Inheritance diagram for ilCourseParticipants:
+ Collaboration diagram for ilCourseParticipants:

Public Member Functions

 __construct ($a_obj_id)
 Singleton constructor.
 updatePassed ($a_usr_id, $a_passed, $a_manual=false, $a_no_origin=false)
 Update passed status.
 getPassedInfo ($a_usr_id)
 Get info about passed status.
 sendNotification ($a_type, $a_usr_id)
 sendUnsubscribeNotificationToAdmins ($a_usr_id)
 sendSubscriptionRequestToAdmins ($a_usr_id)
 sendNotificationToAdmins ($a_usr_id)
 __buildStatusBody (&$user_obj)
- Public Member Functions inherited from ilParticipants
 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 singleton instance.
static getMemberRoles ($a_ref_id)
 Get member roles.
static _updatePassed ($a_obj_id, $a_usr_id, $a_passed, $a_manual=false, $a_no_origin=false)
 Update passed status (static)
static getDateTimeOfPassed ($a_obj_id, $a_usr_id)
static getPassedUsersForObjects (array $a_obj_ids, array $a_usr_ids)
- Static Public Member Functions inherited from ilParticipants
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)

Static Protected Attributes

static $instances = array()

Additional Inherited Members

- Protected Member Functions inherited from ilParticipants
 readSubscribers ()
 read subscribers
 readSubscriberData ($a_usr_id)
 read subscribers
- Protected Attributes inherited from ilParticipants
 $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

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

ilCourseParticipants::__construct (   $a_obj_id)

Singleton constructor.

protected

Parameters
intobj_id of container

Reimplemented from ilParticipants.

Definition at line 45 of file class.ilCourseParticipants.php.

{
$this->type = 'crs';
$this->NOTIFY_DISMISS_SUBSCRIBER = 1;
$this->NOTIFY_ACCEPT_SUBSCRIBER = 2;
$this->NOTIFY_DISMISS_MEMBER = 3;
$this->NOTIFY_BLOCK_MEMBER = 4;
$this->NOTIFY_UNBLOCK_MEMBER = 5;
$this->NOTIFY_ACCEPT_USER = 6;
$this->NOTIFY_ADMINS = 7;
$this->NOTIFY_STATUS_CHANGED = 8;
$this->NOTIFY_SUBSCRIPTION_REQUEST = 9;
$this->NOTIFY_REGISTERED = 10;
$this->NOTIFY_UNSUBSCRIBE = 11;
$this->NOTIFY_WAITING_LIST = 12;
parent::__construct($a_obj_id);
}

Member Function Documentation

ilCourseParticipants::__buildStatusBody ( $user_obj)

Definition at line 369 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, ilParticipants\hasPassed(), ilParticipants\isAdmin(), ilParticipants\isBlocked(), ilParticipants\isMember(), ilParticipants\isNotificationEnabled(), and ilParticipants\isTutor().

{
global $ilDB;
$body = $this->lng->txt('crs_status_changed_body')."\n";
$body .= $this->lng->txt('login').': '.$user_obj->getLogin()."\n";
$body .= $this->lng->txt('role').': ';
if($this->isAdmin($user_obj->getId()))
{
$body .= $this->lng->txt('crs_admin')."\n";
}
if($this->isTutor($user_obj->getId()))
{
$body .= $this->lng->txt('crs_tutor')."\n";
}
if($this->isMember($user_obj->getId()))
{
$body .= $this->lng->txt('crs_member')."\n";
}
$body .= $this->lng->txt('status').': ';
if($this->isNotificationEnabled($user_obj->getId()))
{
$body .= $this->lng->txt("crs_notify")."\n";
}
else
{
$body .= $this->lng->txt("crs_no_notify")."\n";
}
if($this->isBlocked($user_obj->getId()))
{
$body .= $this->lng->txt("crs_blocked")."\n";
}
else
{
$body .= $this->lng->txt("crs_unblocked")."\n";
}
$passed = $this->hasPassed($user_obj->getId()) ? $this->lng->txt('yes') : $this->lng->txt('no');
$body .= $this->lng->txt('crs_passed').': '.$passed."\n";
return $body;
}

+ Here is the call graph for this function:

static ilCourseParticipants::_getInstanceByObjId (   $a_obj_id)
static

Get singleton instance.

public

Parameters
intobj_id

Definition at line 74 of file class.ilCourseParticipants.php.

Referenced by ilCourseEditParticipantsTableGUI\__construct(), ilObjCourseGUI\__showWaitingList(), ilCourseObjectiveResult\__updatePassed(), ilShopUtils\_assignPurchasedCourseMemberRole(), ilObjCourseAccess\_checkAccess(), ilObjCourseGrouping\_checkGroupingDependencies(), ilShopUtils\_deassignPurchasedCourseMemberRole(), ilObjCourseGUI\afterImport(), ilSoapCourseAdministration\assignCourseMember(), ilDataLoader\assignUsersAsCourseMembers(), ilPortfolioAccessHandler\checkAccessOfUser(), ilWorkspaceAccessHandler\checkAccessOfUser(), ilForumNotification\checkParentNodeTree(), ilCourseMembershipMailNotification\createCourseStatus(), ilObjCourseGUI\deleteMembersObject(), ilObjCourseGUI\editMembersObject(), ilSoapCourseAdministration\excludeCourseMember(), ilObjCourseGUI\executeCommand(), ilUserImportParser\getCourseMembersObjectForRole(), ilCalendarBlockGUI\getHTML(), ilParticipants\getInstanceByObjId(), ilCourseParticipantsGroupsTableGUI\getItems(), ilCourseLP\getMembers(), ilLPStatusManualByTutor\getMembers(), ilLPStatusEvent\getMembers(), ilLPStatusObjectives\getMembers(), ilLPStatusCollection\getMembers(), ilTrQuery\getParticipantsForObject(), ilCourseXMLParser\ilCourseXMLParser(), ilObjCourseGUI\initAttendanceList(), ilObjSessionGUI\initContainer(), ilObjCourse\initCourseMembersObject(), ilMemberExport\initMembers(), ilCourseRegistrationGUI\initParticipants(), ilSoapCourseAdministration\isAssignedToCourse(), ilObjCourseGUI\membersMapObject(), ilObjCourseGUI\membersObject(), ilPurchase\purchase(), ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus(), ilObjCourse\register(), ilObjCourseGUI\removeMembersObject(), ilMembershipTest\testSubscription(), and ilObjCourseGUI\updateMembersObject().

{
if(isset(self::$instances[$a_obj_id]) and self::$instances[$a_obj_id])
{
return self::$instances[$a_obj_id];
}
return self::$instances[$a_obj_id] = new ilCourseParticipants($a_obj_id);
}

+ Here is the caller graph for this function:

static ilCourseParticipants::_updatePassed (   $a_obj_id,
  $a_usr_id,
  $a_passed,
  $a_manual = false,
  $a_no_origin = false 
)
static

Update passed status (static)

public

Parameters
int$obj_id
int$usr_id
bool$passed
bool$a_manual
bool$a_no_origin

Definition at line 138 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, $ilUser, $query, and $res.

Referenced by ilCourseAppEventListener\handleEvent(), and updatePassed().

{
global $ilDB, $ilUser;
// #11600
$origin = -1;
if($a_manual)
{
$origin = $ilUser->getId();
}
$query = "SELECT passed FROM obj_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id,'integer');
$res = $ilDB->query($query);
if($res->numRows())
{
// #9284 - only needs updating when status has changed
$old = $ilDB->fetchAssoc($res);
if((int)$old["passed"] != (int)$a_passed)
{
$query = "UPDATE obj_members SET ".
"passed = ".$ilDB->quote((int) $a_passed,'integer').", ".
"origin = ".$ilDB->quote($origin,'integer').", ".
"origin_ts = ".$ilDB->quote(time(),'integer')." ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id,'integer');
}
}
else
{
// when member is added we should not set any date
// see ilObjCourse::checkLPStatusSync()
if($a_no_origin && !$a_passed)
{
$origin = 0;
$origin_ts = 0;
}
else
{
$origin_ts = time();
}
$query = "INSERT INTO obj_members (passed,obj_id,usr_id,notification,blocked,origin,origin_ts) ".
"VALUES ( ".
$ilDB->quote((int) $a_passed,'integer').", ".
$ilDB->quote($a_obj_id,'integer').", ".
$ilDB->quote($a_usr_id,'integer').", ".
$ilDB->quote(0,'integer').", ".
$ilDB->quote(0,'integer').", ".
$ilDB->quote($origin,'integer').", ".
$ilDB->quote($origin_ts,'integer').")";
}
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

static ilCourseParticipants::getDateTimeOfPassed (   $a_obj_id,
  $a_usr_id 
)
static

Definition at line 413 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, and $res.

Referenced by ilCourseCertificateAdapter\_hasUserCertificate(), ilObjCourseGUI\deliverCertificateObject(), ilCourseCertificateAdapter\getCertificateVariablesForPresentation(), and ilObjCourseGUI\initHeaderAction().

{
global $ilDB;
$sql = "SELECT origin_ts FROM obj_members".
" WHERE usr_id = ".$ilDB->quote($a_usr_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND passed = ".$ilDB->quote(1, "integer");
$res = $ilDB->query($sql);
$res = $ilDB->fetchAssoc($res);
if($res["origin_ts"])
{
return date("Y-m-d H:i:s", $res["origin_ts"]);
}
}

+ Here is the caller graph for this function:

static ilCourseParticipants::getMemberRoles (   $a_ref_id)
static

Get member roles.

Parameters
int$a_ref_id

Definition at line 87 of file class.ilCourseParticipants.php.

References ilParticipants\$roles, and ilObject\_lookupTitle().

Referenced by ilObjCourseGUI\membersObject(), ilObjCourseGUI\setShowHidePrefs(), and ilObjCourseGUI\updateRoleStatusObject().

{
global $rbacreview;
$rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
$lrol = $rbacreview->getRolesOfRoleFolder($rolf['ref_id'],false);
$roles = array();
foreach($lrol as $role)
{
$title = ilObject::_lookupTitle($role);
switch(substr($title,0,8))
{
case 'il_crs_a':
case 'il_crs_t':
case 'il_crs_m':
continue;
default:
$roles[$role] = $role;
}
}
return $roles;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseParticipants::getPassedInfo (   $a_usr_id)

Get info about passed status.

Parameters
int$a_usr_id
Returns
array (user_id, timestamp)

Definition at line 201 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, $row, and IL_CAL_UNIX.

{
global $ilDB;
$sql = "SELECT origin, origin_ts".
" FROM obj_members".
" WHERE obj_id = ".$ilDB->quote($this->obj_id, "integer").
" AND usr_id = ".$ilDB->quote($a_usr_id, "integer");
$set = $ilDB->query($sql);
$row = $ilDB->fetchAssoc($set);
if($row["origin"])
{
return array("user_id" => $row["origin"],
"timestamp" => new ilDateTime($row["origin_ts"], IL_CAL_UNIX));
}
}
static ilCourseParticipants::getPassedUsersForObjects ( array  $a_obj_ids,
array  $a_usr_ids 
)
static

Definition at line 429 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, $res, and $row.

Referenced by ilCourseCertificateAdapter\_preloadListData().

{
global $ilDB;
$res = array();
$sql = "SELECT usr_id,obj_id FROM obj_members".
" WHERE ".$ilDB->in("usr_id", $a_usr_ids, "", "integer").
" AND ".$ilDB->in("obj_id", $a_obj_ids, "", "integer").
" AND passed = ".$ilDB->quote(1, "integer");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$res[] = $row;
}
return $res;
}

+ Here is the caller graph for this function:

ilCourseParticipants::sendNotification (   $a_type,
  $a_usr_id 
)

Definition at line 219 of file class.ilCourseParticipants.php.

References $ilUser, sendNotificationToAdmins(), sendSubscriptionRequestToAdmins(), ilCourseMembershipMailNotification\TYPE_ACCEPTED_SUBSCRIPTION_MEMBER, ilCourseMembershipMailNotification\TYPE_ADMISSION_MEMBER, ilCourseMembershipMailNotification\TYPE_BLOCKED_MEMBER, ilCourseMembershipMailNotification\TYPE_DISMISS_MEMBER, ilCourseMembershipMailNotification\TYPE_REFUSED_SUBSCRIPTION_MEMBER, ilCourseMembershipMailNotification\TYPE_STATUS_CHANGED, ilCourseMembershipMailNotification\TYPE_SUBSCRIBE_MEMBER, ilCourseMembershipMailNotification\TYPE_UNBLOCKED_MEMBER, ilCourseMembershipMailNotification\TYPE_UNSUBSCRIBE_MEMBER, and ilCourseMembershipMailNotification\TYPE_WAITING_LIST_MEMBER.

{
include_once './Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
global $ilObjDataCache,$ilUser;
switch($a_type)
{
case $this->NOTIFY_DISMISS_SUBSCRIBER:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_ACCEPT_SUBSCRIBER:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_DISMISS_MEMBER:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_BLOCK_MEMBER:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_UNBLOCK_MEMBER:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_ACCEPT_USER:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_STATUS_CHANGED:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_UNSUBSCRIBE:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_REGISTERED:
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->send();
break;
case $this->NOTIFY_WAITING_LIST:
include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
$wl = new ilCourseWaitingList($this->obj_id);
$pos = $wl->getPosition($a_usr_id);
$mail->setRefId($this->ref_id);
$mail->setRecipients(array($a_usr_id));
$mail->setAdditionalInformation(array('position' => $pos));
$mail->send();
break;
case $this->NOTIFY_SUBSCRIPTION_REQUEST:
break;
case $this->NOTIFY_ADMINS:
$this->sendNotificationToAdmins($a_usr_id);
return true;
break;
}
return true;
}

+ Here is the call graph for this function:

ilCourseParticipants::sendNotificationToAdmins (   $a_usr_id)

Definition at line 354 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, ilParticipants\getNotificationRecipients(), and ilCourseMembershipMailNotification\TYPE_NOTIFICATION_REGISTRATION.

Referenced by sendNotification().

{
global $ilDB,$ilObjDataCache;
include_once './Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
$mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
$mail->setRefId($this->ref_id);
$mail->setRecipients($this->getNotificationRecipients());
$mail->send();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseParticipants::sendSubscriptionRequestToAdmins (   $a_usr_id)

Definition at line 339 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, ilParticipants\getNotificationRecipients(), and ilCourseMembershipMailNotification\TYPE_NOTIFICATION_REGISTRATION_REQUEST.

Referenced by sendNotification().

{
global $ilDB,$ilObjDataCache;
include_once './Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
$mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
$mail->setRefId($this->ref_id);
$mail->setRecipients($this->getNotificationRecipients());
$mail->send();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseParticipants::sendUnsubscribeNotificationToAdmins (   $a_usr_id)

Definition at line 324 of file class.ilCourseParticipants.php.

References ilParticipants\$ilDB, ilParticipants\getNotificationRecipients(), and ilCourseMembershipMailNotification\TYPE_NOTIFICATION_UNSUBSCRIBE.

{
global $ilDB,$ilObjDataCache;
include_once './Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
$mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
$mail->setRefId($this->ref_id);
$mail->setRecipients($this->getNotificationRecipients());
$mail->send();
return true;
}

+ Here is the call graph for this function:

ilCourseParticipants::updatePassed (   $a_usr_id,
  $a_passed,
  $a_manual = false,
  $a_no_origin = false 
)

Update passed status.

public

Parameters
int$usr_id
bool$passed
bool$a_manual
bool$a_no_origin

Definition at line 121 of file class.ilCourseParticipants.php.

References _updatePassed().

{
$this->participants_status[$a_usr_id]['passed'] = (int) $a_passed;
return self::_updatePassed($this->obj_id, $a_usr_id, $a_passed, $a_manual, $a_no_origin);
}

+ Here is the call graph for this function:

Field Documentation

ilCourseParticipants::$instances = array()
staticprotected

Definition at line 37 of file class.ilCourseParticipants.php.


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