ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjStudyProgrammeAccess.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
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 {
107 if ($a_operator === ilConditionHandler::OPERATOR_ACCREDITED_OR_PASSED) {
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}
INTERNAL CLASS: Please do not use in consumer code.
const string OPERATOR_ACCREDITED_OR_PASSED
Class ilObjStudyProgrammeAccess.
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
_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::checkAcc...
static _checkGoto(string $target)
check whether goto script will succeed
Class ilObjectAccess.
Interface for condition handling.
$ref_id
Definition: ltiauth.php:66
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26