TYPO3 API  SVNRelease
AbstractController.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2010-2011 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
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 require_once($GLOBALS['BACK_PATH'] . 'template.php');
00029 
00030 /**
00031  * Abstract action controller.
00032  *
00033  * @author Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
00034  * @package Workspaces
00035  * @subpackage Controller
00036  */
00037 class Tx_Workspaces_Controller_AbstractController extends Tx_Extbase_MVC_Controller_ActionController {
00038     /**
00039      * @var string Key of the extension this controller belongs to
00040      */
00041     protected $extensionName = 'Workspaces';
00042 
00043     /**
00044      * @var t3lib_PageRenderer
00045      */
00046     protected $pageRenderer;
00047 
00048     /**
00049      * @var integer
00050      */
00051     protected $pageId;
00052 
00053     /**
00054      * Initializes the controller before invoking an action method.
00055      *
00056      * @return void
00057      */
00058     protected function initializeAction() {
00059         // @todo Evaluate how the intval() call can be used with Extbase validators/filters
00060         $this->pageId = intval(t3lib_div::_GP('id'));
00061 
00062         $this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId);
00063         $this->pageRenderer->addInlineSetting('Workspaces', 'depth', ($this->pageId === 0 ? 999 : 1));
00064 
00065         $this->pageRenderer->addCssFile(t3lib_extMgm::extRelPath('workspaces') . 'Resources/Public/StyleSheet/module.css');
00066 
00067         $this->pageRenderer->addInlineLanguageLabelArray(array(
00068             'title'         => $GLOBALS['LANG']->getLL('title'),
00069             'path'          => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path'),
00070             'table'         => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table'),
00071             'depth'         => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xml:Depth'),
00072             'depth_0'       => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
00073             'depth_1'       => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
00074             'depth_2'       => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
00075             'depth_3'       => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
00076             'depth_4'       => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_4'),
00077             'depth_infi'    => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi'),
00078         ));
00079 
00080         $this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xml');
00081     }
00082 
00083     /**
00084      * Processes a general request. The result can be returned by altering the given response.
00085      *
00086      * @param Tx_Extbase_MVC_RequestInterface $request The request object
00087      * @param Tx_Extbase_MVC_ResponseInterface $response The response, modified by this handler
00088      * @throws Tx_Extbase_MVC_Exception_UnsupportedRequestType if the controller doesn't support the current request type
00089      * @return void
00090      */
00091     public function processRequest(Tx_Extbase_MVC_RequestInterface $request, Tx_Extbase_MVC_ResponseInterface $response) {
00092         $this->template = t3lib_div::makeInstance('template');
00093         $this->pageRenderer = $this->template->getPageRenderer();
00094 
00095         $GLOBALS['SOBE'] = new stdClass();
00096         $GLOBALS['SOBE']->doc = $this->template;
00097 
00098         parent::processRequest($request, $response);
00099 
00100         $pageHeader = $this->template->startpage(
00101             $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:module.title')
00102         );
00103         $pageEnd = $this->template->endPage();
00104 
00105         $response->setContent($pageHeader . $response->getContent() . $pageEnd);
00106     }
00107 }
00108 
00109 
00110 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Controller/AbstractController.php'])) {
00111     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/Controller/AbstractController.php']);
00112 }
00113 ?>