ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDashboardSidePanelSettingsRepository Class Reference
+ Collaboration diagram for ilDashboardSidePanelSettingsRepository:

Public Member Functions

 __construct (?ilSetting $dashboard_settings=null)
 
 getValidModules ()
 
 setPositions (array $positions)
 
 getPositions ()
 
 enable (string $mod, bool $active)
 
 isEnabled (string $mod)
 

Data Fields

const CALENDAR = 'cal'
 
const NEWS = 'news'
 
const MAIL = 'mail'
 
const TASKS = 'task'
 

Protected Member Functions

 isValidModule (string $mod)
 

Protected Attributes

ilSetting $setting
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDashboardSidePanelSettingsRepository::__construct ( ?ilSetting  $dashboard_settings = null)

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

31  {
32  $this->setting = is_null($dashboard_settings)
33  ? new ilSetting('dash')
34  : $dashboard_settings;
35  }

Member Function Documentation

◆ enable()

ilDashboardSidePanelSettingsRepository::enable ( string  $mod,
bool  $active 
)

Definition at line 82 of file class.ilDashboardSidePanelSettingsRepository.php.

References isValidModule().

82  : void
83  {
84  if ($this->isValidModule($mod)) {
85  $this->setting->set('enable_' . $mod, $active ? '1' : '0');
86  }
87  }
+ Here is the call graph for this function:

◆ getPositions()

ilDashboardSidePanelSettingsRepository::getPositions ( )
Returns
string[]

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

References getValidModules().

61  : array
62  {
63  $positions = $this->setting->get('side_panel_positions', '');
64  $modules = [];
65  if ($positions !== '') {
66  $modules = unserialize($positions, ['allowed_classes' => false]);
67  }
68  $all_modules = $this->getValidModules();
69  foreach ($all_modules as $mod) {
70  if (!in_array($mod, $modules, true)) {
71  $modules[] = $mod;
72  }
73  }
74  return $modules;
75  }
+ Here is the call graph for this function:

◆ getValidModules()

ilDashboardSidePanelSettingsRepository::getValidModules ( )
Returns
string[]

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

Referenced by getPositions(), and isValidModule().

40  : array
41  {
42  return [
43  self::TASKS,
44  self::CALENDAR,
45  self::NEWS,
46  self::MAIL,
47  ];
48  }
+ Here is the caller graph for this function:

◆ isEnabled()

ilDashboardSidePanelSettingsRepository::isEnabled ( string  $mod)

Definition at line 89 of file class.ilDashboardSidePanelSettingsRepository.php.

References isValidModule().

89  : bool
90  {
91  if ($this->isValidModule($mod)) {
92  return (bool) $this->setting->get('enable_' . $mod, '1');
93  }
94  return false;
95  }
+ Here is the call graph for this function:

◆ isValidModule()

ilDashboardSidePanelSettingsRepository::isValidModule ( string  $mod)
protected

Definition at line 77 of file class.ilDashboardSidePanelSettingsRepository.php.

References getValidModules().

Referenced by enable(), and isEnabled().

77  : bool
78  {
79  return in_array($mod, $this->getValidModules());
80  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPositions()

ilDashboardSidePanelSettingsRepository::setPositions ( array  $positions)
Parameters
string[]$positions

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

53  : void
54  {
55  $this->setting->set('side_panel_positions', serialize($positions));
56  }

Field Documentation

◆ $setting

ilSetting ilDashboardSidePanelSettingsRepository::$setting
protected

◆ CALENDAR

const ilDashboardSidePanelSettingsRepository::CALENDAR = 'cal'

◆ MAIL

const ilDashboardSidePanelSettingsRepository::MAIL = 'mail'

◆ NEWS

const ilDashboardSidePanelSettingsRepository::NEWS = 'news'

◆ TASKS

const ilDashboardSidePanelSettingsRepository::TASKS = 'task'

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