ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilOrgUnitGlobalSettings Class Reference

Global settings for org units. More...

+ Collaboration diagram for ilOrgUnitGlobalSettings:

Public Member Functions

 getObjectPositionSettingsByType ($a_obj_type)
 Get object position settings by type. More...
 
 isPositionAccessActiveForObject ($a_obj_id)
 Check of position access is activate for object. More...
 
 saveDefaultPositionActivationStatus ($a_obj_id)
 Set and save the default activation status according to settings. More...
 
 getPositionSettings ()
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Protected Member Functions

 __construct ()
 Singelton constructor. More...
 
 readSettings ()
 read settings More...
 

Protected Attributes

 $object_definition = null
 

Private Attributes

 $position_settings = []
 
 $object_position_cache = []
 

Static Private Attributes

static $instance = null
 

Detailed Description

Global settings for org units.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilOrgUnitGlobalSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitGlobalSettings::__construct ( )
protected

Singelton constructor.

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

References $GLOBALS, and readSettings().

38  {
39  $this->object_definition = $GLOBALS['DIC']['objDefinition'];
40  $this->readSettings();
41  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

◆ getObjectPositionSettingsByType()

ilOrgUnitGlobalSettings::getObjectPositionSettingsByType (   $a_obj_type)

Get object position settings by type.

Parameters
string$a_obj_type
Returns
ilOrgUnitObjectTypePositionSetting
Exceptions

Definition at line 67 of file class.ilOrgUnitGlobalSettings.php.

Referenced by isPositionAccessActiveForObject(), and saveDefaultPositionActivationStatus().

68  {
69  if (!isset($this->position_settings[$a_obj_type])) {
70  throw new \InvalidArgumentException('Object type passed does not support position settings: '
71  . $a_obj_type);
72  }
73 
74  return $this->position_settings[$a_obj_type];
75  }
+ Here is the caller graph for this function:

◆ getPositionSettings()

ilOrgUnitGlobalSettings::getPositionSettings ( )
Returns
[]

Definition at line 158 of file class.ilOrgUnitGlobalSettings.php.

References $position_settings.

◆ isPositionAccessActiveForObject()

ilOrgUnitGlobalSettings::isPositionAccessActiveForObject (   $a_obj_id)

Check of position access is activate for object.

Parameters
int$a_obj_id
Returns
bool

Definition at line 85 of file class.ilOrgUnitGlobalSettings.php.

References $type, ilObject\_lookupType(), and getObjectPositionSettingsByType().

86  {
87  if (isset($this->object_position_cache[$a_obj_id])) {
88  return $this->object_position_cache[$a_obj_id];
89  }
90  $type = ilObject::_lookupType($a_obj_id);
91  try {
92  $type_settings = $this->getObjectPositionSettingsByType($type);
93  } catch (\InvalidArgumentException $invalid_type_exception) {
94  $this->object_position_cache[$a_obj_id] = false;
95 
96  return false;
97  }
98 
99  if (!$type_settings->isActive()) {
100  $this->object_position_cache[$a_obj_id] = false;
101 
102  return false;
103  }
104  if (!$type_settings->isChangeableForObject()) {
105  $this->object_position_cache[$a_obj_id] = true;
106 
107  return true;
108  }
109  $object_position = new ilOrgUnitObjectPositionSetting($a_obj_id);
110 
111  if ($object_position->hasObjectSpecificActivation()) {
112  $this->object_position_cache[$a_obj_id] = $object_position->isActive();
113  } else {
114  $this->object_position_cache[$a_obj_id] = (bool) $type_settings->getActivationDefault();
115  }
116 
117  return $this->object_position_cache[$a_obj_id];
118  }
Stores object activation status of orgunit position settings.
$type
static _lookupType($a_id, $a_reference=false)
lookup object type
getObjectPositionSettingsByType($a_obj_type)
Get object position settings by type.
+ Here is the call graph for this function:

◆ readSettings()

ilOrgUnitGlobalSettings::readSettings ( )
protected

read settings

Definition at line 147 of file class.ilOrgUnitGlobalSettings.php.

References $type.

Referenced by __construct().

148  {
149  foreach ($this->object_definition->getOrgUnitPermissionTypes() as $type) {
150  $this->position_settings[$type] = new ilOrgUnitObjectTypePositionSetting($type);
151  }
152  }
$type
Object settings regarding position permissions.
+ Here is the caller graph for this function:

◆ saveDefaultPositionActivationStatus()

ilOrgUnitGlobalSettings::saveDefaultPositionActivationStatus (   $a_obj_id)

Set and save the default activation status according to settings.

Parameters
int$a_obj_id

Definition at line 126 of file class.ilOrgUnitGlobalSettings.php.

References $type, ilObject\_lookupType(), and getObjectPositionSettingsByType().

127  {
128  $type = ilObject::_lookupType($a_obj_id);
129  try {
130  $type_settings = $this->getObjectPositionSettingsByType($type);
131  } catch (\InvalidArgumentException $ex) {
132  return;
133  }
134  if ($type_settings->isActive()) {
135  $object_setting = new ilOrgUnitObjectTypePositionSetting($a_obj_id);
136  $object_setting->setActive($type_settings->getActivationDefault());
137  $object_setting->update();
138  }
139 
140  return;
141  }
$type
static _lookupType($a_id, $a_reference=false)
lookup object type
getObjectPositionSettingsByType($a_obj_type)
Get object position settings by type.
Object settings regarding position permissions.
+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilOrgUnitGlobalSettings::$instance = null
staticprivate

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

◆ $object_definition

ilOrgUnitGlobalSettings::$object_definition = null
protected

Definition at line 21 of file class.ilOrgUnitGlobalSettings.php.

◆ $object_position_cache

ilOrgUnitGlobalSettings::$object_position_cache = []
private

Definition at line 31 of file class.ilOrgUnitGlobalSettings.php.

◆ $position_settings

ilOrgUnitGlobalSettings::$position_settings = []
private

Definition at line 25 of file class.ilOrgUnitGlobalSettings.php.

Referenced by getPositionSettings().


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