ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules 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;
24  protected $user;
25 
26  public $ctrl = null;
27  public $ilias = null;
28  public $lng = null;
29 
34  public function __construct()
35  {
36  global $DIC;
37 
38  $ilCtrl = $DIC['ilCtrl'];
39  $ilias = $DIC['ilias'];
40  $lng = $DIC['lng'];
41  $tpl = $DIC['tpl'];
42 
43  $this->ilias = $ilias;
44  $this->ctrl = $ilCtrl;
45  $this->lng = $lng;
46  $this->tpl = $tpl;
47  $this->user = $DIC->user();
48  }
49 
50  public function getLastClass()
51  {
52  include_once './Services/Search/classes/class.ilSearchSettings.php';
53  if (ilSearchSettings::getInstance()->enabledLucene()) {
54  $default = 'illucenesearchgui';
55  } else {
56  $default = 'ilsearchgui';
57  }
58  if ($_REQUEST['root_id'] == self::TYPE_USER_SEARCH) {
59  $default = 'illuceneusersearchgui';
60  }
61 
62  $this->setLastClass($default);
63 
64  return $_SESSION['search_last_class'] ? $_SESSION['search_last_class'] : $default;
65  }
66  public function setLastClass($a_class)
67  {
68  $_SESSION['search_last_class'] = $a_class;
69  }
70 
71  public function &executeCommand()
72  {
73  global $DIC;
74 
75  $rbacsystem = $DIC['rbacsystem'];
76 
77  include_once 'Services/Search/classes/class.ilSearchSettings.php';
78 
79  // Check hacks
80  if (!$rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
81  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
82  }
83  $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass();
84 
85  switch ($forward_class) {
86  case 'illucenesearchgui':
87  $this->setLastClass('illucenesearchgui');
88  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchGUI.php';
89  $this->ctrl->forwardCommand(new ilLuceneSearchGUI());
90  break;
91 
92  case 'illuceneadvancedsearchgui':
93  $this->setLastClass('illuceneadvancedsearchgui');
94  include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchGUI.php';
95  $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI());
96  break;
97 
98  case 'illuceneusersearchgui':
99  if ($this->user->getId() == ANONYMOUS_USER_ID) {
100  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
101  }
102  $this->setLastClass('illuceneusersearchgui');
103  include_once './Services/Search/classes/Lucene/class.ilLuceneUserSearchGUI.php';
104  $this->ctrl->forwardCommand(new ilLuceneUserSearchGUI());
105  break;
106 
107  case 'iladvancedsearchgui':
108  // Remember last class
109  $this->setLastClass('iladvancedsearchgui');
110 
111  include_once 'Services/Search/classes/class.ilAdvancedSearchGUI.php';
112 
113  $this->ctrl->forwardCommand(new ilAdvancedSearchGUI());
114  break;
115 
116  case 'ilsearchgui':
117  // Remember last class
118  $this->setLastClass('ilsearchgui');
119 
120  // no break
121  default:
122  include_once 'Services/Search/classes/class.ilSearchGUI.php';
123 
124  $search_gui = new ilSearchGUI();
125  $this->ctrl->forwardCommand($search_gui);
126  break;
127  }
128  $this->tpl->printToStdout();
129 
130  return true;
131  }
132 }
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_SESSION["AccountId"]
Class ilSearchGUI.
user()
Definition: user.php:4
GUI for simple Lucene search
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
GUI for Lucene user search
__construct()
Constructor public.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41