TYPO3 API  SVNRelease
alt_doc_nodoc.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * No-document script
00029  * This is used by eg. the Doc module if no documents is registered as "open" (a concept which is better known from the "classic backend"...)
00030  *
00031  * $Id: alt_doc_nodoc.php 10121 2011-01-18 20:15:30Z ohader $
00032  * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
00033  * XHTML compliant
00034  *
00035  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00036  */
00037 /**
00038  * [CLASS/FUNCTION INDEX of SCRIPT]
00039  *
00040  *
00041  *
00042  *   72: class SC_alt_doc_nodoc
00043  *   84:     function init()
00044  *  108:     function main()
00045  *  168:     function printContent()
00046  *
00047  * TOTAL FUNCTIONS: 3
00048  * (This index is automatically created/updated by the extension "extdeveval")
00049  *
00050  */
00051 
00052 require('init.php');
00053 require('template.php');
00054 $LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml');
00055 
00056 require_once(t3lib_extMgm::extPath('opendocs') . 'class.tx_opendocs.php');
00057 
00058 
00059 /**
00060  * Script Class for the "No-doc" display; This shows most recently edited records.
00061  *
00062  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00063  * @package TYPO3
00064  * @subpackage core
00065  */
00066 class SC_alt_doc_nodoc {
00067 
00068         // Internal:
00069     var $content;       // Content accumulation
00070 
00071     /**
00072      * Document template object
00073      *
00074      * @var mediumDoc
00075      */
00076     var $doc;
00077 
00078     /**
00079      * Object for backend modules.
00080      *
00081      * @var t3lib_loadModules
00082      */
00083     var $loadModules;
00084 
00085     /**
00086      * Constructor, initialize.
00087      *
00088      * @return  void
00089      */
00090     function init() {
00091         global $BACK_PATH;
00092 
00093             // Start the template object:
00094         $this->doc = t3lib_div::makeInstance('mediumDoc');
00095         $this->doc->bodyTagMargins['x']=5;
00096         $this->doc->bodyTagMargins['y']=5;
00097         $this->doc->backPath = $BACK_PATH;
00098 
00099             // Add JS
00100         $this->doc->JScode = $this->doc->wrapScriptTags('
00101         function jump(url, modName, mainModName) {
00102                 // clear information about which entry in nav. tree that might have been highlighted.
00103             top.fsMod.navFrameHighlightedID = [];
00104 
00105             if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
00106                 top.content.nav_frame.refresh_nav();
00107             }
00108 
00109             top.nextLoadModuleUrl = url;
00110             top.goToModule(modName);
00111         }
00112         ');
00113 
00114             // Start the page:
00115         $this->content='';
00116         $this->content.=$this->doc->startPage('TYPO3 Edit Document');
00117 
00118             // Loads the backend modules available for the logged in user.
00119         $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
00120         $this->loadModules->load($GLOBALS['TBE_MODULES']);
00121     }
00122 
00123     /**
00124      * Rendering the content.
00125      *
00126      * @return  void
00127      */
00128     function main() {
00129         global $BE_USER,$LANG,$BACK_PATH;
00130 
00131         $msg=array();
00132 
00133             // Add a message, telling that no documents were open...
00134         $msg[]='<p>'.$LANG->getLL('noDocuments_msg',1).'</p><br />';
00135 
00136             // If another page module was specified, replace the default Page module with the new one
00137         $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule'));
00138         $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00139 
00140             // Perform some acccess checks:
00141         $a_wl = $BE_USER->check('modules','web_list');
00142         $a_wp = t3lib_extMgm::isLoaded('cms') && $BE_USER->check('modules',$pageModule);
00143 
00144 
00145             // Finding module images: PAGE
00146         $imgFile = $LANG->moduleLabels['tabs_images']['web_layout_tab'];
00147         $imgInfo = @getimagesize($imgFile);
00148         $img_web_layout = is_array($imgInfo) ? '<img src="../'.substr($imgFile,strlen(PATH_site)).'" '.$imgInfo[3].' alt="" />' : '';
00149 
00150             // Finding module images: LIST
00151         $imgFile = $LANG->moduleLabels['tabs_images']['web_list_tab'];
00152         $imgInfo = @getimagesize($imgFile);
00153         $img_web_list = is_array($imgInfo) ? '<img src="../'.substr($imgFile,strlen(PATH_site)).'" '.$imgInfo[3].' alt="" />' : '';
00154 
00155 
00156             // If either the Web>List OR Web>Page module are active, show the little message with links to those modules:
00157         if ($a_wl || $a_wp) {
00158             $msg_2 = array();
00159             if ($a_wp)  {   // Web>Page:
00160                 $msg_2[]='<strong><a href="#" onclick="top.goToModule(\''.$pageModule.'\'); return false;">'.$LANG->getLL('noDocuments_pagemodule',1).$img_web_layout.'</a></strong>';
00161                 if ($a_wl)  $msg_2[]=$LANG->getLL('noDocuments_OR');
00162             }
00163             if ($a_wl)  {   // Web>List
00164                 $msg_2[]='<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">'.$LANG->getLL('noDocuments_listmodule',1).$img_web_list.'</a></strong>';
00165             }
00166             $msg[]='<p>'.sprintf($LANG->getLL('noDocuments_msg2',1),implode(' ',$msg_2)).'</p><br />';
00167         }
00168 
00169             // Display the list of the most recently edited documents:
00170         $modObj = t3lib_div::makeInstance('tx_opendocs');
00171         $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg3', TRUE) . '</p><br />' . $modObj->renderMenu();
00172 
00173             // Adding the content:
00174         $this->content.=$this->doc->section($LANG->getLL('noDocuments'),implode(' ',$msg),0,1);
00175     }
00176 
00177     /**
00178      * Printing the content.
00179      *
00180      * @return  void
00181      */
00182     function printContent() {
00183         $this->content.= $this->doc->endPage();
00184         $this->content = $this->doc->insertStylesAndJS($this->content);
00185         echo $this->content;
00186     }
00187 }
00188 
00189 
00190 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_doc_nodoc.php'])) {
00191     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_doc_nodoc.php']);
00192 }
00193 
00194 
00195 
00196 // Make instance:
00197 $SOBE = t3lib_div::makeInstance('SC_alt_doc_nodoc');
00198 $SOBE->init();
00199 $SOBE->main();
00200 $SOBE->printContent();
00201 
00202 ?>