ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

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. 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.

References $DIC, and user().

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  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ 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

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

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

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

◆ _checkGoto()

static ilObjPollAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

References $DIC.

151  {
152  global $DIC;
153 
154  $ilAccess = $DIC->access();
155 
156  $t_arr = explode("_", $a_target);
157 
158  if ($t_arr[0] != "poll" || ((int) $t_arr[1]) <= 0) {
159  return false;
160  }
161 
162  if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
163  return true;
164  }
165  return false;
166  }
global $DIC
Definition: saml.php:7

◆ _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"), );

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

References array.

Referenced by ilObjPollListGUI\init().

137  {
138  $commands = array(
139  array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
140  array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
141  // array("permission" => "write", "cmd" => "export", "lang_var" => "export")
142  );
143 
144  return $commands;
145  }
Create styles array
The data for the language used.
+ 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 106 of file class.ilObjPollAccess.php.

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

Referenced by ilPollBlock\hasAnyContent().

107  {
108  include_once './Services/Object/classes/class.ilObjectActivation.php';
109  $item = ilObjectActivation::getItem($a_ref_id);
110  switch ($item['timing_type']) {
112  if (time() < $item['timing_start'] or
113  time() > $item['timing_end']) {
114  return false;
115  }
116  // fallthrough
117 
118  // no break
119  default:
120  return true;
121  }
122  }
static getItem($a_ref_id)
Get item data.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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 87 of file class.ilObjPollAccess.php.

References $DIC, $ilDB, $result, and $row.

Referenced by ilObjPollListGUI\getProperties().

88  {
89  global $DIC;
90 
91  $ilDB = $DIC->database();
92 
93  $result = $ilDB->query("SELECT * FROM il_poll" .
94  " WHERE id = " . $ilDB->quote($a_obj_id, "integer"));
95  $row = $ilDB->fetchAssoc($result);
96  return $row["online_status"];
97  }
$result
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ canBeDelivered()

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

Implements ilWACCheckingClass.

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

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

175  {
176  $ilAccess = $this->access;
177  preg_match("/\\/poll_([\\d]*)\\//uism", $ilWACPath->getPath(), $results);
178 
179  foreach (ilObject2::_getAllReferences($results[1]) as $ref_id) {
180  if ($ilAccess->checkAccess('read', '', $ref_id)) {
181  return true;
182  }
183  }
184 
185  return false;
186  }
static _getAllReferences($a_id)
$results
Definition: svg-scanner.php:47
+ 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: