ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilShopGUI Class Reference

Class ilShopGUI. More...

+ Inheritance diagram for ilShopGUI:
+ Collaboration diagram for ilShopGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 showFilters ()
 
 clearFilter ()
 
 getPageHTML ()
 
 forwardToPageObject ()
 
 setFilter ()
 
 showShopExplorer ()
 
 performSearch ($oResult=null)
 
 resetFilter ()
 
 showSpecialContent ()
 
 showTopicsContent ($oResult)
 
 showContainerContent ()
 
 showGeneralFilter ($a_count_result=0)
 
 showTopicsFilter ($a_count_result=0)
 
 setTopicId ($a_topic_id)
 
 getTopicId ()
 
 setString ($a_str)
 
 getString ()
 
 setType ($a_type)
 
 getType ()
 
 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 SHOP_PAGE_EDITOR_PAGE_ID = 99999999
 
 $settings = null
 
 $cur_ref_id = null
 

Protected Member Functions

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

Protected Attributes

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

Private Attributes

 $sort_type_topics = ''
 
 $sort_direction_topics = ''
 
 $sort_field = ''
 
 $sort_direction = ''
 
 $string = ''
 
 $type = ''
 
 $topic_id = 0
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilShopGUI::__construct ( )

Definition at line 40 of file class.ilShopGUI.php.

References $_GET, $_POST, $_SESSION, $ilCtrl, ilPaymentSettings\_getInstance(), ilShopSearchResult\_getInstance(), setSortDirection(), setSortField(), setSortingDirectionTopics(), setSortingTypeTopics(), setString(), setTopicId(), setType(), and SHOP_CONTENT.

41  {
42  parent::__construct();
43 
44  global $ilCtrl;
45 
46  if(isset($_POST['cmd']) && $_POST['cmd'] == 'setFilter')
47  {
48  $this->cmd = 'setFilter';
49  }
50  else
51  {
52  $this->cmd = $ilCtrl->getCmd();
53  }
54 
55  $this->cur_ref_id = (int)$_GET['ref_id'];
56  $this->settings = ilPaymentSettings::_getInstance();
57 
59 
60  // set filter settings
61  $this->setType($_SESSION['shop_content']['type']);
62  $this->setString($_SESSION['shop_content']['text']);
63  $this->setTopicId($_POST['filter_topic_id']);
64 
65  // set sorting
66  $this->setSortingTypeTopics($_SESSION['shop_content']['order_topics_sorting_type']);
67  $this->setSortingDirectionTopics($_SESSION['shop_content']['shop_topics_sorting_direction']);
68  $this->setSortField($_POST['order_field']);
69  $this->setSortDirection($_SESSION['shop_content']['shop_order_direction']);
70  }
< 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']
setSortingTypeTopics($a_field)
setSortingDirectionTopics($a_sort_direction)
const SHOP_CONTENT
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
searchResult stores all result of a search query.
setType($a_type)
global $ilCtrl
Definition: ilias.php:18
setString($a_str)
setSortField($a_field)
setTopicId($a_topic_id)
setSortDirection($a_sort_direction)
+ Here is the call graph for this function:

Member Function Documentation

◆ clearFilter()

ilShopGUI::clearFilter ( )

Definition at line 171 of file class.ilShopGUI.php.

References setString(), setTopicId(), and setType().

Referenced by executeCommand().

172  {
173  $this->setString('');
174  $this->setType('');
175  $this->setTopicId(0);
176 
177  #return $this->performSearch();
178  }
setType($a_type)
setString($a_str)
setTopicId($a_topic_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilShopGUI::executeCommand ( )

Definition at line 72 of file class.ilShopGUI.php.

References $_GET, $cmd, $ret, ilObject\_lookupObjId(), ilObject\_lookupType(), clearFilter(), forwardToPageObject(), prepareOutput(), ilShopSearchResult\setFilterMode(), ilShopSearchResult\SHOW_CONTAINER_CONTENT, and ilShopSearchResult\SHOW_SPECIAL_CONTENT.

73  {
74  $next_class = $this->ctrl->getNextClass($this);
75  if(isset($_GET['ref_id']))
76  {
77  $this->cmd = 'showTree';
78  }
79 
80  switch($next_class)
81  {
82  case 'ilshoppagegui':
83  $this->prepareOutput();
84 
85  $ret = $this->forwardToPageObject();
86  if($ret != '')
87  {
88  $this->tpl->setContent($ret);
89  }
90  break;
91 
92  default:
93  switch($this->cmd)
94  {
95  case 'firstpage':
96  $this->clearFilter();
97 
98  if($this->settings->get('use_shop_specials') == true)
99  {
100  //@todo ... continue
102 
103  $cmd = 'showSpecialContent';
104  }
105  else
106  {
107  $cmd = 'performSearch';
108  }
109  break;
110  case 'showTree':
111  $obj_type = ilObject::_lookupType(ilObject::_lookupObjId($this->cur_ref_id));
112  $container = array("root", "cat", 'catr', "grp", "crs", 'crsr', 'rcrs');
113 
114  if(in_array($obj_type, $container))
115  {
116  //@todo ... continue
118  $cmd = 'showContainerContent';
119  }
120  else
121  {
122  $cmd = 'performSearch';
123  }
124  break;
125  case 'resetFilter':
126  $cmd = 'resetFilter';
127  break;
128  case 'setFilter':
129  $cmd = 'setFilter';
130  break;
131  default:
132  $cmd = 'performSearch';
133  break;
134  }
135 
136  $this->prepareOutput();
137  $this->$cmd();
138  break;
139  }
140 
141  return true;
142  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
searchResult stores all result of a search query.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ forwardToPageObject()

ilShopGUI::forwardToPageObject ( )

Definition at line 201 of file class.ilShopGUI.php.

References ilShopBaseGUI\$lng, ilPageObject\_exists(), and ilObjStyleSheet\getContentStylePath().

Referenced by executeCommand().

202  {
203  global $lng, $ilTabs;
204 
205  $ilTabs->clearTargets();
206  $ilTabs->setBackTarget($lng->txt('back'), $this->ctrl->getLinkTarget($this), '_top');
207 
208  // page object
209  include_once 'Services/Payment/classes/class.ilShopPage.php';
210  include_once 'Services/Payment/classes/class.ilShopPageGUI.php';
211 
212  $lng->loadLanguageModule('content');
213 
214  include_once('./Services/Style/classes/class.ilObjStyleSheet.php');
215  $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
216 
217  if(!ilShopPage::_exists('shop', self::SHOP_PAGE_EDITOR_PAGE_ID))
218  {
219  // doesn't exist -> create new one
220  $new_page_object = new ilShopPage();
221  $new_page_object->setParentId(0);
222  $new_page_object->setId(self::SHOP_PAGE_EDITOR_PAGE_ID);
223  $new_page_object->createFromXML();
224  }
225 
226  $this->ctrl->setReturnByClass('ilshoppagegui', 'edit');
227 
228  $page_gui = new ilShopPageGUI(self::SHOP_PAGE_EDITOR_PAGE_ID);
229 
230  return $this->ctrl->forwardCommand($page_gui);
231  }
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
Shop page object.
getContentStylePath($a_style_id)
get content style path
Shop page GUI class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageHTML()

ilShopGUI::getPageHTML ( )

Definition at line 180 of file class.ilShopGUI.php.

References ilPageObject\_exists(), and ilObjStyleSheet\getContentStylePath().

Referenced by showContainerContent(), showSpecialContent(), showTopicsContent(), and showTopicsFilter().

181  {
182  // page object
183  include_once 'Services/Payment/classes/class.ilShopPage.php';
184  include_once 'Services/Payment/classes/class.ilShopPageGUI.php';
185 
186  // if page does not exist, return nothing
187  if(!ilShopPage::_exists('shop', self::SHOP_PAGE_EDITOR_PAGE_ID))
188  {
189  return '';
190  }
191 
192  include_once 'Services/Style/classes/class.ilObjStyleSheet.php';
193  $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
194 
195  // get page object
196  $page_gui = new ilShopPageGUI(self::SHOP_PAGE_EDITOR_PAGE_ID);
197 
198  return $page_gui->showPage();
199  }
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
getContentStylePath($a_style_id)
get content style path
Shop page GUI class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSortDirection()

ilShopGUI::getSortDirection ( )

Definition at line 810 of file class.ilShopGUI.php.

References $sort_direction.

Referenced by showContainerContent(), showSpecialContent(), and showTopicsContent().

811  {
812  return $this->sort_direction;
813  }
+ Here is the caller graph for this function:

◆ getSortField()

ilShopGUI::getSortField ( )

Definition at line 820 of file class.ilShopGUI.php.

References $sort_field.

Referenced by showContainerContent(), showSpecialContent(), and showTopicsContent().

821  {
822  return $this->sort_field;
823  }
+ Here is the caller graph for this function:

◆ getSortingDirectionTopics()

ilShopGUI::getSortingDirectionTopics ( )

Definition at line 858 of file class.ilShopGUI.php.

References $sort_direction_topics.

Referenced by performSearch().

859  {
861  }
+ Here is the caller graph for this function:

◆ getSortingTypeTopics()

ilShopGUI::getSortingTypeTopics ( )

Definition at line 839 of file class.ilShopGUI.php.

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

Referenced by performSearch().

840  {
841  global $ilUser;
842 
843  if(ANONYMOUS_USER_ID == $ilUser->getId() &&
844  $this->sort_type_topics == ilShopTopics::TOPICS_SORT_MANUALLY
845  )
846  {
847  $this->sort_type_topics = ilShopTopics::TOPICS_SORT_BY_TITLE;
848  }
849 
851  }
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ getString()

ilShopGUI::getString ( )

Definition at line 790 of file class.ilShopGUI.php.

References $string.

Referenced by performSearch().

791  {
792  return $this->string;
793  }
+ Here is the caller graph for this function:

◆ getTopicId()

ilShopGUI::getTopicId ( )

Definition at line 780 of file class.ilShopGUI.php.

References $topic_id.

Referenced by performSearch().

781  {
782  return $this->topic_id;
783  }
+ Here is the caller graph for this function:

◆ getType()

ilShopGUI::getType ( )

Definition at line 800 of file class.ilShopGUI.php.

References $type.

Referenced by performSearch().

801  {
802  return $this->type;
803  }
+ Here is the caller graph for this function:

◆ performSearch()

ilShopGUI::performSearch (   $oResult = null)

Definition at line 349 of file class.ilShopGUI.php.

References $_GET, $res, ilShopSearchResult\_getInstance(), ilShopTopics\_getInstance(), ilObjectSearchFactory\_getShopMetaDataSearchInstance(), ilObjectSearchFactory\_getShopObjectSearchInstance(), ilShopBaseGUI\addPager(), getSortingDirectionTopics(), getSortingTypeTopics(), getString(), getTopicId(), getType(), QP_COMBINATION_AND, ilUtil\sendInfo(), SHOP_CONTENT, showTopicsContent(), and ilUtil\stripSlashes().

Referenced by resetFilter(), and setFilter().

350  {
351  if(!is_object($oResult))
352  {
354  if((bool)$this->settings->get('topics_allow_custom_sorting'))
355  {
356  ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
357  ilShopTopics::_getInstance()->enableCustomSorting(true);
358  ilShopTopics::_getInstance()->setSortingType((int)$this->getSortingTypeTopics());
359  ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->getSortingDirectionTopics()));
360  ilShopTopics::_getInstance()->read();
361  }
362  else
363  {
364  ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
365  ilShopTopics::_getInstance()->enableCustomSorting(false);
366  ilShopTopics::_getInstance()->setSortingType((int)$this->settings->get('topics_sorting_type'));
367  ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->settings->get('topics_sorting_direction')));
368  ilShopTopics::_getInstance()->read();
369  }
370 
371  $topics = ilShopTopics::_getInstance()->getTopics();
372 
373  $oResult->setTopics($topics);
374  $oResult->setResultPageNumber((int)$_GET['page_number']);
375  }
376 
377  // query parser
378  include_once 'Services/Search/classes/class.ilQueryParser.php';
379  $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
380  $query_parser->setMinWordLength(0);
381  $query_parser->setCombination(QP_COMBINATION_AND);
382  $query_parser->parse();
383  if(!$query_parser->validate())
384  {
385  ilUtil::sendInfo($query_parser->getMessage());
386  }
387 
388  // search
389  $types = array('crs', 'lm', 'sahs', 'htlm', 'file', 'tst', 'exc', 'glo');
390  if($this->getType() == '' || $this->getType() == 'title' ||
391  $query_parser->getQueryString() == ''
392  )
393  {
394  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
395  $object_search = ilObjectSearchFactory::_getShopObjectSearchInstance($query_parser);
396  $object_search->setFields(array('title'));
397  $object_search->setFilter($types);
398  $object_search->setCustomSearchResultObject($oResult);
399  $object_search->setFilterShopTopicId((int)$this->getTopicId());
400  $res = $object_search->performSearch();
401  }
402  else if($this->getType() == 'author')
403  {
404  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
405  $meta_search = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
406  $meta_search->setMode('contribute');
407  $meta_search->setFilter($types);
408  $meta_search->setFilterShopTopicId((int)$this->getTopicId());
409  $meta_search->setCustomSearchResultObject($oResult);
410  $res = $meta_search->performSearch();
411  }
412  else
413  {
414  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
415  $meta_search = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
416  $meta_search->setMode('title');
417  $meta_search->setFilter($types);
418  $meta_search->setCustomSearchResultObject($oResult);
419  $meta_search->setFilterShopTopicId((int)$this->getTopicId());
420  $res = $meta_search->performSearch();
421 
422  $meta_search = ilObjectSearchFactory::_getShopMetaDataSearchInstance($query_parser);
423  $meta_search->setMode('keyword');
424  $meta_search->setFilter($types);
425  $meta_search->setCustomSearchResultObject($oResult);
426  $meta_search->setFilterShopTopicId((int)$this->getTopicId());
427  $res->mergeEntries($meta_search->performSearch());
428  }
429 
430  $res->filter(ROOT_FOLDER_ID, true);
431  $res->save();
432 
433  if(!count($res->getResults()))
434  {
435  ilUtil::sendInfo($this->lng->txt('payment_shop_not_objects_found'));
436  }
437 
438  $this->showTopicsContent($res);
439  $this->addPager($res);
440  return;
441  }
const SHOP_CONTENT
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getSortingDirectionTopics()
static _getShopMetaDataSearchInstance($query_parser)
get reference of LikeShopMetaDataSearch.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _getShopObjectSearchInstance($query_parser)
get reference of LikeShopObjectSearch.
showTopicsContent($oResult)
const QP_COMBINATION_AND
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilShopGUI::prepareOutput ( )
protected

Definition at line 863 of file class.ilShopGUI.php.

Referenced by executeCommand().

864  {
865  global $ilTabs;
866 
867  parent::prepareOutput();
868  $ilTabs->setTabActive('content');
869  }
+ Here is the caller graph for this function:

◆ resetFilter()

ilShopGUI::resetFilter ( )

Definition at line 443 of file class.ilShopGUI.php.

References $_POST, $_SESSION, performSearch(), ilUtil\sendInfo(), setString(), setTopicId(), and setType().

444  {
445  unset($_SESSION['content_filter']);
446  unset($_POST['sel_filter_type']);
447  unset($_POST['filter_text']);
448  unset($_POST['filter_topic_id']);
449  unset($_POST['order_field']);
450  unset($_POST['order_direction']);
451  unset($_POST['topics_sorting_type']);
452  unset($_POST['topics_sorting_direction']);
453  unset($_POST['updateView']);
454  unset($_POST['show_filter']);
455 
456  ilUtil::sendInfo($this->lng->txt('paya_filter_reseted'));
457  $this->setString('');
458  $this->setType('');
459  $this->setTopicId(0);
460 
461  $this->performSearch();
462  return;
463  }
< 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']
$_POST['username']
Definition: cron.php:12
setType($a_type)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setString($a_str)
performSearch($oResult=null)
setTopicId($a_topic_id)
+ Here is the call graph for this function:

◆ setFilter()

ilShopGUI::setFilter ( )

Definition at line 233 of file class.ilShopGUI.php.

References $_POST, $_SESSION, performSearch(), setSortDirection(), setSortField(), setSortingDirectionTopics(), setSortingTypeTopics(), setString(), setTopicId(), and setType().

234  {
235  $_SESSION['content_filter']['updateView'] = $_POST['updateView'];
236  $_SESSION['content_filter']['show_filter'] = $_POST['show_filter'];
237  $_SESSION['content_filter']['sel_filter_type'] = $_POST['sel_filter_type'];
238  $_SESSION['content_filter']['filter_text'] = $_POST['filter_text'];
239  $_SESSION['content_filter']['filter_topic_id'] = $_POST['filter_topic_id'];
240 
241  $_SESSION['content_filter']['order_field'] = $_POST['order_field'];
242  $_SESSION['content_filter']['order_direction'] = $_POST['order_direction'];
243 
244  $_SESSION['content_filter']['topics_sorting_type'] = $_POST['topics_sorting_type'];
245  $_SESSION['content_filter']['topics_sorting_direction'] = $_POST['topics_sorting_direction'];
246 
247  $this->setString($_POST['filter_text']);
248  $this->setType($_POST['sel_filter_type']);
249  $this->setTopicId($_POST['filter_topic_id']);
250 
251  $this->setSortingTypeTopics($_POST['topics_sorting_type']);
252  $this->setSortingDirectionTopics($_POST['topics_sorting_direction']);
253  $this->setSortField($_POST['order_field']);
254  $this->setSortDirection('asc');
255 
256  $this->performSearch();
257  return;
258  }
< 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']
setSortingTypeTopics($a_field)
setSortingDirectionTopics($a_sort_direction)
$_POST['username']
Definition: cron.php:12
setType($a_type)
setString($a_str)
performSearch($oResult=null)
setSortField($a_field)
setTopicId($a_topic_id)
setSortDirection($a_sort_direction)
+ Here is the call graph for this function:

◆ setSortDirection()

ilShopGUI::setSortDirection (   $a_sort_direction)

Definition at line 805 of file class.ilShopGUI.php.

Referenced by __construct(), and setFilter().

806  {
807  $this->sort_direction = $a_sort_direction;
808  }
+ Here is the caller graph for this function:

◆ setSortField()

ilShopGUI::setSortField (   $a_field)

Definition at line 815 of file class.ilShopGUI.php.

Referenced by __construct(), and setFilter().

816  {
817  $this->sort_field = $a_field;
818  }
+ Here is the caller graph for this function:

◆ setSortingDirectionTopics()

ilShopGUI::setSortingDirectionTopics (   $a_sort_direction)

Definition at line 853 of file class.ilShopGUI.php.

References $_SESSION.

Referenced by __construct(), and setFilter().

854  {
855  $_SESSION['shop_content']['shop_topics_sorting_direction'] = $this->sort_direction_topics = $a_sort_direction;
856  }
< 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()

ilShopGUI::setSortingTypeTopics (   $a_field)

Definition at line 825 of file class.ilShopGUI.php.

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

Referenced by __construct(), and setFilter().

826  {
827  global $ilUser;
828 
829  if(ANONYMOUS_USER_ID == $ilUser->getId() &&
831  )
832  {
834  }
835 
836  $this->sort_type_topics = $a_field;
837  }
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ setString()

ilShopGUI::setString (   $a_str)

Definition at line 785 of file class.ilShopGUI.php.

Referenced by __construct(), clearFilter(), resetFilter(), and setFilter().

786  {
787  $this->string = $a_str;
788  }
+ Here is the caller graph for this function:

◆ setTopicId()

ilShopGUI::setTopicId (   $a_topic_id)

Definition at line 775 of file class.ilShopGUI.php.

Referenced by __construct(), clearFilter(), resetFilter(), and setFilter().

776  {
777  $this->topic_id = $a_topic_id;
778  }
+ Here is the caller graph for this function:

◆ setType()

ilShopGUI::setType (   $a_type)

Definition at line 795 of file class.ilShopGUI.php.

Referenced by __construct(), clearFilter(), resetFilter(), and setFilter().

796  {
797  $this->type = $a_type;
798  }
+ Here is the caller graph for this function:

◆ showContainerContent()

ilShopGUI::showContainerContent ( )

Definition at line 595 of file class.ilShopGUI.php.

References $ilUser, $result, ilShopBaseGUI\$tpl, $type, ilPaymentObject\_getContainerObjects(), ilPaymentObject\_getObjectData(), ilPaymentObject\_isBuyable(), ilObject\_lookupDescription(), ilObject\_lookupObjId(), ilPaymentObject\_lookupPobjectId(), ilObject\_lookupTitle(), ilObject\_lookupType(), getPageHTML(), getSortDirection(), getSortField(), and showFilters().

596  {
597  global $ilUser, $rbacreview, $ilToolbar, $tpl;
598 
599  if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
600  {
601  $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit'));
602  }
603 
604  include_once './Services/Payment/classes/class.ilPaymentObject.php';
605 
606  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_content.html', 'Services/Payment');
607  $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
608 
609  $is_buyable = ilPaymentObject::_isBuyable($this->cur_ref_id);
610 
611  if($is_buyable)
612  {
614 
615  $obj_id = ilObject::_lookupObjId($this->cur_ref_id);
616  $title = ilObject::_lookupTitle($obj_id);
617  $description = ilObject::_lookupDescription($obj_id);
618  $type = ilObject::_lookupType($obj_id);
619 
620  $presentation_results[$pobjects['pt_topic_fk']][$type][] =
621  array(
622  'ref_id' => $pobjects['ref_id'],
623  'title' => $title,
624  'description' => $description,
625  'type' => $type,
626  'obj_id' => $obj_id,
627  'topic_id' => $pobjects['pt_topic_fk'],
628  'child' => $pobjects['child']
629  );
630  }
631  else
632  {
633  $pobjects = ilPaymentObject::_getContainerObjects($this->cur_ref_id);
634 
635  if(count($pobjects) >= 1)
636  {
637  foreach($pobjects as $result)
638  {
639  $obj_id = $result['obj_id'];
640  $title = $result['title'];
641  $description = $result['description'];
642  $type = $result['type'];
643 
644  $presentation_results[$result['pt_topic_fk']][$type][] =
645  array(
646  'ref_id' => $result['ref_id'],
647  'title' => $title,
648  'description' => $description,
649  'type' => $type,
650  'obj_id' => $obj_id,
651  'topic_id' => $result['pt_topic_fk'],
652  'child' => $result['child']
653  );
654  }
655  }
656  }
657 
658  include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
659  $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
660  $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
661  $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
662 
663  if(!$presentation_results)
664  {
665  $this->tpl->setVariable('RESULTS', $this->lng->txt('payment_shop_not_objects_found'));
666  }
667  else
668  {
669  $html = $search_result_presentation->showSpecials();
670  $this->tpl->setVariable('RESULTS', $html);
671  }
672  $this->showFilters();
673  }
$result
static _lookupPobjectId($a_ref_id)
static _getContainerObjects($a_ref_id)
static _getObjectData($a_id)
static _lookupTitle($a_id)
lookup object title
Class ilShopResultPresentationGUI.
static _isBuyable($a_ref_id, $a_subtype='')
static _lookupDescription($a_id)
lookup object description
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ showFilters()

ilShopGUI::showFilters ( )

Definition at line 145 of file class.ilShopGUI.php.

References showGeneralFilter(), showShopExplorer(), and showTopicsFilter().

Referenced by showContainerContent(), showSpecialContent(), and showTopicsContent().

146  {
147  $show_general_filter = $this->settings->get('show_general_filter');
148  $show_topics_filter = $this->settings->get('show_topics_filter');
149  $topics_enabled = $this->settings->get('enable_topics');
150  $show_shop_explorer = $this->settings->get('show_shop_explorer');
151 
152  if($show_general_filter)
153  {
154  $g_filter_html = $this->showGeneralFilter();
155  $this->tpl->setCurrentBlock('show_general_filter');
156  $this->tpl->setVariable('FORM', $g_filter_html);
157  $this->tpl->parseCurrentBlock();
158  }
159 
160  if($show_topics_filter && $topics_enabled)
161  {
162  $this->showTopicsFilter();
163  }
164  if($show_shop_explorer)
165  {
166  $this->showShopExplorer();
167  }
168  }
showGeneralFilter($a_count_result=0)
showTopicsFilter($a_count_result=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showGeneralFilter()

ilShopGUI::showGeneralFilter (   $a_count_result = 0)

Definition at line 675 of file class.ilShopGUI.php.

Referenced by showFilters().

676  {
677  include_once 'Services/Payment/classes/class.ilShopFilterGUI.php';
678  $filterGUI = new ilShopFilterGUI($this, 'setCmd');
679  $filterGUI->initFilter();
680  if($this->cmd == 'setFilter')
681  {
682  $filterGUI->writeFilterToSession();
683  }
684  else
685  {
686  $filterGUI->resetFilter();
687  }
688  return $filterGUI->getHtml();
689  }
Class ilShopFilterGUI.
+ Here is the caller graph for this function:

◆ showShopExplorer()

ilShopGUI::showShopExplorer ( )

Definition at line 260 of file class.ilShopGUI.php.

References $_GET, $ilCtrl, ilShopBaseGUI\$lng, $nd, $path, ilShopBaseGUI\$tpl, ilObject\_getIcon(), ilObject\_lookupObjId(), and exit.

Referenced by showFilters().

261  {
262  global $ilCtrl, $tree, $lng, $tpl;
263 
264  $ilCtrl->setParameter($this, "active_node", $_GET["active_node"]);
265  $tpl->addCss('Services/Payment/css/shop_explorer.css');
266 
267  include_once ("./Services/Payment/classes/class.ilShopRepositoryExplorer.php");
268 
269  $active_node = ($_GET["active_node"] >= 1)
270  ? $_GET["active_node"]
271  : ($_GET["ref_id"] >= 1)
272  ? $_GET["ref_id"]
273  : 0;
274 
275  $top_node = 0;
276 
277  $exp = new ilShopRepositoryExplorer("ilias.php", $top_node);
278  $exp->setUseStandardFrame(false);
279  $exp->setExpandTarget("ilias.php?baseClass=ilshopcontroller&ref_id=1&cmd=showTree");
280 
281  $exp->setFrameUpdater("tree", "updater");
282  $exp->setTargetGet("ref_id");
283 
284  if($_GET["repexpand"] == "")
285  {
286  $expanded = $tree->readRootId();
287  }
288  else
289  {
290  $expanded = $_GET["repexpand"];
291  }
292 
293  $exp->setExpand($expanded);
294 
295  if($active_node > 0)
296  {
297  $path = $tree->getPathId($active_node);
298  if($top_node > 0)
299  {
300  $exp->setForceOpenPath($path);
301  $exp->setExpand($expanded);
302  }
303  else
304  {
305  $exp->setForceOpenPath($path + array($top_node));
306  }
307  $exp->highlightNode($active_node);
308  }
309 
310  // build html-output
311  if($top_node > 0)
312  {
313  $head_tpl = new ilTemplate("tpl.cont_tree_head.html", true, true,
314  "Services/Repository");
315  $path = ilObject::_getIcon(ROOT_FOLDER_ID, "tiny", "root");
316  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
317  $title = $nd["title"];
318  if($title == "ILIAS")
319  {
320  $title = $lng->txt("repository");
321  }
322  $head_tpl->setVariable("IMG_SRC", $path);
323  $head_tpl->setVariable("ALT_IMG", $lng->txt("icon") . " " . $title);
324  $head_tpl->setVariable("LINK_TXT", $title);
325  $head_tpl->setVariable("LINK_HREF", "ilias.php?baseClass=ilshopcontroller&ref_id=1");
326  $exp->setTreeLead($head_tpl->get());
327 
328  $exp->initItemCounter(1);
329  $exp->setOutput($tree->getParentId($top_node), 1,
330  ilObject::_lookupObjId($tree->getParentId($top_node)));
331  }
332  else
333  {
334  $exp->setOutput(0);
335  }
336  $output = $exp->getOutput(true);
337 
338  // asynchronous output
339  if($ilCtrl->isAsynch())
340  {
341  echo $output;
342  exit;
343  }
344 
345  $ilCtrl->setParameter($this, "repexpand", $_GET["repexpand"]);
346  $tpl->setLeftContent($output);
347  }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
exit
Definition: login.php:54
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
$nd
Definition: error.php:9
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSpecialContent()

ilShopGUI::showSpecialContent ( )

Definition at line 466 of file class.ilShopGUI.php.

References $ilUser, $result, $type, ilPaymentObject\_getSpecialObjects(), ilObject\_lookupDescription(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), getPageHTML(), getSortDirection(), getSortField(), and showFilters().

467  {
468  global $ilUser, $rbacreview, $ilToolbar;
469 
470  if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
471  {
472  $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit'));
473  }
474 
475  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_content.html', 'Services/Payment');
476  $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
477 
478  include_once './Services/Payment/classes/class.ilPaymentObject.php';
479 
481  if(count($pobjects))
482  {
483  foreach($pobjects as $result)
484  {
485  $obj_id = ilObject::_lookupObjId($result['ref_id']);
486  $title = ilObject::_lookupTitle($obj_id);
487  $description = ilObject::_lookupDescription($obj_id);
488  $type = ilObject::_lookupType($obj_id);
489 
490  $presentation_results[(int)$result['pt_topic_fk']][$type][] =
491  array(
492  'ref_id' => $result['ref_id'],
493  'title' => $title,
494  'description' => $description,
495  'type' => $type,
496  'obj_id' => $obj_id,
497  'topic_id' => (int)$result['pt_topic_fk'],
498  'child' => $result['child']
499  );
500  }
501  $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
502  }
503  else
504  {
505  $this->tpl->setVariable('PAGE_CONTENT', $this->lng->txt('please_choose_category'));
506  }
507 
508  include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
509  $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
510  $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
511  $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
512 
513  $html = $search_result_presentation->showSpecials();
514 
515  $this->tpl->setVariable('RESULTS', $html);
516  $this->showFilters();
517  }
$result
static _lookupTitle($a_id)
lookup object title
Class ilShopResultPresentationGUI.
static _lookupDescription($a_id)
lookup object description
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ showTopicsContent()

ilShopGUI::showTopicsContent (   $oResult)

Definition at line 519 of file class.ilShopGUI.php.

References $_SESSION, $ilUser, $result, $type, ilPaymentObject\_getTopicsObjects(), ilObject\_lookupDescription(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), getPageHTML(), getSortDirection(), getSortField(), ilUtil\sendInfo(), and showFilters().

Referenced by performSearch().

520  {
521  global $ilUser, $rbacreview, $ilToolbar;
522 
523  if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
524  {
525  $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit'));
526  }
527 
528  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_content.html', 'Services/Payment');
529  if(!count($oResult->getResults()))
530  {
531  $this->tpl->setVariable('ERROR',ilUtil::sendInfo($this->lng->txt('payment_shop_not_objects_found')));
532  }
533 
534  include_once './Services/Payment/classes/class.ilPaymentObject.php';
535  $filter_topics_id = NULL;
536  if($_SESSION['content_filter']['filter_topic_id'] != NULL)
537  {
538  $filter_topics_id = (int)$_SESSION['content_filter']['filter_topic_id'];
539  $pobjects = ilPaymentObject::_getTopicsObjects($filter_topics_id);
540  if(count($pobjects))
541  {
542  foreach($pobjects as $result)
543  {
544  $obj_id = ilObject::_lookupObjId($result['ref_id']);
545  $title = ilObject::_lookupTitle($obj_id);
546  $description = ilObject::_lookupDescription($obj_id);
547  $type = ilObject::_lookupType($obj_id);
548 
549  $presentation_results[(int)$result['pt_topic_fk']][$type][] = array(
550  'ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => (int)$result['pt_topic_fk'], 'child' => $result['child']
551  );
552  }
553  $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
554  }
555  else
556  {
557  $this->tpl->setVariable('PAGE_CONTENT', $this->lng->txt('please_choose_category'));
558  }
559 
560  include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
561  $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
562  $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
563  $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
564 
565  $html = $search_result_presentation->showTopics();
566  }
567  else
568  {
569  foreach($oResult->getResults() as $result)
570  {
571 
572  $obj_id = ilObject::_lookupObjId($result['ref_id']);
573  $title = ilObject::_lookupTitle($obj_id);
574  $description = ilObject::_lookupDescription($obj_id);
575  $tmp_res = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description,
576  'type' => $result['type'], 'obj_id' => $obj_id, 'topic_id' => 0, 'child' => 0);
577 
578  $presentation_results[0][$result['type']][] = $tmp_res;
579  }
580 
581  include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
582  $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
583  $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
584  $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
585 
586  $html = $search_result_presentation->showTopics();
587  }
588  $this->tpl->setVariable('RESULTS', $html);
589  $this->showFilters();
590  }
< 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']
$result
static _getTopicsObjects($topic_id=NULL)
static _lookupTitle($a_id)
lookup object title
Class ilShopResultPresentationGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupDescription($a_id)
lookup object description
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showTopicsFilter()

ilShopGUI::showTopicsFilter (   $a_count_result = 0)

Definition at line 691 of file class.ilShopGUI.php.

References $_POST, $ilUser, ilShopTopics\_getInstance(), getPageHTML(), ilShopTopics\TOPICS_SORT_BY_CREATEDATE, ilShopTopics\TOPICS_SORT_BY_TITLE, and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by showFilters().

692  {
693  global $ilUser;
694 
695  $this->tpl->setCurrentBlock('show_topics_filter');
696 
697  ilShopTopics::_getInstance()->setIdFilter(false);
698  ilShopTopics::_getInstance()->read();
699 
700  if(count(ilShopTopics::_getInstance()->getTopics()))
701  {
702  $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
703  $this->tpl->setVariable('SORTING_FORM_ACTION', $this->ctrl->getFormAction($this, 'setFilter'));
704 
705  $this->tpl->setVariable('SET_FILTER_VAL', $this->lng->txt('pay_update_view'));
706 
707  $this->tpl->setCurrentBlock('topics_option');
708  $this->tpl->setVariable('SORT_TOPICS', $this->lng->txt('topic'));
709 
710  $this->tpl->setVariable('FILTER_TOPIC_ID', 'no_selection');
711  $this->tpl->setVariable('FILTER_TOPIC_TEXT', '------------');
712  if($_POST['cmd'] == 'firstpage')
713  $this->tpl->setVariable('FILTER_TOPIC_SELECTED', 'selected');
714  $this->tpl->parseCurrentBlock('topics_option');
715 
716  $this->tpl->setVariable('FILTER_TOPIC_ID', 'all');
717  $this->tpl->setVariable('FILTER_TOPIC_TEXT', $this->lng->txt('all'));
718  if($_POST['filter_topic_id'] == 'all')
719  $this->tpl->setVariable('FILTER_TOPIC_SELECTED', 'selected');
720  $this->tpl->parseCurrentBlock('topics_option');
721 
722  $oTopics = array();
723  $oTopics = ilShopTopics::_getInstance()->getTopics();
724  foreach($oTopics as $oTopic)
725  {
726  $this->tpl->setVariable('FILTER_TOPIC_ID', $oTopic->getId());
727  $this->tpl->setVariable('FILTER_TOPIC_TEXT', $oTopic->getTitle());
728  if($_POST['filter_topic_id'] == $oTopic->getId())
729  $this->tpl->setVariable('FILTER_TOPIC_SELECTED', 'selected');
730  $this->tpl->parseCurrentBlock('topics_option');
731  }
732  }
733 
734  if($a_count_result)
735  {
736  $objects = (bool)$this->settings->get('objects_allow_custom_sorting');
737  if($objects)
738  {
739  // sorting form
740  $allow_objects_option = array(
741  'title' => $this->lng->txt('title'),
742  'author' => $this->lng->txt('author'),
743  'price' => $this->lng->txt('price_a')
744  );
745  $this->tpl->setCurrentBlock('order_field');
746  $this->tpl->setVariable('SORT_BY_TEXT', $this->lng->txt('sort_by'));
747 
748  foreach($allow_objects_option as $key=> $value)
749  {
750  $this->tpl->setVariable('ORDER_FIELD_VALUE', $key);
751  $this->tpl->setVariable('ORDER_FIELD_TEXT', $value);
752  if($_POST['order_field'] == $key)
753  $this->tpl->setVariable('ORDER_FIELD_SELECTED', 'selected');
754  $this->tpl->parseCurrentBlock('order_field');
755  }
756  }
757 
758  $topics = (bool)$this->settings->get('topics_allow_custom_sorting');
759 
760  if($topics)
761  {
762  // sorting form
763  $allow_topics_option = array(
764  ilShopTopics::TOPICS_SORT_BY_TITLE => $this->lng->txt('sort_topics_by_title'),
765  ilShopTopics::TOPICS_SORT_BY_CREATEDATE => $this->lng->txt('sort_topics_by_date')
766  );
767  if(ANONYMOUS_USER_ID != $ilUser->getId())
768  {
769  $allow_topics_option[ilShopTopics::TOPICS_SORT_MANUALLY] = $this->lng->txt('sort_topics_manually');
770  }
771  }
772  }
773  }
const TOPICS_SORT_BY_CREATEDATE
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cur_ref_id

ilShopGUI::$cur_ref_id = null

Definition at line 33 of file class.ilShopGUI.php.

◆ $ilShopSearchResult

ilShopGUI::$ilShopSearchResult = null
protected

Definition at line 38 of file class.ilShopGUI.php.

◆ $settings

ilShopGUI::$settings = null

Definition at line 31 of file class.ilShopGUI.php.

◆ $sort_direction

ilShopGUI::$sort_direction = ''
private

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

Referenced by getSortDirection().

◆ $sort_direction_topics

ilShopGUI::$sort_direction_topics = ''
private

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

Referenced by getSortingDirectionTopics().

◆ $sort_field

ilShopGUI::$sort_field = ''
private

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

Referenced by getSortField().

◆ $sort_type_topics

ilShopGUI::$sort_type_topics = ''
private

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

Referenced by getSortingTypeTopics().

◆ $string

ilShopGUI::$string = ''
private

Definition at line 27 of file class.ilShopGUI.php.

Referenced by getString().

◆ $topic_id

ilShopGUI::$topic_id = 0
private

Definition at line 29 of file class.ilShopGUI.php.

Referenced by getTopicId().

◆ $type

ilShopGUI::$type = ''
private

◆ SHOP_PAGE_EDITOR_PAGE_ID

const ilShopGUI::SHOP_PAGE_EDITOR_PAGE_ID = 99999999

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


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