ILIAS  release_4-4 Revision
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...
 
 _getCommands ()
 get commands 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

static _lookupOnline ($a_obj_id)
 get status More...
 
static _isActivated ($a_ref_id)
 Is activated? More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. 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 14 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 28 of file class.ilObjPollAccess.php.

References $ilUser, $lng, and IL_NO_OBJECT_ACCESS.

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

◆ _checkGoto()

ilObjPollAccess::_checkGoto (   $a_target)

check whether goto script will succeed

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

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

◆ _getCommands()

ilObjPollAccess::_getCommands ( )

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

Referenced by ilObjPollListGUI\init().

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

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

Referenced by ilPollBlock\hasAnyContent().

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

References $result, and $row.

Referenced by ilObjPollListGUI\getProperties().

52  {
53  global $ilDB;
54 
55  $result = $ilDB->query("SELECT * FROM il_poll".
56  " WHERE id = ".$ilDB->quote($a_obj_id, "integer"));
57  $row = $ilDB->fetchAssoc($result);
58  return $row["online_status"];
59  }
$result
+ Here is the caller graph for this function:

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