ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjPollAccess.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Object/classes/class.ilObjectAccess.php");
6require_once('./Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php');
7
16{
29 function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
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 }
48
52 public static function _lookupOnline($a_obj_id)
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 }
61
69 public static function _isActivated($a_ref_id)
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 }
87
100 function _getCommands()
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 }
111
115 function _checkGoto($a_target)
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 }
132
133
139 public function canBeDelivered(ilWACPath $ilWACPath) {
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 }
151}
152
153?>
$result
const IL_NO_OBJECT_ACCESS
Class ilObjPollAccess.
static _isActivated($a_ref_id)
Is activated?
_checkGoto($a_target)
check whether goto script will succeed
_getCommands()
get commands
static _lookupOnline($a_obj_id)
get status
_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::checkAcce...
canBeDelivered(ilWACPath $ilWACPath)
static _getAllReferences($a_id)
get all reference ids of object
Class ilObjectAccess.
static getItem($a_ref_id)
Get item data.
Class ilWACPath.
Class ilWACCheckingClass.
global $lng
Definition: privfeed.php:40
$ref_id
Definition: sahs_server.php:39
$results
global $ilDB
global $ilUser
Definition: imgupload.php:15