ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 23 of file class.ilOrgUnitGlobalSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitGlobalSettings::__construct ( )
private

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

36 {
37 $this->object_definition = $GLOBALS['DIC']['objDefinition'];
38 $this->readSettings();
39 }
$GLOBALS["DIC"]
Definition: wac.php:54

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

51 {
52 if (!isset($this->position_settings[$a_obj_type])) {
53 throw new \InvalidArgumentException('Object type passed does not support position settings: '
54 . $a_obj_type);
55 }
56
57 return $this->position_settings[$a_obj_type];
58 }
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 127 of file class.ilOrgUnitGlobalSettings.php.

127 : array
128 {
130 }

References $position_settings.

◆ isPositionAccessActiveForObject()

ilOrgUnitGlobalSettings::isPositionAccessActiveForObject ( int  $a_obj_id)

Check of position access is activate for object.

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

63 : bool
64 {
65 if (isset($this->object_position_cache[$a_obj_id])) {
66 return $this->object_position_cache[$a_obj_id];
67 }
68 $type = ilObject::_lookupType($a_obj_id);
69 try {
70 $type_settings = $this->getObjectPositionSettingsByType($type);
71 } catch (\InvalidArgumentException $invalid_type_exception) {
72 $this->object_position_cache[$a_obj_id] = false;
73
74 return false;
75 }
76
77 if (!$type_settings->isActive()) {
78 $this->object_position_cache[$a_obj_id] = false;
79
80 return false;
81 }
82 if (!$type_settings->isChangeableForObject()) {
83 $this->object_position_cache[$a_obj_id] = true;
84
85 return true;
86 }
87 $object_position = new ilOrgUnitObjectPositionSetting($a_obj_id);
88
89 if ($object_position->hasObjectSpecificActivation()) {
90 $this->object_position_cache[$a_obj_id] = $object_position->isActive();
91 } else {
92 $this->object_position_cache[$a_obj_id] = (bool) $type_settings->getActivationDefault();
93 }
94
95 return $this->object_position_cache[$a_obj_id];
96 }
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...

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

+ Here is the call graph for this function:

◆ readSettings()

ilOrgUnitGlobalSettings::readSettings ( )
private

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

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

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilOrgUnitGlobalSettings ilOrgUnitGlobalSettings::$instance = null
staticprivate

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

Referenced by getInstance().

◆ $object_definition

ilObjectDefinition ilOrgUnitGlobalSettings::$object_definition = null
protected

Definition at line 26 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 33 of file class.ilOrgUnitGlobalSettings.php.

◆ $position_settings

array ilOrgUnitGlobalSettings::$position_settings = []
private

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

Referenced by getPositionSettings().


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