ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjContentObjectAccess Class Reference

Class ilObjContentObjectAccess. More...

+ Inheritance diagram for ilObjContentObjectAccess:
+ Collaboration diagram for ilObjContentObjectAccess:

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...
 
 _lookupOnline ($a_id)
 check wether learning module is online More...
 
 _getLastAccessedPage ($a_ref_id, $a_user_id="")
 get last accessed page More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. 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)
 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 _isOffline ($a_obj_id)
 Type-specific implementation of general status. More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 

Static Public Attributes

static $online
 
static $lo_access
 

Detailed Description

Member Function Documentation

◆ _checkAccess()

ilObjContentObjectAccess::_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 34 of file class.ilObjContentObjectAccess.php.

35 {
36 global $ilUser, $lng, $rbacsystem, $ilAccess;
37
38 if ($a_user_id == "")
39 {
40 $a_user_id = $ilUser->getId();
41 }
42
43 switch ($a_cmd)
44 {
45 case "view":
46
48 && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
49 {
50 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
51 return false;
52 }
53 break;
54
55 case "continue":
56 if(!$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
57 {
59 {
60 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
61 return false;
62 }
63 }
64
65 // continue is now default and works all the time
66 // see ilLMPresentationGUI::resume()
67 /*
68 if ($ilUser->getId() == ANONYMOUS_USER_ID)
69 {
70 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("lm_no_continue_for_anonym"));
71 return false;
72 }
73 if (ilObjContentObjectAccess::_getLastAccessedPage($a_ref_id,$a_user_id) <= 0)
74 {
75 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("not_accessed_yet"));
76 return false;
77 }
78 */
79 break;
80
81 // for permission query feature
82 case "info":
84 {
85 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
86 }
87 else
88 {
89 $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
90 }
91 break;
92
93 }
94
95 switch ($a_permission)
96 {
97 case "read":
98 case "visible":
100 (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
101 {
102 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
103 return false;
104 }
105 break;
106 }
107
108
109 return true;
110 }
const IL_NO_OBJECT_ACCESS
_lookupOnline($a_id)
check wether learning module is online
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15

References $ilUser, $lng, _lookupOnline(), and IL_NO_OBJECT_ACCESS.

+ Here is the call graph for this function:

◆ _checkGoto()

ilObjContentObjectAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 185 of file class.ilObjContentObjectAccess.php.

186 {
187 global $ilAccess;
188
189 $t_arr = explode("_", $a_target);
190
191 if (($t_arr[0] != "lm" && $t_arr[0] != "dbk" && $t_arr[0] != "st"
192 && $t_arr[0] != "pg")
193 || ((int) $t_arr[1]) <= 0)
194 {
195 return false;
196 }
197
198 if ($t_arr[0] == "lm" || $t_arr[0] == "dbk")
199 {
200 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
201 $ilAccess->checkAccess("visible", "", $t_arr[1]))
202 {
203 return true;
204 }
205 }
206 else
207 {
208 if ($t_arr[2] > 0)
209 {
210 $ref_ids = array($t_arr[2]);
211 }
212 else
213 {
214 // determine learning object
215 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
216 $lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
217 $ref_ids = ilObject::_getAllReferences($lm_id);
218 }
219 // check read permissions
220 foreach ($ref_ids as $ref_id)
221 {
222 // Permission check
223 if ($ilAccess->checkAccess("read", "", $ref_id))
224 {
225 return true;
226 }
227 }
228
229 }
230 return false;
231 }
_lookupContObjID($a_id)
get learning module / digibook id for lm object
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39

References $ref_id, ilObject\_getAllReferences(), and ilLMObject\_lookupContObjID().

+ Here is the call graph for this function:

◆ _getLastAccessedPage()

ilObjContentObjectAccess::_getLastAccessedPage (   $a_ref_id,
  $a_user_id = "" 
)

get last accessed page

Parameters
int$a_obj_idcontent object id
int$a_user_iduser object id

Definition at line 144 of file class.ilObjContentObjectAccess.php.

145 {
146 global $ilDB, $ilUser;
147
148 if ($a_user_id == "")
149 {
150 $a_user_id = $ilUser->getId();
151 }
152
153 if (isset(self::$lo_access[$a_ref_id]))
154 {
155 $acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
156 }
157 else
158 {
159 $q = "SELECT * FROM lo_access WHERE ".
160 "usr_id = ".$ilDB->quote($a_user_id, "integer")." AND ".
161 "lm_id = ".$ilDB->quote($a_ref_id, "integer");
162
163 $acc_set = $ilDB->query($q);
164 $acc_rec = $ilDB->fetchAssoc($acc_set);
165 }
166
167 if ($acc_rec["obj_id"] > 0)
168 {
169 $lm_id = ilObject::_lookupObjId($a_ref_id);
170 $mtree = new ilTree($lm_id);
171 $mtree->setTableNames('lm_tree','lm_data');
172 $mtree->setTreeTablePK("lm_id");
173 if ($mtree->isInTree($acc_rec["obj_id"]))
174 {
175 return $acc_rec["obj_id"];
176 }
177 }
178
179 return 0;
180 }
static _lookupObjId($a_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
global $ilDB

References $ilDB, $ilUser, and ilObject\_lookupObjId().

Referenced by ilObjDlBookListGUI\initItem(), and ilLMPresentationGUI\resume().

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

◆ _isOffline()

static ilObjContentObjectAccess::_isOffline (   $a_obj_id)
static

Type-specific implementation of general status.

Used in ListGUI and Learning Progress

Parameters
int$a_obj_id
Returns
bool

Reimplemented from ilObjectAccess.

Definition at line 241 of file class.ilObjContentObjectAccess.php.

242 {
243 return !self::_lookupOnline($a_obj_id);
244 }

References _lookupOnline().

Referenced by ilObjDlBookListGUI\getProperties(), and ilObjLearningModuleListGUI\getProperties().

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

◆ _lookupOnline()

ilObjContentObjectAccess::_lookupOnline (   $a_id)

check wether learning module is online

Parameters
int$a_idlearning object id

Definition at line 121 of file class.ilObjContentObjectAccess.php.

122 {
123 global $ilDB;
124
125 if (isset(self::$online[$a_id]))
126 {
127 return self::$online[$a_id];
128 }
129
130 $q = "SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id, "integer");
131 $lm_set = $ilDB->query($q);
132 $lm_rec = $ilDB->fetchAssoc($lm_set);
133
134 self::$online[$a_id] = ilUtil::yn2tf($lm_rec["is_online"]);
135 return ilUtil::yn2tf($lm_rec["is_online"]);
136 }
static yn2tf($a_yn)
convert "y"/"n" to true/false
$lm_set

References $ilDB, $lm_set, and ilUtil\yn2tf().

Referenced by _checkAccess(), and _isOffline().

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

◆ _preloadData()

ilObjContentObjectAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)

Preload data.

Parameters
array$a_obj_idsarray of object ids

Reimplemented from ilObjectAccess.

Definition at line 251 of file class.ilObjContentObjectAccess.php.

252 {
253 global $ilDB, $ilUser;
254
255 $q = "SELECT id, is_online FROM content_object WHERE ".
256 $ilDB->in("id", $a_obj_ids, false, "integer");
257
258 $lm_set = $ilDB->query($q);
259 while ($rec = $ilDB->fetchAssoc($lm_set))
260 {
261 self::$online[$rec["id"]] = ilUtil::yn2tf($rec["is_online"]);
262 }
263
264 $q = "SELECT obj_id, lm_id FROM lo_access WHERE ".
265 "usr_id = ".$ilDB->quote($ilUser->getId(), "integer")." AND ".
266 $ilDB->in("lm_id", $a_ref_ids, false, "integer");;
267 $set = $ilDB->query($q);
268 foreach ($a_ref_ids as $r)
269 {
270 self::$lo_access[$r] = 0;
271 }
272 while ($rec = $ilDB->fetchAssoc($set))
273 {
274 self::$lo_access[$rec["lm_id"]] = $rec["obj_id"];
275 }
276
277 }
$r
Definition: example_031.php:79

References $ilDB, $ilUser, $lm_set, $r, and ilUtil\yn2tf().

+ Here is the call graph for this function:

Field Documentation

◆ $lo_access

ilObjContentObjectAccess::$lo_access
static

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

◆ $online

ilObjContentObjectAccess::$online
static

Definition at line 19 of file class.ilObjContentObjectAccess.php.


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