ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilObjLearningSequenceAccess Class Reference
+ 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)
 
- 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)
 

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

Definition at line 20 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 
)

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

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

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

◆ _getCommands()

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

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

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

Referenced by ilObjLearningSequenceListGUI\init().

27  : array
28  {
29  return array(
30  [
32  'permission' => 'read',
33  'lang_var' => 'show',
34  'default' => true
35  ],
36  [
38  'permission' => 'read',
39  'lang_var' => 'show',
40  ],
41  [
43  'permission' => 'write',
44  'lang_var' => 'edit_content'
45  ],
46  [
48  'permission' => 'write',
49  'lang_var' => 'settings'
50  ],
51  [
53  'permission' => 'unparticipate',
54  'lang_var' => 'unparticipate'
55  ]
56  );
57  }
+ Here is the caller graph for this function:

◆ getDICDependencies()

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

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

References $DIC, and $lng.

Referenced by _checkAccess().

142  : array
143  {
144  global $DIC;
145  $rbacsystem = $DIC['rbacsystem'];
146  $il_access = $DIC['ilAccess'];
147  $lng = $DIC['lng'];
148 
149  return [
150  $rbacsystem,
151  $il_access,
152  $lng
153  ];
154  }
global $DIC
Definition: shib_login.php:25
global $lng
Definition: privfeed.php:32
+ Here is the caller graph for this function:

◆ isOffline()

static ilObjLearningSequenceAccess::isOffline ( int  $ref_id)
static

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

References ilObjectFactory\getInstanceByRefId().

Referenced by _checkAccess(), and ilObjLearningSequenceSettingsGUI\update().

64  : bool
65  {
67  $act = $obj->getLSActivation();
68  $online = $act->getIsOnline();
69 
70  if ($online
71  && ($act->getActivationStart() !== null ||
72  $act->getActivationEnd() !== null)
73  ) {
74  $ts_now = time();
75  $activation_start = $act->getActivationStart();
76  if ($activation_start !== null) {
77  $after_activation_start = $ts_now >= $activation_start->getTimestamp();
78  } else {
79  $after_activation_start = true;
80  }
81  $activation_end = $act->getActivationEnd();
82  if ($activation_end !== null) {
83  $before_activation_end = $ts_now <= $activation_end->getTimestamp();
84  } else {
85  $before_activation_end = true;
86  }
87 
88  $online = ($after_activation_start && $before_activation_end);
89  }
90 
91  if ($act->getEffectiveOnlineStatus() === false && $online === true) {
92  $obj->setEffectiveOnlineStatus(true);
93  $obj->announceLSOOnline();
94  }
95  if ($act->getEffectiveOnlineStatus() === true && $online === false) {
96  $obj->setEffectiveOnlineStatus(false);
97  $obj->announceLSOOffline();
98  }
99 
100  $new_status = ($online)
101  ? $obj->getObjectProperties()->getPropertyIsOnline()->withOnline()
102  : $obj->getObjectProperties()->getPropertyIsOnline()->withOffline();
103  $obj->getObjectProperties()->storePropertyIsOnline($new_status);
104 
105  return !$online;
106  }
$ref_id
Definition: ltiauth.php:66
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usingRegistrationCode()

ilObjLearningSequenceAccess::usingRegistrationCode ( )

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

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

Field Documentation

◆ $using_code

bool ilObjLearningSequenceAccess::$using_code = false
static

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


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