ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
5 require_once('./Services/Object/classes/class.ilObjectAccess.php');
6 require_once('./Services/User/classes/class.ilUserAccountSettings.php');
7 require_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  $a_user_id = $ilUser->getId();
41  }
42 
43  if ($a_permission == "delete") {
44  require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
46  if ($prg->hasRelevantProgresses()) {
47  return false;
48  }
49  }
50 
51  return parent::_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "");
52  }
53 
66  public static function _getCommands()
67  {
68  $commands = array();
69  $commands[] = array('permission' => 'read', 'cmd' => 'view', 'lang_var' => 'show', 'default' => true);
70  $commands[] = array('permission' => 'write', 'cmd' => 'view', 'lang_var' => 'edit_content');
71  $commands[] = array( 'permission' => 'write', 'cmd' => 'edit', 'lang_var' => 'settings');
72 
73  return $commands;
74  }
75 
79  public static function _checkGoto($a_target)
80  {
81  global $DIC;
82  $ilAccess = $DIC['ilAccess'];
83  $t_arr = explode('_', $a_target);
84  if ($t_arr[0] != 'prg' || ((int) $t_arr[1]) <= 0) {
85  return false;
86  }
87  if ($ilAccess->checkAccess('read', '', $t_arr[1])) {
88  return true;
89  }
90 
91  return false;
92  }
93 
97  public static function getConditionOperators()
98  {
99  return array(
101  );
102  }
103 
112  public static function checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
113  {
115  $valid_progress = array(
118  );
119 
120  $prg_user_progress = ilObjStudyProgramme::_getStudyProgrammeUserProgressDB()->getInstancesForUser($a_obj_id, $a_usr_id);
121  foreach ($prg_user_progress as $progress) {
122  if (in_array($progress->getStatus(), $valid_progress)) {
123  return true;
124  }
125  }
126  }
127  return false;
128  }
129 }
Class ilObjStudyProgrammeAccess.
global $DIC
Definition: saml.php:7
static _checkGoto($a_target)
check whether goto script will succeed
Interface for condition handling.
_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 _getStudyProgrammeUserProgressDB()
Get an instance of ilStudyProgrammeUserProgressDB.
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
$ilUser
Definition: imgupload.php:18
Class ilObjectAccess.
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
static getConditionOperators()
Get operators.