ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSearchController.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.|
21  +-----------------------------------------------------------------------------+
22 */
23 
38 {
39  var $ctrl = null;
40  var $ilias = null;
41  var $lng = null;
42 
47  function ilSearchController()
48  {
49  global $ilCtrl,$ilias,$lng,$tpl;
50 
51  $this->ilias = $ilias;
52  $this->ctrl = $ilCtrl;
53  $this->lng = $lng;
54  $this->tpl = $tpl;
55  }
56 
57  function getLastClass()
58  {
59  include_once './Services/Search/classes/class.ilSearchSettings.php';
60  if(ilSearchSettings::getInstance()->enabledLucene())
61  {
62  $default = 'illucenesearchgui';
63  }
64  else
65  {
66  $default = 'ilsearchgui';
67  }
68 
69  return $_SESSION['search_last_class'] ? $_SESSION['search_last_class'] : $default;
70  }
71  function setLastClass($a_class)
72  {
73  $_SESSION['search_last_class'] = $a_class;
74  }
75 
76  function &executeCommand()
77  {
78  global $rbacsystem,$ilUser;
79 
80  // Check for incomplete profile
81  if($ilUser->getProfileIncomplete())
82  {
83  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
84  }
85 
86  // check whether password of user have to be changed
87  // due to first login or password of user is expired
88  if( $ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired() )
89  {
90  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
91  }
92 
93  include_once 'Services/Search/classes/class.ilSearchSettings.php';
94 
95  // Check hacks
96  if(!$rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
97  {
98  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
99  }
100  $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass();
101 
102  switch($forward_class)
103  {
104  case 'illucenesearchgui':
105  $this->setLastClass('illucenesearchgui');
106  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchGUI.php';
107  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
108  break;
109 
110  case 'illuceneadvancedsearchgui':
111  $this->setLastClass('illuceneadvancedsearchgui');
112  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchGUI.php';
113  $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI());
114  break;
115 
116  case 'iladvancedsearchgui':
117  // Remember last class
118  $this->setLastClass('iladvancedsearchgui');
119 
120  include_once 'Services/Search/classes/class.ilAdvancedSearchGUI.php';
121 
122  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
123  break;
124 
125  case 'ilsearchgui':
126  // Remember last class
127  $this->setLastClass('ilsearchgui');
128 
129  default:
130  include_once 'Services/Search/classes/class.ilSearchGUI.php';
131 
132  $search_gui = new ilSearchGUI();
133  $this->ctrl->forwardCommand($search_gui);
134  break;
135  }
136  $this->tpl->show();
137 
138  return true;
139  }
140 }
141 ?>