ILIAS  Release_3_10_x_branch Revision 61812
 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 
37 {
38  var $ctrl = null;
39  var $ilias = null;
40  var $lng = null;
41 
46  function ilSearchController()
47  {
48  global $ilCtrl,$ilias,$lng,$tpl;
49 
50  $this->ilias = $ilias;
51  $this->ctrl = $ilCtrl;
52  $this->lng = $lng;
53  $this->tpl = $tpl;
54  }
55 
56  function getLastClass()
57  {
58  return $_SESSION['search_last_class'] ? $_SESSION['search_last_class'] : 'ilsearchgui';
59  }
60  function setLastClass($a_class)
61  {
62  $_SESSION['search_last_class'] = $a_class;
63  }
64 
65  function &executeCommand()
66  {
67  global $rbacsystem,$ilUser;
68 
69  // Check for incomplete profile
70  if($ilUser->getProfileIncomplete())
71  {
72  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
73  }
74 
75  // check whether password of user have to be changed due to first login
76  if( $ilUser->isPasswordChangeDemanded() )
77  {
78  ilUtil::sendInfo( $this->lng->txt('password_change_on_first_login_demand'), true );
79 
80  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
81  }
82 
83  // check whether password of user is expired
84  if( $ilUser->isPasswordExpired() )
85  {
86  $msg = $this->lng->txt('password_expired');
87  $password_age = $ilUser->getPasswordAge();
88 
89  ilUtil::sendInfo( sprintf($msg,$password_age), true );
90 
91  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
92  }
93 
94  include_once 'Services/Search/classes/class.ilSearchSettings.php';
95 
96  // Check hacks
97  if(!$rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
98  {
99  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
100  }
101  $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass();
102 
103  switch($forward_class)
104  {
105  case 'ilsearchresultgui':
106  // Remember last class
107  $this->setLastClass('ilsearchresultgui');
108 
109  include_once 'Services/Search/classes/class.ilSearchResultGUI.php';
110 
111  $this->ctrl->forwardCommand(new ilSearchResultGUI());
112  break;
113 
114  case 'iladvancedsearchgui':
115  // Remember last class
116  $this->setLastClass('iladvancedsearchgui');
117 
118  include_once 'Services/Search/classes/class.ilAdvancedSearchGUI.php';
119 
120  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
121  break;
122 
123  case 'ilsearchgui':
124  // Remember last class
125  $this->setLastClass('ilsearchgui');
126 
127  default:
128  include_once 'Services/Search/classes/class.ilSearchGUI.php';
129 
130  $search_gui = new ilSearchGUI();
131  $this->ctrl->forwardCommand($search_gui);
132  break;
133  }
134  $this->tpl->show();
135 
136  return true;
137  }
138 }
139 ?>