ILIAS  Release_5_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 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
19 {
20  const TYPE_USER_SEARCH = -1;
21 
22  var $ctrl = null;
23  var $ilias = null;
24  var $lng = null;
25 
30  function ilSearchController()
31  {
32  global $ilCtrl,$ilias,$lng,$tpl;
33 
34  $this->ilias = $ilias;
35  $this->ctrl = $ilCtrl;
36  $this->lng = $lng;
37  $this->tpl = $tpl;
38  }
39 
40  function getLastClass()
41  {
42  include_once './Services/Search/classes/class.ilSearchSettings.php';
43  if(ilSearchSettings::getInstance()->enabledLucene())
44  {
45  $default = 'illucenesearchgui';
46  }
47  else
48  {
49  $default = 'ilsearchgui';
50  }
51  if($_REQUEST['root_id'] == self::TYPE_USER_SEARCH)
52  {
53  $default = 'illuceneusersearchgui';
54  }
55 
56  $this->setLastClass($default);
57 
58  return $_SESSION['search_last_class'] ? $_SESSION['search_last_class'] : $default;
59  }
60  function setLastClass($a_class)
61  {
62  $_SESSION['search_last_class'] = $a_class;
63  }
64 
65  function &executeCommand()
66  {
67  global $rbacsystem;
68 
69  include_once 'Services/Search/classes/class.ilSearchSettings.php';
70 
71  // Check hacks
72  if(!$rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
73  {
74  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
75  }
76  $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass();
77 
78  switch($forward_class)
79  {
80  case 'illucenesearchgui':
81  $this->setLastClass('illucenesearchgui');
82  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchGUI.php';
83  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
84  break;
85 
86  case 'illuceneadvancedsearchgui':
87  $this->setLastClass('illuceneadvancedsearchgui');
88  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchGUI.php';
89  $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI());
90  break;
91 
92  case 'illuceneusersearchgui':
93  $this->setLastClass('illuceneusersearchgui');
94  include_once './Services/Search/classes/Lucene/class.ilLuceneUserSearchGUI.php';
95  $this->ctrl->forwardCommand(new ilLuceneUserSearchGUI());
96  break;
97 
98  case 'iladvancedsearchgui':
99  // Remember last class
100  $this->setLastClass('iladvancedsearchgui');
101 
102  include_once 'Services/Search/classes/class.ilAdvancedSearchGUI.php';
103 
104  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
105  break;
106 
107  case 'ilsearchgui':
108  // Remember last class
109  $this->setLastClass('ilsearchgui');
110 
111  default:
112  include_once 'Services/Search/classes/class.ilSearchGUI.php';
113 
114  $search_gui = new ilSearchGUI();
115  $this->ctrl->forwardCommand($search_gui);
116  break;
117  }
118  $this->tpl->show();
119 
120  return true;
121  }
122 }
123 ?>