ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilShopAdvancedSearchGUI Class Reference

Class ilShopAdvancedSearchGUI. More...

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

Public Member Functions

 __construct ()
 
 setSorting ()
 
 executeCommand ()
 
 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 ()
 
- Public Member Functions inherited from ilShopBaseGUI
 __construct ()
 

Data Fields

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

Protected Member Functions

 prepareOutput ()
 
- Protected Member Functions inherited from ilShopBaseGUI
 prepareOutput ()
 
 addPager ($result, $a_session_key)
 
 buildSubTabs ()
 
 setSection ($a_section)
 
 getSection ()
 
 setSubSection ($a_sub_section)
 
 getSubSection ()
 
 showButton ($a_cmd, $a_text, $a_target='')
 
 initTableGUI ()
 
 setTableGUIBasicData ($tbl, $result_set, $a_default_order_column='')
 

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
 
 $oGeneralSettings = null
 
 $section = 0
 
 $sub_section = 0
 

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 ( )

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

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

29  {
30  parent::__construct();
31 
32  // set filter
33  $this->setCombination($_SESSION['shop_advanced_search']['combination']);
34  $this->setString($_SESSION['shop_advanced_search']['string']);
35  $this->setDetails($_SESSION['shop_advanced_search']['details']);
36  $this->setTopicId($_SESSION['shop_advanced_search']['topic']);
37 
38  // set sorting
39  $this->setSortingTypeTopics($_SESSION['shop_advanced_search']['order_topics_sorting_type']);
40  $this->setSortingDirectionTopics($_SESSION['shop_advanced_search']['shop_topics_sorting_direction']);
41 
42  $this->setSortField($_SESSION['shop_advanced_search']['shop_order_field']);
43  $this->setSortDirection($_SESSION['shop_advanced_search']['shop_order_direction']);
44  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilShopAdvancedSearchGUI::executeCommand ( )

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

References $cmd, and prepareOutput().

59  {
60  $next_class = $this->ctrl->getNextClass($this);
61  $cmd = $this->ctrl->getCmd();
62  switch($next_class)
63  {
64  default:
65  if(!$cmd)
66  {
67  $cmd = 'performSearch';
68  }
69  $this->prepareOutput();
70  $this->$cmd();
71 
72  break;
73  }
74 
75  return true;
76  }
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ getCombination()

ilShopAdvancedSearchGUI::getCombination ( )

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

Referenced by parseQueryString(), and showForm().

379  {
380  return $this->combination ? $this->combination : self::SEARCH_OR;
381  }
+ Here is the caller graph for this function:

◆ getDetails()

ilShopAdvancedSearchGUI::getDetails ( )

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

Referenced by getFilter(), performSearch(), and showForm().

395  {
396  return $this->details ? $this->details : array();
397  }
+ Here is the caller graph for this function:

◆ getFilter()

ilShopAdvancedSearchGUI::getFilter ( )
private

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

References getDetails().

Referenced by searchObjects().

193  {
194  foreach($this->getDetails() as $key => $detail_type)
195  {
196  switch($key)
197  {
198  case 'crs':
199  $filter[] = 'crs';
200  break;
201 
202  case 'lms':
203  $filter[] = 'lm';
204  $filter[] = 'sahs';
205  $filter[] = 'htlm';
206  break;
207 
208  case 'tst':
209  $filter[] = 'tst';
210  break;
211 
212  case 'fil':
213  $filter[] = 'file';
214  break;
215  }
216  }
217  return $filter ? $filter : array();
218  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSortDirection()

ilShopAdvancedSearchGUI::getSortDirection ( )

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

References $sort_direction.

Referenced by showForm().

+ Here is the caller graph for this function:

◆ getSortField()

ilShopAdvancedSearchGUI::getSortField ( )

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

References $sort_field.

Referenced by showForm().

+ Here is the caller graph for this function:

◆ getSortingDirectionTopics()

ilShopAdvancedSearchGUI::getSortingDirectionTopics ( )

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

References $sort_direction_topics.

Referenced by searchObjects(), and showForm().

+ Here is the caller graph for this function:

◆ getSortingTypeTopics()

ilShopAdvancedSearchGUI::getSortingTypeTopics ( )

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

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

Referenced by searchObjects(), and showForm().

436  {
437  global $ilUser;
438 
439  if(ANONYMOUS_USER_ID == $ilUser->getId() &&
440  $this->sort_type_topics == ilShopTopics::TOPICS_SORT_MANUALLY)
441  {
442  $this->sort_type_topics = ilShopTopics::TOPICS_SORT_BY_TITLE;
443  }
444 
446  }
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ getString()

ilShopAdvancedSearchGUI::getString ( )

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

References $string.

Referenced by parseQueryString(), and showForm().

+ Here is the caller graph for this function:

◆ getTopicId()

ilShopAdvancedSearchGUI::getTopicId ( )

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

References $topic_id.

Referenced by searchObjects(), and showForm().

+ Here is the caller graph for this function:

◆ parseQueryString()

ilShopAdvancedSearchGUI::parseQueryString ( )
private

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

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

Referenced by performSearch().

121  {
122  include_once 'Services/Search/classes/class.ilQueryParser.php';
123 
124  $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
125  $query_parser->setCombination($this->getCombination());
126  $query_parser->parse();
127 
128  if (!$query_parser->validate())
129  {
130  return $query_parser->getMessage();
131  }
132 
133  return $query_parser;
134  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilShopAdvancedSearchGUI::performSearch ( )

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

References $_POST, $result, getDetails(), parseQueryString(), searchObjects(), ilUtil\sendInfo(), setCombination(), setDetails(), setString(), setTopicId(), SHOP_ADVANCED_SEARCH, and showForm().

Referenced by setSorting().

79  {
80  if(isset($_POST['search']['combination'])) $this->setCombination($_POST['search']['combination']);
81  if(isset($_POST['search']['string'])) $this->setString($_POST['search']['string']);
82  if(isset($_POST['search']['details'])) $this->setDetails($_POST['search']['details']);
83  if(isset($_POST['search']['topic'])) $this->setTopicId($_POST['search']['topic']);
84 
85  if(!$this->getDetails())
86  {
87  if(method_exists($this, $this->ctrl->getCmd()))
88  ilUtil::sendInfo($this->lng->txt('search_choose_object_type'));
90 
91  return false;
92  }
93 
94  // Step 1: parse query string
95  if(!is_object($query_parser = $this->parseQueryString()))
96  {
97  ilUtil::sendInfo($query_parser);
99 
100  return false;
101  }
102 
103  // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
104  $result = $this->searchObjects($query_parser);
105 
106  // Step 3:
107  $result->filter(ROOT_FOLDER_ID, $query_parser->getCombination() == 'and');
108  $result->save();
109 
110  if(!count($result->getResults()))
111  {
112  ilUtil::sendInfo($this->lng->txt('payment_shop_not_objects_found'));
113  }
114 
115  $this->showForm($result);
116 
117  return true;
118  }
$_POST['username']
Definition: cron.php:12
$result
searchResult stores all result of a search query.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const SHOP_ADVANCED_SEARCH
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilShopAdvancedSearchGUI::prepareOutput ( )
protected

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

Referenced by executeCommand().

457  {
458  global $ilTabs;
459 
460  parent::prepareOutput();
461 
462  $ilTabs->setTabActive('advanced_search');
463  }
+ Here is the caller graph for this function:

◆ searchObjects()

ilShopAdvancedSearchGUI::searchObjects (   $query_parser)
private

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

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

Referenced by performSearch().

137  {
138  // create new search result object and assign the sorted topics
139  $oSearchResult = new ilShopSearchResult(SHOP_ADVANCED_SEARCH);
140  if((bool)$this->oGeneralSettings->get('topics_allow_custom_sorting'))
141  {
142  ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
143  ilShopTopics::_getInstance()->enableCustomSorting(true);
144  ilShopTopics::_getInstance()->setSortingType((int)$this->getSortingTypeTopics());
145  ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->getSortingDirectionTopics()));
146  ilShopTopics::_getInstance()->read();
147  }
148  else
149  {
150  ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
151  ilShopTopics::_getInstance()->enableCustomSorting(false);
152  ilShopTopics::_getInstance()->setSortingType((int)$this->oGeneralSettings->get('topics_sorting_type'));
153  ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->oGeneralSettings->get('topics_sorting_direction')));
154  ilShopTopics::_getInstance()->read();
155  }
156  $oSearchResult->setTopics(ilShopTopics::_getInstance()->getTopics());
157  $oSearchResult->setResultPageNumber((int)$_GET['page_number']);
158 
159  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
160  $res = null;
161 
162  $obj_search = ilObjectSearchFactory::_getShopObjectSearchInstance($query_parser);
163  $obj_search->setFilterShopTopicId((int)$this->getTopicId());
164  $obj_search->setFilter($this->getFilter());
165  $obj_search->setCustomSearchResultObject($oSearchResult);
166  $res = $obj_search->performSearch();
167 
168  $meta_search_c = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
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());
174 
175  $meta_search_t = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
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());
181 
182  $meta_search_k = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
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());
188 
189  return $res;
190  }
$_GET["client_id"]
searchResult stores all result of a search query.
const SHOP_ADVANCED_SEARCH
static _getShopMetaDataSearchInstance($query_parser)
get reference of LikeShopMetaDataSearch.
static _getShopObjectSearchInstance($query_parser)
get reference of LikeShopObjectSearch.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCombination()

ilShopAdvancedSearchGUI::setCombination (   $a_combination)

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

References $_SESSION.

Referenced by __construct(), and performSearch().

375  {
376  $_SESSION['shop_advanced_search']['combination'] = $this->combination = $a_combination;
377  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setDetails()

ilShopAdvancedSearchGUI::setDetails (   $a_details)

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

References $_SESSION.

Referenced by __construct(), and performSearch().

391  {
392  $_SESSION['shop_advanced_search']['details'] = $this->details = $a_details;
393  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setSortDirection()

ilShopAdvancedSearchGUI::setSortDirection (   $a_sort_direction)

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

References $_SESSION.

Referenced by __construct(), and setSorting().

408  {
409  $_SESSION['shop_advanced_search']['order_direction'] = $this->sort_direction = $a_sort_direction;
410  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setSortField()

ilShopAdvancedSearchGUI::setSortField (   $a_field)

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

References $_SESSION.

Referenced by __construct(), and setSorting().

416  {
417  $_SESSION['shop_advanced_search']['shop_order_field'] = $this->sort_field = $a_field;
418  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setSorting()

ilShopAdvancedSearchGUI::setSorting ( )

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

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

47  {
48  $this->setSortingTypeTopics($_POST['topics_sorting_type']);
49  $this->setSortingDirectionTopics($_POST['topics_sorting_direction']);
50  $this->setSortField($_POST['order_field']);
51  $this->setSortDirection($_POST['order_direction']);
52 
53  $this->performSearch();
54 
55  return true;
56  }
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ setSortingDirectionTopics()

ilShopAdvancedSearchGUI::setSortingDirectionTopics (   $a_sort_direction)

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

References $_SESSION.

Referenced by __construct(), and setSorting().

448  {
449  $_SESSION['shop_advanced_search']['shop_topics_sorting_direction'] = $this->sort_direction_topics = $a_sort_direction;
450  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setSortingTypeTopics()

ilShopAdvancedSearchGUI::setSortingTypeTopics (   $a_field)

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

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

Referenced by __construct(), and setSorting().

424  {
425  global $ilUser;
426 
427  if(ANONYMOUS_USER_ID == $ilUser->getId() &&
429  {
431  }
432 
433  $_SESSION['shop_advanced_search']['order_topics_sorting_type'] = $this->sort_type_topics = $a_field;
434  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ setString()

ilShopAdvancedSearchGUI::setString (   $a_str)

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

References $_SESSION.

Referenced by __construct(), and performSearch().

383  {
384  $_SESSION['shop_advanced_search']['string'] = $this->string = $a_str;
385  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setTopicId()

ilShopAdvancedSearchGUI::setTopicId (   $a_topic)

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

References $_SESSION.

Referenced by __construct(), and performSearch().

399  {
400  $_SESSION['shop_advanced_search']['topic'] = $this->topic_id = $a_topic;
401  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ showForm()

ilShopAdvancedSearchGUI::showForm (   $result = null)

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

References $details, $ilUser, $result, ilShopTopics\_getInstance(), ilShopBaseGUI\addPager(), ilShopTopics\DEFAULT_SORTING_DIRECTION, ilUtil\formCheckbox(), ilUtil\formSelect(), getCombination(), getDetails(), getSortDirection(), getSortField(), getSortingDirectionTopics(), getSortingTypeTopics(), getString(), getTopicId(), ilUtil\prepareFormOutput(), ilShopTopics\TOPICS_SORT_BY_CREATEDATE, ilShopTopics\TOPICS_SORT_BY_TITLE, and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by performSearch().

221  {
222  global $ilUser;
223 
224  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_advanced_search.html', 'Services/Payment');
225 
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'));
234 
235  $this->tpl->setVariable('FORM_SEARCH_STR', ilUtil::prepareFormOutput($this->getString(), true));
236 
237  if ($this->getCombination() == self::SEARCH_AND)
238  {
239  $this->tpl->setVariable('AND_CHECKED', 'checked="checked"');
240  }
241  else
242  {
243  $this->tpl->setVariable('OR_CHECKED', 'checked="checked"');
244  }
245 
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'));
250  $details = $this->getDetails();
251  $this->tpl->setVariable('CHECK_CRS', ilUtil::formCheckbox($details['crs'] ? 1 : 0,'search[details][crs]', 1));
252  $this->tpl->setVariable('CHECK_LMS', ilUtil::formCheckbox($details['lms'] ? 1 : 0,'search[details][lms]', 1));
253  $this->tpl->setVariable('CHECK_TST', ilUtil::formCheckbox($details['tst'] ? 1 : 0,'search[details][tst]', 1));
254  $this->tpl->setVariable('CHECK_FIL', ilUtil::formCheckbox($details['fil'] ? 1 : 0,'search[details][fil]', 1));
255 
256  $selectable_topics = array();
257  $selectable_topics[''] = $this->lng->txt('search_any');;
258  ilShopTopics::_getInstance()->setIdFilter(false);
259  ilShopTopics::_getInstance()->read();
260  foreach(ilShopTopics::_getInstance()->getTopics() as $oTopic)
261  {
262  $selectable_topics[$oTopic->getId()] = $oTopic->getTitle();
263  }
264 
265  $this->tpl->setVariable('SELECT_TOPIC', ilUtil::formSelect(array($this->getTopicId()), 'search[topic]', $selectable_topics, false, true));
266 
267  // show results
268  if(count($result->getResults()))
269  {
270  include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
271  $search_result_presentation = new ilShopResultPresentationGUI($result);
272 
273  $this->tpl->setVariable('RESULTS', $search_result_presentation->showResults());
274 
275 
276  $objects = (bool)$this->oGeneralSettings->get('objects_allow_custom_sorting');
277  $topics = (bool)$this->oGeneralSettings->get('topics_allow_custom_sorting');
278  if($objects)
279  {
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')
285  );
286 
287  foreach($order_fields as $key => $value)
288  {
289  $this->tpl->setCurrentBlock('order_field');
290  $this->tpl->setVariable('ORDER_FIELD_VALUE', $key);
291  $this->tpl->setVariable('ORDER_FIELD_TEXT', $value);
292  if (strcmp(trim($this->getSortField()), $key) == 0)
293  {
294  $this->tpl->setVariable('ORDER_FIELD_SELECTED', ' selected="selected"');
295  }
296  $this->tpl->parseCurrentBlock();
297  }
298 
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\"");
303 
304  $this->tpl->parseCurrentBlock();
305  }
306 
307  if($topics)
308  {
309  $this->tpl->setCurrentBlock('topics_sort_block');
310 
311  $this->tpl->setVariable('SORT_TOPICS_BY_TEXT', $this->lng->txt('sort_topics_by'));
312 
313  $this->tpl->setVariable('SORTING_TYPE_BY_TITLE', ilShopTopics::TOPICS_SORT_BY_TITLE);
314  $this->tpl->setVariable('SORTING_TYPE_BY_TITLE_TEXT', $this->lng->txt('sort_topics_by_title'));
316  {
317  $this->tpl->setVariable('SORTING_TYPE_BY_TITLE_SELECTED', ' selected="selected"');
318  }
319 
320  $this->tpl->setVariable('SORTING_TYPE_BY_DATE', ilShopTopics::TOPICS_SORT_BY_CREATEDATE);
321  $this->tpl->setVariable('SORTING_TYPE_BY_DATE_TEXT', $this->lng->txt('sort_topics_by_date'));
323  {
324  $this->tpl->setVariable('SORTING_TYPE_BY_DATE_SELECTED', ' selected="selected"');
325  }
326 
327  if(ANONYMOUS_USER_ID != $ilUser->getId())
328  {
329  $this->tpl->setCurrentBlock('sort_manually');
330  $this->tpl->setVariable('SORTING_TYPE_MANUALLY', ilShopTopics::TOPICS_SORT_MANUALLY);
331  $this->tpl->setVariable('SORTING_TYPE_MANUALLY_TEXT', $this->lng->txt('sort_topics_manually'));
333  {
334  $this->tpl->setVariable('SORTING_TYPE_MANUALLY_SELECTED', ' selected="selected"');
335  }
336  $this->tpl->parseCurrentBlock();
337  }
338 
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'));
341  if(in_array(strtoupper($this->getSortingDirectionTopics()), array('ASC', 'DESC')))
342  {
343  $this->tpl->setVariable('SORTING_DIRECTION_'.strtoupper($this->getSortingDirectionTopics()).'_SELECTED',
344  ' selected="selected"');
345  }
346  else
347  {
348  $this->tpl->setVariable('SORTING_DIRECTION_'.strtoupper(ilShopTopics::DEFAULT_SORTING_DIRECTION).'_SELECTED', ' selected="selected"');
349  }
350 
351  $this->tpl->parseCurrentBlock();
352  }
353 
354  if($objects || $topics)
355  {
356  $this->tpl->setCurrentBlock('sort_button');
357 
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();
362  }
363 
364 
365  $this->tpl->setCurrentBlock('sorting');
366  $this->tpl->parseCurrentBlock();
367  }
368 
369  $this->addPager($result, 'shop_advanced_search_maxpage');
370 
371  return true;
372  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
const TOPICS_SORT_BY_CREATEDATE
$result
const DEFAULT_SORTING_DIRECTION
addPager($result, $a_session_key)
Class ilShopResultPresentationGUI.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
global $ilUser
Definition: imgupload.php:15
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
+ 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.

Referenced by showForm().

◆ $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.


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