Documentation TYPO3 par Ameos

class.tx_version_cm1.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2004-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 *
00017 *  This script is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 *  GNU General Public License for more details.
00021 *
00022 *  This copyright notice MUST APPEAR in all copies of the script!
00023 ***************************************************************/
00054 class tx_version_cm1 {
00055 
00065         function main(&$backRef,$menuItems,$table,$uid) {
00066                 global $BE_USER,$TCA,$LANG;
00067                 
00068                 $localItems = Array();
00069                 if (!$backRef->cmLevel && $uid>0)       {
00070 
00071                                 // Returns directly, because the clicked item was not from the pages table
00072                         if (!$TCA[$table] || !$TCA[$table]['ctrl']['versioningWS'])     return $menuItems;
00073 
00074                                 // Adds the regular item
00075                         $LL = $this->includeLL();
00076 
00077                                 // "Versioning" element added:
00078                         $url = t3lib_extMgm::extRelPath('version').'cm1/index.php?table='.rawurlencode($table).'&uid='.$uid;
00079                         $localItems[] = $backRef->linkItem(
00080                                 $GLOBALS['LANG']->getLLL('title',$LL),
00081                                 $backRef->excludeIcon('<img src="'.$backRef->backPath.t3lib_extMgm::extRelPath('version').'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'),
00082                                 $backRef->urlRefForCM($url),
00083                                 1
00084                         );
00085 
00086                                 // "Send to review" element added:
00087                         $url = t3lib_extMgm::extRelPath('version').'cm1/index.php?id='.($table=='pages'?$uid:$backRef->rec['pid']).'&table='.rawurlencode($table).'&uid='.$uid.'&sendToReview=1';
00088                         $localItems[] = $backRef->linkItem(
00089                                 $GLOBALS['LANG']->getLLL('title_review',$LL),
00090                                 $backRef->excludeIcon('<img src="'.$backRef->backPath.t3lib_extMgm::extRelPath('version').'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'),
00091                                 $backRef->urlRefForCM($url),
00092                                 1
00093                         );
00094 
00095                                 // Find position of "delete" element:
00096                         reset($menuItems);
00097                         $c=0;
00098                         while(list($k)=each($menuItems))        {
00099                                 $c++;
00100                                 if (!strcmp($k,'delete'))       break;
00101                         }
00102                                 // .. subtract two (delete item + divider line)
00103                         $c-=2;
00104                                 // ... and insert the items just before the delete element.
00105                         array_splice(
00106                                 $menuItems,
00107                                 $c,
00108                                 0,
00109                                 $localItems
00110                         );
00111                 }
00112                 return $menuItems;
00113         }
00114 
00120         function includeLL()    {
00121                 global $LANG;
00122 
00123                 return $LANG->includeLLFile('EXT:version/locallang.xml',FALSE);
00124         }
00125 }
00126 
00127 
00128 
00129 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_cm1.php'])    {
00130         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_cm1.php']);
00131 }
00132 ?>


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