ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjSessionAccess Class Reference
+ Collaboration diagram for ilObjSessionAccess:

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)

 _checkGoto ($a_target)
 check whether goto script will succeed

Static Public Member Functions

static _getCommands ()
 get list of command/permission combinations
static _lookupRegistration ($a_obj_id)
 lookup registrations
static _lookupRegistered ($a_usr_id, $a_obj_id)
 lookup if user has registered

Static Protected Attributes

static $registrations = null
static $registered = null

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 32 of file class.ilObjSessionAccess.php.

Member Function Documentation

ilObjSessionAccess::_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

Definition at line 70 of file class.ilObjSessionAccess.php.

References $lng, and _lookupRegistered().

{
global $ilUser, $lng, $rbacsystem, $ilAccess;
$a_user_id = $a_user_id ? $a_user_id : $ilUser->getId();
switch($a_cmd)
{
case 'register':
if(self::_lookupRegistration($a_obj_id))
{
return !self::_lookupRegistered($a_user_id,$a_obj_id);
}
return false;
case 'unregister':
if(self::_lookupRegistration($a_obj_id))
{
return self::_lookupRegistered($a_user_id,$a_obj_id);
}
return false;
}
return true;
}

+ Here is the call graph for this function:

ilObjSessionAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Definition at line 98 of file class.ilObjSessionAccess.php.

{
global $ilAccess;
$t_arr = explode("_", $a_target);
if ($t_arr[0] != "sess" || ((int) $t_arr[1]) <= 0)
{
return false;
}
if($ilAccess->checkAccess("read", "", $t_arr[1]))
{
return true;
}
return false;
}
static ilObjSessionAccess::_getCommands ( )
static

get list of command/permission combinations

public

Returns
array

Definition at line 44 of file class.ilObjSessionAccess.php.

Referenced by ilObjSessionListGUI\init().

{
$commands = array
(
array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "info_short", "default" => true),
array("permission" => "read", "cmd" => "register", "lang_var" => "join_session"),
array("permission" => "read", "cmd" => "unregister", "lang_var" => "event_unregister"),
array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
array('permission' => 'write', 'cmd' => 'members', 'lang_var' => 'event_edit_members')
);
return $commands;
}

+ Here is the caller graph for this function:

static ilObjSessionAccess::_lookupRegistered (   $a_usr_id,
  $a_obj_id 
)
static

lookup if user has registered

public

Parameters
intusr_id
intobj_id
Returns

Definition at line 151 of file class.ilObjSessionAccess.php.

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

Referenced by _checkAccess().

{
if(isset(self::$registered[$a_usr_id]))
{
return (bool) self::$registered[$a_usr_id][$a_obj_id];
}
global $ilDB,$ilUser;
$query = "SELECT event_id, registered FROM event_participants WHERE usr_id = ".$ilDB->quote($ilUser->getId(),'integer');
$res = $ilDB->query($query);
self::$registered[$a_usr_id] = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
self::$registered[$a_usr_id][$row->event_id] = (bool) $row->registered;
}
return (bool) self::$registered[$a_usr_id][$a_obj_id];
}

+ Here is the caller graph for this function:

static ilObjSessionAccess::_lookupRegistration (   $a_obj_id)
static

lookup registrations

public

Parameters
@return

Definition at line 124 of file class.ilObjSessionAccess.php.

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

{
if(!is_null(self::$registrations))
{
return self::$registrations[$a_obj_id];
}
global $ilDB;
$query = "SELECT registration,obj_id FROM event ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
self::$registrations[$row->obj_id] = (bool) $row->registration;
}
return self::$registrations[$a_obj_id];
}

Field Documentation

ilObjSessionAccess::$registered = null
staticprotected

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

ilObjSessionAccess::$registrations = null
staticprotected

Definition at line 34 of file class.ilObjSessionAccess.php.


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