TYPO3 API  SVNRelease
ContainerViewHelper.php
Go to the documentation of this file.
00001 <?php
00002 /*                                                                        *
00003  * This script belongs to the FLOW3 package "Fluid".                      *
00004  *                                                                        *
00005  * It is free software; you can redistribute it and/or modify it under    *
00006  * the terms of the GNU Lesser General Public License as published by the *
00007  * Free Software Foundation, either version 3 of the License, or (at your *
00008  * option) any later version.                                             *
00009  *                                                                        *
00010  * This script is distributed in the hope that it will be useful, but     *
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
00012  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
00013  * General Public License for more details.                               *
00014  *                                                                        *
00015  * You should have received a copy of the GNU Lesser General Public       *
00016  * License along with the script.                                         *
00017  * If not, see http://www.gnu.org/licenses/lgpl.html                      *
00018  *                                                                        *
00019  * The TYPO3 project - inspiring people to share!                         *
00020  *                                                                        */
00021 
00022 /**
00023  * View helper which allows you to create extbase based modules in the style of TYPO3 default modules.
00024  * Note: This feature is experimental!
00025  *
00026  * = Examples =
00027  *
00028  * <code title="Simple">
00029  * <f:be.container>your module content</f:be.container>
00030  * </code>
00031  * <output>
00032  * "your module content" wrapped with propper head & body tags.
00033  * Default backend CSS styles and JavaScript will be included
00034  * </output>
00035  *
00036  * <code title="All options">
00037  * <f:be.container pageTitle="foo" enableJumpToUrl="false" enableClickMenu="false" loadPrototype="false" loadScriptaculous="false" scriptaculousModule="someModule,someOtherModule" loadExtJs="true" loadExtJsTheme="false" extJsAdapter="jQuery" enableExtJsDebug="true" addCssFile="{f:uri.resource(path:'styles/backend.css')}" addJsFile="{f:uri.resource('scripts/main.js')}">your module content</f:be.container>
00038  * </code>
00039  * <output>
00040  * "your module content" wrapped with propper head & body tags.
00041  * Custom CSS file EXT:your_extension/Resources/Public/styles/backend.css and JavaScript file EXT:your_extension/Resources/Public/scripts/main.js will be loaded
00042  * </output>
00043  *
00044  * @author Bastian Waidelich <bastian@typo3.org>
00045  * @license http://www.gnu.org/copyleft/gpl.html
00046  */
00047 class Tx_Fluid_ViewHelpers_Be_ContainerViewHelper extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper {
00048 
00049     /**
00050      * Render start page with template.php and pageTitle
00051      *
00052      * @param string  $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame
00053      * @param boolean $enableJumpToUrl If TRUE, includes "jumpTpUrl" javascript function required by ActionMenu. Defaults to TRUE
00054      * @param boolean $enableClickMenu If TRUE, loads clickmenu.js required by BE context menus. Defaults to TRUE
00055      * @param boolean $loadPrototype specifies whether to load prototype library. Defaults to TRUE
00056      * @param boolean $loadScriptaculous specifies whether to load scriptaculous libraries. Defaults to FALSE
00057      * @param string  $scriptaculousModule additionales modules for scriptaculous
00058      * @param boolean $loadExtJs specifies whether to load ExtJS library. Defaults to FALSE
00059      * @param boolean $loadExtJsTheme whether to load ExtJS "grey" theme. Defaults to FALSE
00060      * @param string  $extJsAdapter load alternative adapter (ext-base is default adapter)
00061      * @param boolean $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only
00062      * @param string $addCssFile Custom CSS file to be loaded
00063      * @param string $addJsFile Custom JavaScript file to be loaded
00064      * @return string
00065      * @see template
00066      * @see t3lib_PageRenderer
00067      */
00068     public function render($pageTitle = '', $enableJumpToUrl = TRUE, $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $extJsAdapter = '', $enableExtJsDebug = FALSE, $addCssFile = NULL, $addJsFile = NULL) {
00069         $doc = $this->getDocInstance();
00070         $pageRenderer = $doc->getPageRenderer();
00071 
00072         if ($enableJumpToUrl) {
00073             $doc->JScode .= '
00074                 <script language="javascript" type="text/javascript">
00075                     script_ended = 0;
00076                     function jumpToUrl(URL) {
00077                         document.location = URL;
00078                     }
00079                     ' . $doc->redirectUrls() . '
00080                 </script>
00081             ';
00082         }
00083         if ($enableClickMenu) {
00084             $doc->loadJavascriptLib('js/clickmenu.js');
00085         }
00086         if ($loadPrototype) {
00087             $pageRenderer->loadPrototype();
00088         }
00089         if ($loadScriptaculous) {
00090             $pageRenderer->loadScriptaculous($scriptaculousModule);
00091         }
00092         if ($loadExtJs) {
00093             $pageRenderer->loadExtJS(true, $loadExtJsTheme, $extJsAdapter);
00094             if ($enableExtJsDebug) {
00095                 $pageRenderer->enableExtJsDebug();
00096             }
00097         }
00098         if ($addCssFile !== NULL) {
00099             $pageRenderer->addCssFile($addCssFile);
00100         }
00101         if ($addJsFile !== NULL) {
00102             $pageRenderer->addJsFile($addJsFile);
00103         }
00104 
00105         $output = $this->renderChildren();
00106         $output = $doc->startPage($pageTitle) . $output;
00107         $output .= $doc->endPage();
00108         return $output;
00109     }
00110 }
00111 ?>