ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjFileBasedLMAccess Class Reference

Class ilFileBasedLMAccess. More...

+ Inheritance diagram for ilObjFileBasedLMAccess:
+ Collaboration diagram for ilObjFileBasedLMAccess:

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 _getCommands ()
 get commands More...
 
static _determineStartUrl ($a_id)
 determine start url More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _lookupDiskUsage ($a_id)
 Returns the number of bytes used on the harddisk by the learning module with the specified object id. 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 $startfile
 

Protected Attributes

 $user
 
 $lng
 
 $rbacsystem
 
 $access
 

Detailed Description

Class ilFileBasedLMAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilObjFileBasedLMAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjFileBasedLMAccess::__construct ( )

Constructor.

Definition at line 42 of file class.ilObjFileBasedLMAccess.php.

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

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjFileBasedLMAccess::_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 66 of file class.ilObjFileBasedLMAccess.php.

67 {
70 $ilAccess = $this->access;
71
72 if ($a_user_id == "") {
73 $a_user_id = $ilUser->getId();
74 }
75
76 switch ($a_permission) {
77 case "read":
78
79 if (ilObjFileBasedLMAccess::_determineStartUrl($a_obj_id) == "") {
80 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
81 return false;
82 }
83 break;
84 }
85 return true;
86 }
const IL_NO_OBJECT_ACCESS
static _determineStartUrl($a_id)
determine start url
$ilUser
Definition: imgupload.php:18

References $access, $ilUser, $lng, $user, _determineStartUrl(), and IL_NO_OBJECT_ACCESS.

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjFileBasedLMAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 152 of file class.ilObjFileBasedLMAccess.php.

153 {
154 global $DIC;
155
156 $ilAccess = $DIC->access();
157
158 $t_arr = explode("_", $a_target);
159
160 if ($t_arr[0] != "htlm" || ((int) $t_arr[1]) <= 0) {
161 return false;
162 }
163
164 if ($ilAccess->checkAccess("visible", "", $t_arr[1]) ||
165 $ilAccess->checkAccess("read", "", $t_arr[1])) {
166 return true;
167 }
168 return false;
169 }

References $DIC.

◆ _determineStartUrl()

static ilObjFileBasedLMAccess::_determineStartUrl (   $a_id)
static

determine start url

Definition at line 119 of file class.ilObjFileBasedLMAccess.php.

120 {
121 global $DIC;
122
123 $ilDB = $DIC->database();
124
125 if (isset(self::$startfile[$a_id])) {
126 $start_file = self::$startfile[$a_id];
127 } else {
128 $q = "SELECT startfile FROM file_based_lm WHERE id = " . $ilDB->quote($a_id, "integer");
129 $set = $ilDB->query($q);
130 $rec = $ilDB->fetchAssoc($set);
131 $start_file = $rec["startfile"];
132 self::$startfile[$a_id] = $start_file . "";
133 }
134
135 $dir = ilUtil::getWebspaceDir() . "/lm_data/lm_" . $a_id;
136
137 if (($start_file != "") &&
138 (@is_file($dir . "/" . $start_file))) {
139 return "./" . $dir . "/" . $start_file;
140 } elseif (@is_file($dir . "/index.html")) {
141 return "./" . $dir . "/index.html";
142 } elseif (@is_file($dir . "/index.htm")) {
143 return "./" . $dir . "/index.htm";
144 }
145
146 return "";
147 }
static getWebspaceDir($mode="filesystem")
get webspace directory
global $ilDB

References $DIC, $ilDB, and ilUtil\getWebspaceDir().

Referenced by _checkAccess(), ilObjFileBasedLMGUI\executeCommand(), ilObjFileBasedLMListGUI\getProperties(), ilObjFileBasedLMGUI\getSettingsFormValues(), ilObjFileBasedLMGUI\getTabs(), ilObjFileBasedLMGUI\initSettingsForm(), and ilObjFileBasedLMGUI\showLearningModule().

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

◆ _getCommands()

static ilObjFileBasedLMAccess::_getCommands ( )
static

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"), );

Reimplemented from ilObjectAccess.

Definition at line 100 of file class.ilObjFileBasedLMAccess.php.

101 {
102 $commands = array(
103 array("permission" => "read", "cmd" => "view", "lang_var" => "show",
104 "default" => true),
105 array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content"),
106 array("permission" => "write", "cmd" => "properties", "lang_var" => "settings")
107 );
108
109 return $commands;
110 }

Referenced by ilObjFileBasedLMListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupDiskUsage()

static ilObjFileBasedLMAccess::_lookupDiskUsage (   $a_id)
static

Returns the number of bytes used on the harddisk by the learning module with the specified object id.

Parameters
intobject id of a file object.

Definition at line 176 of file class.ilObjFileBasedLMAccess.php.

177 {
178 $lm_data_dir = ilUtil::getWebspaceDir('filesystem') . "/lm_data";
179 $lm_dir = $lm_data_dir . DIRECTORY_SEPARATOR . "lm_" . $a_id;
180
181 return file_exists($lm_dir) ? ilUtil::dirsize($lm_dir) : 0;
182 }
static dirsize($directory)
get size of a directory or a file.

References ilUtil\dirsize(), and ilUtil\getWebspaceDir().

Referenced by ilObjFileBasedLM\getDiskUsage().

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

◆ _preloadData()

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

Preload data.

Parameters
array$a_obj_idsarray of object ids

Reimplemented from ilObjectAccess.

Definition at line 190 of file class.ilObjFileBasedLMAccess.php.

191 {
192 global $DIC;
193
194 $ilDB = $DIC->database();
195
196 $q = "SELECT id, startfile FROM file_based_lm WHERE " .
197 $ilDB->in("id", $a_obj_ids, false, "integer");
198
199 $lm_set = $ilDB->query($q);
200 while ($rec = $ilDB->fetchAssoc($lm_set)) {
201 self::$startfile[$rec["id"]] = $rec["startfile"] . "";
202 }
203 }
$lm_set

References $DIC, $ilDB, and $lm_set.

Field Documentation

◆ $access

ilObjFileBasedLMAccess::$access
protected

Definition at line 36 of file class.ilObjFileBasedLMAccess.php.

Referenced by _checkAccess().

◆ $lng

ilObjFileBasedLMAccess::$lng
protected

Definition at line 26 of file class.ilObjFileBasedLMAccess.php.

Referenced by _checkAccess().

◆ $rbacsystem

ilObjFileBasedLMAccess::$rbacsystem
protected

Definition at line 31 of file class.ilObjFileBasedLMAccess.php.

◆ $startfile

ilObjFileBasedLMAccess::$startfile
static

Definition at line 52 of file class.ilObjFileBasedLMAccess.php.

◆ $user

ilObjFileBasedLMAccess::$user
protected

Definition at line 21 of file class.ilObjFileBasedLMAccess.php.

Referenced by _checkAccess().


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