ILIAS  release_8 Revision v8.24
class.ilMDSettings.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/*
5 +-----------------------------------------------------------------------------+
6 | ILIAS open source |
7 +-----------------------------------------------------------------------------+
8 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
9 | |
10 | This program is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU General Public License |
12 | as published by the Free Software Foundation; either version 2 |
13 | of the License, or (at your option) any later version. |
14 | |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU General Public License |
21 | along with this program; if not, write to the Free Software |
22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 +-----------------------------------------------------------------------------+
24*/
25
33{
34 protected static ?self $instance = null;
35
37 private bool $copyright_selection_active = false;
38 private string $delimiter = '';
39
40 private function __construct()
41 {
42 $this->read();
43 }
44
45 public static function _getInstance(): ilMDSettings
46 {
47 if (self::$instance) {
48 return self::$instance;
49 }
50 return self::$instance = new ilMDSettings();
51 }
52
53 public function isCopyrightSelectionActive(): bool
54 {
56 }
57
58 public function activateCopyrightSelection(bool $a_status): void
59 {
60 $this->copyright_selection_active = $a_status;
61 }
62
63 public function setDelimiter(string $a_val): void
64 {
65 $this->delimiter = $a_val;
66 }
67
68 public function getDelimiter(): string
69 {
70 if (trim($this->delimiter) === '') {
71 return ",";
72 }
73 return $this->delimiter;
74 }
75
76 public function save(): void
77 {
78 $this->settings->set('copyright_selection_active', (string) $this->isCopyrightSelectionActive());
79 $this->settings->set('delimiter', $this->getDelimiter());
80 }
81
82 private function read(): void
83 {
84 $this->settings = new ilSetting('md_settings');
85
86 $this->copyright_selection_active = (bool) $this->settings->get('copyright_selection_active', '0');
87 $this->delimiter = (string) $this->settings->get('delimiter', ",");
88 }
89}
setDelimiter(string $a_val)
activateCopyrightSelection(bool $a_status)
bool $copyright_selection_active
static self $instance
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...