[CLEANUP] Improve the @param/@return/@var PHPDoc
[Packages/TYPO3.CMS.git] / typo3 / sysext / impexp / Classes / Clickmenu.php
1 <?php
2 namespace TYPO3\CMS\Impexp;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Adding Import/Export clickmenu item
19 *
20 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
21 */
22 class Clickmenu {
23
24 /**
25 * Processing of clickmenu items
26 *
27 * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent
28 * @param array $menuItems Menu items array to modify
29 * @param string $table Table name
30 * @param int $uid Uid of the record
31 * @return array Menu item array, returned after modification
32 * @todo Skinning for icons...
33 */
34 public function main(&$backRef, $menuItems, $table, $uid) {
35 $localItems = array();
36 // Show import/export on second level menu OR root level.
37 if ($backRef->cmLevel && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
38 $LL = $this->includeLL();
39 $urlParameters = array(
40 'tx_impexp' => array(
41 'action' => 'export'
42 ),
43 'id' => ($table == 'pages' ? $uid : $backRef->rec['pid'])
44 );
45 if ($table == 'pages') {
46 $urlParameters['tx_impexp']['pagetree']['id'] = $uid;
47 $urlParameters['tx_impexp']['pagetree']['levels'] = 0;
48 $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL';
49 } else {
50 $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
51 $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
52 }
53 $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
54 $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-export-t3d')), $backRef->urlRefForCM($url), 1);
55 if ($table == 'pages') {
56 $urlParameters = array(
57 'id' => $uid,
58 'table' => $table,
59 'tx_impexp' => array(
60 'action' => 'import'
61 ),
62 );
63 $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
64 $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-import-t3d')), $backRef->urlRefForCM($url), 1);
65 }
66 }
67 return array_merge($menuItems, $localItems);
68 }
69
70 /**
71 * Include local lang file and return $LOCAL_LANG array loaded.
72 *
73 * @return array Local lang array
74 */
75 public function includeLL() {
76 return $GLOBALS['LANG']->includeLLFile('EXT:impexp/app/locallang.xlf', FALSE);
77 }
78
79 }