TYPO3 CMS  TYPO3_6-2
InfoModuleController.php
Go to the documentation of this file.
1 <?php
3 
18 
26 
31 
35  public $CALC_PERMS;
36 
40  public $pageinfo;
41 
48  public $doc;
49 
53  public function __construct() {
54  $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_web_info.xlf');
55  $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
56  }
57 
63  public function main() {
64  // Access check...
65  // The page will show only if there is a valid page and if this page may be viewed by the user
66  $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
67  $access = is_array($this->pageinfo);
68  if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
69  $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
70  if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) {
71  $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
72  }
73  $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
74  $this->doc->backPath = $GLOBALS['BACK_PATH'];
75  $this->doc->setModuleTemplate('EXT:info/Resources/Private/Templates/info.html');
76  $this->doc->tableLayout = array(
77  '0' => array(
78  '0' => array('<td valign="top"><strong>', '</strong></td>'),
79  'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')
80  ),
81  'defRow' => array(
82  '0' => array('<td valign="top">', '</td>'),
83  'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')
84  )
85  );
86  // JavaScript
87  $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';');
88  // Setting up the context sensitive menu:
89  $this->doc->getContextMenuCode();
90  $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_info')) . '" method="post" name="webinfoForm">';
91  $vContent = $this->doc->getVersionSelector($this->id, 1);
92  if ($vContent) {
93  $this->content .= $this->doc->section('', $vContent);
94  }
95  $this->extObjContent();
96  // Setting up the buttons and markers for docheader
97  $docHeaderButtons = $this->getButtons();
98  $markers = array(
99  'CSH' => $docHeaderButtons['csh'],
100  'FUNC_MENU' => BackendUtility::getFuncMenu(
101  $this->id,
102  'SET[function]',
103  $this->MOD_SETTINGS['function'],
104  $this->MOD_MENU['function']
105  ),
106  'CONTENT' => $this->content
107  );
108  // Build the <body> for the module
109  $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
110  } else {
111  // If no access or if ID == zero
112  $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
113  $this->doc->backPath = $GLOBALS['BACK_PATH'];
114  $this->content = $this->doc->header($GLOBALS['LANG']->getLL('title'));
115  $this->content .= $this->doc->spacer(5);
116  $this->content .= $this->doc->spacer(10);
117  }
118  // Renders the module page
119  $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
120  }
121 
127  public function printContent() {
128  $this->content = $this->doc->insertStylesAndJS($this->content);
129  echo $this->content;
130  }
131 
137  protected function getButtons() {
138  $buttons = array(
139  'csh' => '',
140  'view' => '',
141  'shortcut' => ''
142  );
143  // CSH
144  $buttons['csh'] = BackendUtility::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
145  // View page
146  $buttons['view'] = '<a href="#" '
147  . 'onclick="' . htmlspecialchars(
148  BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))
149  ) . '" '
150  . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
152  . '</a>';
153  // Shortcut
154  if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
155  $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']);
156  }
157  return $buttons;
158  }
159 
160 }
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'][]