ILIAS  release_8 Revision v8.24
ilOrgUnitPosition Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilOrgUnitPosition:
+ Collaboration diagram for ilOrgUnitPosition:

Public Member Functions

 delete ()
 
 afterObjectLoad ()
 
 update ()
 
 create ()
 
 getAuthoritiesAsArray ()
 
 __toString ()
 
 getDependentAuthorities ()
 
 deleteWithAllDependencies ()
 This deletes the Position, it's Authorities, dependent Authorities and all User-Assignements! More...
 
 getId ()
 
 setId (?int $id)
 
 getTitle ()
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 isCorePosition ()
 
 setCorePosition (bool $core_position)
 
 getAuthorities ()
 
 setAuthorities (array $authorities)
 
 getCoreIdentifier ()
 
 setCoreIdentifier (int $core_identifier)
 
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 
 getArFieldList ()
 
 getConnectorContainerName ()
 @description Return the Name of your Connector Table More...
 
 setConnectorContainerName (string $connector_container_name)
 
 getPrimaryFieldValue ()
 
 setPrimaryFieldValue ($value)
 
 __construct ($primary_key=0)
 
 storeObjectToCache ()
 
 asStdClass ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, $value)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 getArrayForConnector ()
 
 installConnector ()
 
 store ()
 
 save ()
 
 create ()
 
 copy (int $new_id=0)
 
 afterObjectLoad ()
 
 read ()
 
 update ()
 
 delete ()
 
 __call ($name, $arguments)
 

Static Public Member Functions

static returnDbTableName ()
 
static get ()
 Override for correct on return value. More...
 
static getCorePosition (int $core_identifier)
 
static getCorePositionId (int $core_identifier)
 
static getActive ()
 
static getActiveForPosition (int $orgu_ref_id)
 
- Static Public Member Functions inherited from ActiveRecord
static returnDbTableName ()
 
static installDB ()
 
static renameDBField (string $old_name, string $new_name)
 
static tableExists ()
 
static fieldExists (string $field_name)
 
static removeDBField (string $field_name)
 
static updateDB ()
 
static resetDB ()
 
static truncateDB ()
 
static flushDB ()
 @depracated never use in ILIAS Core, Plugins only More...
 
static preloadObjects ()
 
static additionalParams (array $additional_params)
 
static findOrFail ($primary_key, array $add_constructor_args=array())
 Tries to find the object and throws an Exception if object is not found, instead of returning null. More...
 
static findOrGetInstance ($primary_key, array $add_constructor_args=array())
 
static where ($where, $operator=null)
 
static innerjoinAR (ActiveRecord $ar, $on_this, $on_external, array $fields=array(' *'), string $operator='=', $both_external=false)
 
static innerjoin ( $tablename, $on_this, $on_external, array $fields=array(' *'), string $operator='=', bool $both_external=false)
 
static leftjoin ( $tablename, $on_this, $on_external, array $fields=array(' *'), string $operator='=', bool $both_external=false)
 
static orderBy ($orderBy, string $orderDirection='ASC')
 
static dateFormat (string $date_format='d.m.Y - H:i:s')
 
static limit ($start, $end)
 
static affectedRows ()
 
static count ()
 
static get ()
 
static debug ()
 
static first ()
 
static getCollection ()
 
static last ()
 
static getFirstFromLastQuery ()
 
static connector (arConnector $connector)
 
static raw (bool $set_raw=true)
 
static getArray (?string $key=null, $values=null)
 
static _toCamelCase (string $str, bool $capitalise_first_char=false)
 

Data Fields

const CORE_POSITION_EMPLOYEE = 1
 
const CORE_POSITION_SUPERIOR = 2
 

Protected Attributes

int $id = 0
 
string $title = ""
 
string $description = ""
 
bool $core_position = false
 
int $core_identifier = 0
 
array $authorities = array()
 
- Protected Attributes inherited from ActiveRecord
bool $ar_safe_read = true
 
string $connector_container_name = ''
 
bool $is_new = true
 

Private Member Functions

 storeAuthorities ()
 

Additional Inherited Members

- Protected Member Functions inherited from ActiveRecord
 installDatabase ()
 
- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 @description Returns an instance of the instatiated calling active record (needs to be done in static methods) @TODO : This should be cached somehow More...
 
static fromCamelCase (string $str)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilOrgUnitPosition

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 23 of file class.ilOrgUnitPosition.php.

Member Function Documentation

◆ __toString()

ilOrgUnitPosition::__toString ( )

Definition at line 190 of file class.ilOrgUnitPosition.php.

190 : string
191 {
192 return $this->getTitle();
193 }

References getTitle().

+ Here is the call graph for this function:

◆ afterObjectLoad()

ilOrgUnitPosition::afterObjectLoad ( )

Reimplemented from ActiveRecord.

Definition at line 162 of file class.ilOrgUnitPosition.php.

162 : void
163 {
164 $this->authorities = ilOrgUnitAuthority::where(array(ilOrgUnitAuthority::POSITION_ID => $this->getId()))
165 ->get();
166 }
static where($where, $operator=null)

References getId(), ilOrgUnitAuthority\POSITION_ID, and ActiveRecord\where().

+ Here is the call graph for this function:

◆ create()

ilOrgUnitPosition::create ( )

Reimplemented from ActiveRecord.

Definition at line 174 of file class.ilOrgUnitPosition.php.

174 : void
175 {
176 parent::create();
177 $this->storeAuthorities();
178 }

References storeAuthorities().

+ Here is the call graph for this function:

◆ delete()

ilOrgUnitPosition::delete ( )
Exceptions
ilException

Reimplemented from ActiveRecord.

Definition at line 57 of file class.ilOrgUnitPosition.php.

57 : void
58 {
59 if ($this->isCorePosition()) {
60 throw new ilException('Cannot delete Core-Position');
61 }
62 parent::delete();
63 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References isCorePosition().

+ Here is the call graph for this function:

◆ deleteWithAllDependencies()

ilOrgUnitPosition::deleteWithAllDependencies ( )

This deletes the Position, it's Authorities, dependent Authorities and all User-Assignements!

Definition at line 209 of file class.ilOrgUnitPosition.php.

209 : void
210 {
211 foreach ($this->getDependentAuthorities() as $authority) {
212 $authority->delete();
213 }
214
215 $ilOrgUnitUserAssignmentQueries = ilOrgUnitUserAssignmentQueries::getInstance();
216 foreach ($ilOrgUnitUserAssignmentQueries->getUserAssignmentsOfPosition($this->getId()) as $assignment) {
217 $assignment->delete();
218 }
219 parent::delete();
220 }

References getDependentAuthorities(), and ilOrgUnitUserAssignmentQueries\getInstance().

+ Here is the call graph for this function:

◆ get()

static ilOrgUnitPosition::get ( )
static

Override for correct on return value.

Returns
ilOrgUnitPosition[]

@noinspection PhpIncompatibleReturnTypeInspection

Reimplemented from ActiveRecord.

Definition at line 37 of file class.ilOrgUnitPosition.php.

37 : array
38 {
40 return parent::get();
41 }
get(string $key, Refinery\Transformation $t)
Get passed parameter, if not data passed, get key from http request.

References ILIAS\Repository\get().

Referenced by ilOrgUnitPermissionTableGUI\collectData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActive()

static ilOrgUnitPosition::getActive ( )
static
Returns
\ilOrgUnitPosition[] array of Positions (all core-positions and all positions which have already UserAssignments)

Definition at line 69 of file class.ilOrgUnitPosition.php.

69 : array
70 {
71 arObjectCache::flush(self::class);
72 $q = "SELECT DISTINCT il_orgu_positions.id, il_orgu_positions.*
73 FROM il_orgu_positions
74 LEFT JOIN il_orgu_ua ON il_orgu_positions.id = il_orgu_ua.position_id
75 WHERE il_orgu_ua.user_id IS NOT NULL
76 OR il_orgu_positions.core_position = 1";
77 $database = $GLOBALS['DIC']->database();
78 $st = $database->query($q);
79
80 $positions = array();
81
82 while ($data = $database->fetchAssoc($st)) {
83 $position = new self();
84 $position->buildFromArray($data);
85 $positions[] = $position;
86 }
87
88 return $positions;
89 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static flush($class_name)

References $data, $GLOBALS, and arObjectCache\flush().

+ Here is the call graph for this function:

◆ getActiveForPosition()

static ilOrgUnitPosition::getActiveForPosition ( int  $orgu_ref_id)
static
Parameters
int$orgu_ref_id
Returns
ilOrgUnitPosition[] array of Positions (all core-positions and all positions which have already UserAssignments at this place)

Definition at line 96 of file class.ilOrgUnitPosition.php.

96 : array
97 {
98 arObjectCache::flush(self::class);
99 $q = "SELECT DISTINCT il_orgu_positions.id, il_orgu_positions.*
100 FROM il_orgu_positions
101 LEFT JOIN il_orgu_ua ON il_orgu_positions.id = il_orgu_ua.position_id AND il_orgu_ua.orgu_id = %s
102 WHERE il_orgu_ua.user_id IS NOT NULL
103 OR core_position = 1";
104 $database = $GLOBALS['DIC']->database();
105 $st = $database->queryF($q, array('integer'), array($orgu_ref_id));
106
107 $positions = array();
108
109 while ($data = $database->fetchAssoc($st)) {
110 $position = new self();
111 $position->buildFromArray($data);
112 $positions[] = $position;
113 }
114
115 return $positions;
116 }

References $data, $GLOBALS, and arObjectCache\flush().

Referenced by ilOrgUnitUserAssignmentGUI\assignmentsRecursive(), and ilOrgUnitUserAssignmentGUI\index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthorities()

ilOrgUnitPosition::getAuthorities ( )
Returns
ilOrgUnitAuthority[]

Definition at line 265 of file class.ilOrgUnitPosition.php.

265 : array
266 {
267 return $this->authorities;
268 }

References $authorities.

Referenced by storeAuthorities().

+ Here is the caller graph for this function:

◆ getAuthoritiesAsArray()

ilOrgUnitPosition::getAuthoritiesAsArray ( )

Definition at line 180 of file class.ilOrgUnitPosition.php.

180 : array
181 {
182 $return = array();
183 foreach ($this->authorities as $authority) {
184 $return[] = $authority->__toArray();
185 }
186
187 return $return;
188 }

◆ getCoreIdentifier()

ilOrgUnitPosition::getCoreIdentifier ( )
Returns
int

Definition at line 281 of file class.ilOrgUnitPosition.php.

281 : int
282 {
284 }

References $core_identifier.

◆ getCorePosition()

static ilOrgUnitPosition::getCorePosition ( int  $core_identifier)
static

@noinspection PhpIncompatibleReturnTypeInspection

Definition at line 43 of file class.ilOrgUnitPosition.php.

43 : self
44 {
46 return self::where(['core_identifier' => $core_identifier])->first();
47 }

References $core_identifier, and ActiveRecord\where().

Referenced by ilOrgUnitPositionGUI\assign(), getCorePositionId(), ilObjOrgUnitTree\getEmployees(), and ilObjOrgUnitTree\getSuperiors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCorePositionId()

static ilOrgUnitPosition::getCorePositionId ( int  $core_identifier)
static

◆ getDependentAuthorities()

ilOrgUnitPosition::getDependentAuthorities ( )
Returns
ilOrgUnitAuthority[] it's own authorities and also all which use this position

Definition at line 198 of file class.ilOrgUnitPosition.php.

198 : array
199 {
200 $dependent = ilOrgUnitAuthority::where(array(ilOrgUnitAuthority::FIELD_OVER => $this->getId()))
201 ->get();
202
203 return $dependent + $this->authorities;
204 }

References $authorities, ilOrgUnitAuthority\FIELD_OVER, getId(), and ActiveRecord\where().

Referenced by deleteWithAllDependencies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilOrgUnitPosition::getDescription ( )

Definition at line 242 of file class.ilOrgUnitPosition.php.

242 : string
243 {
244 return $this->description;
245 }

References $description.

◆ getId()

◆ getTitle()

ilOrgUnitPosition::getTitle ( )

Definition at line 232 of file class.ilOrgUnitPosition.php.

232 : string
233 {
234 return $this->title;
235 }

References $title.

Referenced by ilOrgUnitRecursiveUserAssignmentTableGUI\__construct(), ilOrgUnitUserAssignmentTableGUI\__construct(), and __toString().

+ Here is the caller graph for this function:

◆ isCorePosition()

ilOrgUnitPosition::isCorePosition ( )

Definition at line 252 of file class.ilOrgUnitPosition.php.

252 : bool
253 {
255 }

References $core_position.

Referenced by delete().

+ Here is the caller graph for this function:

◆ returnDbTableName()

static ilOrgUnitPosition::returnDbTableName ( )
static
Exceptions

arException

Deprecated:

Reimplemented from ActiveRecord.

Definition at line 28 of file class.ilOrgUnitPosition.php.

28 : string
29 {
30 return "il_orgu_positions";
31 }

◆ setAuthorities()

ilOrgUnitPosition::setAuthorities ( array  $authorities)
Parameters
ilOrgUnitAuthority[]$authorities

Definition at line 273 of file class.ilOrgUnitPosition.php.

274 {
275 $this->authorities = $authorities;
276 }

References $authorities.

◆ setCoreIdentifier()

ilOrgUnitPosition::setCoreIdentifier ( int  $core_identifier)
Parameters
int$core_identifier

Definition at line 289 of file class.ilOrgUnitPosition.php.

290 {
291 $this->core_identifier = $core_identifier;
292 }

References $core_identifier.

◆ setCorePosition()

ilOrgUnitPosition::setCorePosition ( bool  $core_position)

Definition at line 257 of file class.ilOrgUnitPosition.php.

258 {
259 $this->core_position = $core_position;
260 }

References $core_position.

◆ setDescription()

ilOrgUnitPosition::setDescription ( string  $description)

Definition at line 247 of file class.ilOrgUnitPosition.php.

248 {
249 $this->description = $description;
250 }

References $description.

◆ setId()

ilOrgUnitPosition::setId ( ?int  $id)

Definition at line 227 of file class.ilOrgUnitPosition.php.

228 {
229 $this->id = $id;
230 }

References $id.

◆ setTitle()

ilOrgUnitPosition::setTitle ( string  $title)

Definition at line 237 of file class.ilOrgUnitPosition.php.

238 {
239 $this->title = $title;
240 }

References $title.

◆ storeAuthorities()

ilOrgUnitPosition::storeAuthorities ( )
private

Definition at line 294 of file class.ilOrgUnitPosition.php.

294 : void
295 {
296 $ids = [];
297 foreach ($this->getAuthorities() as $authority) {
298 $authority->setPositionId($this->getId());
299 if ($authority->getId()) {
300 $authority->update();
301 } else {
302 $authority->create();
303 }
304 $ids[] = $authority->getId();
305 }
306 if (count($ids) > 0) {
307 foreach (
309 'id' => $ids,
310 'position_id' => $this->getId(),
311 ), array('id' => 'NOT IN', 'position_id' => '='))->get() as $authority
312 ) {
313 $authority->delete();
314 }
315 }
316
317 if (count($ids) === 0) {
318 foreach (
320 'position_id' => $this->getId(),
321 ))->get() as $authority
322 ) {
323 $authority->delete();
324 }
325 }
326 }

References ActiveRecord\count(), getAuthorities(), getId(), and ActiveRecord\where().

Referenced by create(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilOrgUnitPosition::update ( )

Reimplemented from ActiveRecord.

Definition at line 168 of file class.ilOrgUnitPosition.php.

168 : void
169 {
170 parent::update();
171 $this->storeAuthorities();
172 }

References storeAuthorities().

+ Here is the call graph for this function:

Field Documentation

◆ $authorities

array ilOrgUnitPosition::$authorities = array()
protected

◆ $core_identifier

int ilOrgUnitPosition::$core_identifier = 0
protected

◆ $core_position

bool ilOrgUnitPosition::$core_position = false
protected

Definition at line 149 of file class.ilOrgUnitPosition.php.

Referenced by isCorePosition(), and setCorePosition().

◆ $description

string ilOrgUnitPosition::$description = ""
protected

Definition at line 142 of file class.ilOrgUnitPosition.php.

Referenced by getDescription(), and setDescription().

◆ $id

int ilOrgUnitPosition::$id = 0
protected

Definition at line 128 of file class.ilOrgUnitPosition.php.

Referenced by getId(), and setId().

◆ $title

string ilOrgUnitPosition::$title = ""
protected

Definition at line 135 of file class.ilOrgUnitPosition.php.

Referenced by getTitle(), and setTitle().

◆ CORE_POSITION_EMPLOYEE

◆ CORE_POSITION_SUPERIOR


The documentation for this class was generated from the following file: