ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjContentObjectAccess Class Reference

Class ilObjContentObjectAccess. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 _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...
 
- 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...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getLastAccessedPage ($a_ref_id, $a_user_id="")
 get last accessed page More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. 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 if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Public Attributes

static $lo_access
 

Protected Attributes

 $user
 
 $lng
 
 $rbacsystem
 
 $access
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjContentObjectAccess::__construct ( )

Constructor.

Reimplemented in ilObjLearningModuleAccess.

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

42 {
43 global $DIC;
44
45 $this->user = $DIC->user();
46 $this->lng = $DIC->language();
47 $this->rbacsystem = $DIC->rbac()->system();
48 $this->access = $DIC->access();
49 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24

References $DIC, and user().

+ Here is the call graph for this function:

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

66 {
70 $ilAccess = $this->access;
71
72 if ($a_user_id == "") {
73 $a_user_id = $ilUser->getId();
74 }
75
76 switch ($a_cmd) {
77 case "continue":
78
79 // continue is now default and works all the time
80 // see ilLMPresentationGUI::resume()
81 /*
82 if ($ilUser->getId() == ANONYMOUS_USER_ID)
83 {
84 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("lm_no_continue_for_anonym"));
85 return false;
86 }
87 if (ilObjContentObjectAccess::_getLastAccessedPage($a_ref_id,$a_user_id) <= 0)
88 {
89 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("not_accessed_yet"));
90 return false;
91 }
92 */
93 break;
94
95 // for permission query feature
96 case "info":
97 if (!ilObject::lookupOfflineStatus($a_obj_id)) {
98 $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
99 }
100 break;
101
102 }
103
104 return true;
105 }
const IL_STATUS_MESSAGE
static lookupOfflineStatus($a_obj_id)
Lookup offline status using objectDataCache.
$ilUser
Definition: imgupload.php:18

References $access, $ilUser, $lng, $rbacsystem, $user, IL_STATUS_MESSAGE, and ilObject\lookupOfflineStatus().

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjContentObjectAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

157 {
158 global $DIC;
159
160 $ilAccess = $DIC->access();
161
162 $t_arr = explode("_", $a_target);
163
164 if (($t_arr[0] != "lm" && $t_arr[0] != "st"
165 && $t_arr[0] != "pg")
166 || ((int) $t_arr[1]) <= 0) {
167 return false;
168 }
169
170 if ($t_arr[0] == "lm") {
171 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
172 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
173 return true;
174 }
175 } else {
176 if ($t_arr[2] > 0) {
177 $ref_ids = array($t_arr[2]);
178 } else {
179 // determine learning object
180 $lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
181 $ref_ids = ilObject::_getAllReferences($lm_id);
182 }
183 // check read permissions
184 foreach ($ref_ids as $ref_id) {
185 // Permission check
186 if ($ilAccess->checkAccess("read", "", $ref_id)) {
187 return true;
188 }
189 }
190 }
191 return false;
192 }
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _getAllReferences($a_id)
get all reference ids of object

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

+ Here is the call graph for this function:

◆ _getLastAccessedPage()

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

get last accessed page

Parameters
int$a_obj_idcontent object id
int$a_user_iduser object id

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

119 {
120 global $DIC;
121
122 $ilDB = $DIC->database();
123 $ilUser = $DIC->user();
124
125 if ($a_user_id == "") {
126 $a_user_id = $ilUser->getId();
127 }
128
129 if (isset(self::$lo_access[$a_ref_id])) {
130 $acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
131 } else {
132 $q = "SELECT * FROM lo_access WHERE " .
133 "usr_id = " . $ilDB->quote($a_user_id, "integer") . " AND " .
134 "lm_id = " . $ilDB->quote($a_ref_id, "integer");
135
136 $acc_set = $ilDB->query($q);
137 $acc_rec = $ilDB->fetchAssoc($acc_set);
138 }
139
140 if ($acc_rec["obj_id"] > 0) {
141 $lm_id = ilObject::_lookupObjId($a_ref_id);
142 $mtree = new ilTree($lm_id);
143 $mtree->setTableNames('lm_tree', 'lm_data');
144 $mtree->setTreeTablePK("lm_id");
145 if ($mtree->isInTree($acc_rec["obj_id"])) {
146 return $acc_rec["obj_id"];
147 }
148 }
149
150 return 0;
151 }
static _lookupObjId($a_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
global $ilDB

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

Referenced by ilLMNavigationStatus\determineStatus().

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

◆ _preloadData()

static ilObjContentObjectAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)
static

Preload data.

Parameters
array$a_obj_idsarray of object ids

Reimplemented from ilObjectAccess.

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

200 {
201 global $DIC;
202
203 $ilDB = $DIC->database();
204 $ilUser = $DIC->user();
205
206 $q = "SELECT obj_id, lm_id FROM lo_access WHERE " .
207 "usr_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
208 $ilDB->in("lm_id", $a_ref_ids, false, "integer");
209 ;
210 $set = $ilDB->query($q);
211 foreach ($a_ref_ids as $r) {
212 self::$lo_access[$r] = 0;
213 }
214 while ($rec = $ilDB->fetchAssoc($set)) {
215 self::$lo_access[$rec["lm_id"]] = $rec["obj_id"];
216 }
217 }

References $DIC, $ilDB, and $ilUser.

Field Documentation

◆ $access

ilObjContentObjectAccess::$access
protected

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

Referenced by _checkAccess().

◆ $lng

ilObjContentObjectAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $lo_access

ilObjContentObjectAccess::$lo_access
static

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

◆ $rbacsystem

ilObjContentObjectAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjContentObjectAccess::$user
protected

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

Referenced by _checkAccess().


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