ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 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 getConditionOperators ()
 Get possible conditions operaditors. More...
 
static checkCondition ($a_trigger_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
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 _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 
static getConditionOperators ()
 Returns an array with valid operators for the specific object type. More...
 
static checkCondition ($a_trigger_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition for a specific user and object 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

Reimplemented from ilObjectAccess.

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

75 {
76 global $ilUser, $lng, $rbacsystem, $ilAccess;
77
78 if ($a_user_id == "")
79 {
80 $a_user_id = $ilUser->getId();
81 }
82
83 switch ($a_cmd)
84 {
85 case "view":
86
88 && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
89 {
90 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
91 return false;
92 }
93 break;
94 }
95
96 switch ($a_permission)
97 {
98 case "visible":
100 (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
101 {
102 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
103 return false;
104 }
105 break;
106 }
107
108
109 return true;
110 }
const IL_NO_OBJECT_ACCESS
_lookupOnline($a_id)
check wether learning module is online
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ _checkGoto()

ilObjSAHSLearningModuleAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

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

◆ _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 124 of file class.ilObjSAHSLearningModuleAccess.php.

125 {
126 $commands = array
127 (
128 array("permission" => "read", "cmd" => "view", "lang_var" => "show","default" => true),
129 array("permission" => "write", "cmd" => "editContent", "lang_var" => "edit_content"),
130 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
131 );
132 // #14866
135 if ($offlineMode == false) {
136 $commands[]=array("permission" => "read", "cmd" => "offlineModeStart", "lang_var" => "offline_mode");
137 }
138 else {
139 $commands[]=array("permission" => "read", "cmd" => "offlineModeStop", "lang_var" => "offline_mode");
140 $commands[0]=array("permission" => "read", "cmd" => "offlineModeView", "lang_var" => "show","default" => true);
141 }
142 }
143
144 return $commands;
145 }
static _lookupUserIsOfflineMode($a_obj_id)
Checks offlineMode and returns false if.
_lookupOfflineModeAvailable($a_id)
check wether learning module is online

References _lookupOfflineModeAvailable(), and _lookupUserIsOfflineMode().

+ 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

Reimplemented from ilObjectAccess.

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

273 {
274 return !self::_lookupOnline($a_obj_id);
275 }

References _lookupOnline().

Referenced by ilObjSAHSLearningModuleListGUI\getProperties().

+ Here is the call graph for this function:
+ 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 206 of file class.ilObjSAHSLearningModuleAccess.php.

207 {
208 $lm_data_dir = ilUtil::getWebspaceDir('filesystem')."/lm_data";
209 $lm_dir = $lm_data_dir.DIRECTORY_SEPARATOR."lm_".$a_id;
210
211 return file_exists($lm_dir) ? ilUtil::dirsize($lm_dir) : 0;
212
213 }
static getWebspaceDir($mode="filesystem")
get webspace directory
static dirsize($directory)
get size of a directory or a file.

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

Referenced by ilObjSAHSLearningModule\getDiskUsage().

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

169 {
170 global $ilDB;
171
172 $set = $ilDB->queryF('SELECT * FROM sahs_lm WHERE id = %s',
173 array('integer'), array($a_obj_id));
174 $rec = $ilDB->fetchAssoc($set);
175
176 return $rec["editable"];
177 }
global $ilDB

References $ilDB.

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

+ Here is the caller graph for this function:

◆ _lookupOfflineModeAvailable()

ilObjSAHSLearningModuleAccess::_lookupOfflineModeAvailable (   $a_id)

check wether learning module is online

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

299 {
300 global $ilDB;
301
302 $set = $ilDB->queryF('SELECT offline_mode FROM sahs_lm WHERE id = %s',
303 array('integer'), array($a_id));
304 $rec = $ilDB->fetchAssoc($set);
305
306 return ilUtil::yn2tf($rec["offline_mode"]);
307 }
static yn2tf($a_yn)
convert "y"/"n" to true/false

References $ilDB, and ilUtil\yn2tf().

Referenced by _getCommands().

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

155 {
156 global $ilDB;
157
158 $set = $ilDB->queryF('SELECT c_online FROM sahs_lm WHERE id = %s',
159 array('integer'), array($a_id));
160 $rec = $ilDB->fetchAssoc($set);
161
162 return ilUtil::yn2tf($rec["c_online"]);
163 }

References $ilDB, and ilUtil\yn2tf().

Referenced by _checkAccess(), and _isOffline().

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

222 {
223 global $ilUser;
224 $uid = ($usr_id) ? $usr_id : $ilUser->getId();
225
226 $completed = false;
227 // check for certificates
228 include_once "./Services/Certificate/classes/class.ilCertificate.php";
230 {
231 $lpdata = false;
232 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
234 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
236 {
237 include_once "./Services/Tracking/classes/class.ilLPStatus.php";
238 $completed = ilLPStatus::_hasUserCompleted($obj_id, $uid);
239 $lpdata = true;
240 }
241 switch ($type)
242 {
243 case "scorm":
244 if (!$lpdata)
245 {
246 include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
248 }
249 break;
250 case "scorm2004":
251 if (!$lpdata)
252 {
253 include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
255 }
256 break;
257 default:
258 break;
259 }
260 }
261 return $completed;
262 }
static isObjectActive($a_obj_id)
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.
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

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

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

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

281 {
282 global $ilDB,$ilUser;
283
284 $user_id = $ilUser->getId();
285
286 $set = $ilDB->queryF('SELECT offline_mode FROM sahs_user WHERE obj_id = %s AND user_id = %s',
287 array('integer','integer'),
288 array($a_obj_id, $user_id)
289 );
290 $rec = $ilDB->fetchAssoc($set);
291 if ($rec["offline_mode"] == "offline") return true;
292 return false;
293 }

References $ilDB, and $ilUser.

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

+ 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.

42 {
43 switch($a_operator)
44 {
45
47 include_once './Services/Tracking/classes/class.ilLPStatus.php';
48 ilLPStatus::_lookupStatus($a_trigger_obj_id, $a_usr_id) == ilLPStatus::LP_STATUS_FAILED_NUM;
49 break;
50
52 default:
53 include_once './Services/Tracking/classes/class.ilLPStatus.php';
54 return ilLPStatus::_hasUserCompleted($a_trigger_obj_id, $a_usr_id);
55
56 }
57 return true;
58 }
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
const LP_STATUS_FAILED_NUM

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

+ 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.

24 {
25 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
26 return array(
29 );
30 }

References ilConditionHandler\OPERATOR_FAILED, and ilConditionHandler\OPERATOR_FINISHED.


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