Documentation TYPO3 par Ameos

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


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