ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  public $ctrl = null;
23  public $ilias = null;
24  public $lng = null;
25 
30  public function __construct()
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  public function getLastClass()
41  {
42  include_once './Services/Search/classes/class.ilSearchSettings.php';
43  if (ilSearchSettings::getInstance()->enabledLucene()) {
44  $default = 'illucenesearchgui';
45  } else {
46  $default = 'ilsearchgui';
47  }
48  if ($_REQUEST['root_id'] == self::TYPE_USER_SEARCH) {
49  $default = 'illuceneusersearchgui';
50  }
51 
52  $this->setLastClass($default);
53 
54  return $_SESSION['search_last_class'] ? $_SESSION['search_last_class'] : $default;
55  }
56  public function setLastClass($a_class)
57  {
58  $_SESSION['search_last_class'] = $a_class;
59  }
60 
61  public function &executeCommand()
62  {
63  global $rbacsystem;
64 
65  include_once 'Services/Search/classes/class.ilSearchSettings.php';
66 
67  // Check hacks
68  if (!$rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
69  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
70  }
71  $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass();
72 
73  switch ($forward_class) {
74  case 'illucenesearchgui':
75  $this->setLastClass('illucenesearchgui');
76  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchGUI.php';
77  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
78  break;
79 
80  case 'illuceneadvancedsearchgui':
81  $this->setLastClass('illuceneadvancedsearchgui');
82  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchGUI.php';
83  $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI());
84  break;
85 
86  case 'illuceneusersearchgui':
87  $this->setLastClass('illuceneusersearchgui');
88  include_once './Services/Search/classes/Lucene/class.ilLuceneUserSearchGUI.php';
89  $this->ctrl->forwardCommand(new ilLuceneUserSearchGUI());
90  break;
91 
92  case 'iladvancedsearchgui':
93  // Remember last class
94  $this->setLastClass('iladvancedsearchgui');
95 
96  include_once 'Services/Search/classes/class.ilAdvancedSearchGUI.php';
97 
98  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
99  break;
100 
101  case 'ilsearchgui':
102  // Remember last class
103  $this->setLastClass('ilsearchgui');
104 
105  // no break
106  default:
107  include_once 'Services/Search/classes/class.ilSearchGUI.php';
108 
109  $search_gui = new ilSearchGUI();
110  $this->ctrl->forwardCommand($search_gui);
111  break;
112  }
113  $this->tpl->show();
114 
115  return true;
116  }
117 }
$_SESSION["AccountId"]
Class ilSearchGUI.
$tpl
Definition: ilias.php:10
global $ilCtrl
Definition: ilias.php:18
GUI for simple Lucene search
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
redirection script todo: (a better solution should control the processing via a xml file) ...
GUI for Lucene user search
__construct()
Constructor public.