ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSearchSettings.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 
35 {
36  var $ilias = null;
37  var $max_hits = null;
38  var $index = null;
39 
40  function ilSearchSettings()
41  {
42  global $ilias;
43 
44  $this->ilias =& $ilias;
45  $this->__read();
46  }
47 
54  {
55  global $ilDB;
56 
57  static $seas_ref_id = 0;
58 
59  if($seas_ref_id)
60  {
61  return $seas_ref_id;
62  }
63  $query = "SELECT object_reference.ref_id as ref_id FROM object_reference,tree,object_data ".
64  "WHERE tree.parent = '".SYSTEM_FOLDER_ID."' ".
65  "AND object_data.type = 'seas' ".
66  "AND object_reference.ref_id = tree.child ".
67  "AND object_reference.obj_id = object_data.obj_id";
68 
69  $res = $ilDB->query($query);
70  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
71 
72  return $seas_ref_id = $row->ref_id;
73  }
74 
75  function enabledIndex()
76  {
77  return $this->index ? true : false;
78  }
79  function enableIndex($a_status)
80  {
81  $this->index = $a_status;
82  }
83  function enabledLucene()
84  {
85  return $this->lucene ? true : false;
86  }
87  function enableLucene($a_status)
88  {
89  $this->lucene = $a_status ? true : false;
90  }
91 
92  function getMaxHits()
93  {
94  return $this->max_hits;
95  }
96  function setMaxHits($a_max_hits)
97  {
98  $this->max_hits = $a_max_hits;
99  }
100 
101 
102  function update()
103  {
104  // setSetting writes to db
105  $this->ilias->setSetting('search_max_hits',$this->getMaxHits());
106  $this->ilias->setSetting('search_index',$this->enabledIndex());
107  $this->ilias->setSetting('search_lucene',(int) $this->enabledLucene());
108 
109  return true;
110  }
111 
112  // PRIVATE
113  function __read()
114  {
115  $this->setMaxHits($this->ilias->getSetting('search_max_hits',50));
116  $this->enableIndex($this->ilias->getSetting('search_index',0));
117  $this->enableLucene($this->ilias->getSetting('search_lucene',0));
118  }
119 }
120 ?>