Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2004 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 00067 class tx_wizardsortpages_webfunc_2 extends t3lib_extobjbase { 00068 00075 function modMenu() { 00076 global $LANG; 00077 00078 $modMenuAdd = array( 00079 'sort_blablabla' => array( 00080 '2' => 'TO', 00081 '1' => 'et' 00082 ) 00083 ); 00084 return $modMenuAdd; 00085 } 00086 00092 function main() { 00093 global $SOBE,$LANG; 00094 00095 $theCode=''; 00096 00097 // check if user has modify permissions to 00098 $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect'); 00099 $sortByField = t3lib_div::_GP('sortByField'); 00100 if ($sortByField) { 00101 $menuItems=array(); 00102 if (t3lib_div::inList('title,subtitle,crdate,tstamp',$sortByField)) { 00103 $menuItems = $sys_pages->getMenu($this->pObj->id,'uid,pid,title',$sortByField); 00104 } elseif ($sortByField=='REV') { 00105 $menuItems = $sys_pages->getMenu($this->pObj->id,'uid,pid,title'); 00106 $menuItems = array_reverse($menuItems); 00107 } 00108 if (count($menuItems)) { 00109 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 00110 $tce->stripslashes_values=0; 00111 $menuItems = array_reverse($menuItems); 00112 $cmd=array(); 00113 reset($menuItems); 00114 while(list(,$r)=each($menuItems)) { 00115 $cmd['pages'][$r['uid']]['move']=$this->pObj->id; 00116 } 00117 $tce->start(array(),$cmd); 00118 $tce->process_cmdmap(); 00119 t3lib_BEfunc::getSetUpdateSignal('updatePageTree'); 00120 } 00121 } 00122 00123 // 00124 $menuItems = $sys_pages->getMenu($this->pObj->id); 00125 reset($menuItems); 00126 $lines=array(); 00127 $lines[]= '<tr> 00128 <td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'),'title').'</b></td> 00129 '.(t3lib_extMgm::isLoaded('cms')?'<td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_subtitle'),'subtitle').'</b></td>':'').' 00130 <td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tChange'),'tstamp').'</b></td> 00131 <td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tCreate'),'crdate').'</b></td> 00132 </tr>'; 00133 while(list(,$rec)=each($menuItems)) { 00134 $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(2); // edit permissions for that page! 00135 $pRec = t3lib_BEfunc::getRecord ('pages',$rec['uid'],'uid',' AND '.$m_perms_clause); 00136 $lines[]= '<tr><td nowrap="nowrap">'.t3lib_iconWorks::getIconImage('pages',$rec,$GLOBALS['BACK_PATH'],'align="top" '.t3lib_BEfunc::titleAttribForPages($rec)). 00137 (!is_array($pRec)?$GLOBALS['TBE_TEMPLATE']->rfw('<b>'.$LANG->getLL('wiz_W',1).'</b> '):''). 00138 htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'],$GLOBALS['BE_USER']->uc['titleLen'])).' </td> 00139 '.(t3lib_extMgm::isLoaded('cms')?'<td nowrap="nowrap">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['subtitle'],$GLOBALS['BE_USER']->uc['titleLen'])).' </td>':'').' 00140 <td nowrap="nowrap">'.t3lib_Befunc::datetime($rec['tstamp']).' </td> 00141 <td nowrap="nowrap">'.t3lib_Befunc::datetime($rec['crdate']).' </td> 00142 </tr>'; 00143 } 00144 00145 $theCode.= '<b>'.$LANG->getLL('wiz_currentPageOrder',1).':</b><br /><br /> 00146 <table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table><br />'; 00147 00148 if (count($menuItems)) { 00149 // Menu: 00150 $lines=array(); 00151 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'),'title'); 00152 if (t3lib_extMgm::isLoaded('cms')) $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_subtitle'),'subtitle'); 00153 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tChange'),'tstamp'); 00154 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tCreate'),'crdate'); 00155 $lines[] = ''; 00156 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_REVERSE'),'REV'); 00157 $theCode.= '<b>'.$LANG->getLL('wiz_changeOrder').':</b><br /><br />'.implode('<br />',$lines); 00158 } 00159 00160 // CSH: 00161 $theCode.= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardsortpages', $GLOBALS['BACK_PATH'],'<br/>|'); 00162 00163 $out=$this->pObj->doc->section($LANG->getLL('wiz_sort'),$theCode,0,1); 00164 return $out; 00165 } 00166 00174 function wiz_linkOrder($title,$order) { 00175 return ' <a href="'.htmlspecialchars('index.php?id='.$GLOBALS['SOBE']->id.'&sortByField='.$order).'" onclick="return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_changeOrder_msg1')).')">'.htmlspecialchars($title).'</a>'; 00176 } 00177 } 00178 00179 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wizard_sortpages/class.tx_wizardsortpages_webfunc_2.php']) { 00180 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wizard_sortpages/class.tx_wizardsortpages_webfunc_2.php']); 00181 } 00182 ?>