[BUGFIX] Wrong icon in db_new tree
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / NoDocumentsOpenController.php
1 <?php
2 namespace TYPO3\CMS\Backend\Controller;
3
4 /**
5 * Script Class for the "No-doc" display; This shows most recently edited records.
6 *
7 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
8 * @package TYPO3
9 * @subpackage core
10 */
11 class NoDocumentsOpenController {
12
13 // Internal:
14 // Content accumulation
15 /**
16 * @todo Define visibility
17 */
18 public $content;
19
20 /**
21 * Document template object
22 *
23 * @var \TYPO3\CMS\Backend\Template\MediumDocumentTemplate
24 * @todo Define visibility
25 */
26 public $doc;
27
28 /**
29 * Object for backend modules.
30 *
31 * @var \TYPO3\CMS\Backend\Module\ModuleLoader
32 * @todo Define visibility
33 */
34 public $loadModules;
35
36 /**
37 * Constructor, initialize.
38 *
39 * @return void
40 * @todo Define visibility
41 */
42 public function init() {
43 // Start the template object:
44 $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate');
45 $this->doc->bodyTagMargins['x'] = 5;
46 $this->doc->bodyTagMargins['y'] = 5;
47 $this->doc->backPath = $GLOBALS['BACK_PATH'];
48 // Add JS
49 $this->doc->JScode = $this->doc->wrapScriptTags('
50 function jump(url, modName, mainModName) {
51 // clear information about which entry in nav. tree that might have been highlighted.
52 top.fsMod.navFrameHighlightedID = [];
53
54 if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
55 top.content.nav_frame.refresh_nav();
56 }
57
58 top.nextLoadModuleUrl = url;
59 top.goToModule(modName);
60 }
61 ');
62 // Start the page:
63 $this->content = '';
64 $this->content .= $this->doc->startPage('TYPO3 Edit Document');
65 // Loads the backend modules available for the logged in user.
66 $this->loadModules = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
67 $this->loadModules->load($GLOBALS['TBE_MODULES']);
68 }
69
70 /**
71 * Rendering the content.
72 *
73 * @return void
74 * @todo Define visibility
75 */
76 public function main() {
77 $msg = array();
78 // Add a message, telling that no documents were open...
79 $msg[] = ('<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg', 1)) . '</p><br />';
80 // If another page module was specified, replace the default Page module with the new one
81 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
82 $pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
83 // Perform some access checks:
84 $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
85 $a_wp = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms') && $GLOBALS['BE_USER']->check('modules', $pageModule);
86 // Finding module images: PAGE
87 $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_layout_tab'];
88 $imgInfo = @getimagesize($imgFile);
89 $img_web_layout = is_array($imgInfo) ? ((('<img src="../' . substr($imgFile, strlen(PATH_site))) . '" ') . $imgInfo[3]) . ' alt="" />' : '';
90 // Finding module images: LIST
91 $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_list_tab'];
92 $imgInfo = @getimagesize($imgFile);
93 $img_web_list = is_array($imgInfo) ? ((('<img src="../' . substr($imgFile, strlen(PATH_site))) . '" ') . $imgInfo[3]) . ' alt="" />' : '';
94 // If either the Web>List OR Web>Page module are active, show the little message with links to those modules:
95 if ($a_wl || $a_wp) {
96 $msg_2 = array();
97 // Web>Page:
98 if ($a_wp) {
99 $msg_2[] = (((('<strong><a href="#" onclick="top.goToModule(\'' . $pageModule) . '\'); return false;">') . $GLOBALS['LANG']->getLL('noDocuments_pagemodule', 1)) . $img_web_layout) . '</a></strong>';
100 if ($a_wl) {
101 $msg_2[] = $GLOBALS['LANG']->getLL('noDocuments_OR');
102 }
103 }
104 // Web>List
105 if ($a_wl) {
106 $msg_2[] = (('<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_listmodule', 1)) . $img_web_list) . '</a></strong>';
107 }
108 $msg[] = ('<p>' . sprintf($GLOBALS['LANG']->getLL('noDocuments_msg2', 1), implode(' ', $msg_2))) . '</p><br />';
109 }
110 // Display the list of the most recently edited documents:
111 $modObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController');
112 $msg[] = (('<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg3', TRUE)) . '</p><br />') . $modObj->renderMenu();
113 // Adding the content:
114 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('noDocuments'), implode(' ', $msg), 0, 1);
115 }
116
117 /**
118 * Printing the content.
119 *
120 * @return void
121 * @todo Define visibility
122 */
123 public function printContent() {
124 $this->content .= $this->doc->endPage();
125 $this->content = $this->doc->insertStylesAndJS($this->content);
126 echo $this->content;
127 }
128
129 }
130
131
132 ?>