ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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
22  = array(
23  self::SCOPE_SAME_ORGU,
24  self::SCOPE_SUBSEQUENT_ORGUS,
25  // self::SCOPE_ALL_ORGUS,
26  );
27 
28 
32  public static function getScopes()
33  {
34  return self::$scopes;
35  }
36 
37 
41  public static function returnDbTableName()
42  {
43  return "il_orgu_authority";
44  }
45 
46 
57  protected $id = 0;
65  protected $over = self::OVER_EVERYONE;
73  protected $scope = self::SCOPE_SAME_ORGU;
81  protected $position_id = 0;
85  protected static $name_render;
86 
87 
94  public function __construct($primary_key = 0, \arConnector $connector = null)
95  {
96  parent::__construct($primary_key, $connector);
97  if (!self::$name_render) {
98  self::$name_render = function ($id) {
99  return $id;
100  };
101  }
102  }
103 
104 
108  public static function replaceNameRenderer(Closure $closure)
109  {
110  self::$name_render = $closure;
111  }
112 
113 
117  public function __toString()
118  {
119  $renderer = self::$name_render;
120 
121  return $renderer($this->getId());
122  }
123 
124 
128  public function __toArray()
129  {
130  return array(
131  'id' => $this->getId(),
132  'over' => $this->getOver(),
133  'scope' => $this->getScope(),
134  'position_id' => $this->getPositionId(),
135  );
136  }
137 
138 
142  public function getId()
143  {
144  return $this->id;
145  }
146 
147 
151  public function setId($id)
152  {
153  $this->id = $id;
154  }
155 
156 
160  public function getOver()
161  {
162  return $this->over;
163  }
164 
165 
171  public function setOver($over)
172  {
173  $this->over = $over;
174  }
175 
176 
180  public function getScope()
181  {
182  return $this->scope;
183  }
184 
185 
194  public function setScope($scope)
195  {
196  if (!in_array($scope, self::$scopes)) {
197  throw new ilException('Selected Scop in ' . self::class . ' not allowed');
198  }
199  $this->scope = $scope;
200  }
201 
202 
206  public function getPositionId()
207  {
208  return $this->position_id;
209  }
210 
211 
215  public function setPositionId($position_id)
216  {
217  $this->position_id = $position_id;
218  }
219 }
__construct($primary_key=0, \arConnector $connector=null)
ilOrgUnitAuthority constructor.
setScope($scope)
This is either ilOrgUnitAuthority::SCOPE_SAME_ORGU, ilOrgUnitAuthority::SCOPE_ALL_ORGUS or ilOrgUnitA...
Class ActiveRecord.
Class arConnector.
static replaceNameRenderer(Closure $closure)
__construct(Container $dic, ilPlugin $plugin)
setOver($over)
This is either an ID of a position or ilOrgUnitAuthority::OVER_EVERYONE.
Class ilOrguAuthority.