ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
24include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchFields.php';
25include_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 {
58 return self::$instance;
59 }
60 return self::$instance = new ilLuceneAdvancedSearchSettings();
61 }
62
66 public function isActive($a_field)
67 {
68 return $this->fields[$a_field] ? $this->fields[$a_field] : false;
69 }
70
75 public function setActive($a_field,$a_status)
76 {
77 $this->fields[$a_field] = (bool) $a_status;
78 }
79
80 public function save()
81 {
82 foreach($this->fields as $name => $status)
83 {
84 $this->storage->set($name,$status ? "1" : "0");
85 }
86 return true;
87 }
88
89 private function read()
90 {
91 foreach(ilLuceneAdvancedSearchFields::getFields() as $name => $translation)
92 {
93 $this->fields[$name] = (bool) $this->storage->get($name,true);
94 }
95 }
96}
97?>
static getFields()
Return an array of all meta data fields.
En/disable single lom/advanced meta data fields.
setActive($a_field, $a_status)
set field active status
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:40
$errors fields
Definition: imgupload.php:48