ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilRepositoryObjectSearchGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
16{
17 private $lng = null;
18 private $ctrl = null;
19 private $ref_id = 0;
20 private $object = null;
21 private $parent_obj;
22 private $parent_cmd;
23
24
25
29 public function __construct($a_ref_id, $a_parent_obj, $a_parent_cmd)
30 {
31 global $lng, $ilCtrl;
32
33 $this->ref_id = $a_ref_id;
34 $this->lng = $lng;
35
36 $this->ctrl = $ilCtrl;
37
38
39 include_once './Services/Object/classes/class.ilObjectFactory.php';
40 $factory = new ilObjectFactory();
41 $this->object = $factory->getInstanceByRefId($this->getRefId(),FALSE);
42
43 $this->parent_obj = $a_parent_obj;
44 $this->parent_cmd = $a_parent_cmd;
45 }
46
52 public static function getSearchBlockHTML($a_title)
53 {
54 include_once './Services/Search/classes/class.ilRepositoryObjectSearchBlockGUI.php';
55 $block = new ilRepositoryObjectSearchBlockGUI($a_title);
56 return $block->getHTML();
57 }
58
62 public function executeCommand()
63 {
64 if(!$GLOBALS['ilAccess']->checkAccess('read','',$this->getObject()->getRefId()))
65 {
66 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
67 $this->getCtrl()->returnToParent($this->getParentGUI());
68 }
69
70 $next_class = $this->getCtrl()->getNextClass();
71 $cmd = $this->getCtrl()->getCmd();
72
73
74 switch($next_class)
75 {
76 default:
77 $this->$cmd();
78 break;
79 }
80 }
81
86 public function getLang()
87 {
88 return $this->lng;
89 }
90
95 public function getCtrl()
96 {
97 return $this->ctrl;
98 }
99
100
101 public function getRefId()
102 {
103 return $this->ref_id;
104 }
105
110 public function getObject()
111 {
112 return $this->object;
113 }
114
118 public function getParentGUI()
119 {
120 return $this->parent_obj;
121 }
122
126 public function getParentCmd()
127 {
128 return $this->parent_cmd;
129 }
130
134 protected function performSearch()
135 {
136 include_once './Services/Search/classes/class.ilRepositoryObjectDetailSearch.php';
137
138 try
139 {
141 $search->setQueryString(ilUtil::stripSlashes($_POST['search_term']));
142 $result = $search->performSearch();
143 }
144 catch(Exception $e)
145 {
146 ilUtil::sendFailure($e->getMessage(),TRUE);
147 $this->getCtrl()->returnToParent($this);
148 return FALSE;
149 }
150 // @todo: add a factory to allow overwriting of search result presentation
151 $result_table = $this->getResultTableInstance();
152 $result_table->setSearchTerm(ilUtil::stripSlashes($_POST['search_term']));
153 $result_table->setResults($result);
154
155 $result_table->init();
156 $result_table->parse();
157
158 $GLOBALS['tpl']->setContent($result_table->getHTML());
159 }
160
166 public function getResultTableInstance()
167 {
168 global $objDefinition;
169
170
171 $class = $objDefinition->getClassName($this->getObject()->getType());
172 $location = $objDefinition->getLocation($this->getObject()->getType());
173 $full_class = "ilObj".$class."SearchResultTableGUI";
174
175 if(include_once($location."/class.".$full_class.".php"))
176 {
177 return new $full_class(
178 $this,
179 'performSearch',
180 $this->getRefId()
181 );
182 }
183
184 }
185}
186?>
$result
$location
Definition: buildRTE.php:44
Class ilObjectFactory.
static _lookupObjId($a_id)
static getSearchBlockHTML($a_title)
Get standar search block html.
performSearch()
Perform search lucene or direct search.
__construct($a_ref_id, $a_parent_obj, $a_parent_cmd)
Constructor.
getResultTableInstance()
Get result table instance @global type $objDefinition.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35