ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjPollAccess Class Reference

Class ilObjPollAccess. More...

+ Inheritance diagram for ilObjPollAccess:
+ Collaboration diagram for ilObjPollAccess:

Public Member Functions

 __construct ()
 Constructor. More...
 
 _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...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
- 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...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _lookupOnline ($a_obj_id)
 get status More...
 
static _isActivated ($a_ref_id)
 Is activated? More...
 
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Protected Attributes

 $user
 
 $lng
 
 $rbacsystem
 
 $access
 

Detailed Description

Class ilObjPollAccess.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilObjRootFolderAccess.php 15678 2008-01-06 20:40:55Z akill

Definition at line 15 of file class.ilObjPollAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjPollAccess::__construct ( )

Constructor.

Definition at line 41 of file class.ilObjPollAccess.php.

42 {
43 global $DIC;
44
45 $this->user = $DIC->user();
46 $this->lng = $DIC->language();
47 $this->rbacsystem = $DIC->rbac()->system();
48 $this->access = $DIC->access();
49 }
user()
Definition: user.php:4
$DIC
Definition: xapitoken.php:46

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjPollAccess::_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 63 of file class.ilObjPollAccess.php.

64 {
68 $ilAccess = $this->access;
69
70 if ($a_user_id == "") {
71 $a_user_id = $ilUser->getId();
72 }
73
74 if (
75 $a_cmd == 'preview' &&
76 $a_permission == 'read'
77 ) {
78 return false;
79 }
80
81 // check "global" online switch
82 if (!self::_lookupOnline($a_obj_id) &&
83 !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
84 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
85 return false;
86 }
87
88 return true;
89 }
const IL_NO_OBJECT_ACCESS
$ilUser
Definition: imgupload.php:18

References $access, $ilUser, $lng, $rbacsystem, $user, and IL_NO_OBJECT_ACCESS.

◆ _checkGoto()

static ilObjPollAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 157 of file class.ilObjPollAccess.php.

158 {
159 global $DIC;
160
161 $ilAccess = $DIC->access();
162
163 $t_arr = explode("_", $a_target);
164
165 if ($t_arr[0] != "poll" || ((int) $t_arr[1]) <= 0) {
166 return false;
167 }
168
169 if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
170 return true;
171 }
172 return false;
173 }

References $DIC.

◆ _getCommands()

static ilObjPollAccess::_getCommands ( )
static

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 143 of file class.ilObjPollAccess.php.

144 {
145 $commands = array(
146 array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
147 array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
148 // array("permission" => "write", "cmd" => "export", "lang_var" => "export")
149 );
150
151 return $commands;
152 }

Referenced by ilObjPollListGUI\init().

+ Here is the caller graph for this function:

◆ _isActivated()

static ilObjPollAccess::_isActivated (   $a_ref_id)
static

Is activated?

Parameters
int$a_obj_id
int$a_ref_id
Returns
boolean

Definition at line 113 of file class.ilObjPollAccess.php.

114 {
115 include_once './Services/Object/classes/class.ilObjectActivation.php';
116 $item = ilObjectActivation::getItem($a_ref_id);
117 switch ($item['timing_type']) {
119 if (time() < $item['timing_start'] or
120 time() > $item['timing_end']) {
121 return false;
122 }
123 // fallthrough
124
125 // no break
126 default:
127 return true;
128 }
129 }
static getItem($a_ref_id)
Get item data.

References ilObjectActivation\getItem(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by ilPollBlock\hasAnyContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjPollAccess::_lookupOnline (   $a_obj_id)
static

get status

Definition at line 94 of file class.ilObjPollAccess.php.

95 {
96 global $DIC;
97
98 $ilDB = $DIC->database();
99
100 $result = $ilDB->query("SELECT * FROM il_poll" .
101 " WHERE id = " . $ilDB->quote($a_obj_id, "integer"));
102 $row = $ilDB->fetchAssoc($result);
103 return $row["online_status"];
104 }
$result
global $ilDB

References $DIC, $ilDB, and $result.

Referenced by ilObjPollListGUI\getProperties().

+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjPollAccess::canBeDelivered ( ilWACPath  $ilWACPath)
Parameters
ilWACPath$ilWACPath
Returns
bool

Reimplemented from ilObjectAccess.

Definition at line 181 of file class.ilObjPollAccess.php.

182 {
183 $ilAccess = $this->access;
184 preg_match("/\\/poll_([\\d]*)\\//uism", $ilWACPath->getPath(), $results);
185
186 foreach (ilObject2::_getAllReferences($results[1]) as $ref_id) {
187 if ($ilAccess->checkAccess('read', '', $ref_id)) {
188 return true;
189 }
190 }
191
192 return false;
193 }
static _getAllReferences($a_id)
get all reference ids of object
$results

References $access, $results, ilObject2\_getAllReferences(), and ilWACPath\getPath().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjPollAccess::$access
protected

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

Referenced by _checkAccess(), and canBeDelivered().

◆ $lng

ilObjPollAccess::$lng
protected

Definition at line 25 of file class.ilObjPollAccess.php.

Referenced by _checkAccess().

◆ $rbacsystem

ilObjPollAccess::$rbacsystem
protected

Definition at line 30 of file class.ilObjPollAccess.php.

Referenced by _checkAccess().

◆ $user

ilObjPollAccess::$user
protected

Definition at line 20 of file class.ilObjPollAccess.php.

Referenced by _checkAccess().


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