ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilOrgUnitAuthority.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 public const FIELD_OVER = 'over';
28 public const OVER_EVERYONE = -1;
29 public const POSITION_ID = "position_id";
30 public const SCOPE_SAME_ORGU = 1;
31 public const SCOPE_SUBSEQUENT_ORGUS = 2;
32 public const SCOPES = [
35 ];
36
37 protected int $id;
38 protected int $over = self::OVER_EVERYONE;
40 protected int $position_id = 0;
41
42 public function __construct($id = 0)
43 {
44 $this->id = $id;
45 }
46
50 public static function getScopes(): array
51 {
52 return self::SCOPES;
53 }
54
55 public function __toString(): string
56 {
57 return (string) $this->id;
58 }
59
60 public function getId(): int
61 {
62 return $this->id;
63 }
64
65 public function getOver(): int
66 {
67 return $this->over;
68 }
69
70 public function withOver(int $over): self
71 {
72 $clone = clone $this;
73 $clone->over = $over;
74 return $clone;
75 }
76
77 public function getScope(): int
78 {
79 return $this->scope;
80 }
81
82 public function withScope(int $scope): self
83 {
84 if (!in_array($scope, self::SCOPES)) {
85 throw new ilException('Selected Scope in ' . self::class . ' not allowed');
86 }
87 $clone = clone $this;
88 $clone->scope = $scope;
89 return $clone;
90 }
91
92 public function getPositionId(): int
93 {
94 return $this->position_id;
95 }
96
97 public function withPositionId(int $position_id): self
98 {
99 $clone = clone $this;
100 $clone->position_id = $position_id;
101 return $clone;
102 }
103}
Base class for ILIAS Exception handling.
Class ilOrguAuthority.
withPositionId(int $position_id)