"TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/wizard_crpages/class.tx_wizardcrpages_webfunc_2.php Source File", "datetime" => "Sat Dec 2 19:22:35 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>

class.tx_wizardcrpages_webfunc_2.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-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 ***************************************************************/
00050 require_once(PATH_t3lib.'class.t3lib_page.php');
00051 require_once(PATH_t3lib.'class.t3lib_tcemain.php');
00052 require_once(PATH_t3lib.'class.t3lib_extobjbase.php');
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00070 class tx_wizardcrpages_webfunc_2 extends t3lib_extobjbase {
00071 
00078         function modMenu()      {
00079                 global $LANG;
00080 
00081                 $modMenuAdd = array(
00082                         'cr_333' => array(
00083                                 '0' => 'nul',
00084                                 '1' => 'et'
00085                         )
00086                 );
00087                 return $modMenuAdd;
00088         }
00089 
00095         function main() {
00096                 global $SOBE,$LANG;
00097 
00098                 $theCode='';
00099 
00100                 $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);   // create new pages here?
00101                 $pRec = t3lib_BEfunc::getRecord('pages',$this->pObj->id,'uid',' AND '.$m_perms_clause);
00102                 $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect');
00103                 $menuItems = $sys_pages->getMenu($this->pObj->id,'*','sorting','',0);
00104                 if (is_array($pRec))    {
00105                         $data = t3lib_div::_GP('data');
00106                         if (is_array($data['pages']))   {
00107                                 if (t3lib_div::_GP('createInListEnd'))  {
00108                                         $endI = end($menuItems);
00109                                         $thePid = -intval($endI['uid']);
00110                                         if (!$thePid)   $thePid = $this->pObj->id;
00111                                 } else {
00112                                         $thePid = $this->pObj->id;
00113                                 }
00114 
00115                                 while(list($k,$dat)=each($data['pages']))       {
00116                                         if (!trim($dat['title']))       {
00117                                                 unset($data['pages'][$k]);
00118                                         } else {
00119                                                 $data['pages'][$k]['pid']=$thePid;
00120                                                 $data['pages'][$k]['hidden'] = t3lib_div::_GP('hidePages') ? 1 : 0;
00121                                         }
00122                                 }
00123                                 if (count($data['pages']))      {
00124                                         reset($data);
00125                                         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00126                                         $tce->stripslashes_values=0;
00127                                         $tce->reverseOrder=1;
00128 
00129                                                 // set default TCA values specific for the user
00130                                         $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
00131                                         if (is_array($TCAdefaultOverride))      {
00132                                                 $tce->setDefaultsFromUserTS($TCAdefaultOverride);
00133                                         }
00134 
00135                                         $tce->start($data,array());
00136                                         $tce->process_datamap();
00137                                         t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
00138                                 } else {
00139                                         $theCode.=$GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_noCreate').'<br /><br />');
00140                                 }
00141 
00142                                         // Display result:
00143                                 $menuItems = $sys_pages->getMenu($this->pObj->id,'*','sorting','',0);
00144                                 reset($menuItems);
00145                                 $lines=array();
00146                                 while(list(,$rec)=each($menuItems))     {
00147                                         t3lib_BEfunc::workspaceOL('pages',$rec);
00148                                         $lines[]= '<nobr>'.t3lib_iconWorks::getIconImage('pages',$rec,$GLOBALS['BACK_PATH'],'align="top" '.t3lib_BEfunc::titleAttribForPages($rec)).
00149                                                 htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'],$GLOBALS['BE_USER']->uc['titleLen'])).'</nobr>';
00150                                 }
00151                                 $theCode.= '<b>'.$LANG->getLL('wiz_newPages_currentMenu').':</b><br /><br />'.implode('<br />',$lines);
00152                         } else {
00153                                         // Create loremIpsum code:
00154                                 if (t3lib_extMgm::isLoaded('lorem_ipsum'))      {
00155                                         $loremIpsumObj = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
00156                                 }
00157                                         // Display create form
00158                                 $lines = array();
00159                                 for ($a=0;$a<9;$a++)    {
00160                                         $lines[] = $LANG->getLL('wiz_newPages_page').' '.($a+1).
00161                                                 ': <input type="text" name="data[pages][NEW'.$a.'][title]"'.$this->pObj->doc->formWidth(35).' />'.
00162                                                 (is_object($loremIpsumObj) ? '<a href="#" onclick="'.htmlspecialchars($loremIpsumObj->getHeaderTitleJS('document.forms[0][\'data[pages][NEW'.$a.'][title]\'].value', 'title')).'">'.$loremIpsumObj->getIcon('',$this->pObj->doc->backPath).'</a>' : '');
00163                                 }
00164 
00165                                 $theCode.= '<b>'.$LANG->getLL('wiz_newPages').':</b><br /><br />'.implode('<br />',$lines).
00166                                 '<br /><br />
00167                                 <input type="checkbox" name="createInListEnd" value="1" />'.$LANG->getLL('wiz_newPages_listEnd').'<br />
00168                                 <input type="checkbox" name="hidePages" value="1" />'.$LANG->getLL('wiz_newPages_hidePages').'<br />
00169                                 <input type="submit" name="create" value="'.$LANG->getLL('wiz_newPages_lCreate').'" onclick="return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')).')"> <input type="reset" value="'.$LANG->getLL('wiz_newPages_lReset').'" />';
00170                         }
00171                 } else {
00172                         $theCode.=$GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_errorMsg1'));
00173                 }
00174 
00175                         // CSH
00176                 $theCode.= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardcrpages', $GLOBALS['BACK_PATH'],'<br/>|');
00177 
00178                 $out=$this->pObj->doc->section($LANG->getLL('wiz_crMany'),$theCode,0,1);
00179                 return $out;
00180         }
00181 
00187         function helpBubble()   {
00188                 return '<img src="'.$GLOBALS['BACK_PATH'].'gfx/helpbubble.gif" width="14" height="14" hspace="2" align="top"'.$this->pObj->doc->helpStyle().' alt="" />';
00189         }
00190 }
00191 
00192 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wizard_crpages/class.tx_wizardcrpages_webfunc_2.php']) {
00193         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wizard_crpages/class.tx_wizardcrpages_webfunc_2.php']);
00194 }
00195 ?>