ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLuceneAdvancedSearchSettings.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchFields.php';
25 include_once './Services/Administration/classes/class.ilSetting.php';
26 
37 {
38  private static $instance = null;
39  private $fields = array();
40 
41  protected $storage = null;
42 
46  private function __construct()
47  {
48  global $ilSetting;
49 
50  $this->storage = new ilSetting('lucene_adv_search');
51  $this->read();
52  }
53 
54  public static function getInstance()
55  {
56  if (isset(self::$instance) and self::$instance != null) {
57  return self::$instance;
58  }
59  return self::$instance = new ilLuceneAdvancedSearchSettings();
60  }
61 
65  public function isActive($a_field)
66  {
67  return $this->fields[$a_field] ? $this->fields[$a_field] : false;
68  }
69 
74  public function setActive($a_field, $a_status)
75  {
76  $this->fields[$a_field] = (bool) $a_status;
77  }
78 
79  public function save()
80  {
81  foreach ($this->fields as $name => $status) {
82  $this->storage->set($name, $status ? "1" : "0");
83  }
84  return true;
85  }
86 
87  private function read()
88  {
89  foreach (ilLuceneAdvancedSearchFields::getFields() as $name => $translation) {
90  $this->fields[$name] = (bool) $this->storage->get($name, true);
91  }
92  }
93 }
setActive($a_field, $a_status)
set field active status
isActive($a_field)
check if field is active
En/disable single lom/advanced meta data fields.
$errors fields
Definition: imgupload.php:51
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
static getFields()
Return an array of all meta data fields.