Public Member Functions | |
| ilCourseMembers (&$course_obj) | |
| addDesktopItem ($a_usr_id) | |
| dropDesktopItem ($a_usr_id) | |
| add (&$user_obj, $a_role, $a_status=0, $a_passed=0) | |
| update ($a_usr_id, $a_role, $a_status, $a_passed) | |
| deleteAllEntries () | |
| deleteMembers ($a_usr_ids) | |
| delete ($a_usr_id) | |
| getAssignedUsers () | |
| getUserData ($a_usr_id) | |
| getCountMembers () | |
| getMembers ($a_all=true) | |
| getAdmins () | |
| getTutors () | |
| isAdmin ($a_usr_id) | |
| isMember ($a_usr_id) | |
| isTutor ($a_usr_id) | |
| isAssigned ($a_usr_id) | |
| isBlocked ($a_usr_id) | |
| _isBlocked ($a_obj_id, $a_usr_id) | |
| Static version of isBlocked() to avoid instantiation of course object. | |
| hasAccess ($a_usr_id) | |
| getCountPassed () | |
| checkLastAdmin ($a_usr_ids) | |
| getSubscribers () | |
| getSubscriberData ($a_usr_id) | |
| assignSubscribers ($a_usr_ids) | |
| assignSubscriber ($a_usr_id, $a_role=0, $a_status=0) | |
| autoFillSubscribers () | |
| addSubscriber ($a_usr_id) | |
| deleteSubscriber ($a_usr_id) | |
| deleteSubscribers ($a_usr_ids) | |
| isSubscriber ($a_usr_id) | |
| _isSubscriber ($a_obj_id, $a_usr_id) | |
| sendNotification ($a_type, $a_usr_id) | |
| sendNotificationToAdmins ($a_usr_id) | |
| sendUnsubscribeNotificationToAdmins ($a_usr_id) | |
| __getDefaultAdminStatus () | |
| __getDefaultMemberStatus () | |
| __getDefaultTutorStatus () | |
| __createMemberEntry ($a_usr_id, $a_role, $a_status, $a_passed) | |
| __read ($a_usr_id) | |
| __readSubscribers () | |
| __readSubscriberData ($a_usr_id) | |
| _hasPassed ($a_obj_id, $a_usr_id) | |
| _setPassed ($a_obj_id, $a_usr_id) | |
| __buildStatusBody (&$user_obj) | |
| _isMember ($a_usr_id, $a_course_id, $a_field= '') | |
| check Membership by given field | |
Data Fields | |
| $course_obj | |
| $ilErr | |
| $ilDB | |
| $lng | |
| $member_data | |
| $subscribers | |
Definition at line 35 of file class.ilCourseMembers.php.
| ilCourseMembers::__buildStatusBody | ( | &$ | user_obj | ) |
Definition at line 876 of file class.ilCourseMembers.php.
References __read().
Referenced by sendNotification().
{
$this->__read($user_obj->getId());
$body = $this->lng->txt('crs_status_changed_body').':<br />';
$body .= $this->lng->txt('login').': '.$user_obj->getLogin().'<br />';
$body .= $this->lng->txt('role').': ';
switch($this->member_data['role'])
{
case $this->ROLE_MEMBER:
$body .= $this->lng->txt('crs_member').'<br />';
break;
case $this->ROLE_TUTOR:
$body .= $this->lng->txt('crs_tutor').'<br />';
break;
case $this->ROLE_ADMIN:
$body .= $this->lng->txt('crs_admin').'<br />';
break;
}
$body .= $this->lng->txt('status').': ';
switch($this->member_data['status'])
{
case $this->STATUS_NOTIFY:
$body .= $this->lng->txt("crs_notify").'<br />';
break;
case $this->STATUS_NO_NOTIFY:
$body .= $this->lng->txt("crs_no_notify").'<br />';
break;
case $this->STATUS_BLOCKED:
$body .= $this->lng->txt("crs_blocked").'<br />';
break;
case $this->STATUS_UNBLOCKED:
$body .= $this->lng->txt("crs_unblocked").'<br />';
break;
}
$passed = $this->member_data['passed'] ? $this->lng->txt('yes') : $this->lng->txt('no');
$body .= $this->lng->txt('crs_passed').': '.$passed.'<br />';
return $body;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::__createMemberEntry | ( | $ | a_usr_id, | |
| $ | a_role, | |||
| $ | a_status, | |||
| $ | a_passed | |||
| ) |
Definition at line 773 of file class.ilCourseMembers.php.
Referenced by add().
{
$query = "INSERT INTO crs_members ".
"SET usr_id = '".$a_usr_id."', ".
"obj_id = '".$this->course_obj->getId()."', ".
"status = '".$a_status."', ".
"role = '".$a_role."', ".
"passed = '".$a_passed."'";
$res = $this->ilDB->query($query);
return true;
}
Here is the caller graph for this function:| ilCourseMembers::__getDefaultAdminStatus | ( | ) |
Definition at line 760 of file class.ilCourseMembers.php.
Referenced by add().
{
return $this->STATUS_NOTIFY;
}
Here is the caller graph for this function:| ilCourseMembers::__getDefaultMemberStatus | ( | ) |
Definition at line 764 of file class.ilCourseMembers.php.
Referenced by add().
{
return $this->STATUS_UNBLOCKED;
}
Here is the caller graph for this function:| ilCourseMembers::__getDefaultTutorStatus | ( | ) |
Definition at line 768 of file class.ilCourseMembers.php.
Referenced by add().
{
return $this->STATUS_NO_NOTIFY;
}
Here is the caller graph for this function:| ilCourseMembers::__read | ( | $ | a_usr_id | ) |
Definition at line 787 of file class.ilCourseMembers.php.
References $query, $res, and $row.
Referenced by __buildStatusBody(), delete(), getUserData(), isAdmin(), isBlocked(), isMember(), isTutor(), and update().
{
$query = "SELECT * FROM crs_members ".
"WHERE usr_id = '".$a_usr_id."' ".
"AND obj_id = '".$this->course_obj->getId()."'";
$res = $this->ilDB->query($query);
$this->member_data = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->member_data["usr_id"] = $row->usr_id;
$this->member_data["role"] = $row->role;
$this->member_data["status"] = $row->status;
$this->member_data['passed'] = $row->passed;
}
return true;
}
Here is the caller graph for this function:| ilCourseMembers::__readSubscriberData | ( | $ | a_usr_id | ) |
Definition at line 828 of file class.ilCourseMembers.php.
References $data, $query, $res, and $row.
Referenced by getSubscriberData().
{
$query = "SELECT * FROM crs_subscribers ".
"WHERE obj_id = '".$this->course_obj->getId()."' ".
"AND usr_id = '".$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;
}
return $data ? $data : array();
}
Here is the caller graph for this function:| ilCourseMembers::__readSubscribers | ( | ) |
Definition at line 807 of file class.ilCourseMembers.php.
References $query, $res, $row, deleteSubscriber(), and ilObjectFactory::getInstanceByObjId().
Referenced by autoFillSubscribers(), and getSubscribers().
{
$this->subscribers = array();
$query = "SELECT usr_id FROM crs_subscribers ".
"WHERE obj_id = '".$this->course_obj->getId()."' ".
"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($a_usr_id,false))
{
$this->deleteSubscriber($a_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:| ilCourseMembers::_hasPassed | ( | $ | a_obj_id, | |
| $ | a_usr_id | |||
| ) |
Definition at line 843 of file class.ilCourseMembers.php.
References $ilDB, $query, and $res.
Referenced by ilObjCourse::_checkCondition(), and _setPassed().
{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE obj_id = '".$a_obj_id."' ".
"AND usr_id = '".$a_usr_id."' ".
"AND passed = 1";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}
Here is the caller graph for this function:| ilCourseMembers::_isBlocked | ( | $ | a_obj_id, | |
| $ | a_usr_id | |||
| ) |
Static version of isBlocked() to avoid instantiation of course object.
| int | id of user |
Definition at line 427 of file class.ilCourseMembers.php.
References $ilDB, $query, $res, and $row.
Referenced by ilObjCourseAccess::_checkAccess(), and ilObjCourseListGUI::getProperties().
{
global $ilDB;
$query = "SELECT * FROM crs_members ".
"WHERE usr_id = '".$a_usr_id."' ".
"AND obj_id = '".$a_obj_id."'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->status == 3 ? true : false;
}
return false;
}
Here is the caller graph for this function:| ilCourseMembers::_isMember | ( | $ | a_usr_id, | |
| $ | a_course_id, | |||
| $ | a_field = '' | |||
| ) |
check Membership by given field
| int | usr_id | |
| int | obj_id | |
| string | field (login,email or matriculation) public |
Definition at line 931 of file class.ilCourseMembers.php.
References $ilDB, $ilUser, $query, $res, $tmp_user, and ilObjectFactory::getInstanceByObjId().
Referenced by ilCourseRegisterGUI::__checkGroupingDependencies(), ilObjCourseAccess::_checkAccess(), and ilObjCourseGUI::membersObject().
{
global $ilUser,$ilDB;
// get specific user data
$tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id);
switch($a_field)
{
case 'login':
$and = "AND login = '".$tmp_user->getLogin()."' ";
break;
case 'email':
$and = "AND email = '".$tmp_user->getEmail()."' ";
break;
case 'matriculation':
$and = "AND matriculation = '".$tmp_user->getMatriculation()."' ";
break;
default:
$and = "AND cm.usr_id = '".$a_usr_id."'";
break;
}
// check if entry exists
$query = "SELECT * FROM crs_members as cm, usr_data as ud ".
"WHERE cm.usr_id = ud.usr_id ".
"AND cm.obj_id = '".$a_course_id."' ".
$and;
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::_isSubscriber | ( | $ | a_obj_id, | |
| $ | a_usr_id | |||
| ) |
Definition at line 630 of file class.ilCourseMembers.php.
References $ilDB, $query, $res, and $row.
Referenced by ilObjCourseListGUI::getProperties().
{
global $ilDB;
$query = "SELECT * FROM crs_subscribers ".
"WHERE usr_id = '".$a_usr_id."' ".
"AND obj_id = '".$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:| ilCourseMembers::_setPassed | ( | $ | a_obj_id, | |
| $ | a_usr_id | |||
| ) |
Definition at line 858 of file class.ilCourseMembers.php.
References $ilDB, $query, and _hasPassed().
Referenced by ilCourseContentInterface::__readStatus().
{
global $ilDB;
if(!ilCourseMembers::_hasPassed($a_obj_id,$a_usr_id))
{
$query = "UPDATE crs_members ".
"SET passed = 1 WHERE usr_id = '".$a_usr_id."' ".
"AND obj_id = '".$a_obj_id."'";
$ilDB->query($query);
return true;
}
return false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::add | ( | &$ | user_obj, | |
| $ | a_role, | |||
| $ | a_status = 0, |
|||
| $ | a_passed = 0 | |||
| ) |
Definition at line 103 of file class.ilCourseMembers.php.
References $rbacadmin, $status, __createMemberEntry(), __getDefaultAdminStatus(), __getDefaultMemberStatus(), __getDefaultTutorStatus(), addDesktopItem(), and ilObjUser::updateActiveRoles().
Referenced by assignSubscriber().
{
global $rbacadmin;
switch($a_role)
{
case $this->ROLE_MEMBER:
if($a_status and ($a_status == $this->STATUS_BLOCKED or $a_status == $this->STATUS_UNBLOCKED))
{
$status = $a_status;
}
else if($a_status)
{
$this->ilErr->raiseError($this->lng->txt("crs_status_not_allowed",$this->ilErr->MESSAGE));
}
else
{
$status = $this->__getDefaultMemberStatus();
}
$role = $this->course_obj->getDefaultMemberRole();
$passed = $a_passed;
$this->addDesktopItem($user_obj->getId());
break;
case $this->ROLE_ADMIN:
if($a_status and ($a_status == $this->STATUS_NOTIFY or $a_status == $this->STATUS_NO_NOTIFY))
{
$status = $a_status;
}
else if($a_status)
{
$this->ilErr->raiseError($this->lng->txt("crs_status_not_allowed",$this->ilErr->MESSAGE));
}
else
{
$status = $this->__getDefaultAdminStatus();
}
$role = $this->course_obj->getDefaultAdminRole();
$passed = $a_passed;
$this->addDesktopItem($user_obj->getId());
break;
case $this->ROLE_TUTOR:
if($a_status and ($a_status == $this->STATUS_NOTIFY or $a_status == $this->STATUS_NO_NOTIFY))
{
$status = $a_status;
}
else if($a_status)
{
$this->ilErr->raiseError($this->lng->txt("crs_status_not_allowed",$this->ilErr->MESSAGE));
}
else
{
$status = $this->__getDefaultTutorStatus();
}
$role = $this->course_obj->getDefaultTutorRole();
$passed = $a_passed;
$this->addDesktopItem($user_obj->getId());
break;
}
// 1. create entry
$this->__createMemberEntry($user_obj->getId(),$a_role,$status,$passed);
$rbacadmin->assignUser($role,$user_obj->getId());
ilObjUser::updateActiveRoles($user_obj->getId());
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::addDesktopItem | ( | $ | a_usr_id | ) |
Definition at line 78 of file class.ilCourseMembers.php.
References ilObjectFactory::getInstanceByObjId().
Referenced by add(), and update().
{
$user_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id);
if(!$user_obj->isDesktopItem($this->course_obj->getRefId(),'crs'))
{
$user_obj->addDesktopItem($this->course_obj->getRefId(),'crs');
}
unset($user_obj);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::addSubscriber | ( | $ | a_usr_id | ) |
| ilCourseMembers::assignSubscriber | ( | $ | a_usr_id, | |
| $ | a_role = 0, |
|||
| $ | a_status = 0 | |||
| ) |
Definition at line 510 of file class.ilCourseMembers.php.
References add(), deleteSubscriber(), ilObjectFactory::getInstanceByObjId(), isAssigned(), and isSubscriber().
Referenced by assignSubscribers(), and autoFillSubscribers().
{
$a_role = $a_role ? $a_role : $this->ROLE_MEMBER;
$a_status = $a_status ? $a_status : $this->STATUS_UNBLOCKED;
$this->course_obj->setMessage("");
if(!$this->isSubscriber($a_usr_id))
{
$this->course_obj->appendMessage($this->lng->txt("crs_user_notsubscribed"));
return false;
}
if($this->isAssigned($a_usr_id))
{
$tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
$this->course_obj->appendMessage($tmp_obj->getLogin().": ".$this->lng->txt("crs_user_already_assigned"));
return false;
}
if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id))
{
$this->course_obj->appendMessage($this->lng->txt("crs_user_not_exists"));
return false;
}
$this->add($tmp_obj,$a_role,$a_status);
$this->deleteSubscriber($a_usr_id);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::assignSubscribers | ( | $ | a_usr_ids | ) |
Definition at line 494 of file class.ilCourseMembers.php.
References $id, and 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:| ilCourseMembers::autoFillSubscribers | ( | ) |
Definition at line 545 of file class.ilCourseMembers.php.
References $counter, __readSubscribers(), assignSubscriber(), getCountMembers(), and sendNotification().
{
$this->__readSubscribers();
$counter = 0;
foreach($this->subscribers as $subscriber)
{
if($this->course_obj->getSubscriptionMaxMembers() and
$this->course_obj->getSubscriptionMaxMembers() <= $this->getCountMembers())
{
return $counter;
}
if(!$this->assignSubscriber($subscriber))
{
continue;
}
else
{
$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
}
++$counter;
}
return $counter;
}
Here is the call graph for this function:| ilCourseMembers::checkLastAdmin | ( | $ | a_usr_ids | ) |
Definition at line 467 of file class.ilCourseMembers.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:| ilCourseMembers::delete | ( | $ | a_usr_id | ) |
Definition at line 295 of file class.ilCourseMembers.php.
References $query, $rbacadmin, $res, __read(), dropDesktopItem(), and ilObjUser::updateActiveRoles().
{
global $rbacadmin;
$this->__read($a_usr_id);
switch($this->member_data["role"])
{
case $this->ROLE_ADMIN:
$role = $this->course_obj->getDefaultAdminRole();
break;
case $this->ROLE_TUTOR:
$role = $this->course_obj->getDefaultTutorRole();
break;
case $this->ROLE_MEMBER:
$role = $this->course_obj->getDefaultMemberRole();
break;
}
$this->dropDesktopItem($a_usr_id);
$rbacadmin->deassignUser($role,$a_usr_id);
ilObjUser::updateActiveRoles($a_usr_id);
$query = "DELETE FROM crs_members ".
"WHERE usr_id = '".$a_usr_id."' ".
"AND obj_id = '".$this->course_obj->getId()."'";
$res = $this->ilDB->query($query);
return true;
}
Here is the call graph for this function:| ilCourseMembers::deleteAllEntries | ( | ) |
Definition at line 259 of file class.ilCourseMembers.php.
References $query.
| ilCourseMembers::deleteMembers | ( | $ | a_usr_ids | ) |
Definition at line 274 of file class.ilCourseMembers.php.
References $id.
{
if(!is_array($a_usr_ids) or !count($a_usr_ids))
{
$this->course_obj->setMessage("");
$this->course_obj->appendMessage($this->lng->txt("no_usr_ids_given"));
return false;
}
foreach($a_usr_ids as $id)
{
if(!$this->delete($id))
{
$this->course_obj->appendMessage($this->lng->txt("error_delete_member"));
return false;
}
}
return true;
}
| ilCourseMembers::deleteSubscriber | ( | $ | a_usr_id | ) |
Definition at line 581 of file class.ilCourseMembers.php.
Referenced by __readSubscribers(), assignSubscriber(), and deleteSubscribers().
{
$query = "DELETE FROM crs_subscribers ".
"WHERE usr_id = '".$a_usr_id."' ".
"AND obj_id = '".$this->course_obj->getId()."'";
$res = $this->ilDB->query($query);
return true;
}
Here is the caller graph for this function:| ilCourseMembers::deleteSubscribers | ( | $ | a_usr_ids | ) |
Definition at line 592 of file class.ilCourseMembers.php.
References $id, and deleteSubscriber().
{
if(!is_array($a_usr_ids) or !count($a_usr_ids))
{
$this->course_obj->setMessage("");
$this->course_obj->appendMessage($this->lng->txt("no_usr_ids_given"));
return false;
}
foreach($a_usr_ids as $id)
{
if(!$this->deleteSubscriber($id))
{
$this->course_obj->appendMessage($this->lng->txt("error_delete_subscriber"));
return false;
}
}
return true;
}
Here is the call graph for this function:| ilCourseMembers::dropDesktopItem | ( | $ | a_usr_id | ) |
Definition at line 90 of file class.ilCourseMembers.php.
References ilObjectFactory::getInstanceByObjId().
Referenced by delete().
{
$user_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id);
if($user_obj->isDesktopItem($this->course_obj->getRefId(),'crs'))
{
$user_obj->dropDesktopItem($this->course_obj->getRefId(),'crs');
}
unset($user_obj);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::getAdmins | ( | ) |
Definition at line 366 of file class.ilCourseMembers.php.
References $query, $res, and $row.
Referenced by checkLastAdmin(), and getAssignedUsers().
{
$query = "SELECT usr_id FROM crs_members ".
"WHERE obj_id = '".$this->course_obj->getId()."' ".
"AND role = '".$this->ROLE_ADMIN."'";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$usr_ids[] = $row->usr_id;
}
return $usr_ids ? $usr_ids : array();
}
Here is the caller graph for this function:| ilCourseMembers::getAssignedUsers | ( | ) |
Definition at line 331 of file class.ilCourseMembers.php.
References getAdmins(), getMembers(), and getTutors().
{
// ALL MEMBERS AND ADMINS
return array_merge($this->getMembers(),$this->getAdmins(),$this->getTutors());
}
Here is the call graph for this function:| ilCourseMembers::getCountMembers | ( | ) |
Definition at line 343 of file class.ilCourseMembers.php.
References getMembers().
Referenced by autoFillSubscribers().
{
return count($this->getMembers(false));
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::getCountPassed | ( | ) |
| ilCourseMembers::getMembers | ( | $ | a_all = true |
) |
Definition at line 348 of file class.ilCourseMembers.php.
References $query, $res, and $row.
Referenced by getAssignedUsers(), and getCountMembers().
{
$query = "SELECT usr_id FROM crs_members ".
"WHERE obj_id = '".$this->course_obj->getId()."' ".
"AND role = '".$this->ROLE_MEMBER."'";
if(!$a_all)
{
$query .= " AND status = '".$this->STATUS_UNBLOCKED."'";
}
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$usr_ids[] = $row->usr_id;
}
return $usr_ids ? $usr_ids : array();
}
Here is the caller graph for this function:| ilCourseMembers::getSubscriberData | ( | $ | a_usr_id | ) |
Definition at line 487 of file class.ilCourseMembers.php.
References __readSubscriberData().
{
return $this->__readSubscriberData($a_usr_id);
}
Here is the call graph for this function:| ilCourseMembers::getSubscribers | ( | ) |
Definition at line 480 of file class.ilCourseMembers.php.
References __readSubscribers().
{
$this->__readSubscribers();
return $this->subscribers;
}
Here is the call graph for this function:| ilCourseMembers::getTutors | ( | ) |
Definition at line 379 of file class.ilCourseMembers.php.
References $query, $res, and $row.
Referenced by getAssignedUsers().
{
$query = "SELECT usr_id FROM crs_members ".
"WHERE obj_id = '".$this->course_obj->getId()."' ".
"AND role = '".$this->ROLE_TUTOR."'";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$usr_ids[] = $row->usr_id;
}
return $usr_ids ? $usr_ids : array();
}
Here is the caller graph for this function:| ilCourseMembers::getUserData | ( | $ | a_usr_id | ) |
Definition at line 336 of file class.ilCourseMembers.php.
References __read().
{
$this->__read($a_usr_id);
return $this->member_data;
}
Here is the call graph for this function:| ilCourseMembers::hasAccess | ( | $ | a_usr_id | ) |
Definition at line 444 of file class.ilCourseMembers.php.
References $rbacsystem, isAssigned(), and isBlocked().
{
global $rbacsystem;
#if($rbacsystem->checkAccess('write',$this->course_obj->getRefId()))
#{
# return true;
#}
return $this->isAssigned($a_usr_id) && !$this->isBlocked($a_usr_id) ? true : false;
}
Here is the call graph for this function:| ilCourseMembers::ilCourseMembers | ( | &$ | course_obj | ) |
Definition at line 45 of file class.ilCourseMembers.php.
References $course_obj, $ilDB, $ilErr, and $lng.
{
global $ilErr,$lng,$ilDB;
$this->STATUS_NOTIFY = 1;
$this->STATUS_NO_NOTIFY = 2;
$this->STATUS_BLOCKED = 3;
$this->STATUS_UNBLOCKED = 4;
$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->ROLE_ADMIN = 1;
$this->ROLE_MEMBER = 2;
$this->ROLE_TUTOR = 3;
$this->ilErr =& $ilErr;
$this->ilDB =& $ilDB;
$this->lng =& $lng;
$this->lng->loadLanguageModule("search");
$this->course_obj =& $course_obj;
}
| ilCourseMembers::isAdmin | ( | $ | a_usr_id | ) |
Definition at line 393 of file class.ilCourseMembers.php.
References __read().
Referenced by isAssigned().
{
$this->__read($a_usr_id);
return $this->member_data["role"] == $this->ROLE_ADMIN ? true : false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::isAssigned | ( | $ | a_usr_id | ) |
Definition at line 411 of file class.ilCourseMembers.php.
References isAdmin(), isMember(), and isTutor().
Referenced by assignSubscriber(), and hasAccess().
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::isBlocked | ( | $ | a_usr_id | ) |
Definition at line 415 of file class.ilCourseMembers.php.
References __read().
Referenced by hasAccess().
{
$this->__read($a_usr_id);
return $this->member_data["status"] == $this->STATUS_BLOCKED ? true : false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::isMember | ( | $ | a_usr_id | ) |
Definition at line 399 of file class.ilCourseMembers.php.
References __read().
Referenced by isAssigned().
{
$this->__read($a_usr_id);
return $this->member_data["role"] == $this->ROLE_MEMBER ? true : false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::isSubscriber | ( | $ | a_usr_id | ) |
Definition at line 612 of file class.ilCourseMembers.php.
References $query, $res, and $row.
Referenced by assignSubscriber().
{
$query = "SELECT * FROM crs_subscribers ".
"WHERE usr_id = '".$a_usr_id."' ".
"AND obj_id = '".$this->course_obj->getId()."'";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return true;
}
return false;
}
Here is the caller graph for this function:| ilCourseMembers::isTutor | ( | $ | a_usr_id | ) |
Definition at line 405 of file class.ilCourseMembers.php.
References __read().
Referenced by isAssigned().
{
$this->__read($a_usr_id);
return $this->member_data["role"] == $this->ROLE_TUTOR ? true : false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::sendNotification | ( | $ | a_type, | |
| $ | a_usr_id | |||
| ) |
Definition at line 647 of file class.ilCourseMembers.php.
References $_SESSION, $tmp_user, __buildStatusBody(), ilObjectFactory::getInstanceByObjId(), and sendNotificationToAdmins().
Referenced by autoFillSubscribers().
{
$tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id,false);
switch($a_type)
{
case $this->NOTIFY_DISMISS_SUBSCRIBER:
$subject = $this->lng->txt("crs_reject_subscriber")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_reject_subscriber_body");
break;
case $this->NOTIFY_ACCEPT_SUBSCRIBER:
$subject = $this->lng->txt("crs_accept_subscriber")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_accept_subscriber_body");
break;
case $this->NOTIFY_DISMISS_MEMBER:
$subject = $this->lng->txt("crs_dismiss_member")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_dismiss_member_body");
break;
case $this->NOTIFY_BLOCK_MEMBER:
$subject = $this->lng->txt("crs_blocked_member")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_blocked_member_body");
break;
case $this->NOTIFY_UNBLOCK_MEMBER:
$subject = $this->lng->txt("crs_unblocked_member")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_unblocked_member_body");
break;
case $this->NOTIFY_ACCEPT_USER:
$subject = $this->lng->txt("crs_added_member")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_added_member_body");
break;
case $this->NOTIFY_STATUS_CHANGED:
$subject = $this->lng->txt("crs_status_changed")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->__buildStatusBody($tmp_user);
break;
case $this->NOTIFY_ADMINS:
$this->sendNotificationToAdmins($a_usr_id);
return true;
break;
}
include_once("./classes/class.ilFormatMail.php");
$mail = new ilFormatMail($_SESSION["AccountId"]);
$mail->sendMail($tmp_user->getLogin(),'','',$subject,$body,array(),array('normal'));
unset($tmp_user);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::sendNotificationToAdmins | ( | $ | a_usr_id | ) |
Definition at line 699 of file class.ilCourseMembers.php.
References $query, $res, $row, $tmp_user, and ilObjectFactory::getInstanceByObjId().
Referenced by sendNotification().
{
if(!$this->course_obj->getSubscriptionNotify())
{
return true;
}
include_once("./classes/class.ilFormatMail.php");
$mail =& new ilFormatMail($a_usr_id);
$subject = $this->lng->txt("crs_new_subscription")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_new_subscription_body");
$query = "SELECT usr_id FROM crs_members ".
"WHERE status = '".$this->STATUS_NOTIFY."' ".
"AND obj_id = '".$this->course_obj->getId()."'";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$tmp_user =& ilObjectFactory::getInstanceByObjId($row->usr_id,false);
$message = $mail->sendMail($tmp_user->getLogin(),'','',$subject,$body,array(),array('normal'));
unset($tmp_user);
}
unset($mail);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseMembers::sendUnsubscribeNotificationToAdmins | ( | $ | a_usr_id | ) |
Definition at line 729 of file class.ilCourseMembers.php.
References $query, $res, $row, $tmp_user, and ilObjectFactory::getInstanceByObjId().
{
if(!$this->course_obj->getSubscriptionNotify())
{
return true;
}
include_once("./classes/class.ilFormatMail.php");
$mail =& new ilFormatMail($a_usr_id);
$subject = $this->lng->txt("crs_cancel_subscription")." ".$this->lng->txt("obj_crs").": ".$this->course_obj->getTitle();
$body = $this->lng->txt("crs_cancel_subscription_body");
$query = "SELECT usr_id FROM crs_members ".
"WHERE status = '".$this->STATUS_NOTIFY."' ".
"AND obj_id = '".$this->course_obj->getId()."'";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$tmp_user =& ilObjectFactory::getInstanceByObjId($row->usr_id,false);
$message = $mail->sendMail($tmp_user->getLogin(),'','',$subject,$body,array(),array('normal'));
unset($tmp_user);
}
unset($mail);
return true;
}
Here is the call graph for this function:| ilCourseMembers::update | ( | $ | a_usr_id, | |
| $ | a_role, | |||
| $ | a_status, | |||
| $ | a_passed | |||
| ) |
Definition at line 174 of file class.ilCourseMembers.php.
References $query, $rbacadmin, $res, __read(), addDesktopItem(), and ilObjUser::updateActiveRoles().
{
global $rbacadmin;
$this->__read($a_usr_id);
switch($a_role)
{
case $this->ROLE_ADMIN:
if($a_status != $this->STATUS_NOTIFY or $a_status != $this->STATUS_NO_NOTIFY)
{
$this->ilErr->raiseError($this->lng->txt("crs_status_not_allowed",$this->ilErr->MESSAGE));
}
break;
case $this->ROLE_TUTOR:
if($a_status != $this->STATUS_NOTIFY or $a_status != $this->STATUS_NO_NOTIFY)
{
$this->ilErr->raiseError($this->lng->txt("crs_status_not_allowed",$this->ilErr->MESSAGE));
}
break;
case $this->ROLE_MEMBER:
if($a_status != $this->STATUS_BLOCKED or $a_status != $this->STATUS_UNBLOCKED)
{
$this->ilErr->raiseError($this->lng->txt("crs_status_not_allowed",$this->ilErr->MESSAGE));
}
$this->addDesktopItem($a_usr_id);
default:
$this->ilErr->raiseError($this->lng->txt("crs_role_not_allowed",$this->ilErr->MESSAGE));
break;
}
// UPDATE RBAC ROLES
// deassign old roles
switch($this->member_data["role"])
{
case $this->ROLE_ADMIN:
$rbacadmin->deassignUser($this->course_obj->getDefaultAdminRole(),$a_usr_id);
break;
case $this->ROLE_TUTOR:
$rbacadmin->deassignUser($this->course_obj->getDefaultTutorRole(),$a_usr_id);
break;
case $this->ROLE_MEMBER:
$rbacadmin->deassignUser($this->course_obj->getDefaultMemberRole(),$a_usr_id);
break;
}
// assign new role
switch($a_role)
{
case $this->ROLE_ADMIN:
$rbacadmin->assignUser($this->course_obj->getDefaultAdminRole(),$a_usr_id);
break;
case $this->ROLE_TUTOR:
$rbacadmin->assignUser($this->course_obj->getDefaultTutorRole(),$a_usr_id);
break;
case $this->ROLE_MEMBER:
if($a_status != $this->STATUS_BLOCKED)
{
$rbacadmin->assignUser($this->course_obj->getDefaultMemberRole(),$a_usr_id);
}
break;
}
// Update active roles
ilObjUser::updateActiveRoles($a_usr_id);
$query = "UPDATE crs_members ".
"SET role = '".$a_role."', ".
"status = '".$a_status."', ".
"passed = '".$a_passed."' ".
"WHERE obj_id = '".$this->course_obj->getId()."' ".
"AND usr_id = '".$a_usr_id."'";
$res = $this->ilDB->query($query);
return true;
}
Here is the call graph for this function:| ilCourseMembers::$course_obj |
Definition at line 37 of file class.ilCourseMembers.php.
Referenced by ilCourseMembers().
| ilCourseMembers::$ilDB |
Definition at line 39 of file class.ilCourseMembers.php.
Referenced by _hasPassed(), _isBlocked(), _isMember(), _isSubscriber(), _setPassed(), and ilCourseMembers().
| ilCourseMembers::$ilErr |
Definition at line 38 of file class.ilCourseMembers.php.
Referenced by ilCourseMembers().
| ilCourseMembers::$lng |
Definition at line 40 of file class.ilCourseMembers.php.
Referenced by ilCourseMembers().
| ilCourseMembers::$member_data |
Definition at line 42 of file class.ilCourseMembers.php.
| ilCourseMembers::$subscribers |
Definition at line 43 of file class.ilCourseMembers.php.
1.7.1