• Main Page
  • Related Pages
  • Modules
  • 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                 
00137                 $this->tpl->setVariable("CHECK_TYPE_LUCENE",ilUtil::formCheckBox($this->object->settings_obj->enabledLucene() ? 1 : 0,
00138                                                                                                                                                  'search_lucene',1));
00139                 $this->tpl->setVariable("LUCENE_HOST",ilUtil::prepareFormOutput($rpc_settings->getHost()));
00140                 $this->tpl->setVariable("LUCENE_PORT",ilUtil::prepareFormOutput($rpc_settings->getPort()));
00141                                                                         
00142 
00143                 $this->tpl->setVariable("CMD_SUBMIT",'saveSettings');
00144                 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt('save'));
00145                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00146 
00147                 return true;
00148         }
00149 
00154         function saveSettingsObject()
00155         {
00156                 include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
00157 
00158                 global $rbacsystem;
00159 
00160                 if(!$rbacsystem->checkAccess('write',$this->object->getRefId()))
00161                 {
00162                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00163                 }
00164 
00165                 $this->object->initSettingsObject();
00166                 $this->object->settings_obj->setMaxHits((int) $_POST['max_hits']);
00167                 $this->object->settings_obj->enableIndex($_POST['search_index']);
00168                 $this->object->settings_obj->enableLucene($_POST['search_lucene']);
00169 
00170                 $rpc_settings =& new ilRPCServerSettings();
00171                 if($this->object->settings_obj->enabledLucene() and !$rpc_settings->pingServer())
00172                 {
00173                         sendInfo($this->lng->txt('search_no_connection_lucene'),true);
00174                         $this->ctrl->redirect($this,'settings');
00175 
00176                         return false;
00177                 }
00178 
00179                 $this->object->settings_obj->update();
00180 
00181                 sendInfo($this->lng->txt('settings_saved'),true);
00182                 $this->ctrl->redirect($this,'settings');
00183 
00184                 return true;
00185         }
00186         
00187         function getAdminTabs(&$tabs_gui)
00188         {
00189                 $this->getTabs($tabs_gui);
00190         }
00191 
00197         function getTabs(&$tabs_gui)
00198         {
00199                 global $rbacsystem;
00200 
00201                 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00202                 {
00203                         $tabs_gui->addTarget("settings",
00204                                 $this->ctrl->getLinkTarget($this, "settings"), array("settings","", "view"), "", "");
00205                 }
00206 
00207                 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
00208                 {
00209                         $tabs_gui->addTarget("perm_settings",
00210                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
00211                 }
00212         }
00213 } // END class.ilObjSearchSettingsGUI
00214 ?>

Generated on Fri Dec 13 2013 13:52:12 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1