ILIAS  release_8 Revision v8.24
ilOrgUnitGlobalSettings Class Reference

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

+ Collaboration diagram for ilOrgUnitGlobalSettings:

Public Member Functions

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

Static Public Member Functions

static getInstance ()
 

Protected Attributes

ilObjectDefinition $object_definition = null
 

Private Member Functions

 __construct ()
 
 readSettings ()
 

Private Attributes

array $position_settings = []
 
array $object_position_cache = []
 Array with key obj_id => active status. More...
 

Static Private Attributes

static ilOrgUnitGlobalSettings $instance = null
 

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 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 25 of file class.ilOrgUnitGlobalSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitGlobalSettings::__construct ( )
private

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

38 {
39 $this->object_definition = $GLOBALS['DIC']['objDefinition'];
40 $this->readSettings();
41 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

References $GLOBALS, and readSettings().

+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

◆ getObjectPositionSettingsByType()

ilOrgUnitGlobalSettings::getObjectPositionSettingsByType ( string  $a_obj_type)

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

53 {
54 if (!isset($this->position_settings[$a_obj_type])) {
55 throw new \InvalidArgumentException('Object type passed does not support position settings: '
56 . $a_obj_type);
57 }
58
59 return $this->position_settings[$a_obj_type];
60 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by isPositionAccessActiveForObject(), and saveDefaultPositionActivationStatus().

+ Here is the caller graph for this function:

◆ getPositionSettings()

ilOrgUnitGlobalSettings::getPositionSettings ( )
Returns
ilOrgUnitObjectTypePositionSetting[]

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

129 : array
130 {
132 }

References $position_settings.

◆ isPositionAccessActiveForObject()

ilOrgUnitGlobalSettings::isPositionAccessActiveForObject ( int  $a_obj_id)

Check of position access is activate for object.

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

65 : bool
66 {
67 if (isset($this->object_position_cache[$a_obj_id])) {
68 return $this->object_position_cache[$a_obj_id];
69 }
70 $type = ilObject::_lookupType($a_obj_id);
71 try {
72 $type_settings = $this->getObjectPositionSettingsByType($type);
73 } catch (\InvalidArgumentException $invalid_type_exception) {
74 $this->object_position_cache[$a_obj_id] = false;
75
76 return false;
77 }
78
79 if (!$type_settings->isActive()) {
80 $this->object_position_cache[$a_obj_id] = false;
81
82 return false;
83 }
84 if (!$type_settings->isChangeableForObject()) {
85 $this->object_position_cache[$a_obj_id] = true;
86
87 return true;
88 }
89 $object_position = new ilOrgUnitObjectPositionSetting($a_obj_id);
90
91 if ($object_position->hasObjectSpecificActivation()) {
92 $this->object_position_cache[$a_obj_id] = $object_position->isActive();
93 } else {
94 $this->object_position_cache[$a_obj_id] = (bool) $type_settings->getActivationDefault();
95 }
96
97 return $this->object_position_cache[$a_obj_id];
98 }
static _lookupType(int $id, bool $reference=false)
getObjectPositionSettingsByType(string $a_obj_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type

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

+ Here is the call graph for this function:

◆ readSettings()

ilOrgUnitGlobalSettings::readSettings ( )
private

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

119 : void
120 {
121 foreach ($this->object_definition->getOrgUnitPermissionTypes() as $type) {
122 $this->position_settings[$type] = new ilOrgUnitObjectTypePositionSetting($type);
123 }
124 }

References $type.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ saveDefaultPositionActivationStatus()

ilOrgUnitGlobalSettings::saveDefaultPositionActivationStatus ( int  $a_obj_id)

Set and save the default activation status according to settings.

Parameters
int$a_obj_id

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

104 : void
105 {
106 $type = ilObject::_lookupType($a_obj_id);
107 try {
108 $type_settings = $this->getObjectPositionSettingsByType($type);
109 } catch (\InvalidArgumentException $ex) {
110 return;
111 }
112 if ($type_settings->isActive()) {
113 $object_setting = new ilOrgUnitObjectTypePositionSetting($a_obj_id);
114 $object_setting->setActive($type_settings->getActivationDefault());
115 $object_setting->update();
116 }
117 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilOrgUnitGlobalSettings ilOrgUnitGlobalSettings::$instance = null
staticprivate

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

Referenced by getInstance().

◆ $object_definition

ilObjectDefinition ilOrgUnitGlobalSettings::$object_definition = null
protected

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

◆ $object_position_cache

array ilOrgUnitGlobalSettings::$object_position_cache = []
private

Array with key obj_id => active status.

Parameters
bool[]

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

◆ $position_settings

array ilOrgUnitGlobalSettings::$position_settings = []
private

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

Referenced by getPositionSettings().


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