Class ilObjCourseAccess. More...
Inheritance diagram for ilObjCourseAccess:
Collaboration diagram for ilObjCourseAccess:Public Member Functions | |
| _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="") | |
| checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) | |
| _getCommands () | |
| get commands | |
| _checkGoto ($a_target) | |
| check whether goto script will succeed | |
Class ilObjCourseAccess.
Definition at line 34 of file class.ilObjCourseAccess.php.
| ilObjCourseAccess::_checkAccess | ( | $ | a_cmd, | |
| $ | a_permission, | |||
| $ | a_ref_id, | |||
| $ | a_obj_id, | |||
| $ | a_user_id = "" | |||
| ) |
checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)
| string | $a_cmd command (not permission!) | |
| string | $a_permission permission | |
| int | $a_ref_id reference id | |
| int | $a_obj_id object id | |
| int | $a_user_id user id (if not provided, current user is taken) |
Reimplemented from ilObjectAccess.
Definition at line 48 of file class.ilObjCourseAccess.php.
References $ilias, $lng, ilObjCourse::_isActivated(), ilCourseParticipants::_isBlocked(), ilCourseParticipants::_isParticipant(), and ilObjCourse::_registrationEnabled().
{
global $ilUser, $lng, $rbacsystem, $ilAccess, $ilias;
if ($a_user_id == "")
{
$a_user_id = $ilUser->getId();
}
switch ($a_cmd)
{
case "view":
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
if(ilCourseParticipants::_isBlocked($a_obj_id,$a_user_id) and ilCourseParticipants::_isParticipant($a_ref_id,$a_user_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
return false;
}
/*
if($members->isBlocked($a_user_id) and $members->isAssigned($a_user_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
return false;
}
*/
break;
/*
case "info":
// Used for permission query ?!
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
if(ilCourseParticipants::_isAssigned($a_user_id,$a_obj_id))
{
$ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("info_is_member"));
}
else
{
$ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("info_is_not_member"));
}
break;
*/
case 'join':
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
if(ilCourseParticipants::_isParticipant($a_ref_id,$a_user_id))
{
return false;
}
/*
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$members = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
if($members->isAssigned($a_user_id))
{
return false;
}
*/
break;
}
switch ($a_permission)
{
case "visible":
include_once './Modules/Course/classes/class.ilObjCourse.php';
$active = ilObjCourse::_isActivated($a_obj_id);
$registration = ilObjCourse::_registrationEnabled($a_obj_id);
$tutor = $rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id);
if(!$active)
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
}
if(!$tutor and !$active)
{
return false;
}
break;
case 'read':
$tutor = $rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id);
if($tutor)
{
return true;
}
include_once 'Modules/Course/classes/class.ilObjCourse.php';
$active = ilObjCourse::_isActivated($a_obj_id);
if(!$active)
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
return false;
}
include_once('Modules/Course/classes/class.ilCourseParticipants.php');
if(ilCourseParticipants::_isBlocked($a_obj_id,$a_user_id) and ilCourseParticipants::_isParticipant($a_ref_id,$a_user_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
return false;
}
/*
$members = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
if($members->isBlocked($a_user_id) and $members->isAssigned($a_user_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
return false;
}
*/
break;
}
return true;
}
Here is the call graph for this function:| ilObjCourseAccess::_checkGoto | ( | $ | a_target | ) |
check whether goto script will succeed
Reimplemented from ilObjectAccess.
Definition at line 189 of file class.ilObjCourseAccess.php.
{
global $ilAccess;
$t_arr = explode("_", $a_target);
if ($t_arr[0] != "crs" || ((int) $t_arr[1]) <= 0)
{
return false;
}
if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
$ilAccess->checkAccess("visible", "", $t_arr[1]))
{
return true;
}
return false;
}
| ilObjCourseAccess::_getCommands | ( | ) |
get commands
this method returns an array of all possible commands/permission combinations
example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );
Reimplemented from ilObjectAccess.
Definition at line 173 of file class.ilObjCourseAccess.php.
Referenced by ilObjCourseListGUI::init().
{
$commands = array
(
array("permission" => "read", "cmd" => "", "lang_var" => "view",
"default" => true),
array("permission" => "join", "cmd" => "join", "lang_var" => "join"),
array("permission" => "write", "cmd" => "edit", "lang_var" => "edit")
);
return $commands;
}
Here is the caller graph for this function:
1.7.1