Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
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 ?>