Documentation TYPO3 par Ameos

class.tx_kickstarter_section_tables.php

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")."sections/class.tx_kickstarter_section_fields.php");
00032 
00033 class tx_kickstarter_section_tables extends tx_kickstarter_section_fields {
00034   var $sectionID = 'tables';
00035 
00039         function render_wizard() {
00040                 $lines=array();
00041 
00042                 $action = explode(":",$this->wizard->modData['wizAction']);
00043                 if ($action[0]=="edit") {
00044                         $this->regNewEntry($this->sectionID,$action[1]);
00045                         $lines = $this->catHeaderLines($lines,$this->sectionID,$this->wizard->options[$this->sectionID],'&nbsp;',$action[1]);
00046                         $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]];
00047                         $ffPrefix='['.$this->sectionID.']['.$action[1].']';
00048 
00049                                 // Unique table name:
00050                         $table_suffixes=array();
00051                         if (is_array($this->wizard->wizArray[$this->sectionID]))        {
00052                                 foreach($this->wizard->wizArray[$this->sectionID] as $kk => $vv)        {
00053                                         if (!strcmp($action[1],$kk))    {
00054                                                 if (count($table_suffixes) && t3lib_div::inList(implode(',',$table_suffixes),$vv['tablename'].'Z'))     {
00055                                                         $piConf['tablename'].=$kk;
00056                                                 }
00057                                                 break;
00058                                         }
00059                                         $table_suffixes[]=$vv['tablename'].'Z';
00060                                 }
00061                         }
00062 
00063 
00064                                 // Enter title of the table
00065                         $subContent='<strong>Tablename:</strong><BR>'.
00066                                 $this->returnName($this->wizard->extKey,'tables').'_'.$this->renderStringBox($ffPrefix.'[tablename]',$piConf['tablename']).
00067                                 '<BR><strong>Notice:</strong> Use characters a-z0-9 only. Only lowercase, no spaces.<BR>
00068                                 This becomes the table name in the database. ';
00069                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00070 
00071 
00072                                 // Enter title of the table
00073                         $subContent='<strong>Title of the table:</strong><BR>'.
00074                                 $this->renderStringBox_lang('title',$ffPrefix,$piConf);
00075                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00076 
00077 
00078 
00079                                 // Fields - overview
00080                         $c=array(0);
00081                         $this->usedNames=array();
00082                         if (is_array($piConf['fields']))        {
00083                                 $piConf['fields'] = $this->cleanFieldsAndDoCommands($piConf['fields'],$this->sectionID,$action[1]);
00084 
00085                                 // Do it for real...
00086                                 $lines[]='<tr'.$this->bgCol(1).'><td><strong> Fields Overview </strong></td></tr>';
00087 //                              $lines[]='<tr'.$this->bgCol(2).'><td>'.$this->fw($v[1]).'</td></tr>';
00088                                 $lines[]='<tr><td></td></tr>';
00089 
00090                                 $subContent ='<tr '.$this->bgCol(2).'>
00091                                         <td><strong>Name</strong></td>
00092                                         <td><strong>Title</strong></td>
00093                                         <td><strong>Type</strong></td>
00094                                         <td><strong>Exclude?</strong></td>
00095                                         <td><strong>Details</strong></td>
00096                                 </tr>';
00097                                 foreach($piConf['fields'] as $k=>$v)    {
00098                                         $c[]=$k;
00099                                         $subContent .=$this->renderFieldOverview($ffPrefix.'[fields]['.$k.']',$v);
00100                                 }
00101                                 $lines[]='<tr'.$this->bgCol(3).'><td><table>'.$this->fw($subContent).'</table></td></tr>';
00102                         }
00103 
00104                         $lines[]='<tr'.$this->bgCol(1).'><td><strong> Edit Fields </strong></td></tr>';
00105 //                      $lines[]='<tr'.$this->bgCol(2).'><td>'.$this->fw($v[1]).'</td></tr>';
00106                         $lines[]='<tr><td></td></tr>';
00107 
00108 
00109 
00110 
00111                                 // Admin only
00112                         $subContent = '';
00113                         $subContent .= $this->renderCheckBox($ffPrefix.'[add_deleted]',$piConf['add_deleted'],1).'Add "Deleted" field '.$this->whatIsThis('Whole system: If a table has a deleted column, records are never really deleted, just "marked deleted" . Thus deleted records can actually be restored by clearing a deleted-flag later.\nNotice that all attached files are also not deleted from the server, so if you expect the table to hold some heavy size uploads, maybe you should not set this...') . '<BR>';
00114                         $subContent .= $this->renderCheckBox($ffPrefix . '[add_hidden]', $piConf['add_hidden'],1) . 'Add "Hidden" flag ' . $this->whatIsThis('Frontend: The "Hidden" flag will prevent the record from being displayed on the frontend.') . '<BR>' . $this->resImg('t_flag_hidden.png','hspace=20','','<BR><BR>');
00115                         $subContent .= $this->renderCheckBox($ffPrefix . '[add_starttime]', $piConf['add_starttime']) . 'Add "Starttime" ' . $this->whatIsThis('Frontend: If a "Starttime" is set, the record will not be visible on the website, before that date arrives.') . '<BR>' . $this->resImg('t_flag_starttime.png','hspace=20','','<BR><BR>');
00116                         $subContent .= $this->renderCheckBox($ffPrefix . '[add_endtime]', $piConf['add_endtime']) . 'Add "Endtime" ' . $this->whatIsThis('Frontend: If a "Endtime" is set, the record will be hidden from that date and into the future.') . '<BR>' . $this->resImg('t_flag_endtime.png', 'hspace=20','','<BR><BR>');
00117                         $subContent .= $this->renderCheckBox($ffPrefix . '[add_access]', $piConf['add_access']) . 'Add "Access group" ' . $this->whatIsThis('Frontend: If a frontend user group is set for a record, only frontend users that are members of that group will be able to see the record.') . '<BR>' . $this->resImg('t_flag_access.png', 'hspace=20','','<BR><BR>');
00118                         $lines[] = '<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00119 
00120                                 // Sorting
00121                         $optValues = array(
00122                                 'crdate' => '[crdate]',
00123                                 'cruser_id' => '[cruser_id]',
00124                                 'tstamp' => '[tstamp]',
00125                         );
00126                         $subContent = '';
00127                         $subContent.= $this->renderCheckBox($ffPrefix.'[localization]',$piConf['localization']).'Enabled localization features'.$this->whatIsThis('If set, the records will have a selector box for language and a reference field which can point back to the original default translation for the record. These features are part of the internal framework for localization.').'<BR>';
00128                         $subContent.= $this->renderCheckBox($ffPrefix.'[versioning]',$piConf['versioning']).'Enable versioning '.$this->whatIsThis('If set, you will be able to versionize records from this table. Highly recommended if the records are passed around in a workflow.').'<BR>';
00129                         $subContent.= $this->renderCheckBox($ffPrefix.'[sorting]',$piConf['sorting']).'Manual ordering of records '.$this->whatIsThis('If set, the records can be moved up and down relative to each other in the backend. Just like Content Elements. Otherwise they are sorted automatically by any field you specify').'<BR>';
00130                         $subContent.= $this->textSetup('','If "Manual ordering" is not set, order the table by this field:<BR>'.
00131                                 $this->renderSelectBox($ffPrefix.'[sorting_field]',$piConf['sorting_field'],$this->currentFields($optValues,$piConf['fields'])).'<BR>'.
00132                                 $this->renderCheckBox($ffPrefix.'[sorting_desc]',$piConf['sorting_desc']).' Descending');
00133                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00134 
00135                                 // Type field
00136                         $optValues = array(
00137                                 '0' => '[none]',
00138                         );
00139                         $subContent = '<strong>"Type-field", if any:<BR></strong>'.
00140                                         $this->renderSelectBox($ffPrefix.'[type_field]',$piConf['type_field'],$this->currentFields($optValues,$piConf['fields'])).
00141                                         $this->whatIsThis('A "type-field" is the field in the table which determines how the form is rendered in the backend, eg. which fields are shown under which circumstances.\nFor instance the Content Element table "tt_content" has a type-field, CType. The value of this field determines if the editing form shows the bodytext field as is the case when the type is "Text" or if also the image-field should be shown as when the type is "Text w/Image"');
00142                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00143 
00144                                 // Header field
00145                         $optValues = array(
00146                                 '0' => '[none]',
00147                         );
00148                         $subContent = '<strong>Label-field:<BR></strong>'.
00149                                         $this->renderSelectBox($ffPrefix.'[header_field]',$piConf['header_field'],$this->currentFields($optValues,$piConf['fields'])).
00150                                         $this->whatIsThis('A "label-field" is the field used as record title in the backend.');
00151                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00152 
00153                                 // Icon
00154                         $optValues = array(
00155                                 'default.gif' => 'Default (white)',
00156                                 'default_black.gif' => 'Black',
00157                                 'default_gray4.gif' => 'Gray',
00158                                 'default_blue.gif' => 'Blue',
00159                                 'default_green.gif' => 'Green',
00160                                 'default_red.gif' => 'Red',
00161                                 'default_yellow.gif' => 'Yellow',
00162                                 'default_purple.gif' => 'Purple',
00163                         );
00164 
00165                         $subContent= $this->renderSelectBox($ffPrefix.'[defIcon]',$piConf['defIcon'],$optValues).' Default icon '.$this->whatIsThis('All tables have at least one associated icon. Select which default icon you wish. You can always substitute the file with another.');
00166                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00167 
00168                                 // Allowed on pages
00169                         $subContent = '<strong>Allowed on pages:<BR></strong>'.
00170                                         $this->renderCheckBox($ffPrefix.'[allow_on_pages]',$piConf['allow_on_pages']).' Allow records from this table to be created on regular pages.';
00171                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00172 
00173                                 // Allowed in "Insert Records"
00174                         $subContent = '<strong>Allowed in "Insert Records" field in content elements:<BR></strong>'.
00175                                         $this->renderCheckBox($ffPrefix.'[allow_ce_insert_records]',$piConf['allow_ce_insert_records']).' Allow records from this table to be linked to by content elements.';
00176                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00177 
00178                                 // Add new button
00179                         $subContent = '<strong>Add "Save and new" button in forms:<BR></strong>'.
00180                                         $this->renderCheckBox($ffPrefix.'[save_and_new]',$piConf['save_and_new']).' Will add an additional save-button to forms by which you can save the item and instantly create the next.';
00181                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00182 
00183 
00184                         $subContent = '<strong>Notice on fieldnames:<BR></strong>'.
00185                                 'Don\'t use fieldnames from this list of reserved names/words: <BR>
00186                                 <blockquote><em>' . implode(', ',explode(',',$this->wizard->reservedTypo3Fields . ',' . $this->wizard->mysql_reservedFields)).'</em></blockquote>';
00187                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00188 
00189 
00190 
00191                                 // PRESETS:
00192                         $selPresetBox=$this->presetBox($piConf["fields"]);
00193 
00194                                 // Fields
00195                         $c=array(0);
00196                         $this->usedNames=array();
00197                         if (is_array($piConf['fields']))        {
00198 
00199                                 // Do it for real...
00200                                 foreach($piConf['fields'] as $k=>$v)    {
00201                                         $c[]=$k;
00202                                         $subContent=$this->renderField($ffPrefix.'[fields]['.$k.']',$v);
00203                                         $lines[]='<tr'.$this->bgCol(2).'><td>'.$this->fw('<strong>FIELD:</strong> <em>'.$v['fieldname'].'</em>').'</td></tr>';
00204                                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00205                                 }
00206                         }
00207 
00208                                 // New field:
00209                         $k=max($c)+1;
00210                         $v=array();
00211                         $lines[]='<tr'.$this->bgCol(2).'><td>'.$this->fw('<strong>NEW FIELD:</strong>').'</td></tr>';
00212                         $subContent=$this->renderField($ffPrefix.'[fields]['.$k.']',$v,1);
00213                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00214 
00215 
00216                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw('<BR><BR>Load preset fields: <BR>'.$selPresetBox).'</td></tr>';
00217                 }
00218 
00219                 /* HOOK: Place a hook here, so additional output can be integrated */
00220                 if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_tables'])) {
00221                   foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_tables'] as $_funcRef) {
00222                     $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this);
00223                   }
00224                 }
00225 
00226                 $content = '<table border=0 cellpadding=2 cellspacing=2>'.implode('',$lines).'</table>';
00227 
00228                 return $content;
00229         }
00230 
00231         function currentFields($addFields,$fArr)        {
00232                 if (is_array($fArr))    {
00233                         foreach($fArr as $k=>$v)        {
00234                                 if ($v['type'] && trim($v['fieldname']))        {
00235                                         $addFields[trim($v['fieldname'])]=$v['fieldname'].': '.$v['title'];
00236                                 }
00237                         }
00238                 }
00239                 return $addFields;
00240         }
00241 
00245         function renderFieldOverview($prefix,$fConf,$dontRemove=0)      {
00246                         // Sorting
00247                 $optTypes = array(
00248                         '' => '',
00249                         'input' => 'String input',
00250                         'input+' => 'String input, advanced',
00251                         'textarea' => 'Text area',
00252                         'textarea_rte' => 'Text area with RTE',
00253                         'textarea_nowrap' => 'Text area, No wrapping',
00254                         'check' => 'Checkbox, single',
00255                         'check_4' => 'Checkbox, 4 boxes in a row',
00256                         'check_10' => 'Checkbox, 10 boxes in two rows (max)',
00257                         'link' => 'Link',
00258                         'date' => 'Date',
00259                         'datetime' => 'Date and time',
00260                         'integer' => 'Integer, 10-1000',
00261                         'select' => 'Selectorbox',
00262                         'radio' => 'Radio buttons',
00263                         'rel' => 'Database relation',
00264                         'files' => 'Files',
00265                 );
00266                 $optEval = array(
00267                         '' => '',
00268                         'date' => 'Date (day-month-year)',
00269                         'time' => 'Time (hours, minutes)',
00270                         'timesec' => 'Time + seconds',
00271                         'datetime' => 'Date + Time',
00272                         'year' => 'Year',
00273                         'int' => 'Integer',
00274                         'int+' => 'Integer 0-1000',
00275                         'double2' => 'Floating point, x.xx',
00276                         'alphanum' => 'Alphanumeric only',
00277                         'upper' => 'Upper case',
00278                         'lower' => 'Lower case',
00279                 );
00280                 $optRte = array(
00281                         'tt_content' => 'Transform like "Bodytext"',
00282                         'basic' => 'Typical (based on CSS)',
00283                         'moderate' => 'Transform images / links',
00284                         'none' => 'No transform',
00285                         'custom' => 'Custom transform'
00286                 );
00287 
00288                 switch($fConf['type']) {
00289                         case 'rel':
00290                                 if ($fConf['conf_rel_table'] == '_CUSTOM') {
00291                                         $details .= $fConf['conf_custom_table_name'];
00292                                 } else {
00293                                         $details .= $fConf['conf_rel_table'];
00294                                 }
00295                         break;
00296                         case 'input+':
00297                                 if($fConf['conf_varchar']) $details[] = 'varchar';
00298                                 if($fConf['conf_unique']) $details[] = ($fConf['conf_unique'] == 'L') ?  'unique (page)': 'unique (site)';
00299                                 if($fConf['conf_eval']) $details[] = $optEval[$fConf['conf_eval']];
00300                                 $details = implode(', ', (array) $details);
00301                         break;
00302                         case 'check_10':
00303                         case 'check_4':
00304                                 $details = ($fConf['conf_numberBoxes'] ? $fConf['conf_numberBoxes'] : '4') . ' checkboxes';
00305                         break;
00306                         case 'radio':
00307                                 if($fConf['conf_select_items']) $details = $fConf['conf_select_items'] . ' options';
00308                         break;
00309                         case 'select':
00310                                 if($fConf['conf_select_items']) $details[] = $fConf['conf_select_items'] . ' options';
00311                                 if($fConf['conf_select_pro']) $details[] = 'preprocessing';
00312                                 $details = implode(', ', (array) $details);
00313                         break;
00314                         case 'textarea_rte':
00315                                 if($fConf['conf_rte']) $details = $optRte[$fConf['conf_rte']];
00316                         break;
00317                         case 'files':
00318                                 $details[] = $fConf['conf_files_type'];
00319                                 $details[] = $fConf['conf_files'] . ' files';
00320                                 $details[] = $fConf['conf_max_filesize'] . ' kB';
00321                                 $details = implode(', ', (array) $details);
00322                         break;
00323                 }
00324                 return sprintf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>',
00325                         $fConf['fieldname'],
00326                         $fConf['title'],
00327                         $optTypes[$fConf['type']],
00328                         $fConf['exludeField'] ? 'Yes' : '',
00329                         $details
00330                         );
00331         }
00332 
00333 
00334 
00335 
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343 
00344 
00345 
00346 
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00361         function render_extPart($k,$config,$extKey) {
00362                 $WOP='[tables]['.$k.']';
00363                 $tableName=$config['tablename'];
00364                 $tableName = $this->returnName($extKey,'tables',$tableName);
00365 
00366                 $DBfields=array();
00367                 $columns=array();
00368                 $ctrl=array();
00369                 $enFields=array();
00370 
00371 //str_replace("\\'","'",addslashes($this->getSplitLabels($config,"title")))
00372                 $ctrl[] = trim($this->sPS('
00373                         "title" => "' . $this->getSplitLabels_reference($config,'title',$tableName) . '",               ' . $this->WOPcomment('WOP:'.$WOP.'[title]').'
00374                         "label" => "' . ($config["header_field"]?$config['header_field']:'uid') . '",   '.$this->WOPcomment('WOP:'.$WOP.'[header_field]').'
00375                         "tstamp" => "tstamp",
00376                         "crdate" => "crdate",
00377                         "cruser_id" => "cruser_id",
00378                 ',0));
00379                 $DBfields[] = trim($this->sPS('
00380                         uid int(11) NOT NULL auto_increment,
00381                         pid int(11) DEFAULT \'0\' NOT NULL,
00382                         tstamp int(11) DEFAULT \'0\' NOT NULL,
00383                         crdate int(11) DEFAULT \'0\' NOT NULL,
00384                         cruser_id int(11) DEFAULT \'0\' NOT NULL,
00385                 ',0));
00386 
00387                 if ($config['type_field'])      {
00388                         $ctrl[] = '"type" => "'.$config["type_field"].'",       '.$this->WOPcomment('WOP:'.$WOP.'[type_field]');
00389                 }
00390                 if ($config['versioning'])      {
00391                         $ctrl[] = '"versioning" => "1", ' . $this->WOPcomment('WOP:'.$WOP.'[versioning]');
00392                         $DBfields[] = 't3ver_oid int(11) DEFAULT \'0\' NOT NULL,';
00393                         $DBfields[] = 't3ver_id int(11) DEFAULT \'0\' NOT NULL,';
00394                         $DBfields[] = 't3ver_label varchar(30) DEFAULT \'\' NOT NULL,';
00395                 }
00396                 if ($config["localization"])    {
00397                         $ctrl[] = '"languageField" => "sys_language_uid",       '.$this->WOPcomment('WOP:'.$WOP.'[localization]');
00398                         $ctrl[] = '"transOrigPointerField" => "l18n_parent",    '.$this->WOPcomment('WOP:'.$WOP.'[localization]');
00399                         $ctrl[] = '"transOrigDiffSourceField" => "l18n_diffsource",     '.$this->WOPcomment('WOP:'.$WOP.'[localization]');
00400 
00401                         $DBfields[] = 'sys_language_uid int(11) DEFAULT \'0\' NOT NULL,';
00402                         $DBfields[] = 'l18n_parent int(11) DEFAULT \'0\' NOT NULL,';
00403                         $DBfields[] = 'l18n_diffsource mediumblob NOT NULL,';
00404 
00405                         $columns['sys_language_uid'] = trim($this->sPS("
00406                                 'sys_language_uid' => Array (           ".$this->WOPcomment('WOP:'.$WOP.'[localization]')."
00407                                         'exclude' => 1,
00408                                         'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language',
00409                                         'config' => Array (
00410                                                 'type' => 'select',
00411                                                 'foreign_table' => 'sys_language',
00412                                                 'foreign_table_where' => 'ORDER BY sys_language.title',
00413                                                 'items' => Array(
00414                                                         Array('LLL:EXT:lang/locallang_general.php:LGL.allLanguages',-1),
00415                                                         Array('LLL:EXT:lang/locallang_general.php:LGL.default_value',0)
00416                                                 )
00417                                         )
00418                                 ),
00419                         "));
00420 
00421                         $columns['l18n_parent'] = trim($this->sPS("
00422                                 'l18n_parent' => Array (                ".$this->WOPcomment('WOP:'.$WOP.'[localization]')."
00423                                         'displayCond' => 'FIELD:sys_language_uid:>:0',
00424                                         'exclude' => 1,
00425                                         'label' => 'LLL:EXT:lang/locallang_general.php:LGL.l18n_parent',
00426                                         'config' => Array (
00427                                                 'type' => 'select',
00428                                                 'items' => Array (
00429                                                         Array('', 0),
00430                                                 ),
00431                                                 'foreign_table' => '".$tableName."',
00432                                                 'foreign_table_where' => 'AND ".$tableName.".pid=###CURRENT_PID### AND ".$tableName.".sys_language_uid IN (-1,0)',
00433                                         )
00434                                 ),
00435                         "));
00436 
00437                         $columns["l18n_diffsource"] = trim($this->sPS("
00438                                 'l18n_diffsource' => Array (            ".$this->WOPcomment('WOP:'.$WOP.'[localization]')."
00439                                         'config' => Array (
00440                                                 'type' => 'passthrough'
00441                                         )
00442                                 ),
00443                         "));
00444                 }
00445                 if ($config["sorting"]) {
00446                         $ctrl[] = '"sortby" => "sorting",       '.$this->WOPcomment('WOP:'.$WOP.'[sorting]');
00447                         $DBfields[] = "sorting int(10) DEFAULT '0' NOT NULL,";
00448                 } else {
00449                         $ctrl[] = '"default_sortby" => "ORDER BY '.trim($config["sorting_field"].' '.($config["sorting_desc"]?"DESC":"")).'",   '.$this->WOPcomment('WOP:'.$WOP.'[sorting] / '.$WOP.'[sorting_field] / '.$WOP.'[sorting_desc]');
00450                 }
00451                 if ($config["add_deleted"])     {
00452                         $ctrl[] = '"delete" => "deleted",       '.$this->WOPcomment('WOP:'.$WOP.'[add_deleted]');
00453                         $DBfields[] = "deleted tinyint(4) DEFAULT '0' NOT NULL,";
00454                 }
00455                 if ($config["add_hidden"])      {
00456                         $enFields[] = '"disabled" => "hidden",  '.$this->WOPcomment('WOP:'.$WOP.'[add_hidden]');
00457                         $DBfields[] = "hidden tinyint(4) DEFAULT '0' NOT NULL,";
00458                         $columns["hidden"] = trim($this->sPS('
00459                                 "hidden" => Array (             '.$this->WOPcomment('WOP:'.$WOP.'[add_hidden]').'
00460                                         "exclude" => 1,
00461                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.hidden",
00462                                         "config" => Array (
00463                                                 "type" => "check",
00464                                                 "default" => "0"
00465                                         )
00466                                 ),
00467                         '));
00468                 }
00469                 if ($config["add_starttime"])   {
00470                         $enFields[] = '"starttime" => "starttime",      '.$this->WOPcomment('WOP:'.$WOP.'[add_starttime]');
00471                         $DBfields[] = "starttime int(11) DEFAULT '0' NOT NULL,";
00472                         $columns["starttime"] = trim($this->sPS('
00473                                 "starttime" => Array (          '.$this->WOPcomment('WOP:'.$WOP.'[add_starttime]').'
00474                                         "exclude" => 1,
00475                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.starttime",
00476                                         "config" => Array (
00477                                                 "type" => "input",
00478                                                 "size" => "8",
00479                                                 "max" => "20",
00480                                                 "eval" => "date",
00481                                                 "default" => "0",
00482                                                 "checkbox" => "0"
00483                                         )
00484                                 ),
00485                         '));
00486                 }
00487                 if ($config["add_endtime"])     {
00488                         $enFields[] = '"endtime" => "endtime",  '.$this->WOPcomment('WOP:'.$WOP.'[add_endtime]');
00489                         $DBfields[] = "endtime int(11) DEFAULT '0' NOT NULL,";
00490                         $columns["endtime"] = trim($this->sPS('
00491                                 "endtime" => Array (            '.$this->WOPcomment('WOP:'.$WOP.'[add_endtime]').'
00492                                         "exclude" => 1,
00493                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.endtime",
00494                                         "config" => Array (
00495                                                 "type" => "input",
00496                                                 "size" => "8",
00497                                                 "max" => "20",
00498                                                 "eval" => "date",
00499                                                 "checkbox" => "0",
00500                                                 "default" => "0",
00501                                                 "range" => Array (
00502                                                         "upper" => mktime(0,0,0,12,31,2020),
00503                                                         "lower" => mktime(0,0,0,date("m")-1,date("d"),date("Y"))
00504                                                 )
00505                                         )
00506                                 ),
00507                         '));
00508                 }
00509                 if ($config["add_access"])      {
00510                         $enFields[] = '"fe_group" => "fe_group",        '.$this->WOPcomment('WOP:'.$WOP.'[add_access]');
00511                         $DBfields[] = "fe_group int(11) DEFAULT '0' NOT NULL,";
00512                         $columns["fe_group"] = trim($this->sPS('
00513                                 "fe_group" => Array (           '.$this->WOPcomment('WOP:'.$WOP.'[add_access]').'
00514                                         "exclude" => 1,
00515                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.fe_group",
00516                                         "config" => Array (
00517                                                 "type" => "select",
00518                                                 "items" => Array (
00519                                                         Array("", 0),
00520                                                         Array("LLL:EXT:lang/locallang_general.php:LGL.hide_at_login", -1),
00521                                                         Array("LLL:EXT:lang/locallang_general.php:LGL.any_login", -2),
00522                                                         Array("LLL:EXT:lang/locallang_general.php:LGL.usergroups", "--div--")
00523                                                 ),
00524                                                 "foreign_table" => "fe_groups"
00525                                         )
00526                                 ),
00527                         '));
00528                 }
00529                         // Add enable fields in header:
00530                 if (is_array($enFields) && count($enFields))    {
00531                         $ctrl[]=trim($this->wrapBody('
00532                                 "enablecolumns" => Array (              '.$this->WOPcomment('WOP:'.$WOP.'[add_hidden] / '.$WOP.'[add_starttime] / '.$WOP.'[add_endtime] / '.$WOP.'[add_access]').'
00533                                 ',implode(chr(10),$enFields),'
00534                                 ),
00535                         '));
00536                 }
00537                         // Add dynamic config file.
00538                 $ctrl[]= '"dynamicConfigFile" => t3lib_extMgm::extPath($_EXTKEY)."tca.php",';
00539                 $ctrl[]= '"iconfile" => t3lib_extMgm::extRelPath($_EXTKEY)."icon_'.$tableName.'.gif",';
00540 
00541                 if ($config["allow_on_pages"])  {
00542                         $this->wizard->ext_tables[]=$this->sPS('
00543                                 '.$this->WOPcomment('WOP:'.$WOP.'[allow_on_pages]').'
00544                                 t3lib_extMgm::allowTableOnStandardPages("'.$tableName.'");
00545                         ');
00546                 }
00547                 if ($config["allow_ce_insert_records"]) {
00548                         $this->wizard->ext_tables[]=$this->sPS('
00549                                 '.$this->WOPcomment('WOP:'.$WOP.'[allow_ce_insert_records]').'
00550                                 t3lib_extMgm::addToInsertRecords("'.$tableName.'");
00551                         ');
00552                 }
00553                 if ($config["save_and_new"])    {
00554                         $this->wizard->ext_localconf[]=trim($this->wrapBody("
00555                                 t3lib_extMgm::addUserTSConfig('
00556                                         ","options.saveDocNew.".$tableName."=1","
00557                                 ');
00558                         "));
00559                 }
00560 
00561                 if (is_array($config["fields"]))        {
00562                         reset($config["fields"]);
00563                         while(list($i,$fConf)=each($config["fields"]))  {
00564                                 $this->makeFieldTCA($DBfields,$columns,$fConf,$WOP."[fields][".$i."]",$tableName,$extKey);
00565                         }
00566                 }
00567 
00568 
00569 
00570                         // Finalize tables.sql:
00571                 $DBfields[]=$this->sPS('
00572                         PRIMARY KEY (uid),
00573                         KEY parent (pid)
00574                 ');
00575                 $createTable = $this->wrapBody('
00576                         #
00577                         # Table structure for table \''.$tableName.'\'
00578                         #
00579                         CREATE TABLE '.$tableName.' (
00580                 ', implode(chr(10),$DBfields), '
00581                         );
00582                 ');
00583                 $this->wizard->ext_tables_sql[]=chr(10).$createTable.chr(10);
00584 
00585                         // Finalize tca.php:
00586                 $tca_file="";
00587                 list($typeList,$palList) = $this->implodeColumns($columns);
00588                 $tca_file.=$this->wrapBody('
00589                         $TCA["'.$tableName.'"] = Array (
00590                                 "ctrl" => $TCA["'.$tableName.'"]["ctrl"],
00591                                 "interface" => Array (
00592                                         "showRecordFieldList" => "'.implode(",",array_keys($columns)).'"
00593                                 ),
00594                                 "feInterface" => $TCA["'.$tableName.'"]["feInterface"],
00595                                 "columns" => Array (
00596                         ', trim(implode(chr(10),$columns)),'
00597                                 ),
00598                                 "types" => Array (
00599                                         "0" => Array("showitem" => "'.$typeList.'")
00600                                 ),
00601                                 "palettes" => Array (
00602                                         "1" => Array("showitem" => "'.$palList.'")
00603                                 )
00604                         );
00605                 ',2);
00606                 $this->wizard->ext_tca[]=chr(10).$tca_file.chr(10);
00607 
00608                         // Finalize ext_tables.php:
00609                 $this->wizard->ext_tables[]=$this->wrapBody('
00610                         $TCA["'.$tableName.'"] = Array (
00611                                 "ctrl" => Array (
00612                         ', implode(chr(10),$ctrl),'
00613                                 ),
00614                                 "feInterface" => Array (
00615                                         "fe_admin_fieldList" => "'.implode(", ",array_keys($columns)).'",
00616                                 )
00617                         );
00618                 ',2);
00619 
00620 
00621                                 // Add wizard icon
00622                         $this->addFileToFileArray($pathSuffix."icon_".$tableName.".gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/".$config["defIcon"]));
00623 
00624         }
00625 
00626 }
00627 
00628 
00629 
00630 // Include ux_class extension?
00631 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_tables.php']) {
00632         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_tables.php']);
00633 }
00634 
00635 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6