ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilShopInfoGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/COPage/classes/class.ilPageObjectGUI.php';
5 include_once 'Services/Payment/classes/class.ilShopBaseGUI.php';
6 include_once 'classes/class.ilTabsGUI.php';
7 
8 
18 {
19  const SHOP_PAGE_EDITOR_PAGE_ID = 99999998;
20 
21  public function __construct()
22  {
24  }
25 
26  function executeCommand()
27  {
28  $next_class = $this->ctrl->getNextClass($this);
29  $cmd = $this->ctrl->getCmd();
30 
31  switch($next_class)
32  {
33  case 'ilpageobjectgui':
34  $this->prepareOutput();
35  $ret = $this->forwardToPageObject();
36  if($ret != '')
37  {
38  $this->tpl->setContent($ret);
39  }
40  break;
41  default:
42  if(!$cmd)
43  {
44  $cmd = 'showInfo';
45  }
46  $this->prepareOutput();
47  $this->$cmd();
48 
49  break;
50  }
51 
52  return true;
53  }
54 
55  public function getPageHTML()
56  {
57  // page object
58  include_once 'Services/COPage/classes/class.ilPageObject.php';
59  include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
60 
61  // if page does not exist, return nothing
62  if(!ilPageObject::_exists('shop', self::SHOP_PAGE_EDITOR_PAGE_ID))
63  {
64  return '';
65  }
66 
67  include_once 'Services/Style/classes/class.ilObjStyleSheet.php';
68  $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
69 
70  // get page object
71  $page_gui = new ilPageObjectGUI('shop', self::SHOP_PAGE_EDITOR_PAGE_ID);
72  $page_gui->setIntLinkHelpDefault('StructureObject', self::SHOP_PAGE_EDITOR_PAGE_ID);
73  $page_gui->setLinkXML('');
74  $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'downloadFile'));
75  $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'displayMediaFullscreen'));
76  $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'download_paragraph'));
77  $page_gui->setPresentationTitle('');
78  $page_gui->setTemplateOutput(false);
79  $page_gui->setHeader('');
80  $page_gui->setEnabledRepositoryObjects(false);
81  $page_gui->setEnabledFileLists(true);
82  $page_gui->setEnabledPCTabs(true);
83  $page_gui->setEnabledMaps(true);
84 
85  return $page_gui->showPage();
86  }
87 
88  public function forwardToPageObject()
89  {
90  global $lng, $ilTabs;
91 
92  $ilTabs->clearTargets();
93  $ilTabs->setBackTarget($lng->txt('back'), $this->ctrl->getLinkTarget($this), '_top');
94 
95  // page object
96  include_once 'Services/COPage/classes/class.ilPageObject.php';
97  include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
98 
99  $lng->loadLanguageModule('content');
100 
101  include_once('./Services/Style/classes/class.ilObjStyleSheet.php');
102  $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
103 
104  if(!ilPageObject::_exists('shop', self::SHOP_PAGE_EDITOR_PAGE_ID))
105  {
106  // doesn't exist -> create new one
107  $new_page_object = new ilPageObject('shop');
108  $new_page_object->setParentId(0);
109  $new_page_object->setId(self::SHOP_PAGE_EDITOR_PAGE_ID);
110  $new_page_object->createFromXML();
111  }
112 
113  $this->ctrl->setReturnByClass('ilpageobjectgui', 'edit');
114 
115  $page_gui = new ilPageObjectGUI('shop', self::SHOP_PAGE_EDITOR_PAGE_ID);
116  $page_gui->setIntLinkHelpDefault('StructureObject', self::SHOP_PAGE_EDITOR_PAGE_ID);
117  $page_gui->setTemplateTargetVar('ADM_CONTENT');
118  $page_gui->setLinkXML('');
119  $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'downloadFile'));
120  $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'displayMediaFullscreen'));
121  $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'download_paragraph'));
122  $page_gui->setPresentationTitle('');
123  $page_gui->setTemplateOutput(false);
124  $page_gui->setHeader('');
125  $page_gui->setEnabledRepositoryObjects(false);
126  $page_gui->setEnabledFileLists(true);
127  $page_gui->setEnabledMaps(true);
128  $page_gui->setEnabledPCTabs(true);
129 
130  return $this->ctrl->forwardCommand($page_gui);
131  }
132 
133  public function showInfo()
134  {
135  global $ilUser, $rbacreview, $ilToolbar;
136 
137  if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
138  {
139  $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit'));
140  }
141 
142  $this->tpl->setVariable('ADM_CONTENT', $this->getPageHTML());
143  }
144 
145  protected function prepareOutput()
146  {
147  global $ilTabs;
148 
150 
151  $ilTabs->setTabActive('shop_info');
152  }
153 }
154 ?>