ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjPollAccess Class Reference

Class ilObjPollAccess. More...

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

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

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.

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

References $ilUser, $lng, and IL_NO_OBJECT_ACCESS.

30  {
31  global $ilUser, $lng, $rbacsystem, $ilAccess;
32 
33  if ($a_user_id == "")
34  {
35  $a_user_id = $ilUser->getId();
36  }
37 
38  // check "global" online switch
39  if(!self::_lookupOnline($a_obj_id) &&
40  !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
41  {
42  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
43  return false;
44  }
45 
46  return true;
47  }
const IL_NO_OBJECT_ACCESS
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17

◆ _checkGoto()

static ilObjPollAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

116  {
117  global $ilAccess;
118 
119  $t_arr = explode("_", $a_target);
120 
121  if ($t_arr[0] != "poll" || ((int) $t_arr[1]) <= 0)
122  {
123  return false;
124  }
125 
126  if ($ilAccess->checkAccess("read", "", $t_arr[1]))
127  {
128  return true;
129  }
130  return false;
131  }

◆ _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 100 of file class.ilObjPollAccess.php.

References array.

Referenced by ilObjPollListGUI\init().

101  {
102  $commands = array
103  (
104  array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
105  array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
106  // array("permission" => "write", "cmd" => "export", "lang_var" => "export")
107  );
108 
109  return $commands;
110  }
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 69 of file class.ilObjPollAccess.php.

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

Referenced by ilPollBlock\hasAnyContent().

70  {
71  include_once './Services/Object/classes/class.ilObjectActivation.php';
72  $item = ilObjectActivation::getItem($a_ref_id);
73  switch($item['timing_type'])
74  {
76  if(time() < $item['timing_start'] or
77  time() > $item['timing_end'])
78  {
79  return false;
80  }
81  // fallthrough
82 
83  default:
84  return true;
85  }
86  }
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 52 of file class.ilObjPollAccess.php.

References $ilDB, $result, and $row.

Referenced by ilObjPollListGUI\getProperties().

53  {
54  global $ilDB;
55 
56  $result = $ilDB->query("SELECT * FROM il_poll".
57  " WHERE id = ".$ilDB->quote($a_obj_id, "integer"));
58  $row = $ilDB->fetchAssoc($result);
59  return $row["online_status"];
60  }
$result
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 139 of file class.ilObjPollAccess.php.

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

139  {
140  global $ilAccess;
141  preg_match("/\\/poll_([\\d]*)\\//uism", $ilWACPath->getPath(), $results);
142 
144  if ($ilAccess->checkAccess('read', '', $ref_id)) {
145  return true;
146  }
147  }
148 
149  return false;
150  }
static _getAllReferences($a_id)
$results
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

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