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