[TASK] Invalidate autoloader cache in em
[Packages/TYPO3.CMS.git] / typo3 / sysext / impexp / class.tx_impexp_clickmenu.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Adding Import/Export clickmenu item
29 *
30 * Revised for TYPO3 3.6 December/2003 by Kasper Skårhøj
31 * XHTML compliant
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 */
35
36
37
38
39
40
41
42
43
44
45
46
47 /**
48 * Adding Import/Export clickmenu item
49 *
50 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
51 * @package TYPO3
52 * @subpackage tx_impexp
53 */
54 class tx_impexp_clickmenu {
55
56 /**
57 * Processing of clickmenu items
58 *
59 * @param object Reference to parent
60 * @param array Menu items array to modify
61 * @param string Table name
62 * @param integer Uid of the record
63 * @return array Menu item array, returned after modification
64 * @todo Skinning for icons...
65 */
66 function main(&$backRef,$menuItems,$table,$uid) {
67 $localItems=array();
68 if (($backRef->cmLevel && t3lib_div::_GP('subname')=='moreoptions') || ($table==='pages' && $uid==0)) { // Show import/export on second level menu OR root level.
69
70 $LL = $this->includeLL();
71
72 $modUrl = $backRef->backPath.t3lib_extMgm::extRelPath('impexp').'app/index.php';
73 $url = $modUrl . '?tx_impexp[action]=export&id=' . ($table == 'pages' ? $uid : $backRef->rec['pid']);
74 if ($table=='pages') {
75 $url.='&tx_impexp[pagetree][id]='.$uid;
76 $url.='&tx_impexp[pagetree][levels]=0';
77 $url.='&tx_impexp[pagetree][tables][]=_ALL';
78 } else {
79 $url.='&tx_impexp[record][]='.rawurlencode($table.':'.$uid);
80 $url.='&tx_impexp[external_ref][tables][]=_ALL';
81 }
82 $localItems[] = $backRef->linkItem(
83 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export',$LL)),
84 $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-export-t3d')),
85 $backRef->urlRefForCM($url),
86 1 // Disables the item in the top-bar
87 );
88
89 if ($table=='pages') {
90 $url = $modUrl . '?id='. $uid . '&table=' . $table . '&tx_impexp[action]=import';
91 $localItems[] = $backRef->linkItem(
92 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import',$LL)),
93 $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-import-t3d')),
94 $backRef->urlRefForCM($url),
95 1 // Disables the item in the top-bar
96 );
97 }
98 }
99 return array_merge($menuItems,$localItems);
100 }
101
102 /**
103 * Include local lang file and return $LOCAL_LANG array loaded.
104 *
105 * @return array Local lang array
106 */
107 function includeLL() {
108 global $LANG;
109
110 return $LANG->includeLLFile('EXT:impexp/app/locallang.php',FALSE);
111 }
112 }
113
114 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/impexp/class.tx_impexp_clickmenu.php'])) {
115 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/impexp/class.tx_impexp_clickmenu.php']);
116 }
117 ?>