ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjCourseAccess Class Reference

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
 _lookupViewMode ($a_id)
 Lookup view mode.
- Public Member Functions inherited from ilObjectAccess
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id=0)
 check condition

Static Public Member Functions

static _isActivated ($a_obj_id)
 Is activated?
static _registrationEnabled ($a_obj_id)

Detailed Description

Class ilObjCourseAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilObjCourseAccess.php 22168 2009-10-22 08:07:25Z akill

Definition at line 36 of file class.ilObjCourseAccess.php.

Member Function Documentation

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)

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok

Reimplemented from ilObjectAccess.

Definition at line 50 of file class.ilObjCourseAccess.php.

References $lng, ilCourseParticipants\_getInstanceByObjId(), _isActivated(), ilWaitingList\_isOnList(), _registrationEnabled(), and IL_NO_OBJECT_ACCESS.

{
global $ilUser, $lng, $rbacsystem, $ilAccess, $ilias;
if ($a_user_id == "")
{
$a_user_id = $ilUser->getId();
}
$participants = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
switch ($a_cmd)
{
case "view":
if($participants->isBlocked($a_user_id) and $participants->isAssigned($a_user_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
return false;
}
break;
case 'leave':
// Regular member
if($a_permission == 'leave')
{
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
if(!$participants->isAssigned($a_user_id) or $participants->isLastAdmin($a_user_id))
{
return false;
}
}
// Waiting list
if($a_permission == 'join')
{
include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
if(!ilCourseWaitingList::_isOnList($ilUser->getId(), $a_obj_id))
{
return false;
}
return true;
}
break;
}
switch ($a_permission)
{
case "visible":
$active = ilObjCourseAccess::_isActivated($a_obj_id);
$registration = ilObjCourseAccess::_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;
}
$active = ilObjCourseAccess::_isActivated($a_obj_id);
if(!$active)
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
return false;
}
if($participants->isBlocked($a_user_id) and $participants->isAssigned($a_user_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
return false;
}
break;
case 'join':
if(!self::_registrationEnabled($a_obj_id))
{
return false;
}
include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
if(ilCourseWaitingList::_isOnList($ilUser->getId(), $a_obj_id))
{
return false;
}
if($participants->isAssigned($a_user_id))
{
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 195 of file class.ilObjCourseAccess.php.

{
global $ilAccess;
$t_arr = explode("_", $a_target);
if ($t_arr[0] != "crs" || ((int) $t_arr[1]) <= 0)
{
return false;
}
// checking for read results in endless loop, if read is given
// but visible is not given (-> see bug 5323)
//if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
// $ilAccess->checkAccess("visible", "", $t_arr[1]))
if ($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 169 of file class.ilObjCourseAccess.php.

References ilDAVActivationChecker\_isActive().

Referenced by ilObjCourseListGUI\init().

{
$commands = array();
$commands[] = array("permission" => "read", "cmd" => "", "lang_var" => "view", "default" => true);
$commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
// on waiting list
$commands[] = array('permission' => "join", "cmd" => "leave", "lang_var" => "leave_waiting_list");
// regualar users
$commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "crs_unsubscribe");
// BEGIN WebDAV: Mount as webfolder.
require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
{
$commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
}
// END WebDAV: Mount as webfolder.
$commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "edit");
return $commands;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjCourseAccess::_isActivated (   $a_obj_id)
static

Is activated?

Parameters
intid of user
Returns
boolean

Definition at line 242 of file class.ilObjCourseAccess.php.

References $ilDB, $query, $res, $row, $start, $type, DB_FETCHMODE_OBJECT, ilMemberViewSettings\getInstance(), IL_CRS_ACTIVATION_LIMITED, IL_CRS_ACTIVATION_OFFLINE, and IL_CRS_ACTIVATION_UNLIMITED.

Referenced by _checkAccess(), and ilObjCourseListGUI\getProperties().

{
global $ilDB;
include_once './Services/Container/classes/class.ilMemberViewSettings.php';
{
return true;
}
$query = "SELECT * FROM crs_settings ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$type = $row->activation_type;
$start = $row->activation_start;
$end = $row->activation_end;
}
switch($type)
{
return false;
return true;
if(time() < $start or
time() > $end)
{
return false;
}
return true;
default:
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjCourseAccess::_lookupViewMode (   $a_id)

Lookup view mode.

This is placed here to the need that ilObjFolder must always instantiate a Course object.

Returns
Parameters
object$a_id

Definition at line 223 of file class.ilObjCourseAccess.php.

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

Referenced by ilObjFolder\getViewMode().

{
global $ilDB;
$query = "SELECT view_mode FROM crs_settings WHERE obj_id = ".$ilDB->quote($a_id ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->view_mode;
}
return false;
}

+ Here is the caller graph for this function:

static ilObjCourseAccess::_registrationEnabled (   $a_obj_id)
static
Returns
Parameters
object$a_obj_id

Definition at line 288 of file class.ilObjCourseAccess.php.

References $ilDB, $query, $res, $row, $type, DB_FETCHMODE_OBJECT, IL_CRS_SUBSCRIPTION_DEACTIVATED, IL_CRS_SUBSCRIPTION_LIMITED, and IL_CRS_SUBSCRIPTION_UNLIMITED.

Referenced by _checkAccess().

{
global $ilDB;
$query = "SELECT * FROM crs_settings ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$type = $row->sub_limitation_type;
$reg_start = $row->sub_start;
$reg_end = $row->sub_end;
}
switch($type)
{
return true;
return false;
if(time() > $reg_start and
time() < $reg_end)
{
return true;
}
default:
return false;
}
return false;
}

+ Here is the caller graph for this function:


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