ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilOrgUnitOperationContext.php
Go to the documentation of this file.
1<?php
2
9{
10 const CONTEXT_OBJECT = "object";
11 const CONTEXT_CRS = "crs";
12 const CONTEXT_GRP = "grp";
13 const CONTEXT_IASS = "iass";
14 const CONTEXT_TST = "tst";
15 const CONTEXT_EXC = "exc";
16 const CONTEXT_SVY = "svy";
17 const CONTEXT_USRF = "usrf";
18 const CONTEXT_PRG = "prg";
19
23 public static $available_contexts = [
33 ];
34
35
36
37
38
42 public function getPopulatedContextNames()
43 {
44 $contexts = array($this->getContext());
45 $this->appendParentContextName($contexts);
46
47 return $contexts;
48 }
49
50
54 public function getPopulatedContextIds()
55 {
56 $contexts = array($this->getId());
57 $this->appendParentContextName($contexts);
58
59 return $contexts;
60 }
61
62
73 protected $id = 0;
91 protected $parent_context_id = 0;
92
93
97 public function getId()
98 {
99 return $this->id;
100 }
101
102
106 public function setId($id)
107 {
108 $this->id = $id;
109 }
110
111
115 public function getContext()
116 {
117 return $this->context;
118 }
119
120
124 public function setContext($context)
125 {
126 $this->context = $context;
127 }
128
129
133 public function getParentContextId()
134 {
136 }
137
138
143 {
144 $this->parent_context_id = $parent_context_id;
145 }
146
147
151 public static function returnDbTableName()
152 {
153 return 'il_orgu_op_contexts';
154 }
155
156
157 public function create()
158 {
159 if (self::where(array('context' => $this->getContext()))->hasSets()) {
160 throw new ilException('Context already registered');
161 }
162 parent::create();
163 }
164
165
169 protected function appendParentContextName(&$contexts)
170 {
171 if ($this->getParentContextId()) {
175 $parent = self::find($this->getParentContextId());
176 if ($parent) {
177 $contexts[] = $parent->getContext();
178 $parent->appendParentContextName($contexts);
179 }
180 }
181 }
182
183
187 protected function appendParentContextId(&$contexts)
188 {
189 if ($this->getParentContextId()) {
193 $parent = self::find($this->getParentContextId());
194 if ($parent) {
195 $contexts[] = $parent->getId();
196 $parent->appendParentContextName($contexts);
197 }
198 }
199 }
200}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Base class for ILIAS Exception handling.
Class ilOrgUnitOperationContext.