ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 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 
)

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

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

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

◆ _getCommands()

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

Definition at line 28 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().

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  }
+ Here is the caller graph for this function:

◆ getDICDependencies()

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

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

References $DIC, and $lng.

Referenced by _checkAccess().

143  : array
144  {
145  global $DIC;
146  $rbacsystem = $DIC['rbacsystem'];
147  $il_access = $DIC['ilAccess'];
148  $lng = $DIC['lng'];
149 
150  return [
151  $rbacsystem,
152  $il_access,
153  $lng
154  ];
155  }
global $DIC
Definition: shib_login.php:22
global $lng
Definition: privfeed.php:31
+ 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.

References ilObjectFactory\getInstanceByRefId(), and null.

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

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  $new_status = ($online)
102  ? $obj->getObjectProperties()->getPropertyIsOnline()->withOnline()
103  : $obj->getObjectProperties()->getPropertyIsOnline()->withOffline();
104  $obj->getObjectProperties()->storePropertyIsOnline($new_status);
105 
106  return !$online;
107  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
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 60 of file class.ilObjLearningSequenceAccess.php.

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

Field Documentation

◆ $using_code

bool ilObjLearningSequenceAccess::$using_code = false
static

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


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