TYPO3 CMS  TYPO3_6-2
PageFunctionsController.php
Go to the documentation of this file.
1 <?php
3 
18 
26 
31  public $pageinfo;
32 
37 
44  public $doc;
45 
49  public function __construct() {
50  $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_web_func.xlf');
51  $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
52  }
53 
59  public function main() {
60  // Access check...
61  // The page will show only if there is a valid page and if this page may be viewed by the user
62  $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
63  $access = is_array($this->pageinfo);
64  // Template markers
65  $markers = array(
66  'CSH' => '',
67  'FUNC_MENU' => '',
68  'CONTENT' => ''
69  );
70  $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
71  $this->doc->backPath = $GLOBALS['BACK_PATH'];
72  $this->doc->setModuleTemplate('EXT:func/Resources/Private/Templates/func.html');
73  // Main
74  if ($this->id && $access) {
75  // JavaScript
76  $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';');
77  // Setting up the context sensitive menu:
78  $this->doc->getContextMenuCode();
79  $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
80  $vContent = $this->doc->getVersionSelector($this->id, TRUE);
81  if ($vContent) {
82  $this->content .= $this->doc->section('', $vContent);
83  }
84  $this->extObjContent();
85  // Setting up the buttons and markers for docheader
86  $docHeaderButtons = $this->getButtons();
87  $markers['CSH'] = $docHeaderButtons['csh'];
88  $markers['FUNC_MENU'] = BackendUtility::getFuncMenu(
89  $this->id,
90  'SET[function]',
91  $this->MOD_SETTINGS['function'],
92  $this->MOD_MENU['function']
93  );
94  $markers['CONTENT'] = $this->content;
95  } else {
96  // If no access or if ID == zero
98  'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
99  $GLOBALS['LANG']->getLL('clickAPage_content'),
100  $GLOBALS['LANG']->getLL('title'),
101  \TYPO3\CMS\Core\Messaging\FlashMessage::INFO
102  );
103  $this->content = $flashMessage->render();
104  // Setting up the buttons and markers for docheader
105  $docHeaderButtons = $this->getButtons();
106  $markers['CSH'] = $docHeaderButtons['csh'];
107  $markers['CONTENT'] = $this->content;
108  }
109  // Build the <body> for the module
110  $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
111  // Renders the module page
112  $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
113  }
114 
120  public function printContent() {
121  echo $this->content;
122  }
123 
129  protected function getButtons() {
130  $buttons = array(
131  'csh' => '',
132  'view' => '',
133  'shortcut' => ''
134  );
135  // CSH
136  $buttons['csh'] = BackendUtility::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH'], '', TRUE);
137  if ($this->id && is_array($this->pageinfo)) {
138  // View page
139  $buttons['view'] = '<a href="#" '
140  . 'onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" '
141  . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
142  . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>';
143  // Shortcut
144  if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
145  $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
146  }
147  }
148  return $buttons;
149  }
150 
151 }
static readPageAccess($id, $perms_clause)
static BEgetRootLine($uid, $clause='', $workspaceOL=FALSE)
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static viewOnClick($pageUid, $backPath='', $rootLine='', $anchorSection='', $alternativeUrl='', $additionalGetVars='', $switchFocus=TRUE)
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script='', $addparams='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]