ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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="")
 
 _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)
 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)

@param      string          $a_cmd          command (not permission!)
@param      string          $a_permission   permission
@param      int                     $a_ref_id       reference id
@param      int                     $a_obj_id       object id
@param      int                     $a_user_id      user id (if not provided, current user is taken)

@return     boolean         true, if everything is ok

Reimplemented from ilObjectAccess.

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

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

References $ilUser, $lng, and _lookupRegistered().

+ Here is the call graph for this function:

◆ _checkGoto()

ilObjSessionAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

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

◆ _getCommands()

ilObjSessionAccess::_getCommands ( )
static

get list of command/permission combinations

@access public

Returns
array

Reimplemented from ilObjectAccess.

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

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" => "settings"),
54 array("permission" => "write", "cmd" => "materials", "lang_var" => "crs_objective_add_mat"),
55 array('permission' => 'write', 'cmd' => 'members', 'lang_var' => 'event_edit_members')
56 );
57
58 return $commands;
59 }

Referenced by ilObjSessionListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupRegistered()

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

lookup if user has registered

@access public

Parameters
intusr_id
intobj_id
Returns

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

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

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

Referenced by _checkAccess().

+ Here is the caller graph for this function:

◆ _lookupRegistration()

static ilObjSessionAccess::_lookupRegistration (   $a_obj_id)
static

lookup registrations

@access public

Parameters

return

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

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

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

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: