ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjStudyProgrammeAccess.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
29 {
30  public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
31  {
32  if ($user_id === 0 || $user_id === null) {
33  global $DIC;
34  $user_id = $DIC->user()->getId();
35  }
36 
37  if ($permission === "delete") {
39  if ($prg->hasRelevantProgresses()) {
40  return false;
41  }
42  }
43 
44  return parent::_checkAccess($cmd, $permission, $ref_id, $obj_id, $user_id);
45  }
46 
59  public static function _getCommands(): array
60  {
61  $commands = [];
62  $commands[] = ['permission' => 'read', 'cmd' => 'view', 'lang_var' => 'show', 'default' => true];
63  $commands[] = ['permission' => 'write', 'cmd' => 'view', 'lang_var' => 'edit_content'];
64  $commands[] = [ 'permission' => 'write', 'cmd' => 'edit', 'lang_var' => 'settings'];
65 
66  return $commands;
67  }
68 
72  public static function _checkGoto(string $target): bool
73  {
74  global $DIC;
75  $ilAccess = $DIC->access();
76  $t_arr = explode('_', $target);
77  if ($t_arr[0] !== 'prg' || ((int) $t_arr[1]) <= 0) {
78  return false;
79  }
80 
81  return $ilAccess->checkAccess('read', '', (int) $t_arr[1]);
82  }
83 
87  public static function getConditionOperators(): array
88  {
89  return array(
91  );
92  }
93 
101  public static function checkCondition(
102  int $a_trigger_obj_id,
103  string $a_operator,
104  string $a_value,
105  int $a_usr_id
106  ): bool {
108  $repo = ilStudyProgrammeDIC::dic()['repo.assignment'];
109  $assignments = $repo->getAllForNodeIsContained($a_trigger_obj_id, [$a_usr_id]);
110 
111  foreach ($assignments as $ass) {
112  if ($ass->getProgressForNode($a_trigger_obj_id)->isSuccessful()) {
113  return true;
114  }
115  }
116  }
117  return false;
118  }
119 }
static _checkGoto(string $target)
check whether goto script will succeed
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface for condition handling.
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static getConditionOperators()
Get operators.
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)