• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Search/classes/class.ilSearchSettings.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00034 class ilSearchSettings
00035 {
00036         var $ilias = null;
00037         var $max_hits = null;
00038         var $index = null;
00039 
00040         function ilSearchSettings()
00041         {
00042                 global $ilias;
00043 
00044                 $this->ilias =& $ilias;
00045                 $this->__read();
00046         }
00047 
00053         function _getSearchSettingRefId()
00054         {
00055                 global $ilDB;
00056 
00057                 static $seas_ref_id = 0;
00058 
00059                 if($seas_ref_id)
00060                 {
00061                         return $seas_ref_id;
00062                 }
00063                 $query = "SELECT object_reference.ref_id as ref_id FROM object_reference,tree,object_data ".
00064                         "WHERE tree.parent = '".SYSTEM_FOLDER_ID."' ".
00065                         "AND object_data.type = 'seas' ".
00066                         "AND object_reference.ref_id = tree.child ".
00067                         "AND object_reference.obj_id = object_data.obj_id";
00068                         
00069                 $res = $ilDB->query($query);
00070                 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
00071                 
00072                 return $seas_ref_id = $row->ref_id;
00073         }
00074 
00075         function enabledIndex()
00076         {
00077                 return $this->index ? true : false;
00078         }
00079         function enableIndex($a_status)
00080         {
00081                 $this->index = $a_status;
00082         }
00083         function enabledLucene()
00084         {
00085                 return $this->lucene ? true : false;
00086         }
00087         function enableLucene($a_status)
00088         {
00089                 $this->lucene = $a_status ? true : false;
00090         }
00091 
00092         function getMaxHits()
00093         {
00094                 return $this->max_hits;
00095         }
00096         function setMaxHits($a_max_hits)
00097         {
00098                 $this->max_hits = $a_max_hits;
00099         }
00100 
00101 
00102         function update()
00103         {
00104                 // setSetting writes to db
00105                 $this->ilias->setSetting('search_max_hits',$this->getMaxHits());
00106                 $this->ilias->setSetting('search_index',$this->enabledIndex());
00107                 $this->ilias->setSetting('search_lucene',(int) $this->enabledLucene());
00108 
00109                 return true;
00110         }
00111 
00112         // PRIVATE
00113         function __read()
00114         {
00115                 $this->setMaxHits($this->ilias->getSetting('search_max_hits',50));
00116                 $this->enableIndex($this->ilias->getSetting('search_index',0));
00117                 $this->enableLucene($this->ilias->getSetting('search_lucene',0));
00118         }
00119 }
00120 ?>

Generated on Fri Dec 13 2013 10:18:31 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1