ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
18
22 public function getPopulatedContextNames()
23 {
24 $contexts = array( $this->getContext() );
25 $this->appendParentContextName($contexts);
26
27 return $contexts;
28 }
29
30
34 public function getPopulatedContextIds()
35 {
36 $contexts = array( $this->getId() );
37 $this->appendParentContextName($contexts);
38
39 return $contexts;
40 }
41
42
53 protected $id = 0;
71 protected $parent_context_id = 0;
72
73
77 public function getId()
78 {
79 return $this->id;
80 }
81
82
86 public function setId($id)
87 {
88 $this->id = $id;
89 }
90
91
95 public function getContext()
96 {
97 return $this->context;
98 }
99
100
104 public function setContext($context)
105 {
106 $this->context = $context;
107 }
108
109
113 public function getParentContextId()
114 {
116 }
117
118
123 {
124 $this->parent_context_id = $parent_context_id;
125 }
126
127
131 public static function returnDbTableName()
132 {
133 return 'il_orgu_op_contexts';
134 }
135
136
137 public function create()
138 {
139 if (self::where(array( 'context' => $this->getContext() ))->hasSets()) {
140 throw new ilException('Context already registered');
141 }
142 parent::create();
143 }
144
145
149 protected function appendParentContextName(&$contexts)
150 {
151 if ($this->getParentContextId()) {
155 $parent = self::find($this->getParentContextId());
156 if ($parent) {
157 $contexts[] = $parent->getContext();
158 $parent->appendParentContextName($contexts);
159 }
160 }
161 }
162
163
167 protected function appendParentContextId(&$contexts)
168 {
169 if ($this->getParentContextId()) {
173 $parent = self::find($this->getParentContextId());
174 if ($parent) {
175 $contexts[] = $parent->getId();
176 $parent->appendParentContextName($contexts);
177 }
178 }
179 }
180}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Base class for ILIAS Exception handling.
Class ilOrgUnitOperationContext.