ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilOrgUnitOperationContext.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  public const CONTEXT_OBJECT = "object";
27  public const CONTEXT_CRS = "crs";
28  public const CONTEXT_GRP = "grp";
29  public const CONTEXT_IASS = "iass";
30  public const CONTEXT_TST = "tst";
31  public const CONTEXT_EXC = "exc";
32  public const CONTEXT_SVY = "svy";
33  public const CONTEXT_USRF = "usrf";
34  public const CONTEXT_PRG = "prg";
35  public const CONTEXT_ETAL = "etal";
36 
40  public static array $available_contexts = [
41  self::CONTEXT_OBJECT,
42  self::CONTEXT_CRS,
43  self::CONTEXT_GRP,
44  self::CONTEXT_IASS,
45  self::CONTEXT_TST,
46  self::CONTEXT_EXC,
47  self::CONTEXT_SVY,
48  self::CONTEXT_USRF,
49  self::CONTEXT_PRG,
50  self::CONTEXT_ETAL,
51  ];
52 
53  protected ?int $id = 0;
54  protected string $context = self::CONTEXT_OBJECT;
55  protected int $parent_context_id = 0;
56  protected array $path_names = [self::CONTEXT_OBJECT];
57  protected array $path_ids = [0];
58 
59  public function __construct(?int $id = 0)
60  {
61  $this->id = $id;
62  $this->path_ids = [$id];
63  }
64 
65  public function getId(): ?int
66  {
67  return $this->id;
68  }
69 
70  public function getContext(): string
71  {
72  return $this->context;
73  }
74 
75  public function withContext(string $context): self
76  {
77  $clone = clone $this;
78  $clone->context = $context;
79  return $clone;
80  }
81 
82  public function getParentContextId(): int
83  {
85  }
86 
87  public function withParentContextId(int $parent_context_id): self
88  {
89  $clone = clone $this;
90  $clone->parent_context_id = $parent_context_id;
91  return $clone;
92  }
93 
94  public function getPathNames(): array
95  {
96  return $this->path_names;
97  }
98 
99  public function withPathNames(array $path_names): self
100  {
101  $clone = clone $this;
102  $clone->path_names = $path_names;
103  return $clone;
104  }
105 
106  public function getPathIds(): array
107  {
108  return $this->path_ids;
109  }
110 
111  public function withPathIds(array $path_ids): self
112  {
113  $clone = clone $this;
114  $clone->path_ids = $path_ids;
115  return $clone;
116  }
117 
122  public function getPopulatedContextNames(): array
123  {
124  return $this->getPathNames();
125  }
126 
127 
128 
133  public function getPopulatedContextIds(): array
134  {
135  return $this->getPathIds();
136  }
137 }