ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilOrgUnitAuthority.php
Go to the documentation of this file.
1<?php
2
3// namespace ILIAS\Modules\OrgUnit\Positions\Authorities;
4
11{
12 const FIELD_OVER = 'over';
13 const OVER_EVERYONE = -1;
14 const POSITION_ID = "position_id";
15 const SCOPE_SAME_ORGU = 1;
17 const SCOPE_ALL_ORGUS = 3;
21 protected static $scopes = array(
22 self::SCOPE_SAME_ORGU,
23 self::SCOPE_SUBSEQUENT_ORGUS,
24 // self::SCOPE_ALL_ORGUS,
25 );
26
27
31 public static function getScopes()
32 {
33 return self::$scopes;
34 }
35
36
40 public static function returnDbTableName()
41 {
42 return "il_orgu_authority";
43 }
44
45
56 protected $id = 0;
80 protected $position_id = 0;
84 protected static $name_render;
85
86
93 public function __construct($primary_key = 0, \arConnector $connector = null)
94 {
95 parent::__construct($primary_key, $connector);
96 if (!self::$name_render) {
97 self::$name_render = function ($id) {
98 return $id;
99 };
100 }
101 }
102
103
107 public static function replaceNameRenderer(Closure $closure)
108 {
109 self::$name_render = $closure;
110 }
111
112
116 public function __toString()
117 {
118 $renderer = self::$name_render;
119
120 return $renderer($this->getId());
121 }
122
123
127 public function __toArray()
128 {
129 return array(
130 'id' => $this->getId(),
131 'over' => $this->getOver(),
132 'scope' => $this->getScope(),
133 'position_id' => $this->getPositionId(),
134 );
135 }
136
137
141 public function getId()
142 {
143 return $this->id;
144 }
145
146
150 public function setId($id)
151 {
152 $this->id = $id;
153 }
154
155
159 public function getOver()
160 {
161 return $this->over;
162 }
163
164
170 public function setOver($over)
171 {
172 $this->over = $over;
173 }
174
175
179 public function getScope()
180 {
181 return $this->scope;
182 }
183
184
193 public function setScope($scope)
194 {
195 if (!in_array($scope, self::$scopes)) {
196 throw new ilException('Selected Scop in ' . self::class . ' not allowed');
197 }
198 $this->scope = $scope;
199 }
200
201
205 public function getPositionId()
206 {
207 return $this->position_id;
208 }
209
210
215 {
216 $this->position_id = $position_id;
217 }
218}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Class arConnector.
Base class for ILIAS Exception handling.
Class ilOrguAuthority.
setOver($over)
This is either an ID of a position or ilOrgUnitAuthority::OVER_EVERYONE.
__construct($primary_key=0, \arConnector $connector=null)
ilOrgUnitAuthority constructor.
static replaceNameRenderer(Closure $closure)
setScope($scope)
This is either ilOrgUnitAuthority::SCOPE_SAME_ORGU, ilOrgUnitAuthority::SCOPE_ALL_ORGUS or ilOrgUnitA...