TYPO3 CMS  TYPO3_6-2
Clickmenu.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Impexp;
3 
22 class Clickmenu {
23 
35  public function main(&$backRef, $menuItems, $table, $uid) {
36  $localItems = array();
37  // Show import/export on second level menu OR root level.
38  if ($backRef->cmLevel && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
39  $LL = $this->includeLL();
40  $urlParameters = array(
41  'tx_impexp' => array(
42  'action' => 'export'
43  ),
44  'id' => ($table == 'pages' ? $uid : $backRef->rec['pid'])
45  );
46  if ($table == 'pages') {
47  $urlParameters['tx_impexp']['pagetree']['id'] = $uid;
48  $urlParameters['tx_impexp']['pagetree']['levels'] = 0;
49  $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL';
50  } else {
51  $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
52  $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
53  }
54  $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
55  $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);
56  if ($table == 'pages') {
57  $backendUser = $this->getBackendUser();
58  $isEnabledForNonAdmin = $backendUser->getTSConfig('options.impexp.enableImportForNonAdminUser');
59  if ($backendUser->isAdmin() || !empty($isEnabledForNonAdmin['value'])) {
60  $urlParameters = array(
61  'id' => $uid,
62  'table' => $table,
63  'tx_impexp' => array(
64  'action' => 'import'
65  ),
66  );
67  $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
68  $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);
69  }
70  }
71  }
72  return array_merge($menuItems, $localItems);
73  }
74 
81  public function includeLL() {
82  global $LANG;
83  return $LANG->includeLLFile('EXT:impexp/app/locallang.xlf', FALSE);
84  }
85 
89  protected function getBackendUser() {
90  return $GLOBALS['BE_USER'];
91  }
92 }
$uid
Definition: server.php:36
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
main(&$backRef, $menuItems, $table, $uid)
Definition: Clickmenu.php:35
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]