ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilShopAdvancedSearchGUI Class Reference

Class ilShopAdvancedSearchGUI. More...

+ Inheritance diagram for ilShopAdvancedSearchGUI:
+ Collaboration diagram for ilShopAdvancedSearchGUI:

Public Member Functions

 __construct ()
 
 setSorting ()
 
 executeCommand ()
 
 setFilter ()
 
 resetFilter ()
 
 performSearch ()
 
 showForm ($result=null)
 
 setCombination ($a_combination)
 
 getCombination ()
 
 setString ($a_str)
 
 getString ()
 
 setDetails ($a_details)
 
 getDetails ()
 
 setTopicId ($a_topic)
 
 getTopicId ()
 
 setSortDirection ($a_sort_direction)
 
 getSortDirection ()
 
 setSortField ($a_field)
 
 getSortField ()
 
 setSortingTypeTopics ($a_field)
 
 getSortingTypeTopics ()
 
 setSortingDirectionTopics ($a_sort_direction)
 
 getSortingDirectionTopics ()
 
 __construct ()
 

Data Fields

const SEARCH_OR = 'or'
 
const SEARCH_AND = 'and'
 

Protected Member Functions

 prepareOutput ()
 
- Protected Member Functions inherited from ilShopBaseGUI
 prepareOutput ()
 
 addPager ($result)
 

Private Member Functions

 parseQueryString ()
 
 searchObjects ($query_parser)
 
 getFilter ()
 

Private Attributes

 $string = ''
 
 $combination = ''
 
 $details = array()
 
 $topic_id = 0
 
 $sort_type_topics = ''
 
 $sort_direction_topics = ''
 
 $sort_field = ''
 
 $sort_direction = ''
 

Additional Inherited Members

- Protected Attributes inherited from ilShopBaseGUI
 $ctrl = null
 
 $lng = null
 
 $tpl = null
 
 $settings = null
 

Detailed Description

Class ilShopAdvancedSearchGUI.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 14 of file class.ilShopAdvancedSearchGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopAdvancedSearchGUI::__construct ( )

Reimplemented from ilShopBaseGUI.

Definition at line 28 of file class.ilShopAdvancedSearchGUI.php.

29 {
30 parent::__construct();
31
32 if($this->cmd == 'setFilter')
33 {
34 // set filter
35 $this->setCombination($_SESSION['shop_advanced_search']['combination']);
36 $this->setString($_SESSION['shop_advanced_search']['string']);
37 $this->setDetails($_SESSION['shop_advanced_search']['details']);
38 $this->setTopicId($_SESSION['shop_advanced_search']['topic']);
39
40 // set sorting
41 $this->setSortingTypeTopics($_SESSION['shop_advanced_search']['order_topics_sorting_type']);
42 $this->setSortingDirectionTopics($_SESSION['shop_advanced_search']['shop_topics_sorting_direction']);
43
44 $this->setSortField($_SESSION['shop_advanced_search']['shop_order_field']);
45 $this->setSortDirection($_SESSION['shop_advanced_search']['shop_order_direction']);
46 }
47 }
$_SESSION["AccountId"]

References $_SESSION, setCombination(), setDetails(), setSortDirection(), setSortField(), setSortingDirectionTopics(), setSortingTypeTopics(), setString(), and setTopicId().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilShopAdvancedSearchGUI::executeCommand ( )

Definition at line 61 of file class.ilShopAdvancedSearchGUI.php.

62 {
63 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd();
65
66 if(isset($_POST['cmd']) && $_POST['cmd'] == 'setFilter')
67 {
68 $this->cmd = 'setFilter';
69 }
70 else
71 {
72 $this->cmd = $this->ctrl->getCmd();
73 }
74
75 switch($next_class)
76 {
77 default:
78 if(!$cmd)
79 {
80 $cmd = 'performSearch';
81 }
82 $this->prepareOutput();
83 $this->$cmd();
84
85 break;
86 }
87
88 return true;
89 }
$_POST['username']
Definition: cron.php:12
$cmd
Definition: sahs_server.php:35

References $_POST, $cmd, and prepareOutput().

+ Here is the call graph for this function:

◆ getCombination()

ilShopAdvancedSearchGUI::getCombination ( )

Definition at line 295 of file class.ilShopAdvancedSearchGUI.php.

296 {
297 return $this->combination ? $this->combination : self::SEARCH_OR;
298 }

References SEARCH_OR.

Referenced by parseQueryString().

+ Here is the caller graph for this function:

◆ getDetails()

ilShopAdvancedSearchGUI::getDetails ( )

Definition at line 311 of file class.ilShopAdvancedSearchGUI.php.

312 {
313 return $this->details ? $this->details : array();
314 }

Referenced by getFilter(), and performSearch().

+ Here is the caller graph for this function:

◆ getFilter()

ilShopAdvancedSearchGUI::getFilter ( )
private

Definition at line 229 of file class.ilShopAdvancedSearchGUI.php.

230 {
231 foreach($this->getDetails() as $key => $detail_type)
232 {
233 switch($detail_type)
234 {
235 case 'crs':
236 $filter[] = 'crs';
237 break;
238 case 'lms':
239 $filter[] = 'lm';
240 $filter[] = 'sahs';
241 $filter[] = 'htlm';
242 break;
243 case 'tst':
244 $filter[] = 'tst';
245 break;
246 case 'fil':
247 $filter[] = 'file';
248 break;
249 }
250 }
251 return $filter ? $filter : array();
252 }

References getDetails().

Referenced by searchObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSortDirection()

ilShopAdvancedSearchGUI::getSortDirection ( )

◆ getSortField()

ilShopAdvancedSearchGUI::getSortField ( )

Definition at line 336 of file class.ilShopAdvancedSearchGUI.php.

References $sort_field.

◆ getSortingDirectionTopics()

ilShopAdvancedSearchGUI::getSortingDirectionTopics ( )

Definition at line 368 of file class.ilShopAdvancedSearchGUI.php.

References $sort_direction_topics.

Referenced by searchObjects().

+ Here is the caller graph for this function:

◆ getSortingTypeTopics()

ilShopAdvancedSearchGUI::getSortingTypeTopics ( )

Definition at line 352 of file class.ilShopAdvancedSearchGUI.php.

353 {
354 global $ilUser;
355
356 if(ANONYMOUS_USER_ID == $ilUser->getId() &&
357 $this->sort_type_topics == ilShopTopics::TOPICS_SORT_MANUALLY)
358 {
359 $this->sort_type_topics = ilShopTopics::TOPICS_SORT_BY_TITLE;
360 }
361
363 }
global $ilUser
Definition: imgupload.php:15

References $ilUser, $sort_type_topics, ilShopTopics\TOPICS_SORT_BY_TITLE, and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by searchObjects().

+ Here is the caller graph for this function:

◆ getString()

ilShopAdvancedSearchGUI::getString ( )

Definition at line 303 of file class.ilShopAdvancedSearchGUI.php.

References $string.

Referenced by parseQueryString().

+ Here is the caller graph for this function:

◆ getTopicId()

ilShopAdvancedSearchGUI::getTopicId ( )

Definition at line 319 of file class.ilShopAdvancedSearchGUI.php.

References $topic_id.

Referenced by searchObjects().

+ Here is the caller graph for this function:

◆ parseQueryString()

ilShopAdvancedSearchGUI::parseQueryString ( )
private

Definition at line 157 of file class.ilShopAdvancedSearchGUI.php.

158 {
159 include_once 'Services/Search/classes/class.ilQueryParser.php';
160
161 $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
162 $query_parser->setCombination($this->getCombination());
163 $query_parser->parse();
164
165 if (!$query_parser->validate())
166 {
167 return $query_parser->getMessage();
168 }
169
170 return $query_parser;
171 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References getCombination(), getString(), and ilUtil\stripSlashes().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilShopAdvancedSearchGUI::performSearch ( )

Definition at line 120 of file class.ilShopAdvancedSearchGUI.php.

121 {
122 if(!$this->getDetails())
123 {
124 if(method_exists($this, $this->ctrl->getCmd()))
125 ilUtil::sendInfo($this->lng->txt('search_choose_object_type'));
127
128 return false;
129 }
130
131 // Step 1: parse query string
132 if(!is_object($query_parser = $this->parseQueryString()))
133 {
134 ilUtil::sendInfo($query_parser);
136
137 return false;
138 }
139
140 // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
141 $result = $this->searchObjects($query_parser);
142
143 // Step 3:
144 $result->filter(ROOT_FOLDER_ID, $query_parser->getCombination() == 'and');
145 $result->save();
146
147 if(!count($result->getResults()))
148 {
149 ilUtil::sendInfo($this->lng->txt('payment_shop_not_objects_found'));
150 }
151
152 $this->showForm($result);
153
154 return true;
155 }
$result
const SHOP_ADVANCED_SEARCH
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $result, ilShopSearchResult\_getInstance(), getDetails(), parseQueryString(), searchObjects(), ilUtil\sendInfo(), SHOP_ADVANCED_SEARCH, and showForm().

Referenced by setFilter(), and setSorting().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilShopAdvancedSearchGUI::prepareOutput ( )
protected

Reimplemented from ilShopBaseGUI.

Definition at line 373 of file class.ilShopAdvancedSearchGUI.php.

374 {
375 global $ilTabs;
376
377 parent::prepareOutput();
378
379 $ilTabs->setTabActive('advanced_search');
380 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ resetFilter()

ilShopAdvancedSearchGUI::resetFilter ( )

Definition at line 114 of file class.ilShopAdvancedSearchGUI.php.

115 {
116 unset($_SESSION['shop_advanced_search']);
117 return $this->showForm();
118 }

References $_SESSION, and showForm().

+ Here is the call graph for this function:

◆ searchObjects()

ilShopAdvancedSearchGUI::searchObjects (   $query_parser)
private

Definition at line 173 of file class.ilShopAdvancedSearchGUI.php.

174 {
175 // create new search result object and assign the sorted topics
177 if((bool)$this->settings->get('topics_allow_custom_sorting'))
178 {
179 ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
180 ilShopTopics::_getInstance()->enableCustomSorting(true);
181 ilShopTopics::_getInstance()->setSortingType((int)$this->getSortingTypeTopics());
182 ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->getSortingDirectionTopics()));
184 }
185 else
186 {
187 ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
188 ilShopTopics::_getInstance()->enableCustomSorting(false);
189 ilShopTopics::_getInstance()->setSortingType((int)$this->settings->get('topics_sorting_type'));
190 ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->settings->get('topics_sorting_direction')));
192 }
193 $oSearchResult->setTopics(ilShopTopics::_getInstance()->getTopics());
194 $oSearchResult->setResultPageNumber((int)$_GET['page_number']);
195
196 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
197 $res = null;
198
199 $obj_search = ilObjectSearchFactory::_getShopObjectSearchInstance($query_parser);
200 $obj_search->setFilterShopTopicId((int)$this->getTopicId());
201 $obj_search->setFilter($this->getFilter());
202 $obj_search->setCustomSearchResultObject($oSearchResult);
203 $res = $obj_search->performSearch();
204
205 $meta_search_c = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
206 $meta_search_c->setMode('contribute');
207 $meta_search_c->setFilter($this->getFilter());
208 $meta_search_c->setFilterShopTopicId((int)$this->getTopicId());
209 $meta_search_c->setCustomSearchResultObject($oSearchResult);
210 $res->mergeEntries($meta_search_c->performSearch());
211
212 $meta_search_t = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
213 $meta_search_t->setMode('title');
214 $meta_search_t->setFilter($this->getFilter());
215 $meta_search_t->setCustomSearchResultObject($oSearchResult);
216 $meta_search_t->setFilterShopTopicId((int)$this->getTopicId());
217 $res->mergeEntries($meta_search_t->performSearch());
218
219 $meta_search_k = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
220 $meta_search_k->setMode('keyword');
221 $meta_search_k->setFilter($this->getFilter());
222 $meta_search_k->setCustomSearchResultObject($oSearchResult);
223 $meta_search_k->setFilterShopTopicId((int)$this->getTopicId());
224 $res->mergeEntries($meta_search_k->performSearch());
225
226 return $res;
227 }
$_GET["client_id"]
static _getShopMetaDataSearchInstance($query_parser)
get reference of LikeShopMetaDataSearch.
static _getShopObjectSearchInstance($query_parser)

References $_GET, $res, ilShopSearchResult\_getInstance(), ilShopTopics\_getInstance(), ilObjectSearchFactory\_getShopMetaDataSearchInstance(), ilObjectSearchFactory\_getShopObjectSearchInstance(), getFilter(), getSortingDirectionTopics(), getSortingTypeTopics(), getTopicId(), and SHOP_ADVANCED_SEARCH.

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCombination()

ilShopAdvancedSearchGUI::setCombination (   $a_combination)

Definition at line 291 of file class.ilShopAdvancedSearchGUI.php.

292 {
293 $_SESSION['shop_advanced_search']['combination'] = $this->combination = $a_combination;
294 }

References $_SESSION.

Referenced by __construct(), and setFilter().

+ Here is the caller graph for this function:

◆ setDetails()

ilShopAdvancedSearchGUI::setDetails (   $a_details)

Definition at line 307 of file class.ilShopAdvancedSearchGUI.php.

308 {
309 $_SESSION['shop_advanced_search']['details'] = $this->details = $a_details;
310 }

References $_SESSION.

Referenced by __construct(), and setFilter().

+ Here is the caller graph for this function:

◆ setFilter()

ilShopAdvancedSearchGUI::setFilter ( )

Definition at line 91 of file class.ilShopAdvancedSearchGUI.php.

92 {
93 if(isset($_POST['search_combination']))
94 {
95 $this->setCombination($_POST['search_combination']);
96 }
97 if(isset($_POST['search_string']))
98 {
99 $this->setString($_POST['search_string']);
100
101 }
102 if(isset($_POST['search_details']))
103 {
104 $this->setDetails($_POST['search_details']);
105 }
106 if(isset($_POST['search_topic']))
107 {
108 $this->setTopicId($_POST['search_topic']);
109 }
110 $this->performSearch();
111 }

References $_POST, performSearch(), setCombination(), setDetails(), setString(), and setTopicId().

+ Here is the call graph for this function:

◆ setSortDirection()

ilShopAdvancedSearchGUI::setSortDirection (   $a_sort_direction)

Definition at line 324 of file class.ilShopAdvancedSearchGUI.php.

325 {
326 $_SESSION['shop_advanced_search']['order_direction'] = $this->sort_direction = $a_sort_direction;
327 }

References $_SESSION.

Referenced by __construct(), and setSorting().

+ Here is the caller graph for this function:

◆ setSortField()

ilShopAdvancedSearchGUI::setSortField (   $a_field)

Definition at line 332 of file class.ilShopAdvancedSearchGUI.php.

333 {
334 $_SESSION['shop_advanced_search']['shop_order_field'] = $this->sort_field = $a_field;
335 }

References $_SESSION.

Referenced by __construct(), and setSorting().

+ Here is the caller graph for this function:

◆ setSorting()

ilShopAdvancedSearchGUI::setSorting ( )

Definition at line 49 of file class.ilShopAdvancedSearchGUI.php.

50 {
51 $this->setSortingTypeTopics($_POST['topics_sorting_type']);
52 $this->setSortingDirectionTopics($_POST['topics_sorting_direction']);
53 $this->setSortField($_POST['order_field']);
54 $this->setSortDirection($_POST['order_direction']);
55
56 $this->performSearch();
57
58 return true;
59 }

References $_POST, performSearch(), setSortDirection(), setSortField(), setSortingDirectionTopics(), and setSortingTypeTopics().

+ Here is the call graph for this function:

◆ setSortingDirectionTopics()

ilShopAdvancedSearchGUI::setSortingDirectionTopics (   $a_sort_direction)

Definition at line 364 of file class.ilShopAdvancedSearchGUI.php.

365 {
366 $_SESSION['shop_advanced_search']['shop_topics_sorting_direction'] = $this->sort_direction_topics = $a_sort_direction;
367 }

References $_SESSION.

Referenced by __construct(), and setSorting().

+ Here is the caller graph for this function:

◆ setSortingTypeTopics()

ilShopAdvancedSearchGUI::setSortingTypeTopics (   $a_field)

Definition at line 340 of file class.ilShopAdvancedSearchGUI.php.

341 {
342 global $ilUser;
343
344 if(ANONYMOUS_USER_ID == $ilUser->getId() &&
346 {
348 }
349
350 $_SESSION['shop_advanced_search']['order_topics_sorting_type'] = $this->sort_type_topics = $a_field;
351 }

References $_SESSION, $ilUser, ilShopTopics\TOPICS_SORT_BY_TITLE, and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by __construct(), and setSorting().

+ Here is the caller graph for this function:

◆ setString()

ilShopAdvancedSearchGUI::setString (   $a_str)

Definition at line 299 of file class.ilShopAdvancedSearchGUI.php.

300 {
301 $_SESSION['shop_advanced_search']['string'] = $this->string = $a_str;
302 }

References $_SESSION.

Referenced by __construct(), and setFilter().

+ Here is the caller graph for this function:

◆ setTopicId()

ilShopAdvancedSearchGUI::setTopicId (   $a_topic)

Definition at line 315 of file class.ilShopAdvancedSearchGUI.php.

316 {
317 $_SESSION['shop_advanced_search']['topic'] = $this->topic_id = $a_topic;
318 }

References $_SESSION.

Referenced by __construct(), and setFilter().

+ Here is the caller graph for this function:

◆ showForm()

ilShopAdvancedSearchGUI::showForm (   $result = null)

Definition at line 254 of file class.ilShopAdvancedSearchGUI.php.

255 {
256 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_advanced_search.html', 'Services/Payment');
257 include_once 'Services/Payment/classes/class.ilAdvancedSearchFilterGUI.php';
258 $filterGUI = new ilAdvancedSearchFilterGUI($this, $this->cmd);
259 $filterGUI->initFilter();
260 if($this->cmd == 'setFilter')
261 {
262 $filterGUI->writeFilterToSession();
263 }
264 else
265 {
266 $_SESSION['shop_advanced_search'] = array();
267 $filterGUI->resetFilter();
268 }
269 $this->tpl->setVariable('FILTER', $filterGUI->getHtml());
270
271 // show results
272 if($result && count($result->getResults()))
273 {
274 include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
275 $search_result_presentation = new ilShopResultPresentationGUI($result);
276 $this->tpl->setVariable('RESULTS', $search_result_presentation->showAdvancedSearchResults());
277 }
278 else
279 {
280 $this->tpl->setVariable('RESULTS', $this->lng->txt('payment_shop_not_objects_found'));
281 }
282
283 if($result)
284 {
285 $this->addPager($result);
286 }
287
288// return true;
289 }
Class ilAdvancedSearchFilterGUI.
Class ilShopResultPresentationGUI.

References $_SESSION, $result, and ilShopBaseGUI\addPager().

Referenced by performSearch(), and resetFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $combination

ilShopAdvancedSearchGUI::$combination = ''
private

Definition at line 20 of file class.ilShopAdvancedSearchGUI.php.

◆ $details

ilShopAdvancedSearchGUI::$details = array()
private

Definition at line 21 of file class.ilShopAdvancedSearchGUI.php.

◆ $sort_direction

ilShopAdvancedSearchGUI::$sort_direction = ''
private

Definition at line 26 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortDirection().

◆ $sort_direction_topics

ilShopAdvancedSearchGUI::$sort_direction_topics = ''
private

Definition at line 24 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortingDirectionTopics().

◆ $sort_field

ilShopAdvancedSearchGUI::$sort_field = ''
private

Definition at line 25 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortField().

◆ $sort_type_topics

ilShopAdvancedSearchGUI::$sort_type_topics = ''
private

Definition at line 23 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortingTypeTopics().

◆ $string

ilShopAdvancedSearchGUI::$string = ''
private

Definition at line 19 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getString().

◆ $topic_id

ilShopAdvancedSearchGUI::$topic_id = 0
private

Definition at line 22 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getTopicId().

◆ SEARCH_AND

const ilShopAdvancedSearchGUI::SEARCH_AND = 'and'

Definition at line 17 of file class.ilShopAdvancedSearchGUI.php.

◆ SEARCH_OR

const ilShopAdvancedSearchGUI::SEARCH_OR = 'or'

Definition at line 16 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getCombination().


The documentation for this class was generated from the following file: