Documentation TYPO3 par Ameos

class.tx_kickstarter_sectionbase.php

00001 <?php
00002 
00003 #vars that probably still need "wizard->" added: dontPrintImages printWOP
00004 
00005 class tx_kickstarter_sectionbase {
00006         
00007         /* instance of the main Kickstarter Wizard class (class.tx_kickstarter_wizard.php) */
00008         var $wizard;
00009         
00010         /* instance of the Kickstarter Compilefiles class (class.tx_kickstarter_compilefiles.php) */
00011         var $compilefiles;
00012         
00013         /* Unique ID of this section (used in forms and data processing) */
00014         var $sectionID = 'uniqueID';
00015 
00016         /* Variable-Prefix used for the generation of input-fields */
00017         var $varPrefix = 'kickstarter';
00018 
00019         /* renders the wizard for this section */
00020         function render_wizard() {
00021         }
00022         
00023         /* renders the code for this section */
00024         function render_extPart() {
00025         }
00026         
00027         function &process_hook($hookName, &$data) {
00028                 if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter'][$this->sectionID][$hookName])) {
00029                         foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter'][$this->sectionID][$hookName] as $_funcRef) {
00030         $data =& t3lib_div::callUserFunction($_funcRef, $data, $this);
00031                         }
00032                 }
00033                 return $data;
00034         }
00035 
00036         function renderCheckBox($prefix,$value,$defVal=0)       {
00037                 if (!isset($value))     $value=$defVal;
00038                 $onCP = $this->getOnChangeParts($prefix);
00039                 return $this->wopText($prefix).$onCP[0].'<input type="hidden" name="'.$this->piFieldName("wizArray_upd").$prefix.'" value="0"><input type="checkbox" name="'.$this->piFieldName("wizArray_upd").$prefix.'" value="1"'.($value?" CHECKED":"").' onClick="'.$onCP[1].'"'.$this->wop($prefix).'>';
00040         }
00041 
00042         function renderTextareaBox($prefix,$value)      {
00043                 $onCP = $this->getOnChangeParts($prefix);
00044                 return $this->wopText($prefix).$onCP[0].'<textarea name="'.$this->piFieldName("wizArray_upd").$prefix.'" style="width:600px;" rows="10" wrap="OFF" onChange="'.$onCP[1].'" title="'.htmlspecialchars("WOP:".$prefix).'"'.$this->wop($prefix).'>'.t3lib_div::formatForTextarea($value).'</textarea>';
00045         }
00046 
00047         function renderStringBox($prefix,$value,$width=200)     {
00048                 $onCP = $this->getOnChangeParts($prefix);
00049                 return $this->wopText($prefix).$onCP[0].'<input type="text" name="'.$this->piFieldName("wizArray_upd").$prefix.'" value="'.htmlspecialchars($value).'" style="width:'.$width.'px;" onChange="'.$onCP[1].'"'.$this->wop($prefix).'>';
00050         }
00051 
00052         function renderRadioBox($prefix,$value,$thisValue)      {
00053                 $onCP = $this->getOnChangeParts($prefix);
00054                 return $this->wopText($prefix).$onCP[0].'<input type="radio" name="'.$this->piFieldName("wizArray_upd").$prefix.'" value="'.$thisValue.'"'.(!strcmp($value,$thisValue)?" CHECKED":"").' onClick="'.$onCP[1].'"'.$this->wop($prefix).'>';
00055         }
00056 
00057         function renderSelectBox($prefix,$value,$optValues)     {
00058                 $onCP = $this->getOnChangeParts($prefix);
00059                 $opt=array();
00060                 $isSelFlag=0;
00061                 foreach($optValues as $k=>$v)   {
00062                         $sel = (!strcmp($k,$value)?" SELECTED":"");
00063                         if ($sel)       $isSelFlag++;
00064                         $opt[]='<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
00065                 }
00066                 if (!$isSelFlag && strcmp("",$value))   $opt[]='<option value="'.$value.'" SELECTED>'.htmlspecialchars("CURRENT VALUE '".$value."' DID NOT EXIST AMONG THE OPTIONS").'</option>';
00067                 return $this->wopText($prefix).$onCP[0].'<select name="'.$this->piFieldName("wizArray_upd").$prefix.'" onChange="'.$onCP[1].'"'.$this->wop($prefix).'>'.implode("",$opt).'</select>';
00068         }
00069 
00070         function whatIsThis($str)       {
00071                 return ' <a href="#" title="'.htmlspecialchars($str).'" style="cursor:help" onClick="alert('.$GLOBALS['LANG']->JScharCode($str).');return false;">(What is this?)</a>';
00072         }
00073 
00074         function renderStringBox_lang($fieldName,$ffPrefix,$piConf)     {
00075                 $content = $this->renderStringBox($ffPrefix."[".$fieldName."]",$piConf[$fieldName])." [English]";
00076                 if (count($this->wizard->selectedLanguages))    {
00077                         $lines=array();
00078                         foreach($this->wizard->selectedLanguages as $k=>$v) {
00079                                 $lines[]=$this->renderStringBox($ffPrefix."[".$fieldName."_".$k."]",$piConf[$fieldName."_".$k])." [".$v."]";
00080                         }
00081                         $content.=$this->textSetup("",implode("<BR>",$lines));
00082                 }
00083                 return $content;
00084         }
00085 
00086         function textSetup($header,$content)    {
00087                 return ($header?"<strong>".$header."</strong><BR>":"")."<blockquote>".trim($content)."</blockquote>";
00088         }
00089 
00090         function resImg($name,$p='align="center"',$pre="<BR>",$post="<BR>")     {
00091                 if ($this->dontPrintImages)     return "<BR>";
00092                 $imgRel = $this->path_resources().$name;
00093                 $imgInfo = @getimagesize(PATH_site.$imgRel);
00094                 return $pre.'<img src="'.$this->wizard->siteBackPath.$imgRel.'" '.$imgInfo[3].($p?" ".$p:"").' vspace=5 border=1 style="border:solid 1px;">'.$post;
00095         }
00096 
00097         function resIcon($name,$p="")   {
00098                 if ($this->dontPrintImages)     return "";
00099                 $imgRel = $this->path_resources("icons/").$name;
00100                 if (!@is_file(PATH_site.$imgRel))       return "";
00101                 $imgInfo = @getimagesize(PATH_site.$imgRel);
00102                 return '<img src="'.$this->wizard->siteBackPath.$imgRel.'" '.$imgInfo[3].($p?" ".$p:"").'>';
00103         }
00104 
00105         function path_resources($subdir="res/") {
00106                 return substr(t3lib_extMgm::extPath("kickstarter"),strlen(PATH_site)).$subdir;
00107         }
00108 
00109         function getOnChangeParts($prefix)      {
00110                 $md5h=t3lib_div::shortMd5($this->piFieldName("wizArray_upd").$prefix);
00111                 return array('<a name="'.$md5h.'"></a>',"setFormAnchorPoint('".$md5h."');");
00112         }
00113 
00114         function wop($prefix)   {
00115                 return ' title="'.htmlspecialchars("WOP: ".$prefix).'"';
00116         }
00117 
00118         function returnName($extKey,$type,$suffix='')   {
00119                 if (substr($extKey,0,5)=='user_')       {
00120                         $extKey = substr($extKey,5);
00121                         switch($type)   {
00122                                 case 'class':
00123                                         return 'user_'.str_replace('_','',$extKey).($suffix?'_'.$suffix:'');
00124                                 break;
00125                                 case 'tables':
00126                                 case 'fields':
00127                                 case 'fields':
00128                                         return 'user_'.str_replace('_','',$extKey).($suffix?'_'.$suffix:'');
00129                                 break;
00130                                 case 'module':
00131                                         return 'u'.str_replace('_','',$extKey).$suffix;
00132                                 break;
00133                         }
00134                 } else {
00135                         switch($type)   {
00136                                 case 'class':
00137                                         return 'tx_'.str_replace('_','',$extKey).($suffix?'_'.$suffix:'');
00138                                 break;
00139                                 case 'tables':
00140                                 case 'fields':
00141                                 case 'fields':
00142                                         return 'tx_'.str_replace('_','',$extKey).($suffix?'_'.$suffix:'');
00143                                 break;
00144                                 case 'module':
00145                                         return 'tx'.str_replace('_','',$extKey).$suffix;
00146                                 break;
00147                         }
00148                 }
00149         }
00150 
00151         function wopText($prefix)       {
00152                 return $this->printWOP?'<font face="verdana,arial,sans-serif" size=1 color=#999999>'.htmlspecialchars($prefix).':</font><BR>':'';
00153         }
00154 
00155         function catHeaderLines($lines,$k,$v,$altHeader="",$index="")   {
00156                                         $lines[]='<tr'.$this->bgCol(1).'><td><strong>'.$this->fw($v[0]).'</strong></td></tr>';
00157                                         $lines[]='<tr'.$this->bgCol(2).'><td>'.$this->fw($v[1]).'</td></tr>';
00158                                         $lines[]='<tr><td></td></tr>';
00159                 return $lines;
00160         }
00161 
00162         function linkCurrentItems($cat) {
00163                 $items = $this->wizard->wizArray[$cat];
00164                 $lines=array();
00165                 $c=0;
00166                 if (is_array($items))   {
00167                         foreach($items as $k=>$conf)    {
00168                                 $lines[]='<strong>'.$this->linkStr($conf["title"]?$conf["title"]:"<em>Item ".$k."</em>",$cat,'edit:'.$k).'</strong>';
00169                                 $c=$k;
00170                         }
00171                 }
00172                 if (!t3lib_div::inList("save,ts,TSconfig,languages",$cat) || !count($lines))    {
00173                         $c++;
00174                         if (count($lines))      $lines[]='';
00175                         $lines[]=$this->linkStr('Add new item',$cat,'edit:'.$c);
00176                 }
00177                 return $this->fw(implode("<BR>",$lines));
00178         }
00179 
00180         function linkStr($str,$wizSubCmd,$wizAction)    {
00181                 return '<a href="#" onClick="
00182                         document.'.$this->varPrefix.'_wizard[\''.$this->piFieldName("wizSubCmd").'\'].value=\''.$wizSubCmd.'\';
00183                         document.'.$this->varPrefix.'_wizard[\''.$this->piFieldName("wizAction").'\'].value=\''.$wizAction.'\';
00184                         document.'.$this->varPrefix.'_wizard.submit();
00185                         return false;">'.$str.'</a>';
00186         }
00187 
00188         function bgCol($n,$mod=0)       {
00189                 $color = $this->color[$n-1];
00190                 if ($mod)       $color = t3lib_div::modifyHTMLcolor($color,$mod,$mod,$mod);
00191                 return ' bgColor="'.$color.'"';
00192         }
00193 
00194         function regNewEntry($k,$index) {
00195                 if (!is_array($this->wizard->wizArray[$k][$index]))     {
00196                         $this->wizard->wizArray[$k][$index]=array();
00197                 }
00198         }
00199 
00200         function bwWithFlag($str,$flag) {
00201                 if ($flag)      $str = '<strong>'.$str.'</strong>';
00202                 return $str;
00203         }
00204 
00211         function linkThisCmd($uPA=array())      {
00212                 $url = t3lib_div::linkThisScript($uPA);
00213                 return $url;
00214         }
00215 
00222         function fw($str)       {
00223                 return '<span style="font-family:verdana,arial,sans-serif; font-size:10px;">'.$str.'</span>';
00224         }
00225 
00226 
00227         function piFieldName($key)      {
00228                 return $this->varPrefix."[".$key."]";
00229         }
00230 
00231         function cmdHiddenField()       {
00232                 return '<input type="hidden" name="'.$this->piFieldName("cmd").'" value="'.htmlspecialchars($this->currentCMD).'">';
00233         }
00234 
00235         function preWrap($str)  {
00236                 $str = str_replace(chr(9),"&nbsp;&nbsp;&nbsp;&nbsp;",htmlspecialchars($str));
00237                 $str = '<pre>'.$str.'</pre>';
00238                 return $str;
00239         }
00240 
00241         function fieldIsRTE($fC)        {
00242                 return !strcmp($fC["type"],"textarea_rte") &&
00243                                                 ($fC["conf_rte"]=="basic" ||
00244                                                 (t3lib_div::inList("custom,moderate",$fC["conf_rte"]) && $fC["conf_mode_cssOrNot"])
00245                                                 );
00246         }
00247 
00248 
00249 
00250 
00251 
00252 
00253 
00254 
00255 
00256 
00257 
00258 
00259 ######### Functions from compilefiles #########
00260 
00261         function sPS($content,$preLines=1)      {
00262                 $lines = explode(chr(10),str_replace(chr(13),"",$content));
00263                 $lastLineWithContent=0;
00264                 $firstLineWithContent=-1;
00265                 $min=array();
00266                 reset($lines);
00267                 while(list($k,$v)=each($lines)) {
00268                         if (trim($v))   {
00269                                 if ($firstLineWithContent==-1)  $firstLineWithContent=$k;
00270                                 list($preSpace) = split("[^[:space:]]",$v,2);
00271                                 $min[]=count(explode(chr(9),$preSpace));
00272                                 $lastLineWithContent=$k;
00273                         }
00274                 }
00275                 $number_of=count($min) ? min($min) : 0;
00276                 $newLines=array();
00277                 if ($firstLineWithContent>=0)   {
00278                         for ($a=$firstLineWithContent;$a<=$lastLineWithContent;$a++)    {
00279                                 $parts = explode(chr(9),$lines[$a],$number_of);
00280                                 $newLines[]=end($parts);
00281                         }
00282                 }
00283                 return str_pad("",$preLines,chr(10)).implode(chr(10),$newLines).chr(10);
00284         }
00285 
00286         function getSplitLabels_reference($config,$key,$LLkey)  {
00287                 $this->wizard->ext_locallang_db["default"][$LLkey]=array(trim($config[$key]));
00288                 if (count($this->wizard->languages))    {
00289                         reset($this->wizard->languages);
00290                         while(list($lk,$lv)=each($this->wizard->languages))     {
00291                                 if (isset($this->wizard->selectedLanguages[$lk]))       {
00292                                         $this->wizard->ext_locallang_db[$lk][$LLkey]=array(trim($config[$key."_".$lk]));
00293                                 }
00294                         }
00295                 }
00296                 return "LLL:EXT:".$this->wizard->extKey."/locallang_db.php:".$LLkey;
00297         }
00298 
00299         function WOPcomment($str)       {
00300                 return $str&&$this->wizard->outputWOP ? "## ".$str : "";
00301         }
00302 
00303         function indentLines($content,$number=1)        {
00304                 $preTab = str_pad("",$number,chr(9));
00305                 $lines = explode(chr(10),str_replace(chr(13),"",$content));
00306                 while(list($k,$v)=each($lines)) {
00307                         $lines[$k]=$preTab.$v;
00308                 }
00309                 return implode(chr(10),$lines);
00310         }
00311 
00312         function printPre($content)     {
00313                 echo '<pre>'.htmlspecialchars(str_replace(chr(9),'    ',$content)).'</pre>';
00314         }
00315 
00316         function wrapBody($before,$content,$after,$indent=1)    {
00317                 $parts=array();
00318                 $parts[] = $this->sPS($before,0);
00319                 $parts[] = $this->indentLines(rtrim($content),$indent);
00320                 $parts[] = chr(10).$this->sPS($after,0);
00321 
00322                 return implode('',$parts);
00323         }
00324 
00325         function replaceMarkers($content,$markers)      {
00326                 reset($markers);
00327                 while(list($k,$v)=each($markers))       {
00328                         $content = str_replace($k,$v,$content);
00329                 }
00330                 return $content;
00331         }
00332 
00333         function makeFileArray($name,$content)  {
00334         #       echo '<HR><strong>'.$name.'</strong><HR><pre>'.htmlspecialchars($content).'</pre>';
00335 
00336                 return array(
00337                         'name' => $name,
00338                         'size' => strlen($content),
00339                         'mtime' => time(),
00340                         'is_executable' => 0,
00341                         'content' => $content,
00342                         'content_md5' => md5($content)
00343                 );
00344         }
00345 
00346         function slashValueForSingleDashes($value)      {
00347                 return str_replace("'","\'",str_replace('\\','\\\\',$value));
00348         }
00349 
00350         function getSplitLabels($config,$key)   {
00351                 $language=array();
00352                 $language[]=str_replace('|','',$config[$key]);
00353                 if (count($this->wizard->languages))    {
00354                         reset($this->wizard->languages);
00355                         while(list($lk,$lv)=each($this->wizard->languages))     {
00356                                 if (isset($this->wizard->selectedLanguages[$lk]))       {
00357                                         $language[]=str_replace('|','',$config[$key.'_'.$lk]);
00358                                 } else $language[]='';
00359                         }
00360                 }
00361                 $out = implode('|',$language);
00362                 $out = str_replace(chr(10),'',$out);
00363                 $out = rtrim(str_replace('|',chr(10),$out));
00364                 $out = str_replace(chr(10),'|',$out);
00365                 return $out;
00366         }
00367 
00368         function addLocalLangFile($arr,$filename,$description)  {
00369                 $lines=array();
00370                 reset($arr);
00371                 $lines[]='<?php';
00372                 $lines[]=trim($this->sPS('
00378                 '));
00379                 $lines[]='';
00380                 $lines[]='$LOCAL_LANG = Array (';
00381                 while(list($lK,$labels)=each($arr))     {
00382                         if (is_array($labels))  {
00383                                 $lines[]="      '".$lK."' => Array (";
00384                                 while(list($l,$v)=each($labels))        {
00385                                         if (strcmp($v[0],''))   $lines[]="              '".$l."' => '".addslashes($v[0])."',    ".$this->WOPcomment($v[1]);
00386                                 }
00387                                 $lines[]='      ),';
00388                         }
00389                 }
00390                 $lines[]=');';
00391                 $lines[]='?>';
00392                 $this->addFileToFileArray($filename,implode(chr(10),$lines));
00393         }
00394 
00395         function writeStandardBE_xMod($extKey,$config,$pathSuffix,$cN,$k,$k_prefix)     {
00396                         // Make conf.php file:
00397                 $content = $this->sPS("
00398                                 // DO NOT REMOVE OR CHANGE THESE 3 LINES:
00399                         define('TYPO3_MOD_PATH', 'ext/".$extKey."/".$pathSuffix."');
00400                         \$BACK_PATH='../../../';
00401                         \$MCONF['name']='xMOD_".$cN."';
00402                 ");
00403                 $content=$this->wrapBody('
00404                         <?php
00405                         ',$content,'
00406                         ?>
00407                 ',0);
00408                 $this->addFileToFileArray($pathSuffix."conf.php",trim($content));
00409                 $this->wizard->EM_CONF_presets["module"][]=ereg_replace("\/$","",$pathSuffix);
00410 
00411                         // Add title to local lang file
00412                 $ll=array();
00413                 $this->addLocalConf($ll,$config,"title",$k_prefix,$k,1);
00414                 $this->addLocalConf($ll,array("function1"=>"Function #1"),"function1",$k_prefix,$k,1,1);
00415                 $this->addLocalConf($ll,array("function2"=>"Function #2"),"function2",$k_prefix,$k,1,1);
00416                 $this->addLocalConf($ll,array("function3"=>"Function #3"),"function3",$k_prefix,$k,1,1);
00417                 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for '.$extKey.' module '.$k_prefix.$k);
00418 
00419                         // Add clear.gif
00420                 $this->addFileToFileArray($pathSuffix."clear.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/clear.gif"));
00421 
00422                         // Make module index.php file:
00423                 $indexContent = $this->sPS("
00424                                 // DEFAULT initialization of a module [BEGIN]
00425                         unset(\$MCONF);
00426                         require ('conf.php');
00427                         require (\$BACK_PATH.'init.php');
00428                         require (\$BACK_PATH.'template.php');
00429                         \$LANG->includeLLFile('EXT:".$extKey."/".$pathSuffix."locallang.php');
00430                         #include ('locallang.php');
00431                         require_once (PATH_t3lib.'class.t3lib_scbase.php');
00432                                 // ....(But no access check here...)
00433                                 // DEFAULT initialization of a module [END]
00434                 ");
00435 
00436                 $indexContent.= $this->sPS("
00437                         class ".$cN." extends t3lib_SCbase {
00441                                 function menuConfig()   {
00442                                         global \$LANG;
00443                                         \$this->MOD_MENU = Array (
00444                                                 'function' => Array (
00445                                                         '1' => \$LANG->getLL('function1'),
00446                                                         '2' => \$LANG->getLL('function2'),
00447                                                         '3' => \$LANG->getLL('function3'),
00448                                                 )
00449                                         );
00450                                         parent::menuConfig();
00451                                 }
00452 
00456                                 function main() {
00457                                         global \$BE_USER,\$LANG,\$BACK_PATH,\$TCA_DESCR,\$TCA,\$CLIENT,\$TYPO3_CONF_VARS;
00458 
00459                                                 // Draw the header.
00460                                         \$this->doc = t3lib_div::makeInstance('mediumDoc');
00461                                         \$this->doc->backPath = \$BACK_PATH;
00462                                         \$this->doc->form='<form action=\"\" method=\"POST\">';
00463 
00464                                                 // JavaScript
00465                                         \$this->doc->JScode = '
00466                                                 <script language=\"javascript\" type=\"text/javascript\">
00467                                                         script_ended = 0;
00468                                                         function jumpToUrl(URL) {
00469                                                                 document.location = URL;
00470                                                         }
00471                                                 </script>
00472                                         ';
00473 
00474                                         \$this->pageinfo = t3lib_BEfunc::readPageAccess(\$this->id,\$this->perms_clause);
00475                                         \$access = is_array(\$this->pageinfo) ? 1 : 0;
00476                                         if ((\$this->id && \$access) || (\$BE_USER->user['admin'] && !\$this->id))      {
00477                                                 if (\$BE_USER->user['admin'] && !\$this->id)    {
00478                                                         \$this->pageinfo=array('title' => '[root-level]','uid'=>0,'pid'=>0);
00479                                                 }
00480 
00481                                                 \$headerSection = \$this->doc->getHeader('pages',\$this->pageinfo,\$this->pageinfo['_thePath']).'<br>'.\$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path').': '.t3lib_div::fixed_lgd_pre(\$this->pageinfo['_thePath'],50);
00482 
00483                                                 \$this->content.=\$this->doc->startPage(\$LANG->getLL('title'));
00484                                                 \$this->content.=\$this->doc->header(\$LANG->getLL('title'));
00485                                                 \$this->content.=\$this->doc->spacer(5);
00486                                                 \$this->content.=\$this->doc->section('',\$this->doc->funcMenu(\$headerSection,t3lib_BEfunc::getFuncMenu(\$this->id,'SET[function]',\$this->MOD_SETTINGS['function'],\$this->MOD_MENU['function'])));
00487                                                 \$this->content.=\$this->doc->divider(5);
00488 
00489 
00490                                                 // Render content:
00491                                                 \$this->moduleContent();
00492 
00493 
00494                                                 // ShortCut
00495                                                 if (\$BE_USER->mayMakeShortcut())       {
00496                                                         \$this->content.=\$this->doc->spacer(20).\$this->doc->section('',\$this->doc->makeShortcutIcon('id',implode(',',array_keys(\$this->MOD_MENU)),\$this->MCONF['name']));
00497                                                 }
00498                                         }
00499                                         \$this->content.=\$this->doc->spacer(10);
00500                                 }
00501                                 function printContent() {
00502 
00503                                         \$this->content.=\$this->doc->endPage();
00504                                         echo \$this->content;
00505                                 }
00506 
00507                                 function moduleContent()        {
00508                                         switch((string)\$this->MOD_SETTINGS['function'])        {
00509                                                 case 1:
00510                                                         \$content='<div align=center><strong>Hello World!</strong></div><BR>
00511                                                                 The \"Kickstarter\" has made this module automatically, it contains a default framework for a backend module but apart from it does nothing useful until you open the script \"'.substr(t3lib_extMgm::extPath('".$extKey."'),strlen(PATH_site)).'".$pathSuffix."index.php\" and edit it!
00512                                                                 <HR>
00513                                                                 <BR>This is the GET/POST vars sent to the script:<BR>'.
00514                                                                 'GET:'.t3lib_div::view_array(\$_GET).'<BR>'.
00515                                                                 'POST:'.t3lib_div::view_array(\$_POST).'<BR>'.
00516                                                                 '';
00517                                                         \$this->content.=\$this->doc->section('Message #1:',\$content,0,1);
00518                                                 break;
00519                                                 case 2:
00520                                                         \$content='<div align=center><strong>Menu item #2...</strong></div>';
00521                                                         \$this->content.=\$this->doc->section('Message #2:',\$content,0,1);
00522                                                 break;
00523                                                 case 3:
00524                                                         \$content='<div align=center><strong>Menu item #3...</strong></div>';
00525                                                         \$this->content.=\$this->doc->section('Message #3:',\$content,0,1);
00526                                                 break;
00527                                         }
00528                                 }
00529                         }
00530                 ");
00531 
00532                 $this->addFileToFileArray($pathSuffix."index.php",$this->PHPclassFile($extKey,$pathSuffix."index.php",$indexContent,$extKey.' module '.$k_prefix.$k,$cN));
00533         }
00534 
00535         function addLLfunc($extKey)     {
00536                 return $this->sPS("
00540                         function includeLL()    {
00541                                 include(t3lib_extMgm::extPath('".$extKey."').'locallang.php');
00542                                 return \$LOCAL_LANG;
00543                         }
00544                 ");
00545         }
00546         function addStdLocalLangConf($ll,$k,$onlyMode=0)        {
00547                 $this->addLocalConf($ll,array(
00548                         "list_mode_1"=>"Mode 1",
00549                         "list_mode_1_dk"=>"Visning 1"
00550                 ),"list_mode_1","pi",$k,1,1);
00551                 $this->addLocalConf($ll,array(
00552                         "list_mode_2"=>"Mode 2",
00553                         "list_mode_2_dk"=>"Visning 2"
00554                 ),"list_mode_2","pi",$k,1,1);
00555                 $this->addLocalConf($ll,array(
00556                         "list_mode_3"=>"Mode 3",
00557                         "list_mode_3_dk"=>"Visning 3"
00558                 ),"list_mode_3","pi",$k,1,1);
00559                 $this->addLocalConf($ll,array(
00560                         "back"=>"Back",
00561                         "back_dk"=>"Tilbage"
00562                 ),"back","pi",$k,1,1);
00563 
00564                 if (!$onlyMode) {
00565                         $this->addLocalConf($ll,array(
00566                                 "pi_list_browseresults_prev"=>"< Previous",
00567                                 "pi_list_browseresults_prev_dk"=>"< Forrige"
00568                         ),"pi_list_browseresults_prev","pi",$k,1,1);
00569                         $this->addLocalConf($ll,array(
00570                                 "pi_list_browseresults_page"=>"Page",
00571                                 "pi_list_browseresults_page_dk"=>"Side"
00572                         ),"pi_list_browseresults_page","pi",$k,1,1);
00573                         $this->addLocalConf($ll,array(
00574                                 "pi_list_browseresults_next"=>"Next >",
00575                                 "pi_list_browseresults_next_dk"=>"Nćste >"
00576                         ),"pi_list_browseresults_next","pi",$k,1,1);
00577                         $this->addLocalConf($ll,array(
00578                                 "pi_list_browseresults_displays"=>"Displaying results ###SPAN_BEGIN###%s to %s</span> out of ###SPAN_BEGIN###%s</span>",
00579                                 "pi_list_browseresults_displays_dk"=>"Viser resultaterne ###SPAN_BEGIN###%s til %s</span> ud af ###SPAN_BEGIN###%s</span>"
00580                         ),"pi_list_browseresults_displays","pi",$k,1,1);
00581 
00582                         $this->addLocalConf($ll,array(
00583                                 "pi_list_searchBox_search"=>"Search",
00584                                 "pi_list_searchBox_search_dk"=>"Sřg"
00585                         ),"pi_list_searchBox_search","pi",$k,1,1);
00586                 }
00587 
00588                 return $ll;
00589         }
00590 
00591         function addLocalConf(&$lArray,$confArray,$key,$prefix,$subPrefix,$dontPrefixKey=0,$noWOP=0,$overruleKey="")    {
00592                 reset($this->wizard->languages);
00593 
00594                 $overruleKey = $overruleKey ? $overruleKey : ($dontPrefixKey?"":$prefix.$subPrefix."_").$key;
00595 
00596                 $lArray["default"][$overruleKey] = array($confArray[$key],(!$noWOP?'WOP:['.$prefix.']['.$subPrefix.']['.$key.']':''));
00597                 while(list($k)=each($this->wizard->languages))  {
00598                         $lArray[$k][$overruleKey] = array(trim($confArray[$key."_".$k]),(!$noWOP?'WOP:['.$prefix.']['.$subPrefix.']['.$key."_".$k.']':''));
00599                 }
00600                 return $lArray;
00601         }
00602 
00603 
00604 
00605 
00606         function PHPclassFile($extKey,$filename,$content,$desrc,$SOBE_class="",$SOBE_extras="") {
00607                 $file = trim($this->sPS('
00608                         <?php
00609                         /***************************************************************
00610                         *  Copyright notice
00611                         *
00612                         *  (c) 2005 '.$this->userField("name").' ('.$this->userField("email").')
00613                         *  All rights reserved
00614                         *
00615                         *  This script is part of the TYPO3 project. The TYPO3 project is
00616                         *  free software; you can redistribute it and/or modify
00617                         *  it under the terms of the GNU General Public License as published by
00618                         *  the Free Software Foundation; either version 2 of the License, or
00619                         *  (at your option) any later version.
00620                         *
00621                         *  The GNU General Public License can be found at
00622                         *  http://www.gnu.org/copyleft/gpl.html.
00623                         *
00624                         *  This script is distributed in the hope that it will be useful,
00625                         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00626                         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00627                         *  GNU General Public License for more details.
00628                         *
00629                         *  This copyright notice MUST APPEAR in all copies of the script!
00630                         ***************************************************************/
00636                 '));
00637 
00638                 $file.="\n\n\n".$content."\n\n\n";
00639 
00640                 $file.=trim($this->sPS("
00641 
00642                         if (defined('TYPO3_MODE') && \$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/".$extKey."/".$filename."'])  {
00643                                 include_once(\$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/".$extKey."/".$filename."']);
00644                         }
00645                         ".($SOBE_class?"
00646 
00647 
00648 
00649                         // Make instance:
00650                         \$SOBE = t3lib_div::makeInstance('".$SOBE_class."');
00651                         \$SOBE->init();
00652                         ".($SOBE_extras['include']?"
00653                         // Include files?
00654                         foreach(\$SOBE->include_once as \$INC_FILE)     include_once(\$INC_FILE);":"")."
00655                         ".($SOBE_extras['firstLevel']?"
00656                         \$SOBE->checkExtObj();  // Checking for first level external objects":"")."
00657                         \$SOBE->main();
00658                         \$SOBE->printContent();
00659                         ":"")."
00660                         ?>
00661                 "));
00662 
00663                 return $file;
00664         }
00665 
00666 
00667 
00668         function addFileToFileArray($name,$content,$mode=0)     {
00669                 switch($mode)   {
00670                         case 1: // Append
00671                                 $this->wizard->fileArray[$name]=$this->makeFileArray($name,$this->wizard->fileArray[$name]["content"].chr(10).$content);
00672                         break;
00673                         case -1:        // Prepend
00674                                 $this->wizard->fileArray[$name]=$this->makeFileArray($name,$content.chr(10).$this->wizard->fileArray[$name]["content"]);
00675                         break;
00676                         default:        // Substitution:
00677                                 $this->wizard->fileArray[$name]=$this->makeFileArray($name,$content);
00678                         break;
00679                 }
00680         }
00681 
00682         function makeEMCONFpreset($prefix="")   {
00683                 $this->wizard->_addArray = $this->wizard->wizArray["emconf"][1];
00684                 $EM_CONF=array();
00685                 $presetFields = explode(",","title,description,category,shy,dependencies,conflicts,priority,module,state,internal,uploadfolder,createDirs,modify_tables,clearCacheOnLoad,lockType,author,author_email,author_company,private,download_password,version");
00686                 while(list(,$s)=each($presetFields))    {
00687                         $EM_CONF[$prefix.$s]="";
00688                 }
00689 
00690 
00691                 $EM_CONF[$prefix."uploadfolder"] = $this->wizard->EM_CONF_presets["uploadfolder"]?1:0;
00692                 $EM_CONF[$prefix."clearCacheOnLoad"] = $this->wizard->EM_CONF_presets["clearCacheOnLoad"]?1:0;
00693 
00694                 if (is_array($this->wizard->EM_CONF_presets["createDirs"]))     {
00695                         $EM_CONF[$prefix."createDirs"] = implode(",",array_unique($this->wizard->EM_CONF_presets["createDirs"]));
00696                 }
00697 
00698                 if (is_array($this->wizard->EM_CONF_presets["dependencies"]) || $this->wizard->wizArray["emconf"][1]["dependencies"])   {
00699                         $aa= t3lib_div::trimExplode(",",strtolower($this->wizard->wizArray["emconf"][1]["dependencies"]),1);
00700                         $EM_CONF[$prefix."dependencies"] = implode(",",array_unique(array_merge($this->wizard->EM_CONF_presets["dependencies"],$aa)));
00701                 }
00702                 unset($this->wizard->_addArray["dependencies"]);
00703                 if (is_array($this->wizard->EM_CONF_presets["module"])) {
00704                         $EM_CONF[$prefix."module"] = implode(",",array_unique($this->wizard->EM_CONF_presets["module"]));
00705                 }
00706                 if (is_array($this->wizard->EM_CONF_presets["modify_tables"]))  {
00707                         $EM_CONF[$prefix."modify_tables"] = implode(",",array_unique($this->wizard->EM_CONF_presets["modify_tables"]));
00708                 }
00709 
00710                 return $EM_CONF;
00711         }
00712         function userField($k)  {
00713                 $v = "";
00714                 if($k == "name") {
00715                         $v = ($this->wizard->wizArray["emconf"][1]["author"] != "") ? $this->wizard->wizArray["emconf"][1]["author"] : $GLOBALS['BE_USER']->user['realName'];
00716                 } else if ($k == "email") {
00717                         $v = ($this->wizard->wizArray["emconf"][1]["author_email"] != "") ? $this->wizard->wizArray["emconf"][1]["author_email"] : $GLOBALS['BE_USER']->user['email'];
00718                 }
00719                 return $v;
00720         }
00721 }
00722 
00723 
00724 // Include extension?
00725 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/kickstarter/class.tx_kickstarter_sectionbase.php"]) {
00726         include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/kickstarter/class.tx_kickstarter_sectionbase.php"]);
00727 }
00728 
00729 
00730 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6