ILIAS  release_4-4 Revision
ilObjSessionAccess Class Reference
+ Inheritance diagram for ilObjSessionAccess:
+ 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) More...

 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
- Public Member Functions inherited from ilObjectAccess
 _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) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id=0)
 check condition More...
 
 _getCommands ()
 get commands More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Public Member Functions

 _getCommands ()
 get list of command/permission combinations More...
 
static _lookupRegistration ($a_obj_id)
 lookup registrations More...
 
static _lookupRegistered ($a_usr_id, $a_obj_id)
 lookup if user has registered More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 

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 34 of file class.ilObjSessionAccess.php.

Member Function Documentation

◆ _checkAccess()

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 72 of file class.ilObjSessionAccess.php.

References $ilUser, and $lng.

73  {
74  global $ilUser, $lng, $rbacsystem, $ilAccess;
75 
76  $a_user_id = $a_user_id ? $a_user_id : $ilUser->getId();
77  switch($a_cmd)
78  {
79  case 'register':
80  if(self::_lookupRegistration($a_obj_id)&& $a_user_id != ANONYMOUS_USER_ID)
81  {
82  return !self::_lookupRegistered($a_user_id,$a_obj_id);
83  }
84  return false;
85 
86  case 'unregister':
87  if(self::_lookupRegistration($a_obj_id) && $a_user_id != ANONYMOUS_USER_ID)
88  {
89  return self::_lookupRegistered($a_user_id,$a_obj_id);
90  }
91  return false;
92  }
93  return true;
94  }
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40

◆ _checkGoto()

ilObjSessionAccess::_checkGoto (   $a_target)

check whether goto script will succeed

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

101  {
102  global $ilAccess;
103 
104  $t_arr = explode("_", $a_target);
105 
106  if ($t_arr[0] != "sess" || ((int) $t_arr[1]) <= 0)
107  {
108  return false;
109  }
110 
111  if($ilAccess->checkAccess("read", "", $t_arr[1]))
112  {
113  return true;
114  }
115  return false;
116  }

◆ _getCommands()

ilObjSessionAccess::_getCommands ( )
static

get list of command/permission combinations

public

Returns
array

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

Referenced by ilObjSessionListGUI\init().

47  {
48  $commands = array
49  (
50  array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "info_short", "default" => true),
51  array("permission" => "read", "cmd" => "register", "lang_var" => "join_session"),
52  array("permission" => "read", "cmd" => "unregister", "lang_var" => "event_unregister"),
53  array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
54  array('permission' => 'write', 'cmd' => 'members', 'lang_var' => 'event_edit_members')
55  );
56 
57  return $commands;
58  }
+ Here is the caller graph for this function:

◆ _lookupRegistered()

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 153 of file class.ilObjSessionAccess.php.

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

154  {
155  if(isset(self::$registered[$a_usr_id]))
156  {
157  return (bool) self::$registered[$a_usr_id][$a_obj_id];
158  }
159 
160  global $ilDB,$ilUser;
161 
162  $query = "SELECT event_id, registered FROM event_participants WHERE usr_id = ".$ilDB->quote($ilUser->getId(),'integer');
163  $res = $ilDB->query($query);
164  self::$registered[$a_usr_id] = array();
165  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
166  {
167  self::$registered[$a_usr_id][$row->event_id] = (bool) $row->registered;
168  }
169  return (bool) self::$registered[$a_usr_id][$a_obj_id];
170  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilUser
Definition: imgupload.php:15

◆ _lookupRegistration()

static ilObjSessionAccess::_lookupRegistration (   $a_obj_id)
static

lookup registrations

public

Parameters

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

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

127  {
128  if(!is_null(self::$registrations))
129  {
130  return self::$registrations[$a_obj_id];
131  }
132 
133  global $ilDB;
134 
135  $query = "SELECT registration,obj_id FROM event ";
136  $res = $ilDB->query($query);
137  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
138  {
139  self::$registrations[$row->obj_id] = (bool) $row->registration;
140  }
141  return self::$registrations[$a_obj_id];
142  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

Field Documentation

◆ $registered

ilObjSessionAccess::$registered = null
staticprotected

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

◆ $registrations

ilObjSessionAccess::$registrations = null
staticprotected

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


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