4 include_once
'Services/Payment/classes/class.ilShopBaseGUI.php';
60 $next_class = $this->ctrl->getNextClass($this);
61 $cmd = $this->ctrl->getCmd();
67 $cmd =
'performSearch';
87 if(method_exists($this, $this->ctrl->getCmd()))
107 $result->filter(ROOT_FOLDER_ID, $query_parser->getCombination() ==
'and');
110 if(!count($result->getResults()))
122 include_once
'Services/Search/classes/class.ilQueryParser.php';
126 $query_parser->parse();
128 if (!$query_parser->validate())
130 return $query_parser->getMessage();
133 return $query_parser;
140 if((
bool)$this->oGeneralSettings->get(
'topics_allow_custom_sorting'))
157 $oSearchResult->setResultPageNumber((
int)
$_GET[
'page_number']);
159 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
163 $obj_search->setFilterShopTopicId((
int)$this->
getTopicId());
164 $obj_search->setFilter($this->
getFilter());
165 $obj_search->setCustomSearchResultObject($oSearchResult);
166 $res = $obj_search->performSearch();
169 $meta_search_c->setMode(
'contribute');
170 $meta_search_c->setFilter($this->
getFilter());
171 $meta_search_c->setFilterShopTopicId((
int)$this->
getTopicId());
172 $meta_search_c->setCustomSearchResultObject($oSearchResult);
173 $res->mergeEntries($meta_search_c->performSearch());
176 $meta_search_t->setMode(
'title');
177 $meta_search_t->setFilter($this->
getFilter());
178 $meta_search_t->setCustomSearchResultObject($oSearchResult);
179 $meta_search_t->setFilterShopTopicId((
int)$this->
getTopicId());
180 $res->mergeEntries($meta_search_t->performSearch());
183 $meta_search_k->setMode(
'keyword');
184 $meta_search_k->setFilter($this->
getFilter());
185 $meta_search_k->setCustomSearchResultObject($oSearchResult);
186 $meta_search_k->setFilterShopTopicId((
int)$this->
getTopicId());
187 $res->mergeEntries($meta_search_k->performSearch());
194 foreach($this->
getDetails() as $key => $detail_type)
217 return $filter ? $filter : array();
224 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shop_advanced_search.html',
'Services/Payment');
226 $this->tpl->setVariable(
'TBL_TITLE',$this->lng->txt(
'advanced_search'));
227 $this->tpl->setVariable(
'SEARCH_ACTION',$this->ctrl->getFormAction($this));
228 $this->tpl->setVariable(
'TXT_SEARCHTERM',$this->lng->txt(
'search_search_term'));
229 $this->tpl->setVariable(
'TXT_AND',$this->lng->txt(
'search_all_words'));
230 $this->tpl->setVariable(
'TXT_OR',$this->lng->txt(
'search_any_word'));
231 $this->tpl->setVariable(
'TXT_OBJECT_TYPE',$this->lng->txt(
'obj_type'));
232 $this->tpl->setVariable(
'TXT_TOPIC',$this->lng->txt(
'topic'));
233 $this->tpl->setVariable(
'BTN_SEARCH',$this->lng->txt(
'search'));
239 $this->tpl->setVariable(
'AND_CHECKED',
'checked="checked"');
243 $this->tpl->setVariable(
'OR_CHECKED',
'checked="checked"');
246 $this->tpl->setVariable(
'CRS',$this->lng->txt(
'courses'));
247 $this->tpl->setVariable(
'LMS',$this->lng->txt(
'learning_resources'));
248 $this->tpl->setVariable(
'TST',$this->lng->txt(
'tests'));
249 $this->tpl->setVariable(
'FIL',$this->lng->txt(
'objs_file'));
256 $selectable_topics = array();
257 $selectable_topics[
''] = $this->lng->txt(
'search_any');;
262 $selectable_topics[$oTopic->getId()] = $oTopic->getTitle();
265 $this->tpl->setVariable(
'SELECT_TOPIC',
ilUtil::formSelect(array($this->
getTopicId()),
'search[topic]', $selectable_topics,
false,
true));
268 if(count($result->getResults()))
270 include_once
'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
273 $this->tpl->setVariable(
'RESULTS', $search_result_presentation->showResults());
276 $objects = (bool)$this->oGeneralSettings->get(
'objects_allow_custom_sorting');
277 $topics = (bool)$this->oGeneralSettings->get(
'topics_allow_custom_sorting');
280 $this->tpl->setCurrentBlock(
'objects_sort_block');
281 $order_fields = array(
282 'title' => $this->lng->txt(
'title'),
283 'author' => $this->lng->txt(
'author'),
284 'price' => $this->lng->txt(
'price_a')
287 foreach($order_fields as $key => $value)
289 $this->tpl->setCurrentBlock(
'order_field');
290 $this->tpl->setVariable(
'ORDER_FIELD_VALUE', $key);
291 $this->tpl->setVariable(
'ORDER_FIELD_TEXT', $value);
294 $this->tpl->setVariable(
'ORDER_FIELD_SELECTED',
' selected="selected"');
296 $this->tpl->parseCurrentBlock();
299 $this->tpl->setVariable(
'SORT_BY_TEXT', $this->lng->txt(
'sort_by'));
300 $this->tpl->setVariable(
'ASCENDING_TEXT', $this->lng->txt(
'sort_asc'));
301 $this->tpl->setVariable(
'DESCENDING_TEXT', $this->lng->txt(
'sort_desc'));
302 $this->tpl->setVariable(
'ORDER_DIRECTION_'.strtoupper(trim($this->
getSortDirection())).
'_SELECTED',
" selected=\"selected\"");
304 $this->tpl->parseCurrentBlock();
309 $this->tpl->setCurrentBlock(
'topics_sort_block');
311 $this->tpl->setVariable(
'SORT_TOPICS_BY_TEXT', $this->lng->txt(
'sort_topics_by'));
314 $this->tpl->setVariable(
'SORTING_TYPE_BY_TITLE_TEXT', $this->lng->txt(
'sort_topics_by_title'));
317 $this->tpl->setVariable(
'SORTING_TYPE_BY_TITLE_SELECTED',
' selected="selected"');
321 $this->tpl->setVariable(
'SORTING_TYPE_BY_DATE_TEXT', $this->lng->txt(
'sort_topics_by_date'));
324 $this->tpl->setVariable(
'SORTING_TYPE_BY_DATE_SELECTED',
' selected="selected"');
327 if(ANONYMOUS_USER_ID != $ilUser->getId())
329 $this->tpl->setCurrentBlock(
'sort_manually');
331 $this->tpl->setVariable(
'SORTING_TYPE_MANUALLY_TEXT', $this->lng->txt(
'sort_topics_manually'));
334 $this->tpl->setVariable(
'SORTING_TYPE_MANUALLY_SELECTED',
' selected="selected"');
336 $this->tpl->parseCurrentBlock();
339 $this->tpl->setVariable(
'SORTING_DIRECTION_ASCENDING_TEXT', $this->lng->txt(
'sort_asc'));
340 $this->tpl->setVariable(
'SORTING_DIRECTION_DESCENDING_TEXT', $this->lng->txt(
'sort_desc'));
344 ' selected="selected"');
351 $this->tpl->parseCurrentBlock();
354 if($objects || $topics)
356 $this->tpl->setCurrentBlock(
'sort_button');
358 $this->tpl->setVariable(
'SORTING_FORM_ACTION', $this->ctrl->getFormAction($this,
'setSorting'));
359 $this->tpl->setVariable(
'CMD_SORT',
'setSorting');
360 $this->tpl->setVariable(
'SORT_TEXT', $this->lng->txt(
'sort'));
361 $this->tpl->parseCurrentBlock();
365 $this->tpl->setCurrentBlock(
'sorting');
366 $this->tpl->parseCurrentBlock();
369 $this->
addPager($result,
'shop_advanced_search_maxpage');
376 $_SESSION[
'shop_advanced_search'][
'combination'] = $this->combination = $a_combination;
384 $_SESSION[
'shop_advanced_search'][
'string'] = $this->
string = $a_str;
392 $_SESSION[
'shop_advanced_search'][
'details'] = $this->details = $a_details;
396 return $this->details ? $this->details : array();
400 $_SESSION[
'shop_advanced_search'][
'topic'] = $this->topic_id = $a_topic;
409 $_SESSION[
'shop_advanced_search'][
'order_direction'] = $this->sort_direction = $a_sort_direction;
417 $_SESSION[
'shop_advanced_search'][
'shop_order_field'] = $this->sort_field = $a_field;
427 if(ANONYMOUS_USER_ID == $ilUser->getId() &&
433 $_SESSION[
'shop_advanced_search'][
'order_topics_sorting_type'] = $this->sort_type_topics = $a_field;
439 if(ANONYMOUS_USER_ID == $ilUser->getId() &&
449 $_SESSION[
'shop_advanced_search'][
'shop_topics_sorting_direction'] = $this->sort_direction_topics = $a_sort_direction;
462 $ilTabs->setTabActive(
'advanced_search');