ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilDashboardSidePanelSettingsRepository.php
Go to the documentation of this file.
1 <?php
2 
20 {
21  public const CALENDAR = "cal";
22  public const NEWS = "news";
23  public const MAIL = "mail";
24  public const TASKS = "task";
25 
26  protected ilSetting $setting;
27 
28  public function __construct(ilSetting $dashboard_settings = null)
29  {
30  $this->setting = is_null($dashboard_settings)
31  ? new ilSetting("dash")
32  : $dashboard_settings;
33  }
34 
35  public function getValidModules(): array
36  {
37  return [
38  self::CALENDAR,
39  self::NEWS,
40  self::MAIL,
41  self::TASKS
42  ];
43  }
44 
45  protected function isValidModule(string $mod): bool
46  {
47  return in_array($mod, $this->getValidModules());
48  }
49 
50 
51  // Enable module
52  public function enable(string $mod, bool $active): void
53  {
54  if ($this->isValidModule($mod)) {
55  $this->setting->set("enable_" . $mod, (int) $active);
56  }
57  }
58 
59  // Is module enabled?
60  public function isEnabled(string $mod): bool
61  {
62  if ($this->isValidModule($mod)) {
63  return (bool) $this->setting->get("enable_" . $mod, true);
64  }
65  return false;
66  }
67 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...