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

Services/Search/classes/class.ilObjSearchSettingsGUI.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 require_once "classes/class.ilObjectGUI.php";
00035 
00036 class ilObjSearchSettingsGUI extends ilObjectGUI
00037 {
00042         function ilObjSearchSettingsGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
00043         {
00044                 $this->type = "seas";
00045                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00046 
00047                 $this->lng->loadLanguageModule('search');
00048         }
00049 
00054         function settingsObject()
00055         {
00056                 global $rbacsystem;
00057 
00058                 include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
00059 
00060                 $rpc_settings =& new ilRPCServerSettings();
00061 
00062                 if(!$rbacsystem->checkAccess('read',$this->object->getRefId()))
00063                 {
00064                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00065                 }
00066 
00067                 $this->object->initSettingsObject();
00068 
00069                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.seas_settings.html','Services/Search');
00070 
00071                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00072                 $this->tpl->setVariable("TXT_SEAS_TITLE",$this->lng->txt('seas_settings'));
00073 
00074                 // Max hits
00075                 $this->tpl->setVariable("TXT_MAX_HITS",$this->lng->txt('seas_max_hits'));
00076                 $this->tpl->setVariable("TXT_MAX_HITS_INFO",$this->lng->txt('seas_max_hits_info'));
00077                 for($i = 10; $i <= 100; $i += 10)
00078                 {
00079                         $max_hits[$i] = $i;
00080                 }
00081                 $this->tpl->setVariable('SELECT_MAX_HITS',ilUtil::formSelect($this->object->settings_obj->getMaxHits(),
00082                                                                                                                                          'max_hits',
00083                                                                                                                                          $max_hits,false,true));
00084 
00085                 $this->tpl->setVariable("TXT_DIRECT",$this->lng->txt('search_direct'));
00086                 $this->tpl->setVariable("TXT_INDEX",$this->lng->txt('search_index'));
00087 
00088                 $this->tpl->setVariable("TXT_TYPE",$this->lng->txt('search_type'));
00089                 $this->tpl->setVariable("TXT_LIKE_INFO",$this->lng->txt('search_like_info'));
00090                 $this->tpl->setVariable("TXT_FULL_INFO",$this->lng->txt('search_full_info'));
00091 
00092                 $this->tpl->setVariable("RADIO_TYPE_LIKE",ilUtil::formRadioButton($this->object->settings_obj->enabledIndex() ? 0 : 1,
00093                                                                                                                                                   'search_index',0));
00094 
00095                 $this->tpl->setVariable("RADIO_TYPE_FULL",ilUtil::formRadioButton($this->object->settings_obj->enabledIndex() ? 1 : 0,
00096                                                                                                                                                   'search_index',1));
00097 
00098                 // Lucene
00099                 $this->tpl->setVariable("TXT_LUCENE",$this->lng->txt('search_lucene'));
00100                 $this->tpl->setVariable("TXT_LUCENE_INFO",$this->lng->txt('search_lucene_info'));
00101                 $this->tpl->setVariable("TXT_LUCENE_README",$this->lng->txt('search_lucene_readme'));
00102                 $this->tpl->setVariable("TXT_LUCENE_HOST",$this->lng->txt('search_lucene_host'));
00103                 $this->tpl->setVariable("TXT_LUCENE_PORT",$this->lng->txt('search_lucene_port'));
00104                 
00105                 $this->tpl->setVariable("CHECK_TYPE_LUCENE",ilUtil::formCheckBox($this->object->settings_obj->enabledLucene() ? 1 : 0,
00106                                                                                                                                                  'search_lucene',1));
00107                 $this->tpl->setVariable("LUCENE_HOST",ilUtil::prepareFormOutput($rpc_settings->getHost()));
00108                 $this->tpl->setVariable("LUCENE_PORT",ilUtil::prepareFormOutput($rpc_settings->getPort()));
00109                                                                         
00110 
00111                 $this->tpl->setVariable("CMD_SUBMIT",'saveSettings');
00112                 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt('save'));
00113                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00114 
00115 
00116                 return true;
00117         }
00118 
00123         function saveSettingsObject()
00124         {
00125                 include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
00126 
00127                 global $rbacsystem;
00128 
00129                 if(!$rbacsystem->checkAccess('write',$this->object->getRefId()))
00130                 {
00131                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00132                 }
00133 
00134                 $this->object->initSettingsObject();
00135                 $this->object->settings_obj->setMaxHits((int) $_POST['max_hits']);
00136                 $this->object->settings_obj->enableIndex($_POST['search_index']);
00137                 $this->object->settings_obj->enableLucene($_POST['search_lucene']);
00138 
00139                 $rpc_settings =& new ilRPCServerSettings();
00140                 $rpc_settings->setHost(ilUtil::stripslashes($_POST['lucene_host']));
00141                 $rpc_settings->setPort(ilUtil::stripslashes($_POST['lucene_port']));
00142                 $rpc_settings->update();
00143                 if($this->object->settings_obj->enabledLucene() and !$rpc_settings->pingServer())
00144                 {
00145                         sendInfo($this->lng->txt('search_no_connection_lucene'));
00146                         $this->settingsObject();
00147 
00148                         return false;
00149                 }
00150                 $this->object->settings_obj->update();
00151 
00152                 sendInfo($this->lng->txt('settings_saved'));
00153                 $this->settingsObject();
00154 
00155                 return true;
00156         }
00162         function getTabs(&$tabs_gui)
00163         {
00164                 // tabs are defined manually here. The autogeneration via objects.xml will be deprecated in future
00165                 // for usage examples see ilObjGroupGUI or ilObjSystemFolderGUI
00166         }
00167 } // END class.ilObjSearchSettings
00168 ?>

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