ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

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 _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 _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 if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. 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 73 of file class.ilObjSAHSLearningModuleAccess.php.

74 {
75 global $DIC;
76 $ilUser = $DIC['ilUser'];
77 $lng = $DIC['lng'];
78 $rbacsystem = $DIC['rbacsystem'];
79 $ilAccess = $DIC['ilAccess'];
80
81 if ($a_user_id == "") {
82 $a_user_id = $ilUser->getId();
83 }
84
85 // switch ($a_cmd)
86 // {
87 // case "view":
88
89 // if(!ilObjSAHSLearningModuleAccess::_lookupOnline($a_obj_id)
90 // && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
91 // {
92 // $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
93 // return false;
94 // }
95 // break;
96 // }
97
98 // switch ($a_permission)
99 // {
100 // case "visible":
101 // if (!ilObjSAHSLearningModuleAccess::_lookupOnline($a_obj_id) &&
102 // (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
103 // {
104 // $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
105 // return false;
106 // }
107 // break;
108 // }
109
110
111 return true;
112 }
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
$lng

References $DIC, $ilUser, and $lng.

◆ _checkGoto()

static ilObjSAHSLearningModuleAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

175 {
176 global $DIC;
177 $ilAccess = $DIC['ilAccess'];
178
179 $t_arr = explode("_", $a_target);
180
181 if ($t_arr[0] != "sahs" || ((int) $t_arr[1]) <= 0) {
182 return false;
183 }
184
185 if ($ilAccess->checkAccess("visible", "", $t_arr[1]) || $ilAccess->checkAccess("read", "", $t_arr[1])) {
186 return true;
187 }
188 return false;
189 }

References $DIC.

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

127 {
128 $commands = array(
129 array("permission" => "read", "cmd" => "view", "lang_var" => "show","default" => true),
130 array("permission" => "write", "cmd" => "editContent", "lang_var" => "edit_content"),
131 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
132 );
133 // #14866
136 if ($offlineMode == false) {
137 $commands[] = array("permission" => "read", "cmd" => "offlineModeStart", "lang_var" => "offline_mode");
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.
static _lookupOfflineModeAvailable($a_id)
check wether learning module is online

References _lookupOfflineModeAvailable(), and _lookupUserIsOfflineMode().

+ Here is the call 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 196 of file class.ilObjSAHSLearningModuleAccess.php.

197 {
198 $lm_data_dir = ilUtil::getWebspaceDir('filesystem') . "/lm_data";
199 $lm_dir = $lm_data_dir . DIRECTORY_SEPARATOR . "lm_" . $a_id;
200
201 return file_exists($lm_dir) ? ilUtil::dirsize($lm_dir) : 0;
202 }
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 155 of file class.ilObjSAHSLearningModuleAccess.php.

156 {
157 global $DIC;
158 $ilDB = $DIC['ilDB'];
159
160 $set = $ilDB->queryF(
161 'SELECT * FROM sahs_lm WHERE id = %s',
162 array('integer'),
163 array($a_obj_id)
164 );
165 $rec = $ilDB->fetchAssoc($set);
166
167 return $rec["editable"];
168 }
global $ilDB

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ _lookupOfflineModeAvailable()

static ilObjSAHSLearningModuleAccess::_lookupOfflineModeAvailable (   $a_id)
static

check wether learning module is online

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

232 {
233 global $DIC;
234 $ilDB = $DIC['ilDB'];
235
236 $set = $ilDB->queryF(
237 'SELECT offline_mode FROM sahs_lm WHERE id = %s',
238 array('integer'),
239 array($a_id)
240 );
241 $rec = $ilDB->fetchAssoc($set);
242
243 return ilUtil::yn2tf($rec["offline_mode"]);
244 }
static yn2tf($a_yn)
convert "y"/"n" to true/false

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

Referenced by _getCommands().

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

209 {
210 global $DIC;
211 $ilDB = $DIC['ilDB'];
212 $ilUser = $DIC['ilUser'];
213
214 $user_id = $ilUser->getId();
215
216 $set = $ilDB->queryF(
217 'SELECT offline_mode FROM sahs_user WHERE obj_id = %s AND user_id = %s',
218 array('integer','integer'),
219 array($a_obj_id, $user_id)
220 );
221 $rec = $ilDB->fetchAssoc($set);
222 if ($rec["offline_mode"] == "offline") {
223 return true;
224 }
225 return false;
226 }

References $DIC, $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
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 _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
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/Conditions/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: