Documentation TYPO3 par Ameos

class.tx_version_cm1.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 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 *
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 ***************************************************************/
00031 class tx_version_cm1 {
00032         function main(&$backRef,$menuItems,$table,$uid) {
00033                 global $BE_USER,$TCA,$LANG;
00034 
00035                 $localItems = Array();
00036                 if (!$backRef->cmLevel) {
00037 
00038                                 // Returns directly, because the clicked item was not from the pages table
00039                         if (!$TCA[$table] && $TCA[$table]['ctrl']['versioning'])        return $menuItems;
00040 
00041                                 // Adds the regular item:
00042                         $LL = $this->includeLL();
00043 
00044                                 // Repeat this (below) for as many items you want to add!
00045                                 // Remember to add entries in the localconf.php file for additional titles.
00046                         $url = t3lib_extMgm::extRelPath("version")."cm1/index.php?table=".rawurlencode($table)."&uid=".$uid;
00047                         $localItems[] = $backRef->linkItem(
00048                                 $GLOBALS["LANG"]->getLLL("cm1_title",$LL),
00049                                 $backRef->excludeIcon('<img src="'.$backRef->backPath.t3lib_extMgm::extRelPath("version").'cm1/cm_icon.gif" width="15" height="12" border=0 align=top>'),
00050                                 $backRef->urlRefForCM($url),
00051                                 1       // Disables the item in the top-bar. Set this to zero if you with the item to appear in the top bar!
00052                         );
00053 
00054 
00055 
00056                                 // Find position of "delete" element:
00057                         reset($menuItems);
00058                         $c=0;
00059                         while(list($k)=each($menuItems))        {
00060                                 $c++;
00061                                 if (!strcmp($k,"delete"))       break;
00062                         }
00063                                 // .. subtract two (delete item + divider line)
00064                         $c-=2;
00065                                 // ... and insert the items just before the delete element.
00066                         array_splice(
00067                                 $menuItems,
00068                                 $c,
00069                                 0,
00070                                 $localItems
00071                         );
00072                 }
00073                 return $menuItems;
00074         }
00075 
00079         function includeLL()    {
00080                 include(t3lib_extMgm::extPath("version")."locallang.php");
00081                 return $LOCAL_LANG;
00082         }
00083 }
00084 
00085 
00086 
00087 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/version/class.tx_version_cm1.php"])    {
00088         include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/version/class.tx_version_cm1.php"]);
00089 }
00090 
00091 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6