ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
57 // no continue command for anonymous user
58 if ($ilUser->getId() == ANONYMOUS_USER_ID)
59 {
60 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("lm_no_continue_for_anonym"));
61 return false;
62 }
63
65 && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
66 {
67 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
68 return false;
69 }
70
71 if (ilObjContentObjectAccess::_getLastAccessedPage($a_ref_id,$a_user_id) <= 0)
72 {
73 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("not_accessed_yet"));
74 return false;
75 }
76 break;
77
78 // for permission query feature
79 case "info":
81 {
82 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
83 }
84 else
85 {
86 $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
87 }
88 break;
89
90 }
91
92 switch ($a_permission)
93 {
94 case "read":
95 case "visible":
97 (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
98 {
99 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
100 return false;
101 }
102 break;
103 }
104
105
106 return true;
107 }
const IL_NO_OBJECT_ACCESS
_lookupOnline($a_id)
check wether learning module is online
_getLastAccessedPage($a_ref_id, $a_user_id="")
get last accessed page
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15

References $ilUser, $lng, _getLastAccessedPage(), _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 182 of file class.ilObjContentObjectAccess.php.

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

142 {
143 global $ilDB, $ilUser;
144
145 if ($a_user_id == "")
146 {
147 $a_user_id = $ilUser->getId();
148 }
149
150 if (isset(self::$lo_access[$a_ref_id]))
151 {
152 $acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
153 }
154 else
155 {
156 $q = "SELECT * FROM lo_access WHERE ".
157 "usr_id = ".$ilDB->quote($a_user_id, "integer")." AND ".
158 "lm_id = ".$ilDB->quote($a_ref_id, "integer");
159
160 $acc_set = $ilDB->query($q);
161 $acc_rec = $ilDB->fetchAssoc($acc_set);
162 }
163
164 if ($acc_rec["obj_id"] > 0)
165 {
166 $lm_id = ilObject::_lookupObjId($a_ref_id);
167 $mtree = new ilTree($lm_id);
168 $mtree->setTableNames('lm_tree','lm_data');
169 $mtree->setTreeTablePK("lm_id");
170 if ($mtree->isInTree($acc_rec["obj_id"]))
171 {
172 return $acc_rec["obj_id"];
173 }
174 }
175
176 return 0;
177 }
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 _checkAccess(), ilObjDlBookListGUI\initItem(), and ilObjLearningModuleListGUI\initItem().

+ 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 238 of file class.ilObjContentObjectAccess.php.

239 {
240 return !self::_lookupOnline($a_obj_id);
241 }

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 118 of file class.ilObjContentObjectAccess.php.

119 {
120 global $ilDB;
121
122 if (isset(self::$online[$a_id]))
123 {
124 return self::$online[$a_id];
125 }
126
127 $q = "SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id, "integer");
128 $lm_set = $ilDB->query($q);
129 $lm_rec = $ilDB->fetchAssoc($lm_set);
130
131 self::$online[$a_id] = ilUtil::yn2tf($lm_rec["is_online"]);
132 return ilUtil::yn2tf($lm_rec["is_online"]);
133 }
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 248 of file class.ilObjContentObjectAccess.php.

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

References $ilDB, $ilUser, $lm_set, 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: