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