• 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 
00036 require_once "classes/class.ilObjectGUI.php";
00037 
00038 class ilObjSearchSettingsGUI extends ilObjectGUI
00039 {
00044         function ilObjSearchSettingsGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
00045         {
00046                 $this->type = "seas";
00047                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00048 
00049                 $this->lng->loadLanguageModule('search');
00050         }
00051 
00052         function &executeCommand()
00053         {
00054                 $next_class = $this->ctrl->getNextClass($this);
00055                 $cmd = $this->ctrl->getCmd();
00056                 $this->prepareOutput();
00057 
00058                 switch($next_class)
00059                 {
00060                         case 'ilpermissiongui':
00061                                 include_once("./classes/class.ilPermissionGUI.php");
00062                                 $perm_gui =& new ilPermissionGUI($this);
00063                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00064                                 break;
00065 
00066                         default:
00067                                 if($cmd == "" || $cmd == "view")
00068                                 {
00069                                         $cmd = "settings";
00070                                 }
00071                                 $cmd .= "Object";
00072                                 $this->$cmd();
00073 
00074                                 break;
00075                 }
00076                 return true;
00077         }
00078         
00079         function cancelObject()
00080         {
00081                 sendInfo($this->lng->txt("msg_cancel"),true);
00082                 $this->ctrl->redirect($this, "settings");
00083         }
00084 
00089         function settingsObject()
00090         {
00091                 global $rbacsystem;
00092 
00093                 include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
00094 
00095                 $rpc_settings =& new ilRPCServerSettings();
00096 
00097                 if(!$rbacsystem->checkAccess('read',$this->object->getRefId()))
00098                 {
00099                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00100                 }
00101 
00102                 $this->object->initSettingsObject();
00103 
00104                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.seas_settings.html','Services/Search');
00105 
00106                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00107                 $this->tpl->setVariable("TXT_SEAS_TITLE",$this->lng->txt('seas_settings'));
00108 
00109                 // Max hits
00110                 $this->tpl->setVariable("TXT_MAX_HITS",$this->lng->txt('seas_max_hits'));
00111                 $this->tpl->setVariable("TXT_MAX_HITS_INFO",$this->lng->txt('seas_max_hits_info'));
00112                 for($i = 10; $i <= 100; $i += 10)
00113                 {
00114                         $max_hits[$i] = $i;
00115                 }
00116                 $this->tpl->setVariable('SELECT_MAX_HITS',ilUtil::formSelect($this->object->settings_obj->getMaxHits(),
00117                                                                                                                                          'max_hits',
00118                                                                                                                                          $max_hits,false,true));
00119 
00120                 $this->tpl->setVariable("TXT_DIRECT",$this->lng->txt('search_direct'));
00121                 $this->tpl->setVariable("TXT_INDEX",$this->lng->txt('search_index'));
00122 
00123                 $this->tpl->setVariable("TXT_TYPE",$this->lng->txt('search_type'));
00124                 $this->tpl->setVariable("TXT_LIKE_INFO",$this->lng->txt('search_like_info'));
00125                 $this->tpl->setVariable("TXT_FULL_INFO",$this->lng->txt('search_full_info'));
00126 
00127                 $this->tpl->setVariable("RADIO_TYPE_LIKE",ilUtil::formRadioButton($this->object->settings_obj->enabledIndex() ? 0 : 1,
00128                                                                                                                                                   'search_index',0));
00129 
00130                 $this->tpl->setVariable("RADIO_TYPE_FULL",ilUtil::formRadioButton($this->object->settings_obj->enabledIndex() ? 1 : 0,
00131                                                                                                                                                   'search_index',1));
00132 
00133                 // Lucene
00134                 $this->tpl->setVariable("TXT_LUCENE",$this->lng->txt('search_lucene'));
00135                 $this->tpl->setVariable("TXT_LUCENE_INFO",$this->lng->txt('search_lucene_info'));
00136                 $this->tpl->setVariable("TXT_LUCENE_README",$this->lng->txt('search_lucene_readme'));
00137                 $this->tpl->setVariable("TXT_LUCENE_HOST",$this->lng->txt('search_lucene_host'));
00138                 $this->tpl->setVariable("TXT_LUCENE_PORT",$this->lng->txt('search_lucene_port'));
00139                 
00140                 $this->tpl->setVariable("CHECK_TYPE_LUCENE",ilUtil::formCheckBox($this->object->settings_obj->enabledLucene() ? 1 : 0,
00141                                                                                                                                                  'search_lucene',1));
00142                 $this->tpl->setVariable("LUCENE_HOST",ilUtil::prepareFormOutput($rpc_settings->getHost()));
00143                 $this->tpl->setVariable("LUCENE_PORT",ilUtil::prepareFormOutput($rpc_settings->getPort()));
00144                                                                         
00145 
00146                 $this->tpl->setVariable("CMD_SUBMIT",'saveSettings');
00147                 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt('save'));
00148                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00149 
00150                 return true;
00151         }
00152 
00157         function saveSettingsObject()
00158         {
00159                 include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
00160 
00161                 global $rbacsystem;
00162 
00163                 if(!$rbacsystem->checkAccess('write',$this->object->getRefId()))
00164                 {
00165                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00166                 }
00167 
00168                 $this->object->initSettingsObject();
00169                 $this->object->settings_obj->setMaxHits((int) $_POST['max_hits']);
00170                 $this->object->settings_obj->enableIndex($_POST['search_index']);
00171                 $this->object->settings_obj->enableLucene($_POST['search_lucene']);
00172 
00173                 $rpc_settings =& new ilRPCServerSettings();
00174                 $rpc_settings->setHost(ilUtil::stripslashes($_POST['lucene_host']));
00175                 $rpc_settings->setPort(ilUtil::stripslashes($_POST['lucene_port']));
00176                 $rpc_settings->update();
00177 
00178                 if($this->object->settings_obj->enabledLucene() and !$rpc_settings->pingServer())
00179                 {
00180                         sendInfo($this->lng->txt('search_no_connection_lucene'),true);
00181                         $this->ctrl->redirect($this,'settings');
00182 
00183                         return false;
00184                 }
00185 
00186                 $this->object->settings_obj->update();
00187 
00188                 sendInfo($this->lng->txt('settings_saved'),true);
00189                 $this->ctrl->redirect($this,'settings');
00190 
00191                 return true;
00192         }
00193         
00194         function getAdminTabs(&$tabs_gui)
00195         {
00196                 $this->getTabs($tabs_gui);
00197         }
00198 
00204         function getTabs(&$tabs_gui)
00205         {
00206                 global $rbacsystem;
00207 
00208                 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00209                 {
00210                         $tabs_gui->addTarget("settings",
00211                                 $this->ctrl->getLinkTarget($this, "settings"), array("settings","", "view"), "", "");
00212                 }
00213 
00214                 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
00215                 {
00216                         $tabs_gui->addTarget("perm_settings",
00217                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
00218                 }
00219         }
00220 } // END class.ilObjSearchSettingsGUI
00221 ?>

Generated on Fri Dec 13 2013 11:57:59 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1