ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjStudyProgrammeAccess.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5require_once('./Services/Object/classes/class.ilObjectAccess.php');
6require_once('./Services/User/classes/class.ilUserAccountSettings.php');
7require_once('./Services/Conditions/interfaces/interface.ilConditionHandling.php');
8
9
20{
21
37 public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
38 {
39 if ($a_user_id == "") {
40 global $DIC;
41 $a_user_id = $DIC->user()->getId();
42 }
43
44 if ($a_permission == "delete") {
45 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
47 if ($prg->hasRelevantProgresses()) {
48 return false;
49 }
50 }
51
52 return parent::_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id);
53 }
54
67 public static function _getCommands()
68 {
69 $commands = array();
70 $commands[] = array('permission' => 'read', 'cmd' => 'view', 'lang_var' => 'show', 'default' => true);
71 $commands[] = array('permission' => 'write', 'cmd' => 'view', 'lang_var' => 'edit_content');
72 $commands[] = array( 'permission' => 'write', 'cmd' => 'edit', 'lang_var' => 'settings');
73
74 return $commands;
75 }
76
80 public static function _checkGoto($a_target)
81 {
82 global $DIC;
83 $ilAccess = $DIC['ilAccess'];
84 $t_arr = explode('_', $a_target);
85 if ($t_arr[0] != 'prg' || ((int) $t_arr[1]) <= 0) {
86 return false;
87 }
88 if ($ilAccess->checkAccess('read', '', $t_arr[1])) {
89 return true;
90 }
91
92 return false;
93 }
94
98 public static function getConditionOperators()
99 {
100 return array(
102 );
103 }
104
113 public static function checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
114 {
116 $valid_progress = array(
119 );
120
121 $prg_user_progress = ilStudyProgrammeDIC::dic()['model.Progress.ilStudyProgrammeProgressRepository']
122 ->getByPrgIdAndUserId($a_obj_id, $a_usr_id);
123
124 foreach ($prg_user_progress as $progress) {
125 if (in_array($progress->getStatus(), $valid_progress)) {
126 return true;
127 }
128 }
129 }
130 return false;
131 }
132}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjStudyProgrammeAccess.
static _checkGoto($a_target)
check whether goto script will succeed
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...
static getInstanceByRefId($a_ref_id)
Class ilObjectAccess.
global $DIC
Definition: goto.php:24
Interface for condition handling.