ILIAS  release_8 Revision v8.24
ilObjLearningSequenceAccess 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 ilObjLearningSequenceAccess:
+ Collaboration diagram for ilObjLearningSequenceAccess:

Public Member Functions

 usingRegistrationCode ()
 
 _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...
 
- 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)
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 
static isOffline (int $ref_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 bool $using_code = false
 

Protected Member Functions

 getDICDependencies ()
 

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

Definition at line 21 of file class.ilObjLearningSequenceAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjLearningSequenceAccess::_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)

Please do not check any preconditions handled by ilConditionHandler here. Also don't do any RBAC checks.

Reimplemented from ilObjectAccess.

Definition at line 105 of file class.ilObjLearningSequenceAccess.php.

105 : bool
106 {
107 list($rbacsystem, $il_access, $lng) = $this->getDICDependencies();
108
109 switch ($permission) {
110 case 'visible':
111 $has_any_administrative_permission = false;
112 if (!is_null($user_id)) {
113 $has_any_administrative_permission = (
114 $rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id) ||
115 $rbacsystem->checkAccessOfUser($user_id, 'edit_members', $ref_id) ||
116 $rbacsystem->checkAccessOfUser($user_id, 'edit_learning_progress', $ref_id)
117 );
118 }
119
120 $is_offine = $this->isOffline($ref_id);
121
122 if ($is_offine && !$has_any_administrative_permission) {
123 $il_access->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
124 return false;
125 }
126 return true;
127
128 default:
129 if (is_null($user_id)) {
130 return false;
131 }
132 return $rbacsystem->checkAccessOfUser($user_id, $permission, $ref_id);
133 }
134 }
$ref_id
Definition: ltiauth.php:67
$lng

References $lng, $ref_id, getDICDependencies(), ilAccessInfo\IL_NO_OBJECT_ACCESS, and isOffline().

+ Here is the call graph for this function:

◆ _getCommands()

static ilObjLearningSequenceAccess::_getCommands ( )
static
Returns
array<array<string|bool>>

Reimplemented from ilObjectAccess.

Definition at line 28 of file class.ilObjLearningSequenceAccess.php.

28 : array
29 {
30 return array(
31 [
33 'permission' => 'read',
34 'lang_var' => 'show',
35 'default' => true
36 ],
37 [
39 'permission' => 'read',
40 'lang_var' => 'show',
41 ],
42 [
44 'permission' => 'write',
45 'lang_var' => 'edit_content'
46 ],
47 [
49 'permission' => 'write',
50 'lang_var' => 'settings'
51 ],
52 [
54 'permission' => 'unparticipate',
55 'lang_var' => 'unparticipate'
56 ]
57 );
58 }

References ilObjLearningSequenceGUI\CMD_CONTENT, ilObjLearningSequenceGUI\CMD_LEARNER_VIEW, ilObjLearningSequenceGUI\CMD_SETTINGS, ilObjLearningSequenceGUI\CMD_UNPARTICIPATE, and ilObjLearningSequenceGUI\CMD_VIEW.

Referenced by ilObjLearningSequenceListGUI\init().

+ Here is the caller graph for this function:

◆ getDICDependencies()

ilObjLearningSequenceAccess::getDICDependencies ( )
protected
Returns
array<ilRbacSystem|ilAccess|ilLanguage>

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

139 : array
140 {
141 global $DIC;
142 $rbacsystem = $DIC['rbacsystem'];
143 $il_access = $DIC['ilAccess'];
144 $lng = $DIC['lng'];
145
146 return [
147 $rbacsystem,
148 $il_access,
149 $lng
150 ];
151 }
global $DIC
Definition: feed.php:28

References $DIC, and $lng.

Referenced by _checkAccess().

+ Here is the caller graph for this function:

◆ isOffline()

static ilObjLearningSequenceAccess::isOffline ( int  $ref_id)
static

Definition at line 65 of file class.ilObjLearningSequenceAccess.php.

65 : bool
66 {
68 $act = $obj->getLSActivation();
69 $online = $act->getIsOnline();
70
71 if (!$online
72 && ($act->getActivationStart() !== null ||
73 $act->getActivationEnd() !== null)
74 ) {
75 $ts_now = time();
76 $activation_start = $act->getActivationStart();
77 if ($activation_start !== null) {
78 $after_activation_start = $ts_now >= $activation_start->getTimestamp();
79 } else {
80 $after_activation_start = true;
81 }
82 $activation_end = $act->getActivationEnd();
83 if ($activation_end !== null) {
84 $before_activation_end = $ts_now <= $activation_end->getTimestamp();
85 } else {
86 $before_activation_end = true;
87 }
88
89 $online = ($after_activation_start && $before_activation_end);
90 }
91
92 if ($act->getEffectiveOnlineStatus() === false && $online === true) {
93 $obj->setEffectiveOnlineStatus(true);
94 $obj->announceLSOOnline();
95 }
96 if ($act->getEffectiveOnlineStatus() === true && $online === false) {
97 $obj->setEffectiveOnlineStatus(false);
98 $obj->announceLSOOffline();
99 }
100
101
102 return !$online;
103 }
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id

References $ref_id, and ilObjectFactory\getInstanceByRefId().

Referenced by _checkAccess(), ilDashboardLearningSequenceGUI\getOnlineStatus(), and ilObjLearningSequenceListGUI\getProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usingRegistrationCode()

ilObjLearningSequenceAccess::usingRegistrationCode ( )

Definition at line 60 of file class.ilObjLearningSequenceAccess.php.

60 : bool
61 {
62 return self::$using_code;
63 }

References $using_code.

Field Documentation

◆ $using_code

bool ilObjLearningSequenceAccess::$using_code = false
static

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

Referenced by usingRegistrationCode().


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