ILIAS  release_8 Revision v8.23
ilObjFileBasedLMAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct ()
 
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 
static _determineStartUrl (int $a_id)
 
static _checkGoto (string $target)
 
static _lookupDiskUsage (int $a_id)
 Returns the number of bytes used on the harddisk by the learning module with the specified object id. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 
static isInfoEnabled (int $obj_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Static Public Attributes

static array $startfile = []
 

Protected Attributes

ilObjUser $user
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilAccessHandler $access
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilObjFileBasedLMAccess::__construct ( )

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

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

32  {
33  global $DIC;
34 
35  $this->user = $DIC->user();
36  $this->lng = $DIC->language();
37  $this->rbacsystem = $DIC->rbac()->system();
38  $this->access = $DIC->access();
39  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjFileBasedLMAccess::_checkAccess ( string  $cmd,
string  $permission,
int  $ref_id,
int  $obj_id,
?int  $user_id = null 
)

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

References $access, $lng, ilRBACAccessHandler\addInfoItem(), ilAccessInfo\IL_NO_OBJECT_ACCESS, and ilLanguage\txt().

41  : bool
42  {
43  $lng = $this->lng;
44  $ilAccess = $this->access;
45 
46  switch ($permission) {
47  case "read":
48 
49  if (self::_determineStartUrl($obj_id) === "") {
50  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
51  return false;
52  }
53  break;
54  }
55  return true;
56  }
addInfoItem(string $a_type, string $a_text, string $a_data="")
add an info item to current info object
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjFileBasedLMAccess::_checkGoto ( string  $target)
static

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

References $DIC.

104  : bool
105  {
106  global $DIC;
107 
108  $ilAccess = $DIC->access();
109 
110  $t_arr = explode("_", $target);
111 
112  if ($t_arr[0] !== "htlm" || ((int) $t_arr[1]) <= 0) {
113  return false;
114  }
115 
116  if ($ilAccess->checkAccess("visible", "", $t_arr[1]) ||
117  $ilAccess->checkAccess("read", "", $t_arr[1])) {
118  return true;
119  }
120  return false;
121  }
global $DIC
Definition: feed.php:28

◆ _determineStartUrl()

static ilObjFileBasedLMAccess::_determineStartUrl ( int  $a_id)
static

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

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

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

74  : string
75  {
76  global $DIC;
77 
78  $ilDB = $DIC->database();
79 
80  if (isset(self::$startfile[$a_id])) {
81  $start_file = self::$startfile[$a_id];
82  } else {
83  $q = "SELECT startfile FROM file_based_lm WHERE id = " . $ilDB->quote($a_id, "integer");
84  $set = $ilDB->query($q);
85  $rec = $ilDB->fetchAssoc($set);
86  $start_file = $rec["startfile"];
87  self::$startfile[$a_id] = $start_file . "";
88  }
89 
90  $dir = ilFileUtils::getWebspaceDir() . "/lm_data/lm_" . $a_id;
91 
92  if (($start_file !== "") &&
93  (is_file($dir . "/" . $start_file))) {
94  return "./" . $dir . "/" . $start_file;
95  } elseif (is_file($dir . "/index.html")) {
96  return "./" . $dir . "/index.html";
97  } elseif (is_file($dir . "/index.htm")) {
98  return "./" . $dir . "/index.htm";
99  }
100 
101  return "";
102  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getCommands()

static ilObjFileBasedLMAccess::_getCommands ( )
static

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

Referenced by ilObjFileBasedLMListGUI\init().

58  : array
59  {
60  return [
61  [
62  "permission" => "read", "cmd" => "view", "lang_var" => "show",
63  "default" => true
64  ],
65  ["permission" => "write", "cmd" => "edit", "lang_var" => "edit_content"],
66  ["permission" => "write", "cmd" => "properties", "lang_var" => "settings"]
67  ];
68  }
+ Here is the caller graph for this function:

◆ _lookupDiskUsage()

static ilObjFileBasedLMAccess::_lookupDiskUsage ( int  $a_id)
static

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

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

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

127  : int
128  {
129  $lm_data_dir = ilFileUtils::getWebspaceDir('filesystem') . "/lm_data";
130  $lm_dir = $lm_data_dir . DIRECTORY_SEPARATOR . "lm_" . $a_id;
131 
132  return file_exists($lm_dir) ? ilFileUtils::dirsize($lm_dir) : 0;
133  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static dirsize(string $directory)
get size of a directory or a file.
+ Here is the call graph for this function:

◆ _preloadData()

static ilObjFileBasedLMAccess::_preloadData ( array  $obj_ids,
array  $ref_ids 
)
static

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

References $DIC, $ilDB, and $lm_set.

135  : void
136  {
137  global $DIC;
138 
139  $ilDB = $DIC->database();
140 
141  $q = "SELECT id, startfile FROM file_based_lm WHERE " .
142  $ilDB->in("id", $obj_ids, false, "integer");
143 
144  $lm_set = $ilDB->query($q);
145  while ($rec = $ilDB->fetchAssoc($lm_set)) {
146  self::$startfile[$rec["id"]] = $rec["startfile"] . "";
147  }
148  }
global $DIC
Definition: feed.php:28
$lm_set

◆ isInfoEnabled()

static ilObjFileBasedLMAccess::isInfoEnabled ( int  $obj_id)
static

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

References ilContainer\_lookupContainerSetting(), and ilObjectServiceSettingsGUI\INFO_TAB_VISIBILITY.

Referenced by ilObjFileBasedLMListGUI\getInfoScreenStatus().

150  : bool
151  {
153  $obj_id,
155  true
156  );
157  }
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjFileBasedLMAccess::$access
protected

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

Referenced by _checkAccess().

◆ $lng

ilLanguage ilObjFileBasedLMAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilRbacSystem ilObjFileBasedLMAccess::$rbacsystem
protected

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

◆ $startfile

array ilObjFileBasedLMAccess::$startfile = []
static

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

◆ $user

ilObjUser ilObjFileBasedLMAccess::$user
protected

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


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