TYPO3 API  SVNRelease
index.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  * Module: Advanced functions
00029  * Advanced Functions related to pages
00030  *
00031  * $Id: index.php 10120 2011-01-18 20:03:36Z 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  *   71: class SC_mod_web_func_index extends t3lib_SCbase
00043  *   84:     function main()
00044  *  172:     function printContent()
00045  *
00046  * TOTAL FUNCTIONS: 2
00047  * (This index is automatically created/updated by the extension "extdeveval")
00048  *
00049  */
00050 
00051 
00052 unset($MCONF);
00053 require('conf.php');
00054 require($BACK_PATH.'init.php');
00055 require($BACK_PATH.'template.php');
00056 $LANG->includeLLFile('EXT:lang/locallang_mod_web_func.xml');
00057 
00058 $BE_USER->modAccess($MCONF,1);
00059 
00060 
00061 
00062 /**
00063  * Script Class for the Web > Functions module
00064  * This class creates the framework to which other extensions can connect their sub-modules
00065  *
00066  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00067  * @package TYPO3
00068  * @subpackage core
00069  */
00070 class SC_mod_web_func_index extends t3lib_SCbase {
00071 
00072         // Internal, dynamic:
00073     var $pageinfo;
00074     var $fileProcessor;
00075 
00076     /**
00077      * Document Template Object
00078      *
00079      * @var mediumDoc
00080      */
00081     var $doc;
00082 
00083 
00084 
00085     /**
00086      * Initialize module header etc and call extObjContent function
00087      *
00088      * @return  void
00089      */
00090     function main() {
00091         global $BE_USER,$LANG,$BACK_PATH;
00092 
00093         // Access check...
00094         // The page will show only if there is a valid page and if this page may be viewed by the user
00095         $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
00096         $access = is_array($this->pageinfo) ? 1 : 0;
00097 
00098             // Template markers
00099         $markers = array(
00100             'CSH' => '',
00101             'FUNC_MENU' => '',
00102             'CONTENT' => ''
00103         );
00104 
00105         $this->doc = t3lib_div::makeInstance('template');
00106         $this->doc->backPath = $BACK_PATH;
00107         $this->doc->setModuleTemplate('templates/func.html');
00108 
00109         // **************************
00110         // Main
00111         // **************************
00112         if ($this->id && $access)   {
00113                 // JavaScript
00114             $this->doc->JScode = $this->doc->wrapScriptTags('
00115                 script_ended = 0;
00116                 function jumpToUrl(URL) {   //
00117                     window.location.href = URL;
00118                 }
00119             ');
00120             $this->doc->postCode=$this->doc->wrapScriptTags('
00121                 script_ended = 1;
00122                 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00123             ');
00124 
00125 
00126                 // Setting up the context sensitive menu:
00127             $this->doc->getContextMenuCode();
00128 
00129             $this->doc->form='<form action="index.php" method="post"><input type="hidden" name="id" value="'.$this->id.'" />';
00130 
00131             $vContent = $this->doc->getVersionSelector($this->id,1);
00132             if ($vContent)  {
00133                 $this->content.=$this->doc->section('',$vContent);
00134             }
00135 
00136 
00137             $this->extObjContent();
00138 
00139                 // Setting up the buttons and markers for docheader
00140             $docHeaderButtons = $this->getButtons();
00141             $markers['CSH'] = $docHeaderButtons['csh'];
00142             $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
00143             $markers['CONTENT'] = $this->content;
00144         } else {
00145                 // If no access or if ID == zero
00146             $flashMessage = t3lib_div::makeInstance(
00147                 't3lib_FlashMessage',
00148                 $LANG->getLL('clickAPage_content'),
00149                 $LANG->getLL('title'),
00150                 t3lib_FlashMessage::INFO
00151             );
00152             $this->content = $flashMessage->render();
00153 
00154                 // Setting up the buttons and markers for docheader
00155             $docHeaderButtons = $this->getButtons();
00156             $markers['CSH'] = $docHeaderButtons['csh'];
00157             $markers['CONTENT'] = $this->content;
00158         }
00159             // Build the <body> for the module
00160         $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00161             // Renders the module page
00162         $this->content = $this->doc->render(
00163             $LANG->getLL('title'),
00164             $this->content
00165         );
00166     }
00167 
00168     /**
00169      * Print module content (from $this->content)
00170      *
00171      * @return  void
00172      */
00173     function printContent() {
00174         echo $this->content;
00175     }
00176 
00177     /**
00178      * Create the panel of buttons for submitting the form or otherwise perform operations.
00179      *
00180      * @return  array   all available buttons as an assoc. array
00181      */
00182     protected function getButtons() {
00183         global $TCA, $LANG, $BACK_PATH, $BE_USER;
00184 
00185         $buttons = array(
00186             'csh' => '',
00187             'view' => '',
00188             'record_list' => '',
00189             'shortcut' => '',
00190         );
00191             // CSH
00192         $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH'], '', TRUE);
00193 
00194         if($this->id && is_array($this->pageinfo)) {
00195 
00196                 // View page
00197             $buttons['view'] = '<a href="#"
00198                     onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '"
00199                     title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '
00200                 ">' .   t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
00201 
00202                 // Shortcut
00203             if ($BE_USER->mayMakeShortcut())    {
00204                 $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']);
00205             }
00206 
00207                 // If access to Web>List for user, then link to that module.
00208             $buttons['record_list'] = t3lib_BEfunc::getListViewLink(
00209                 array(
00210                     'id' => $this->pageinfo['uid'],
00211                     'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI'),
00212                 ),
00213                 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')
00214             );
00215 
00216         }
00217         return $buttons;
00218     }
00219 }
00220 
00221 
00222 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/web/func/index.php'])) {
00223     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/web/func/index.php']);
00224 }
00225 
00226 
00227 
00228 // Make instance:
00229 $SOBE = t3lib_div::makeInstance('SC_mod_web_func_index');
00230 $SOBE->init();
00231 
00232 // Include files?
00233 foreach($SOBE->include_once as $INC_FILE)   include_once($INC_FILE);
00234 $SOBE->checkExtObj();   // Checking for first level external objects
00235 
00236 // Repeat Include files! - if any files has been added by second-level extensions
00237 foreach($SOBE->include_once as $INC_FILE)   include_once($INC_FILE);
00238 $SOBE->checkSubExtObj();    // Checking second level external objects
00239 
00240 $SOBE->main();
00241 $SOBE->printContent();
00242 
00243 ?>