Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2001-2005 Kasper Skaarhoj (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 ***************************************************************/ 00031 require_once(t3lib_extMgm::extPath("kickstarter")."class.tx_kickstarter_sectionbase.php"); 00032 00033 class tx_kickstarter_section_modulefunction extends tx_kickstarter_sectionbase { 00034 var $sectionID = 'modulefunction'; 00038 function render_wizard() { 00039 $lines=array(); 00040 00041 $action = explode(":",$this->wizard->modData["wizAction"]); 00042 if ($action[0]=="edit") { 00043 $this->regNewEntry($this->sectionID,$action[1]); 00044 $lines = $this->catHeaderLines($lines,$this->sectionID,$this->wizard->options[$this->sectionID]," ",$action[1]); 00045 $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; 00046 $ffPrefix='['.$this->sectionID.']['.$action[1].']'; 00047 00048 // Enter title of the module function 00049 $subContent="<strong>Enter the title of function-menu item:</strong><BR>". 00050 $this->renderStringBox_lang("title",$ffPrefix,$piConf); 00051 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00052 00053 // Position 00054 $optValues = array( 00055 "web_func" => "Web>Func", 00056 "web_func_wizards" => "Web>Func, Wizards", 00057 "web_info" => "Web>Info", 00058 "web_ts" => "Web>Template", 00059 "user_task" => "User>Task Center", 00060 ); 00061 $subContent="<strong>Sub- or main module?</strong><BR>". 00062 $this->renderSelectBox($ffPrefix."[position]",$piConf["position"],$optValues). 00063 "<BR><BR>These images gives you an idea what the options above means:". 00064 $this->resImg("modulefunc_task.png"). 00065 $this->resImg("modulefunc_func.png"); 00066 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00067 00068 } 00069 00070 /* HOOK: Place a hook here, so additional output can be integrated */ 00071 if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_moduleFunction'])) { 00072 foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_moduleFunction'] as $_funcRef) { 00073 $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); 00074 } 00075 } 00076 00077 $content = '<table border=0 cellpadding=2 cellspacing=2>'.implode("",$lines).'</table>'; 00078 return $content; 00079 } 00080 00081 00082 00083 00084 00085 00086 00087 00091 function render_extPart($k,$config,$extKey) { 00092 $WOP="[moduleFunction][".$k."]"; 00093 $cN = $this->returnName($extKey,"class","modfunc".$k); 00094 $pathSuffix = "modfunc".$k."/"; 00095 00096 $position =$config["position"]; 00097 $subPos=""; 00098 switch($config["position"]) { 00099 case "user_task"; 00100 $this->wizard->EM_CONF_presets["dependencies"][]="taskcenter"; 00101 break; 00102 case "web_ts"; 00103 $this->wizard->EM_CONF_presets["dependencies"][]="tstemplate"; 00104 break; 00105 case "web_func_wizards"; 00106 $this->wizard->EM_CONF_presets["dependencies"][]="func_wizards"; 00107 $position="web_func"; 00108 $subPos="wiz"; 00109 break; 00110 } 00111 00112 $this->wizard->ext_tables[]=$this->sPS(' 00113 if (TYPO3_MODE=="BE") { 00114 t3lib_extMgm::insertModuleFunction( 00115 "'.$position.'", '.$this->WOPcomment('WOP:'.$WOP.'[position]').' 00116 "'.$cN.'", 00117 t3lib_extMgm::extPath($_EXTKEY)."'.$pathSuffix.'class.'.$cN.'.php", 00118 "'.addslashes($this->getSplitLabels_reference($config,"title","moduleFunction.".$cN)).'"'.($subPos?', 00119 "'.$subPos.'" '.$this->WOPcomment('WOP:'.$WOP.'[position]'):'').' 00120 ); 00121 } 00122 '); 00123 00124 00125 // Add title to local lang file 00126 $ll=array(); 00127 $this->addLocalConf($ll,$config,"title","module",$k,1); 00128 $this->addLocalConf($ll,array("checklabel"=>"Check box #1"),"checklabel","modfunc",$k,1,1); 00129 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for module "'.$mN.'"'); 00130 00131 if ($position!="user_task") { 00132 $indexContent.= $this->sPS(' 00133 require_once(PATH_t3lib."class.t3lib_extobjbase.php"); 00134 00135 class '.$cN.' extends t3lib_extobjbase { 00136 function modMenu() { 00137 global $LANG; 00138 00139 return Array ( 00140 "'.$cN.'_check" => "", 00141 ); 00142 } 00143 00144 function main() { 00145 // Initializes the module. Done in this function because we may need to re-initialize if data is submitted! 00146 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 00147 00148 $theOutput.=$this->wizard->pObj->doc->spacer(5); 00149 $theOutput.=$this->wizard->pObj->doc->section($LANG->getLL("title"),"Dummy content here...",0,1); 00150 00151 $menu=array(); 00152 $menu[]=t3lib_BEfunc::getFuncCheck($this->wizard->pObj->id,"SET['.$cN.'_check]",$this->wizard->pObj->MOD_SETTINGS["'.$cN.'_check"]).$LANG->getLL("checklabel"); 00153 $theOutput.=$this->wizard->pObj->doc->spacer(5); 00154 $theOutput.=$this->wizard->pObj->doc->section("Menu",implode(" - ",$menu),0,1); 00155 00156 return $theOutput; 00157 } 00158 } 00159 '); 00160 } else { 00161 $indexContent.= $this->sPS(' 00162 class '.$cN.' extends mod_user_task { 00166 function overview_main(&$pObj) { 00167 $icon = \'<img src="\'.$this->wizard->backPath.t3lib_extMgm::extRelPath("'.$extKey.'").\'ext_icon.gif" width=18 height=16 class="absmiddle">\'; 00168 $content.=$pObj->doc->section($icon." ".$this->headLink("'.$cN.'",0),$this->overviewContent(),1,1); 00169 return $content; 00170 } 00171 function main() { 00172 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 00173 00174 return $this->mainContent(); 00175 } 00176 function overviewContent() { 00177 return "Content in overview frame..."; 00178 } 00179 function mainContent() { 00180 return "Content in main frame..."; 00181 } 00182 } 00183 '); 00184 } 00185 00186 $this->addFileToFileArray($pathSuffix."class.".$cN.".php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN.".php",$indexContent,"Module extension (addition to function menu) '".$config["title"]."' for the '".$extKey."' extension.")); 00187 00188 } 00189 00190 } 00191 00192 00193 // Include ux_class extension? 00194 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_modulefunction.php']) { 00195 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_modulefunction.php']); 00196 } 00197 00198 00199 ?>