ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilOrgUnitPosition Class Reference

Class ilOrgUnitPosition. 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 ($id)
 
 getTitle ()
 
 setTitle ($title)
 
 getDescription ()
 
 setDescription ($description)
 
 isCorePosition ()
 
 setCorePosition ($core_position)
 
 getAuthorities ()
 
 setAuthorities ($authorities)
 
 getCoreIdentifier ()
 
 setCoreIdentifier ($core_identifier)
 
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 
 getArFieldList ()
 
 getConnectorContainerName ()
 
 setConnectorContainerName ($connector_container_name)
 
 getPrimaryFieldValue ()
 
 setPrimaryFieldValue ($value)
 
 __construct ($primary_key=0, arConnector $connector=null)
 
 storeObjectToCache ()
 
 __getConvertedDateFieldsAsArray ($format=null)
 
 __asCsv ($separator=';', $header=false)
 
 __asArray ()
 
 __asStdClass ()
 
 __asSerializedObject ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, $value)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 getArrayForDb ()
 
 getArrayForConnector ()
 
 installConnector ()
 
 store ()
 
 save ()
 
 create ()
 
 copy ($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 ($core_identifier)
 
static getCorePositionId ($core_identifier)
 
static getActive ()
 
static getActiveForPosition ($orgu_ref_id)
 
- Static Public Member Functions inherited from ActiveRecord
static returnDbTableName ()
 
static installDB ()
 
static renameDBField ($old_name, $new_name)
 
static tableExists ()
 
static fieldExists ($field_name)
 
static removeDBField ($field_name)
 
static updateDB ()
 
static resetDB ()
 
static truncateDB ()
 
static flushDB ()
 
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, $fields=array(' *'), $operator='=', $both_external=false)
 
static innerjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static leftjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static orderBy ($orderBy, $orderDirection='ASC')
 
static dateFormat ($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 ($set_raw=true)
 
static getArray ($key=null, $values=null)
 
static _toCamelCase ($str, $capitalise_first_char=false)
 

Data Fields

const CORE_POSITION_EMPLOYEE = 1
 
const CORE_POSITION_SUPERIOR = 2
 
- Data Fields inherited from ActiveRecord
const ACTIVE_RECORD_VERSION = '2.0.7'
 

Protected Attributes

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

Private Member Functions

 storeAuthorities ()
 

Additional Inherited Members

- Protected Member Functions inherited from ActiveRecord
 serializeToCSV ($field)
 This method is called for every field of your instance if you use __asCsv. More...
 
 installDatabase ()
 
- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 
static fromCamelCase ($str)
 

Detailed Description

Member Function Documentation

◆ __toString()

ilOrgUnitPosition::__toString ( )
Returns
string

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

214 {
215 return $this->getTitle();
216 }

References getTitle().

+ Here is the call graph for this function:

◆ afterObjectLoad()

ilOrgUnitPosition::afterObjectLoad ( )

Reimplemented from ActiveRecord.

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

176 {
177 $this->authorities = ilOrgUnitAuthority::where(array(ilOrgUnitAuthority::POSITION_ID => $this->getId()))
178 ->get();
179 }
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 189 of file class.ilOrgUnitPosition.php.

190 {
191 parent::create();
192 $this->storeAuthorities();
193 }

References storeAuthorities().

+ Here is the call graph for this function:

◆ delete()

ilOrgUnitPosition::delete ( )
Exceptions

ilException whenever you try to delete a core-position like employee or superior

Reimplemented from ActiveRecord.

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

62 {
63 if ($this->isCorePosition()) {
64 throw new ilException('Cannot delete Core-Position');
65 }
66 parent::delete();
67 }
Base class for ILIAS Exception handling.

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 236 of file class.ilOrgUnitPosition.php.

237 {
238 foreach ($this->getDependentAuthorities() as $authority) {
239 $authority->delete();
240 }
241
242 $ilOrgUnitUserAssignmentQueries = ilOrgUnitUserAssignmentQueries::getInstance();
243 foreach ($ilOrgUnitUserAssignmentQueries->getUserAssignmentsOfPosition($this->getId()) as $assignment) {
244 $assignment->delete();
245 }
246 parent::delete();
247 }

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 28 of file class.ilOrgUnitPosition.php.

29 {
31 return parent::get();
32 }
get(string $class_name)

References ILIAS\GlobalScreen\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 74 of file class.ilOrgUnitPosition.php.

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

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

+ Here is the call graph for this function:

◆ getActiveForPosition()

static ilOrgUnitPosition::getActiveForPosition (   $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 103 of file class.ilOrgUnitPosition.php.

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

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 325 of file class.ilOrgUnitPosition.php.

References $authorities.

Referenced by storeAuthorities().

+ Here is the caller graph for this function:

◆ getAuthoritiesAsArray()

ilOrgUnitPosition::getAuthoritiesAsArray ( )
Returns
array

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

200 {
201 $return = array();
202 foreach ($this->authorities as $authority) {
203 $return[] = $authority->__toArray();
204 }
205
206 return $return;
207 }

◆ getCoreIdentifier()

ilOrgUnitPosition::getCoreIdentifier ( )
Returns
int

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

References $core_identifier.

◆ getCorePosition()

static ilOrgUnitPosition::getCorePosition (   $core_identifier)
static
Parameters
$core_identifier
Returns
\ilOrgUnitPosition

@noinspection PhpIncompatibleReturnTypeInspection

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

41 {
43 return ilOrgUnitPosition::where(['core_identifier' => $core_identifier])->first();
44 }

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 (   $core_identifier)
static

◆ getDependentAuthorities()

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

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

223 {
224 $dependent = ilOrgUnitAuthority::where(array(ilOrgUnitAuthority::FIELD_OVER => $this->getId()))
225 ->get();
226
227 $arr = $dependent + $this->authorities;
228
229 return (array) $arr;
230 }

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 ( )
Returns
string

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

References $description.

◆ getId()

ilOrgUnitPosition::getId ( )
Returns
int

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

254 {
255 return $this->id;
256 }

References $id.

Referenced by afterObjectLoad(), ilObjOrgUnitTree\getAssignements(), getDependentAuthorities(), and storeAuthorities().

+ Here is the caller graph for this function:

◆ getTitle()

ilOrgUnitPosition::getTitle ( )
Returns
string

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

272 {
273 return $this->title;
274 }

References $title.

Referenced by __toString().

+ Here is the caller graph for this function:

◆ isCorePosition()

ilOrgUnitPosition::isCorePosition ( )
Returns
bool

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

References $core_position.

Referenced by delete().

+ Here is the caller graph for this function:

◆ returnDbTableName()

static ilOrgUnitPosition::returnDbTableName ( )
static
Returns
string

Reimplemented from ActiveRecord.

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

18 {
19 return "il_orgu_positions";
20 }

◆ setAuthorities()

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

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

335 {
336 $this->authorities = $authorities;
337 }

References $authorities.

◆ setCoreIdentifier()

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

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

353 {
354 $this->core_identifier = $core_identifier;
355 }

References $core_identifier.

◆ setCorePosition()

ilOrgUnitPosition::setCorePosition (   $core_position)
Parameters
bool$core_position

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

317 {
318 $this->core_position = $core_position;
319 }

References $core_position.

◆ setDescription()

ilOrgUnitPosition::setDescription (   $description)
Parameters
string$description

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

299 {
300 $this->description = $description;
301 }

References $description.

◆ setId()

ilOrgUnitPosition::setId (   $id)
Parameters
int$id

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

263 {
264 $this->id = $id;
265 }

References $id.

◆ setTitle()

ilOrgUnitPosition::setTitle (   $title)
Parameters
string$title

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

281 {
282 $this->title = $title;
283 }

References $title.

◆ storeAuthorities()

ilOrgUnitPosition::storeAuthorities ( )
private

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

359 {
360 $ids = [];
361 foreach ($this->getAuthorities() as $authority) {
362 $authority->setPositionId($this->getId());
363 if ($authority->getId()) {
364 $authority->update();
365 } else {
366 $authority->create();
367 }
368 $ids[] = $authority->getId();
369 }
370 if (count($ids) > 0) {
371 foreach (
373 'id' => $ids,
374 'position_id' => $this->getId(),
375 ), array('id' => 'NOT IN', 'position_id' => '='))->get() as $authority
376 ) {
377 $authority->delete();
378 }
379 }
380
381 if (count($ids) === 0) {
382 foreach (
384 'position_id' => $this->getId(),
385 ))->get() as $authority
386 ) {
387 $authority->delete();
388 }
389 }
390 }

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 182 of file class.ilOrgUnitPosition.php.

183 {
184 parent::update();
185 $this->storeAuthorities();
186 }

References storeAuthorities().

+ Here is the call graph for this function:

Field Documentation

◆ $authorities

ilOrgUnitPosition::$authorities = array()
protected

◆ $core_identifier

ilOrgUnitPosition::$core_identifier = 0
protected

◆ $core_position

ilOrgUnitPosition::$core_position = false
protected

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

Referenced by isCorePosition(), and setCorePosition().

◆ $description

ilOrgUnitPosition::$description = ""
protected

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

Referenced by getDescription(), and setDescription().

◆ $id

ilOrgUnitPosition::$id = 0
protected

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

Referenced by getId(), and setId().

◆ $title

ilOrgUnitPosition::$title = ""
protected

Definition at line 144 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: