ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilDashboardSidePanelSettingsRepository.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
12 const CALENDAR = "cal";
13 const NEWS = "news";
14 const MAIL = "mail";
15 const TASKS = "task";
16
20 public function __construct(ilSetting $dashboard_settings = null)
21 {
22 $this->setting = is_null($dashboard_settings)
23 ? new ilSetting("dash")
24 : $dashboard_settings;
25 }
26
32 public function getValidModules() : array
33 {
34 return [
39 ];
40 }
41
47 protected function isValidModule(string $mod) : bool
48 {
49 return in_array($mod, $this->getValidModules());
50 }
51
52
59 public function enable(string $mod, bool $active)
60 {
61 if ($this->isValidModule($mod)) {
62 $this->setting->set("enable_" . $mod, (int) $active);
63 }
64 }
65
72 public function isEnabled(string $mod) : bool
73 {
74 if ($this->isValidModule($mod)) {
75 return (bool) $this->setting->get("enable_" . $mod, true);
76 }
77 return false;
78 }
79}
An exception for terminatinating execution or to throw for unit testing.
__construct(ilSetting $dashboard_settings=null)
Constructor.
ILIAS Setting Class.