ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjSAHSLearningModuleAccess Class Reference

Class ilObjContentObjectAccess. More...

+ Inheritance diagram for ilObjSAHSLearningModuleAccess:
+ Collaboration diagram for ilObjSAHSLearningModuleAccess:

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...
 
 _getCommands ($a_obj_id=null)
 get commands More...
 
 _lookupOnline ($a_id)
 check wether learning module is online More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _lookupDiskUsage ($a_id)
 Returns the number of bytes used on the harddisk by the learning module with the specified object id. More...
 
 _lookupOfflineModeAvailable ($a_id)
 check wether learning module is online 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=0)
 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 _lookupEditable ($a_obj_id)
 Lookup editable. More...
 
static _lookupUserCertificate ($obj_id, $usr_id=0)
 Checks whether a certificate exists for the active user or not. More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status. More...
 
static _lookupUserIsOfflineMode ($a_obj_id)
 Checks offlineMode and returns false if. More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 

Detailed Description

Member Function Documentation

◆ _checkAccess()

ilObjSAHSLearningModuleAccess::_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

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

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

31  {
32  global $ilUser, $lng, $rbacsystem, $ilAccess;
33 
34  if ($a_user_id == "")
35  {
36  $a_user_id = $ilUser->getId();
37  }
38 
39  switch ($a_cmd)
40  {
41  case "view":
42 
44  && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
45  {
46  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
47  return false;
48  }
49  break;
50  }
51 
52  switch ($a_permission)
53  {
54  case "visible":
56  (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
57  {
58  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
59  return false;
60  }
61  break;
62  }
63 
64 
65  return true;
66  }
const IL_NO_OBJECT_ACCESS
global $ilUser
Definition: imgupload.php:15
_lookupOnline($a_id)
check wether learning module is online
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ _checkGoto()

ilObjSAHSLearningModuleAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Definition at line 139 of file class.ilObjSAHSLearningModuleAccess.php.

140  {
141  global $ilAccess;
142 
143  $t_arr = explode("_", $a_target);
144 
145  if ($t_arr[0] != "sahs" || ((int) $t_arr[1]) <= 0)
146  {
147  return false;
148  }
149 
150  if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
151  {
152  return true;
153  }
154  return false;
155  }

◆ _getCommands()

ilObjSAHSLearningModuleAccess::_getCommands (   $a_obj_id = null)

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

Definition at line 80 of file class.ilObjSAHSLearningModuleAccess.php.

References _lookupOfflineModeAvailable(), and _lookupUserIsOfflineMode().

81  {
82  $commands = array
83  (
84  array("permission" => "read", "cmd" => "view", "lang_var" => "show","default" => true),
85  array("permission" => "write", "cmd" => "editContent", "lang_var" => "edit_content"),
86  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
87  );
88  // #14866
91  if ($offlineMode == false) {
92  $commands[]=array("permission" => "read", "cmd" => "offlineModeStart", "lang_var" => "offline_mode");
93  }
94  else {
95  $commands[]=array("permission" => "read", "cmd" => "offlineModeStop", "lang_var" => "offline_mode");
96  $commands[0]=array("permission" => "read", "cmd" => "offlineModeView", "lang_var" => "show","default" => true);
97  }
98  }
99 
100  return $commands;
101  }
_lookupOfflineModeAvailable($a_id)
check wether learning module is online
static _lookupUserIsOfflineMode($a_obj_id)
Checks offlineMode and returns false if.
+ Here is the call graph for this function:

◆ _isOffline()

static ilObjSAHSLearningModuleAccess::_isOffline (   $a_obj_id)
static

Type-specific implementation of general status.

Used in ListGUI and Learning Progress

Parameters
int$a_obj_id
Returns
bool

Definition at line 228 of file class.ilObjSAHSLearningModuleAccess.php.

Referenced by ilObjSAHSLearningModuleListGUI\getProperties().

229  {
230  return !self::_lookupOnline($a_obj_id);
231  }
+ Here is the caller graph for this function:

◆ _lookupDiskUsage()

ilObjSAHSLearningModuleAccess::_lookupDiskUsage (   $a_id)

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 162 of file class.ilObjSAHSLearningModuleAccess.php.

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

Referenced by ilObjSAHSLearningModule\getDiskUsage().

163  {
164  $lm_data_dir = ilUtil::getWebspaceDir('filesystem')."/lm_data";
165  $lm_dir = $lm_data_dir.DIRECTORY_SEPARATOR."lm_".$a_id;
166 
167  return file_exists($lm_dir) ? ilUtil::dirsize($lm_dir) : 0;
168 
169  }
static dirsize($directory)
get size of a directory or a file.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupEditable()

static ilObjSAHSLearningModuleAccess::_lookupEditable (   $a_obj_id)
static

Lookup editable.

Definition at line 124 of file class.ilObjSAHSLearningModuleAccess.php.

Referenced by ilSAHSPresentationGUI\executeCommand(), ilObjSAHSLearningModuleListGUI\getCommandLink(), and ilObjSAHSLearningModuleListGUI\getProperties().

125  {
126  global $ilDB;
127 
128  $set = $ilDB->queryF('SELECT * FROM sahs_lm WHERE id = %s',
129  array('integer'), array($a_obj_id));
130  $rec = $ilDB->fetchAssoc($set);
131 
132  return $rec["editable"];
133  }
+ Here is the caller graph for this function:

◆ _lookupOfflineModeAvailable()

ilObjSAHSLearningModuleAccess::_lookupOfflineModeAvailable (   $a_id)

check wether learning module is online

Definition at line 254 of file class.ilObjSAHSLearningModuleAccess.php.

References ilUtil\yn2tf().

Referenced by _getCommands().

255  {
256  global $ilDB;
257 
258  $set = $ilDB->queryF('SELECT offline_mode FROM sahs_lm WHERE id = %s',
259  array('integer'), array($a_id));
260  $rec = $ilDB->fetchAssoc($set);
261 
262  return ilUtil::yn2tf($rec["offline_mode"]);
263  }
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupOnline()

ilObjSAHSLearningModuleAccess::_lookupOnline (   $a_id)

check wether learning module is online

Definition at line 110 of file class.ilObjSAHSLearningModuleAccess.php.

References ilUtil\yn2tf().

Referenced by _checkAccess().

111  {
112  global $ilDB;
113 
114  $set = $ilDB->queryF('SELECT c_online FROM sahs_lm WHERE id = %s',
115  array('integer'), array($a_id));
116  $rec = $ilDB->fetchAssoc($set);
117 
118  return ilUtil::yn2tf($rec["c_online"]);
119  }
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupUserCertificate()

static ilObjSAHSLearningModuleAccess::_lookupUserCertificate (   $obj_id,
  $usr_id = 0 
)
static

Checks whether a certificate exists for the active user or not.

Parameters
intobj_id Object ID of the SCORM Learning Module
intusr_id Object ID of the user. If not given, the active user will be taken
Returns
true/false

Definition at line 177 of file class.ilObjSAHSLearningModuleAccess.php.

References $ilUser, $usr_id, ilObjUserTracking\_enabledLearningProgress(), ilObjSCORM2004LearningModule\_getCourseCompletionForUser(), ilObjSCORMLearningModule\_getCourseCompletionForUser(), ilLPStatus\_hasUserCompleted(), ilObjSAHSLearningModule\_lookupSubType(), ilCertificate\isActive(), and ilCertificate\isObjectActive().

Referenced by ilSCORMPresentationGUI\downloadCertificate(), ilObjSAHSLearningModuleListGUI\getProperties(), and ilSoapSCORMAdministration\hasSCORMCertificate().

178  {
179  global $ilUser;
180  $uid = ($usr_id) ? $usr_id : $ilUser->getId();
181 
182  $completed = false;
183  // check for certificates
184  include_once "./Services/Certificate/classes/class.ilCertificate.php";
186  {
187  $lpdata = false;
188  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
190  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
192  {
193  include_once "./Services/Tracking/classes/class.ilLPStatus.php";
194  $completed = ilLPStatus::_hasUserCompleted($obj_id, $uid);
195  $lpdata = true;
196  }
197  switch ($type)
198  {
199  case "scorm":
200  if (!$lpdata)
201  {
202  include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
203  $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $uid);
204  }
205  break;
206  case "scorm2004":
207  if (!$lpdata)
208  {
209  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
211  }
212  break;
213  default:
214  break;
215  }
216  }
217  return $completed;
218  }
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static isObjectActive($a_obj_id)
global $ilUser
Definition: imgupload.php:15
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupUserIsOfflineMode()

static ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode (   $a_obj_id)
static

Checks offlineMode and returns false if.

Definition at line 236 of file class.ilObjSAHSLearningModuleAccess.php.

References $ilUser.

Referenced by _getCommands(), ilSAHSPresentationGUI\executeCommand(), and ilObjectListGUI\initItem().

237  {
238  global $ilDB,$ilUser;
239 
240  $user_id = $ilUser->getId();
241 
242  $set = $ilDB->queryF('SELECT offline_mode FROM sahs_user WHERE obj_id = %s AND user_id = %s',
243  array('integer','integer'),
244  array($a_obj_id, $user_id)
245  );
246  $rec = $ilDB->fetchAssoc($set);
247  if ($rec["offline_mode"] == "offline") return true;
248  return false;
249  }
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

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