TYPO3 CMS  TYPO3_6-2
VersionClickMenu.php
Go to the documentation of this file.
1 <?php
3 
23 
33  public function main(&$backRef, $menuItems, $table, $uid) {
34  $localItems = array();
35  if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) {
36  // Returns directly, because the clicked item was not from the pages table
37  if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
38  return $menuItems;
39  }
40  // Adds the regular item
41  $LL = $this->includeLL();
42  // "Versioning" element added:
43  $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
44  $localItems[] = $backRef->linkItem(
45  $GLOBALS['LANG']->getLLL('title', $LL),
46  $backRef->excludeIcon('<img src="' . $backRef->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('version') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'),
47  $backRef->urlRefForCM($url),
48  TRUE
49  );
50  // Find position of "delete" element:
51  $c = 0;
52  foreach ($menuItems as $k => $value) {
53  $c++;
54  if ($k === 'delete') {
55  break;
56  }
57  }
58  // .. subtract two (delete item + divider line)
59  $c -= 2;
60  // ... and insert the items just before the delete element.
61  array_splice($menuItems, $c, 0, $localItems);
62  }
63  return $menuItems;
64  }
65 
72  public function includeLL() {
73  return $GLOBALS['LANG']->includeLLFile('EXT:version/locallang.xlf', FALSE);
74  }
75 
76 }
main(&$backRef, $menuItems, $table, $uid)
$uid
Definition: server.php:36
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]