ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSearchController.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
19 {
20  var $ctrl = null;
21  var $ilias = null;
22  var $lng = null;
23 
28  function ilSearchController()
29  {
30  global $ilCtrl,$ilias,$lng,$tpl;
31 
32  $this->ilias = $ilias;
33  $this->ctrl = $ilCtrl;
34  $this->lng = $lng;
35  $this->tpl = $tpl;
36  }
37 
38  function getLastClass()
39  {
40  include_once './Services/Search/classes/class.ilSearchSettings.php';
41  if(ilSearchSettings::getInstance()->enabledLucene())
42  {
43  $default = 'illucenesearchgui';
44  }
45  else
46  {
47  $default = 'ilsearchgui';
48  }
49 
50  return $_SESSION['search_last_class'] ? $_SESSION['search_last_class'] : $default;
51  }
52  function setLastClass($a_class)
53  {
54  $_SESSION['search_last_class'] = $a_class;
55  }
56 
57  function &executeCommand()
58  {
59  global $rbacsystem,$ilUser;
60 
61  // Check for incomplete profile
62  if($ilUser->getProfileIncomplete())
63  {
64  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
65  }
66 
67  // check whether password of user have to be changed
68  // due to first login or password of user is expired
69  if( $ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired() )
70  {
71  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
72  }
73 
74  include_once 'Services/Search/classes/class.ilSearchSettings.php';
75 
76  // Check hacks
77  if(!$rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
78  {
79  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
80  }
81  $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass();
82 
83  switch($forward_class)
84  {
85  case 'illucenesearchgui':
86  $this->setLastClass('illucenesearchgui');
87  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchGUI.php';
88  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
89  break;
90 
91  case 'illuceneadvancedsearchgui':
92  $this->setLastClass('illuceneadvancedsearchgui');
93  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchGUI.php';
94  $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI());
95  break;
96 
97  case 'iladvancedsearchgui':
98  // Remember last class
99  $this->setLastClass('iladvancedsearchgui');
100 
101  include_once 'Services/Search/classes/class.ilAdvancedSearchGUI.php';
102 
103  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
104  break;
105 
106  case 'ilsearchgui':
107  // Remember last class
108  $this->setLastClass('ilsearchgui');
109 
110  default:
111  include_once 'Services/Search/classes/class.ilSearchGUI.php';
112 
113  $search_gui = new ilSearchGUI();
114  $this->ctrl->forwardCommand($search_gui);
115  break;
116  }
117  $this->tpl->show();
118 
119  return true;
120  }
121 }
122 ?>