ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
- 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...
 

Static Public Member Functions

static getConditionOperators ()
 Get possible conditions operaditors. More...
 
static checkCondition ($a_trigger_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
static _getCommands ($a_obj_id=null)
 get commands More...
 
static _lookupOnline ($a_id)
 check wether learning module is online More...
 
static _lookupEditable ($a_obj_id)
 Lookup editable. 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 _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 _lookupOfflineModeAvailable ($a_id)
 check wether learning module is online 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. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. 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 73 of file class.ilObjSAHSLearningModuleAccess.php.

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

74  {
75  global $ilUser, $lng, $rbacsystem, $ilAccess;
76 
77  if ($a_user_id == "") {
78  $a_user_id = $ilUser->getId();
79  }
80 
81  switch ($a_cmd) {
82  case "view":
83 
85  && !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
86  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
87  return false;
88  }
89  break;
90  }
91 
92  switch ($a_permission) {
93  case "visible":
95  (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))) {
96  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
97  return false;
98  }
99  break;
100  }
101 
102 
103  return true;
104  }
const IL_NO_OBJECT_ACCESS
static _lookupOnline($a_id)
check wether learning module is online
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjSAHSLearningModuleAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

182  {
183  global $ilAccess;
184 
185  $t_arr = explode("_", $a_target);
186 
187  if ($t_arr[0] != "sahs" || ((int) $t_arr[1]) <= 0) {
188  return false;
189  }
190 
191  if ($ilAccess->checkAccess("visible", "", $t_arr[1]) || $ilAccess->checkAccess("read", "", $t_arr[1])) {
192  return true;
193  }
194  return false;
195  }

◆ _getCommands()

static ilObjSAHSLearningModuleAccess::_getCommands (   $a_obj_id = null)
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"), );

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

References _lookupOfflineModeAvailable(), _lookupUserIsOfflineMode(), and array.

119  {
120  $commands = array(
121  array("permission" => "read", "cmd" => "view", "lang_var" => "show","default" => true),
122  array("permission" => "write", "cmd" => "editContent", "lang_var" => "edit_content"),
123  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
124  );
125  // #14866
128  if ($offlineMode == false) {
129  $commands[]=array("permission" => "read", "cmd" => "offlineModeStart", "lang_var" => "offline_mode");
130  } else {
131  $commands[]=array("permission" => "read", "cmd" => "offlineModeStop", "lang_var" => "offline_mode");
132  $commands[0]=array("permission" => "read", "cmd" => "offlineModeView", "lang_var" => "show","default" => true);
133  }
134  }
135 
136  return $commands;
137  }
static _lookupUserIsOfflineMode($a_obj_id)
Checks offlineMode and returns false if.
static _lookupOfflineModeAvailable($a_id)
check wether learning module is online
Create styles array
The data for the language used.
+ 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 262 of file class.ilObjSAHSLearningModuleAccess.php.

Referenced by ilObjSAHSLearningModuleListGUI\getProperties().

263  {
264  return !self::_lookupOnline($a_obj_id);
265  }
+ Here is the caller graph for this function:

◆ _lookupDiskUsage()

static ilObjSAHSLearningModuleAccess::_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 202 of file class.ilObjSAHSLearningModuleAccess.php.

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

Referenced by ilObjSAHSLearningModule\getDiskUsage().

203  {
204  $lm_data_dir = ilUtil::getWebspaceDir('filesystem') . "/lm_data";
205  $lm_dir = $lm_data_dir . DIRECTORY_SEPARATOR . "lm_" . $a_id;
206 
207  return file_exists($lm_dir) ? ilUtil::dirsize($lm_dir) : 0;
208  }
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 163 of file class.ilObjSAHSLearningModuleAccess.php.

References $ilDB, and array.

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

164  {
165  global $ilDB;
166 
167  $set = $ilDB->queryF(
168  'SELECT * FROM sahs_lm WHERE id = %s',
169  array('integer'),
170  array($a_obj_id)
171  );
172  $rec = $ilDB->fetchAssoc($set);
173 
174  return $rec["editable"];
175  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupOfflineModeAvailable()

static ilObjSAHSLearningModuleAccess::_lookupOfflineModeAvailable (   $a_id)
static

check wether learning module is online

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

References $ilDB, array, and ilUtil\yn2tf().

Referenced by _getCommands().

292  {
293  global $ilDB;
294 
295  $set = $ilDB->queryF(
296  'SELECT offline_mode FROM sahs_lm WHERE id = %s',
297  array('integer'),
298  array($a_id)
299  );
300  $rec = $ilDB->fetchAssoc($set);
301 
302  return ilUtil::yn2tf($rec["offline_mode"]);
303  }
Create styles array
The data for the language used.
global $ilDB
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()

static ilObjSAHSLearningModuleAccess::_lookupOnline (   $a_id)
static

check wether learning module is online

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

References $ilDB, array, and ilUtil\yn2tf().

Referenced by _checkAccess().

147  {
148  global $ilDB;
149 
150  $set = $ilDB->queryF(
151  'SELECT c_online FROM sahs_lm WHERE id = %s',
152  array('integer'),
153  array($a_id)
154  );
155  $rec = $ilDB->fetchAssoc($set);
156 
157  return ilUtil::yn2tf($rec["c_online"]);
158  }
Create styles array
The data for the language used.
global $ilDB
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 216 of file class.ilObjSAHSLearningModuleAccess.php.

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

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

217  {
218  global $ilUser;
219  $uid = ($usr_id) ? $usr_id : $ilUser->getId();
220 
221  $completed = false;
222  // check for certificates
223  include_once "./Services/Certificate/classes/class.ilCertificate.php";
225  $lpdata = false;
226  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
228  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
230  include_once "./Services/Tracking/classes/class.ilLPStatus.php";
231  $completed = ilLPStatus::_hasUserCompleted($obj_id, $uid);
232  $lpdata = true;
233  }
234  switch ($type) {
235  case "scorm":
236  if (!$lpdata) {
237  include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
238  $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $uid);
239  }
240  break;
241  case "scorm2004":
242  if (!$lpdata) {
243  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
245  }
246  break;
247  default:
248  break;
249  }
250  }
251  return $completed;
252  }
$type
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
$ilUser
Definition: imgupload.php:18
static isObjectActive($a_obj_id)
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 270 of file class.ilObjSAHSLearningModuleAccess.php.

References $ilDB, $ilUser, and array.

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

271  {
272  global $ilDB,$ilUser;
273 
274  $user_id = $ilUser->getId();
275 
276  $set = $ilDB->queryF(
277  'SELECT offline_mode FROM sahs_user WHERE obj_id = %s AND user_id = %s',
278  array('integer','integer'),
279  array($a_obj_id, $user_id)
280  );
281  $rec = $ilDB->fetchAssoc($set);
282  if ($rec["offline_mode"] == "offline") {
283  return true;
284  }
285  return false;
286  }
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ checkCondition()

static ilObjSAHSLearningModuleAccess::checkCondition (   $a_trigger_obj_id,
  $a_operator,
  $a_value,
  $a_usr_id 
)
static

check condition

Parameters
type$a_svy_id
type$a_operator
type$a_value
type$a_usr_id
Returns
boolean

Implements ilConditionHandling.

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

References ilLPStatus\_hasUserCompleted(), ilLPStatus\_lookupStatus(), ilLPStatus\LP_STATUS_FAILED_NUM, ilConditionHandler\OPERATOR_FAILED, and ilConditionHandler\OPERATOR_FINISHED.

42  {
43  switch ($a_operator) {
44 
46  include_once './Services/Tracking/classes/class.ilLPStatus.php';
47  return ilLPStatus::_lookupStatus($a_trigger_obj_id, $a_usr_id) == ilLPStatus::LP_STATUS_FAILED_NUM;
48  break;
49 
51  default:
52  include_once './Services/Tracking/classes/class.ilLPStatus.php';
53  return ilLPStatus::_hasUserCompleted($a_trigger_obj_id, $a_usr_id);
54 
55  }
56  return true;
57  }
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:

◆ getConditionOperators()

static ilObjSAHSLearningModuleAccess::getConditionOperators ( )
static

Get possible conditions operaditors.

Implements ilConditionHandling.

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

References array, ilConditionHandler\OPERATOR_FAILED, and ilConditionHandler\OPERATOR_FINISHED.

24  {
25  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
26  return array(
29  );
30  }
Create styles array
The data for the language used.

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