ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 26 of file class.ilOrgUnitGlobalSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitGlobalSettings::__construct ( )
private

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

References $GLOBALS, and readSettings().

39  {
40  $this->object_definition = $GLOBALS['DIC']['objDefinition'];
41  $this->readSettings();
42  }
$GLOBALS["DIC"]
Definition: wac.php:30
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

◆ getObjectPositionSettingsByType()

ilOrgUnitGlobalSettings::getObjectPositionSettingsByType ( string  $a_obj_type)

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

Referenced by isPositionAccessActiveForObject(), and saveDefaultPositionActivationStatus().

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

◆ getPositionSettings()

ilOrgUnitGlobalSettings::getPositionSettings ( )
Returns
ilOrgUnitObjectTypePositionSetting[]

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

References $position_settings.

130  : array
131  {
133  }

◆ isPositionAccessActiveForObject()

ilOrgUnitGlobalSettings::isPositionAccessActiveForObject ( int  $a_obj_id)

Check of position access is activate for object.

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

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

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

◆ readSettings()

ilOrgUnitGlobalSettings::readSettings ( )
private

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

Referenced by __construct().

120  : void
121  {
122  foreach ($this->object_definition->getOrgUnitPermissionTypes() as $type) {
123  $this->position_settings[$type] = new ilOrgUnitObjectTypePositionSetting($type);
124  }
125  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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 105 of file class.ilOrgUnitGlobalSettings.php.

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

105  : void
106  {
107  $type = ilObject::_lookupType($a_obj_id);
108  try {
109  $type_settings = $this->getObjectPositionSettingsByType($type);
110  } catch (\InvalidArgumentException $ex) {
111  return;
112  }
113  if ($type_settings->isActive()) {
114  $object_setting = new ilOrgUnitObjectTypePositionSetting($a_obj_id);
115  $object_setting->setActive($type_settings->getActivationDefault());
116  $object_setting->update();
117  }
118  }
getObjectPositionSettingsByType(string $a_obj_type)
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilOrgUnitGlobalSettings ilOrgUnitGlobalSettings::$instance = null
staticprivate

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

◆ $object_definition

ilObjectDefinition ilOrgUnitGlobalSettings::$object_definition = null
protected

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

◆ $position_settings

array ilOrgUnitGlobalSettings::$position_settings = []
private

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

Referenced by getPositionSettings().


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