ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSearchBaseGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once 'Services/Search/classes/class.ilSearchSettings.php';
5 include_once './Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
6 include_once './Services/Administration/interfaces/interface.ilAdministrationCommandHandling.php';
7 
23 {
24  var $settings = null;
25 
26  protected $ctrl = null;
27  var $ilias = null;
28  var $lng = null;
29  var $tpl = null;
30 
35  function ilSearchBaseGUI()
36  {
37  global $ilCtrl,$ilias,$lng,$tpl,$ilMainMenu;
38 
39  $this->ilias =& $ilias;
40  $this->ctrl =& $ilCtrl;
41  $this->tpl =& $tpl;
42  $this->lng =& $lng;
43  $this->lng->loadLanguageModule('search');
44 
45  $ilMainMenu->setActive('search');
46  $this->settings =& new ilSearchSettings();
47  }
48 
49  function prepareOutput()
50  {
51  global $ilLocator, $lng;
52 
53  $this->tpl->getStandardTemplate();
54 
55 // $ilLocator->addItem($this->lng->txt('search'),$this->ctrl->getLinkTarget($this));
56 // $this->tpl->setLocator();
57 
58  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_src_b.gif"),
59  // $lng->txt("search"));
60  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_src_b.gif"),
61  "");
62  $this->tpl->setTitle($lng->txt("search"));
63 
65 
66  }
67 
68  public function handleCommand($a_cmd)
69  {
70  if(method_exists($this, $a_cmd))
71  {
72  $this->$a_cmd();
73  }
74  else
75  {
76  $a_cmd .= 'Object';
77  $this->$a_cmd();
78  }
79  }
80 
84  public function addToDeskObject()
85  {
86  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
88  $this->showSavedResults();
89  }
90 
94  public function removeFromDeskObject()
95  {
96  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
98  $this->showSavedResults();
99  }
100 
104  public function delete()
105  {
106  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
107  $admin = new ilAdministrationCommandGUI($this);
108  $admin->delete();
109  }
110 
114  public function cancelDelete()
115  {
116  $this->showSavedResults();
117  }
118 
122  public function performDelete()
123  {
124  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
125  $admin = new ilAdministrationCommandGUI($this);
126  $admin->performDelete();
127  }
128 
132  public function cut()
133  {
134 
135 
136  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
137  $admin = new ilAdministrationCommandGUI($this);
138  $admin->cut();
139  }
140 
144  public function link()
145  {
146  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
147  $admin = new ilAdministrationCommandGUI($this);
148  $admin->link();
149  }
150 
151  public function paste()
152  {
153  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
154  $admin = new ilAdministrationCommandGUI($this);
155  $admin->paste();
156  }
157 
159  {
160  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
161  $admin = new ilAdministrationCommandGUI($this);
162  $admin->showLinkIntoMultipleObjectsTree();
163  }
164 
165  public function showMoveIntoObjectTree()
166  {
167  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
168  $admin = new ilAdministrationCommandGUI($this);
169  $admin->showMoveIntoObjectTree();
170  }
171 
173  {
174  include_once './Services/Administration/classes/class.ilAdministrationCommandGUI.php';
175  $admin = new ilAdministrationCommandGUI($this);
176  $admin->performPasteIntoMultipleObjects();
177  }
178 
179  public function clear()
180  {
181  unset($_SESSION['clipboard']);
182  $this->ctrl->redirect($this);
183  }
184 
185  public function enableAdministrationPanel()
186  {
187  $_SESSION["il_cont_admin_panel"] = true;
188  $this->ctrl->redirect($this);
189  }
190 
191  public function disableAdministrationPanel()
192  {
193  $_SESSION["il_cont_admin_panel"] = false;
194  $this->ctrl->redirect($this);
195  }
196 
197 
201  public function addLocator()
202  {
203  $ilLocator->addItem($this->lng->txt('search'),$this->ctrl->getLinkTarget($this));
204  $this->tpl->setLocator();
205  }
206 
214  protected function addPager($result,$a_session_key)
215  {
216  global $tpl;
217 
218  $_SESSION["$a_session_key"] = max($_SESSION["$a_session_key"],$this->search_cache->getResultPageNumber());
219 
220  if($_SESSION["$a_session_key"] == 1 and
221  (count($result->getResults()) < $result->getMaxHits()))
222  {
223  return true;
224  }
225 
226  if($this->search_cache->getResultPageNumber() > 1)
227  {
228  $this->ctrl->setParameter($this,'page_number',$this->search_cache->getResultPageNumber() - 1);
229 /* $this->tpl->setCurrentBlock('prev');
230  $this->tpl->setVariable('PREV_LINK',$this->ctrl->getLinkTarget($this,'performSearch'));
231  $this->tpl->setVariable('TXT_PREV',$this->lng->txt('search_page_prev'));
232  $this->tpl->parseCurrentBlock();
233 */
234  $this->prev_link = $this->ctrl->getLinkTarget($this,'performSearch');
235  }
236  for($i = 1;$i <= $_SESSION["$a_session_key"];$i++)
237  {
238  if($i == $this->search_cache->getResultPageNumber())
239  {
240 /* $this->tpl->setCurrentBlock('pages_link');
241  $this->tpl->setVariable('NUMBER',$i);
242  $this->tpl->parseCurrentBlock();
243 */
244  continue;
245  }
246 
247  $this->ctrl->setParameter($this,'page_number',$i);
248  $link = '<a href="'.$this->ctrl->getLinkTarget($this,'performSearch').'" /a>'.$i.'</a> ';
249 /* $this->tpl->setCurrentBlock('pages_link');
250  $this->tpl->setVariable('NUMBER',$link);
251  $this->tpl->parseCurrentBlock();
252 */
253  }
254 
255 
256  if(count($result->getResults()) >= $result->getMaxHits())
257  {
258  $this->ctrl->setParameter($this,'page_number',$this->search_cache->getResultPageNumber() + 1);
259 /* $this->tpl->setCurrentBlock('next');
260  $this->tpl->setVariable('NEXT_LINK',$this->ctrl->getLinkTarget($this,'performSearch'));
261  $this->tpl->setVariable('TXT_NEXT',$this->lng->txt('search_page_next'));
262  $this->tpl->parseCurrentBlock();
263 */
264 $this->next_link = $this->ctrl->getLinkTarget($this,'performSearch');
265  }
266 
267 /* $this->tpl->setCurrentBlock('prev_next');
268  $this->tpl->setVariable('SEARCH_PAGE',$this->lng->txt('search_page'));
269  $this->tpl->parseCurrentBlock();
270 */
271 
272  $this->ctrl->clearParameters($this);
273  }
274 
279  protected function buildSearchAreaPath($a_root_node)
280  {
281  global $tree;
282 
283  $path_arr = $tree->getPathFull($a_root_node,ROOT_FOLDER_ID);
284  $counter = 0;
285  foreach($path_arr as $data)
286  {
287  if($counter++)
288  {
289  $path .= " > ";
290  $path .= $data['title'];
291  }
292  else
293  {
294  $path .= $this->lng->txt('repository');
295  }
296 
297  }
298  return $path;
299  }
300 
304  function autoComplete()
305  {
306  $q = $_REQUEST["query"];
307  include_once("./Services/Search/classes/class.ilSearchAutoComplete.php");
308  $list = ilSearchAutoComplete::getList($q);
309  echo $list;
310  exit;
311  }
312 
313 }
314 ?>