TYPO3 CMS  TYPO3_6-2
NoDocumentsOpenController.php
Go to the documentation of this file.
1 <?php
3 
18 
25 
26  // Internal:
27  // Content accumulation
31  public $content;
32 
39  public $doc;
40 
47  public $loadModules;
48 
52  public function __construct() {
53  $GLOBALS['SOBE'] = $this;
54  $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_alt_doc.xml');
55 
56  $this->init();
57  }
58 
64  protected function init() {
65  // Start the template object:
66  $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
67  $this->doc->bodyTagMargins['x'] = 5;
68  $this->doc->bodyTagMargins['y'] = 5;
69  $this->doc->backPath = $GLOBALS['BACK_PATH'];
70  // Add JS
71  $this->doc->JScode = $this->doc->wrapScriptTags('
72  function jump(url, modName, mainModName) {
73  // clear information about which entry in nav. tree that might have been highlighted.
74  top.fsMod.navFrameHighlightedID = [];
75 
76  if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
77  top.content.nav_frame.refresh_nav();
78  }
79 
80  top.nextLoadModuleUrl = url;
81  top.goToModule(modName);
82  }
83  ');
84  // Start the page:
85  $this->content = '';
86  $this->content .= $this->doc->startPage('TYPO3 Edit Document');
87  // Loads the backend modules available for the logged in user.
88  $this->loadModules = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
89  $this->loadModules->load($GLOBALS['TBE_MODULES']);
90  }
91 
97  public function main() {
98  $msg = array();
99  // Add a message, telling that no documents were open...
100  $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg', TRUE) . '</p><br />';
101  // If another page module was specified, replace the default Page module with the new one
102  $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
103  $pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
104  // Perform some access checks:
105  $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
106  $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
107  // Finding module images: PAGE
108  $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_layout_tab'];
109  $imgInfo = @getimagesize($imgFile);
110  $img_web_layout = is_array($imgInfo) ? '<img src="../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($imgFile) . '" ' . $imgInfo[3] . ' alt="" />' : '';
111  // Finding module images: LIST
112  $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_list_tab'];
113  $imgInfo = @getimagesize($imgFile);
114  $img_web_list = is_array($imgInfo) ? '<img src="../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($imgFile) . '" ' . $imgInfo[3] . ' alt="" />' : '';
115  // If either the Web>List OR Web>Page module are active, show the little message with links to those modules:
116  if ($a_wl || $a_wp) {
117  $msg_2 = array();
118  // Web>Page:
119  if ($a_wp) {
120  $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'' . $pageModule . '\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_pagemodule', TRUE) . $img_web_layout . '</a></strong>';
121  if ($a_wl) {
122  $msg_2[] = $GLOBALS['LANG']->getLL('noDocuments_OR');
123  }
124  }
125  // Web>List
126  if ($a_wl) {
127  $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_listmodule', TRUE) . $img_web_list . '</a></strong>';
128  }
129  $msg[] = '<p>' . sprintf($GLOBALS['LANG']->getLL('noDocuments_msg2', 1), implode(' ', $msg_2)) . '</p><br />';
130  }
131  // Display the list of the most recently edited documents:
132  $modObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController');
133  $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg3', TRUE) . '</p><br />' . $modObj->renderMenu();
134  // Adding the content:
135  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('noDocuments'), implode(' ', $msg), 0, 1);
136  }
137 
143  public function printContent() {
144  $this->content .= $this->doc->endPage();
145  $this->content = $this->doc->insertStylesAndJS($this->content);
146  echo $this->content;
147  }
148 
149 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]