本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::isTableLocalizable方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::isTableLocalizable方法的具体用法?PHP BackendUtility::isTableLocalizable怎么用?PHP BackendUtility::isTableLocalizable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::isTableLocalizable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isLocalizationEnabled
/**
* @return bool
*/
protected function isLocalizationEnabled()
{
return BackendUtility::isTableLocalizable($this->tableName);
}
示例2: checkLocalization
/**
* Checks workspace localization integrity of a single elements.
* If current record is a localization and its localization parent
* is new in this workspace (has only a placeholder record in live),
* then boths (localization and localization parent) should be published.
*
* @param \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $element
* @return void
*/
protected function checkLocalization(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $element)
{
$table = $element->getTable();
if (BackendUtility::isTableLocalizable($table)) {
$languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
$languageParentField = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
$versionRow = $element->getVersionRecord()->getRow();
// If element is a localization:
if ($versionRow[$languageField] > 0) {
// Get localization parent from live workspace:
$languageParentRecord = BackendUtility::getRecord($table, $versionRow[$languageParentField], 'uid,t3ver_state');
// If localization parent is a "new placeholder" record:
if (VersionState::cast($languageParentRecord['t3ver_state'])->equals(VersionState::NEW_PLACEHOLDER)) {
$title = BackendUtility::getRecordTitle($table, $versionRow);
// Add warning for current versionized record:
$this->addIssue($element->getLiveRecord()->getIdentifier(), self::STATUS_Warning, sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('integrity.dependsOnDefaultLanguageRecord', 'workspaces'), $title));
// Add info for related localization parent record:
$this->addIssue($table . ':' . $languageParentRecord['uid'], self::STATUS_Info, sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('integrity.isDefaultLanguageRecord', 'workspaces'), $title));
}
}
}
}
示例3: deleteL10nOverlayRecords
/**
* Find l10n-overlay records and perform the requested delete action for these records.
*
* @param string $table Record Table
* @param string $uid Record UID
* @return void
*/
public function deleteL10nOverlayRecords($table, $uid)
{
// Check whether table can be localized or has a different table defined to store localizations:
if (!BackendUtility::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']) || !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
return;
}
$where = '';
if (isset($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
$where = ' AND t3ver_oid=0';
}
$l10nRecords = BackendUtility::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid, $where);
if (is_array($l10nRecords)) {
foreach ($l10nRecords as $record) {
// Ignore workspace delete placeholders. Those records have been marked for
// deletion before - deleting them again in a workspace would revert that state.
if ($this->BE_USER->workspace > 0 && BackendUtility::isTableWorkspaceEnabled($table)) {
BackendUtility::workspaceOL($table, $record);
if (VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
continue;
}
}
$this->deleteAction($table, (int) $record['t3ver_oid'] > 0 ? (int) $record['t3ver_oid'] : (int) $record['uid']);
}
}
}
示例4: buildTcaWhereClause
/**
* Builds the WHERE clauses of the Index Queue initialization query based
* on TCA information for the type to be initialized.
*
* @return string Conditions to only add indexable items to the Index Queue
*/
protected function buildTcaWhereClause()
{
$tcaWhereClause = '';
$conditions = array();
if (isset($GLOBALS['TCA'][$this->type]['ctrl']['delete'])) {
$conditions['delete'] = $GLOBALS['TCA'][$this->type]['ctrl']['delete'] . ' = 0';
}
if (isset($GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['disabled'])) {
$conditions['disabled'] = $GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['disabled'] . ' = 0';
}
if (isset($GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['endtime'])) {
// only include records with a future endtime or default value (0)
$endTimeFieldName = $GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['endtime'];
$conditions['endtime'] = '(' . $endTimeFieldName . ' > ' . time() . ' OR ' . $endTimeFieldName . ' = 0)';
}
if (BackendUtility::isTableLocalizable($this->type)) {
$conditions['languageField'] = array($GLOBALS['TCA'][$this->type]['ctrl']['languageField'] . ' = 0', $GLOBALS['TCA'][$this->type]['ctrl']['languageField'] . ' = -1');
if (isset($GLOBALS['TCA'][$this->type]['ctrl']['transOrigPointerField'])) {
$conditions['languageField'][] = $GLOBALS['TCA'][$this->type]['ctrl']['transOrigPointerField'] . ' = 0';
// translations without original language source
}
$conditions['languageField'] = '(' . implode(' OR ', $conditions['languageField']) . ')';
}
if (!empty($GLOBALS['TCA'][$this->type]['ctrl']['versioningWS'])) {
// versioning is enabled for this table: exclude draft workspace records
$conditions['versioningWS'] = 'pid != -1';
}
if (count($conditions)) {
$tcaWhereClause = ' AND ' . implode(' AND ', $conditions);
}
return $tcaWhereClause;
}
示例5: getLocalizations
/**
* Gets all localizations of the current record.
*
* @param string $table The table
* @param array $parentRec The current record
* @param string $bgColClass Class for the background color of a column
* @param string $pad Pad reference
* @return string HTML table rows
*/
public function getLocalizations($table, $parentRec, $bgColClass, $pad)
{
$lines = array();
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
if ($table != 'pages' && BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
$where = array();
$where[] = $tcaCtrl['transOrigPointerField'] . '=' . (int) $parentRec['uid'];
$where[] = $tcaCtrl['languageField'] . '<>0';
if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
$where[] = $tcaCtrl['delete'] . '=0';
}
if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
$where[] = 't3ver_wsid=' . $parentRec['t3ver_wsid'];
}
$rows = $this->getDatabaseConnection()->exec_SELECTgetRows('*', $table, implode(' AND ', $where));
if (is_array($rows)) {
$modeData = '';
if ($pad == 'normal') {
$mode = $this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut';
$modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
}
foreach ($rows as $rec) {
$lines[] = '
<tr>
<td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
<td nowrap="nowrap" class="col-control"></td>
</tr>';
}
}
}
return implode('', $lines);
}
示例6: printDBClickMenu
/**
* Make 1st level clickmenu:
*
* @param string $table Table name
* @param integer $uid UID for the current record.
* @return string HTML content
* @todo Define visibility
*/
public function printDBClickMenu($table, $uid)
{
// Get record:
$this->rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$root = 0;
$DBmount = FALSE;
// Rootlevel
if ($table == 'pages' && !strcmp($uid, '0')) {
$root = 1;
}
// DB mount
if ($table == 'pages' && in_array($uid, $GLOBALS['BE_USER']->returnWebmounts())) {
$DBmount = TRUE;
}
// Used to hide cut,copy icons for l10n-records
$l10nOverlay = FALSE;
// Should only be performed for overlay-records within the same table
if (\TYPO3\CMS\Backend\Utility\BackendUtility::isTableLocalizable($table) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
$l10nOverlay = intval($this->rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]) != 0;
}
// If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
if (is_array($this->rec) || $root) {
// Get permissions
$lCP = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $table == 'pages' ? $this->rec['uid'] : $this->rec['pid']));
// View
if (!in_array('view', $this->disabledItems)) {
if ($table == 'pages') {
$menuItems['view'] = $this->DB_view($uid);
}
if ($table == $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) {
$ws_rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $this->rec['uid']);
$menuItems['view'] = $this->DB_view($ws_rec['pid']);
}
}
// Edit:
if (!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
if (!in_array('edit', $this->disabledItems)) {
$menuItems['edit'] = $this->DB_edit($table, $uid);
}
$this->editOK = 1;
}
// New:
if (!in_array('new', $this->disabledItems) && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'new')) {
$menuItems['new'] = $this->DB_new($table, $uid);
}
// Info:
if (!in_array('info', $this->disabledItems) && !$root) {
$menuItems['info'] = $this->DB_info($table, $uid);
}
$menuItems['spacer1'] = 'spacer';
// Copy:
if (!in_array('copy', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) {
$menuItems['copy'] = $this->DB_copycut($table, $uid, 'copy');
}
// Cut:
if (!in_array('cut', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) {
$menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
}
// Paste:
$elFromAllTables = count($this->clipObj->elFromTable(''));
if (!in_array('paste', $this->disabledItems) && $elFromAllTables) {
$selItem = $this->clipObj->getSelectedRecord();
$elInfo = array(GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $GLOBALS['BE_USER']->uc['titleLen']), $root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen']), $this->clipObj->currentMode());
if ($table == 'pages' && $lCP & 8) {
if ($elFromAllTables) {
$menuItems['pasteinto'] = $this->DB_paste('', $uid, 'into', $elInfo);
}
}
$elFromTable = count($this->clipObj->elFromTable($table));
if (!$root && !$DBmount && $elFromTable && $GLOBALS['TCA'][$table]['ctrl']['sortby']) {
$menuItems['pasteafter'] = $this->DB_paste($table, -$uid, 'after', $elInfo);
}
}
// Delete:
$elInfo = array(GeneralUtility::fixed_lgd_cs(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen']));
if (!in_array('delete', $this->disabledItems) && !$root && !$DBmount && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'delete')) {
$menuItems['spacer2'] = 'spacer';
$menuItems['delete'] = $this->DB_delete($table, $uid, $elInfo);
}
if (!in_array('history', $this->disabledItems)) {
$menuItems['history'] = $this->DB_history($table, $uid, $elInfo);
}
}
// Adding external elements to the menuItems array
$menuItems = $this->processingByExtClassArray($menuItems, $table, $uid);
// Processing by external functions?
$menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
if (!is_array($this->rec)) {
$this->rec = array();
}
// Return the printed elements:
//.........这里部分代码省略.........
示例7: getLanguageValue
/**
* Gets the used language value (sys_language.uid) of
* a given database record.
*
* @param string $table Name of the table
* @param array $record Database record
* @return integer
*/
protected function getLanguageValue($table, array $record)
{
$languageValue = 0;
if (BackendUtility::isTableLocalizable($table)) {
$languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
if (!empty($record[$languageField])) {
$languageValue = $record[$languageField];
}
}
return $languageValue;
}
示例8: deleteL10nOverlayRecords
/**
* Find l10n-overlay records and perform the requested delete action for these records.
*
* @param string $table Record Table
* @param string $uid Record UID
* @return void
* @todo Define visibility
*/
public function deleteL10nOverlayRecords($table, $uid)
{
// Check whether table can be localized or has a different table defined to store localizations:
if (!\TYPO3\CMS\Backend\Utility\BackendUtility::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']) || !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
return;
}
$where = '';
if (isset($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
$where = ' AND t3ver_oid=0';
}
$l10nRecords = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid, $where);
if (is_array($l10nRecords)) {
foreach ($l10nRecords as $record) {
$this->deleteAction($table, intval($record['t3ver_oid']) > 0 ? intval($record['t3ver_oid']) : intval($record['uid']));
}
}
}
示例9: getLocalizations
/**
* Gets all localizations of the current record.
*
* @param string $table The table
* @param array $parentRec The current record
* @param string $bgColClass Class for the background color of a column
* @param string $pad Pad reference
* @return string HTML table rows
*/
public function getLocalizations($table, $parentRec, $bgColClass, $pad)
{
$lines = array();
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
if ($table != 'pages' && BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getQueryContext()->setContext(QueryContextType::UNRESTRICTED);
$queryBuilder->select('*')->from($table)->where($queryBuilder->expr()->eq($tcaCtrl['transOrigPointerField'], (int) $parentRec['uid']))->andWhere($queryBuilder->expr()->neq($tcaCtrl['languageField'], 0));
if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
$queryBuilder->andWhere($queryBuilder->expr()->eq($tcaCtrl['delete'], 0));
}
if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
$queryBuilder->andWhere($queryBuilder->expr()->eq('t3ver_wsid', $parentRec['t3ver_wsid']));
}
$rows = $queryBuilder->execute()->fetchAll();
if (is_array($rows)) {
$modeData = '';
if ($pad == 'normal') {
$mode = $this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut';
$modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
}
foreach ($rows as $rec) {
$lines[] = '
<tr>
<td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
<td nowrap="nowrap" class="col-control"></td>
</tr>';
}
}
}
return implode('', $lines);
}
示例10: isLanguageAccessibleForCurrentUser
/**
* Check current be users language access on given record.
*
* @param string $table Name of the table
* @param array $record Record row to be checked
* @return boolean
*/
protected function isLanguageAccessibleForCurrentUser($table, array $record)
{
$languageUid = 0;
if (BackendUtility::isTableLocalizable($table)) {
$languageUid = $record[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
} else {
return TRUE;
}
return $GLOBALS['BE_USER']->checkLanguageAccess($languageUid);
}
示例11: printDBClickMenu
/**
* Make 1st level clickmenu:
*
* @param string $table Table name
* @param integer $uid UID for the current record.
* @return string HTML content
* @todo Define visibility
*/
public function printDBClickMenu($table, $uid)
{
$uid = (int) $uid;
// Get record:
$this->rec = BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$root = 0;
$DBmount = FALSE;
// Rootlevel
if ($table === 'pages' && $uid === 0) {
$root = 1;
}
// DB mount
if ($table === 'pages' && in_array($uid, $GLOBALS['BE_USER']->returnWebmounts())) {
$DBmount = TRUE;
}
// Used to hide cut,copy icons for l10n-records
$l10nOverlay = FALSE;
// Should only be performed for overlay-records within the same table
if (BackendUtility::isTableLocalizable($table) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
$l10nOverlay = (int) $this->rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0;
}
// If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
if (is_array($this->rec) || $root) {
// Get permissions
$lCP = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $table == 'pages' ? $this->rec['uid'] : $this->rec['pid']));
// View
if (!in_array('view', $this->disabledItems)) {
if ($table === 'pages') {
$menuItems['view'] = $this->DB_view($uid);
}
if ($table === 'tt_content') {
$ws_rec = BackendUtility::getRecordWSOL($table, $this->rec['uid']);
$menuItems['view'] = $this->DB_view($ws_rec['pid']);
}
}
// Edit:
if (!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
if (!in_array('edit', $this->disabledItems)) {
$menuItems['edit'] = $this->DB_edit($table, $uid);
}
$this->editOK = 1;
}
// New:
if (!in_array('new', $this->disabledItems) && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'new')) {
$menuItems['new'] = $this->DB_new($table, $uid);
}
// Info:
if (!in_array('info', $this->disabledItems) && !$root) {
$menuItems['info'] = $this->DB_info($table, $uid);
}
$menuItems['spacer1'] = 'spacer';
// Copy:
if (!in_array('copy', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) {
$menuItems['copy'] = $this->DB_copycut($table, $uid, 'copy');
}
// Cut:
if (!in_array('cut', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) {
$menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
}
// Paste:
$elFromAllTables = count($this->clipObj->elFromTable(''));
if (!in_array('paste', $this->disabledItems) && $elFromAllTables) {
$selItem = $this->clipObj->getSelectedRecord();
$elInfo = array(GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $GLOBALS['BE_USER']->uc['titleLen']), $root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen']), $this->clipObj->currentMode());
if ($table === 'pages' && $lCP & 8) {
if ($elFromAllTables) {
$menuItems['pasteinto'] = $this->DB_paste('', $uid, 'into', $elInfo);
}
}
$elFromTable = count($this->clipObj->elFromTable($table));
if (!$root && !$DBmount && $elFromTable && $GLOBALS['TCA'][$table]['ctrl']['sortby']) {
$menuItems['pasteafter'] = $this->DB_paste($table, -$uid, 'after', $elInfo);
}
}
$subname = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname');
$localItems = array();
if (!$this->cmLevel && !in_array('moreoptions', $this->disabledItems, TRUE)) {
// Creating menu items here:
if ($this->editOK) {
$localItems[] = 'spacer';
$localItems['moreoptions'] = $this->linkItem($this->label('more'), $this->excludeIcon(''), 'top.loadTopMenu(\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript() . '&cmLevel=1&subname=moreoptions\');return false;', FALSE, TRUE);
$menuItemHideUnhideAllowed = FALSE;
$hiddenField = '';
// Check if column for disabled is defined
if (isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])) {
$hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
if ($hiddenField !== '' && !empty($GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude']) && $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField)) {
$menuItemHideUnhideAllowed = TRUE;
}
}
if ($menuItemHideUnhideAllowed && !in_array('hide', $this->disabledItems, TRUE)) {
//.........这里部分代码省略.........
示例12: main
/**
* Changes the clickmenu Items for the Commerce Records
*
* @param ClickMenu $clickMenu Clickenu object
* @param array $menuItems Current menu Items
* @param string $table Table
* @param int $uid Uid
*
* @return array Menu Items Array
*/
public function main(ClickMenu &$clickMenu, array $menuItems, $table, $uid)
{
// Only modify the menu Items if we have the correct table
if (!in_array($table, $this->commerceTables)) {
return $menuItems;
}
$backendUser = $this->getBackendUser();
// Check for List allow
if (!$backendUser->check('tables_select', $table)) {
if (TYPO3_DLOG) {
GeneralUtility::devLog('Clickmenu not allowed for user.', COMMERCE_EXTKEY, 1);
}
return '';
}
// Configure the parent clickmenu
$this->clickMenu = $clickMenu;
$this->ajax = $this->clickMenu->ajax;
$this->listFrame = $this->clickMenu->listFrame;
$this->alwaysContentFrame = $this->clickMenu->alwaysContentFrame;
$this->clipObj = $this->clickMenu->clipObj;
$this->disabledItems = $this->clickMenu->disabledItems;
$this->clickMenu->backPath = $this->backPath;
$this->additionalParameter = GeneralUtility::explodeUrl2Array(urldecode(GeneralUtility::_GET('addParams')));
$this->newWizardAddParams = '&parentCategory=' . $this->additionalParameter['parentCategory'];
$this->rec = BackendUtility::getRecordWSOL($table, $this->additionalParameter['control[' . $table . '][uid]']);
// Initialize the rights-variables
$rights = array('delete' => FALSE, 'edit' => FALSE, 'new' => FALSE, 'editLock' => FALSE, 'DBmount' => FALSE, 'copy' => FALSE, 'paste' => FALSE, 'overwrite' => FALSE, 'version' => FALSE, 'review' => FALSE, 'l10nOverlay' => FALSE, 'root' => 0, 'copyType' => 'after');
// used to hide cut,copy icons for l10n-records
// should only be performed for overlay-records within the same table
if (BackendUtility::isTableLocalizable($table) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
$rights['l10nOverlay'] = intval($this->rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]) != 0;
}
// get rights based on the table
switch ($table) {
case 'tx_commerce_categories':
$rights = $this->calculateCategoryRights($this->rec['uid'], $rights);
break;
case 'tx_commerce_products':
$rights = $this->calculateProductRights($this->rec['uid'], $rights);
break;
case 'tx_commerce_articles':
$rights = $this->calculateArticleRights($this->rec['uid'], $rights);
break;
default:
}
$menuItems = array();
// If record found, go ahead and fill the $menuItems array which will contain
// data for the elements to render.
if (is_array($this->rec)) {
// Edit:
if (!$rights['root'] && !$rights['editLock'] && $rights['edit']) {
if (!in_array('hide', $this->disabledItems) && is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']) && $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']) {
$menuItems['hide'] = $this->DB_hideUnhide($table, $this->rec, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']);
}
if (!in_array('edit', $this->disabledItems)) {
$menuItems['edit'] = $this->DB_edit($table, $uid);
}
$this->clickMenu->editOK = 1;
}
// fix: always give the UID of the products page to create any commerce object
if (!in_array('new', $this->disabledItems) && $rights['new']) {
$menuItems['new'] = $this->DB_new($table, $uid);
}
// Info:
if (!in_array('info', $this->disabledItems) && !$rights['root']) {
$menuItems['info'] = $this->DB_info($table, $uid);
}
$menuItems['spacer1'] = 'spacer';
// Cut not included
// Copy:
if (!in_array('copy', $this->disabledItems) && !$rights['root'] && !$rights['DBmount'] && !$rights['l10nOverlay'] && $rights['copy']) {
$clipboardUid = $uid;
if ($this->additionalParameter['category']) {
$clipboardUid .= '|' . $this->additionalParameter['category'];
}
$menuItems['copy'] = $this->DB_copycut($table, $clipboardUid, 'copy');
}
// Cut:
if (!in_array('cut', $this->disabledItems) && !$rights['root'] && !$rights['DBmount'] && !$rights['l10nOverlay'] && $rights['copy']) {
$menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
}
// Paste
$elFromAllTables = count($this->clickMenu->clipObj->elFromTable(''));
if (!in_array('paste', $this->disabledItems) && $elFromAllTables && $rights['paste']) {
$selItem = $this->clipObj->getSelectedRecord();
$elInfo = array(GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $backendUser->uc['titleLen']), $rights['root'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $backendUser->uc['titleLen']), $this->clipObj->currentMode());
$pasteUid = $uid;
if ($this->additionalParameter['category']) {
$pasteUid .= '|' . $this->additionalParameter['category'];
}
//.........这里部分代码省略.........
示例13: printDBClickMenu
/**
* Make 1st level clickmenu:
*
* @param string $table Table name
* @param int $uid UID for the current record.
* @return string HTML content
*/
public function printDBClickMenu($table, $uid)
{
$uid = (int) $uid;
// Get record:
$this->rec = BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$root = 0;
$DBmount = false;
// Rootlevel
if ($table === 'pages' && $uid === 0) {
$root = 1;
}
// DB mount
if ($table === 'pages' && in_array($uid, $this->backendUser->returnWebmounts())) {
$DBmount = true;
}
// Used to hide cut,copy icons for l10n-records
$l10nOverlay = false;
// Should only be performed for overlay-records within the same table
if (BackendUtility::isTableLocalizable($table) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
$l10nOverlay = (int) $this->rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0;
}
// If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
if (is_array($this->rec) || $root) {
// Get permissions
$lCP = $this->backendUser->calcPerms(BackendUtility::getRecord('pages', $table === 'pages' ? (int) $this->rec['uid'] : (int) $this->rec['pid']));
// View
if (!in_array('view', $this->disabledItems, true)) {
if ($table === 'pages') {
$menuItems['view'] = $this->DB_view($uid);
}
if ($table === 'tt_content') {
$ws_rec = BackendUtility::getRecordWSOL($table, (int) $this->rec['uid']);
$menuItems['view'] = $this->DB_view((int) $ws_rec['pid']);
}
}
// Edit:
if (!$root && ($this->backendUser->isPSet($lCP, $table, 'edit') || $this->backendUser->isPSet($lCP, $table, 'editcontent'))) {
if (!in_array('edit', $this->disabledItems, true)) {
$menuItems['edit'] = $this->DB_edit($table, $uid);
}
$this->editOK = true;
}
// New:
if (!in_array('new', $this->disabledItems, true) && $this->backendUser->isPSet($lCP, $table, 'new')) {
$menuItems['new'] = $this->DB_new($table, $uid);
}
// Info:
if (!in_array('info', $this->disabledItems, true) && !$root) {
$menuItems['info'] = $this->DB_info($table, $uid);
}
$menuItems['spacer1'] = 'spacer';
// Copy:
if (!in_array('copy', $this->disabledItems, true) && !$root && !$DBmount && !$l10nOverlay) {
$menuItems['copy'] = $this->DB_copycut($table, $uid, 'copy');
}
// Cut:
if (!in_array('cut', $this->disabledItems, true) && !$root && !$DBmount && !$l10nOverlay) {
$menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
}
// Paste:
$elFromAllTables = count($this->clipObj->elFromTable(''));
if (!in_array('paste', $this->disabledItems, true) && $elFromAllTables) {
$selItem = $this->clipObj->getSelectedRecord();
$elInfo = array(GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $this->backendUser->uc['titleLen']), $root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $this->backendUser->uc['titleLen']), $this->clipObj->currentMode());
if ($table === 'pages' && $lCP & Permission::PAGE_NEW) {
if ($elFromAllTables) {
$menuItems['pasteinto'] = $this->DB_paste('', $uid, 'into', $elInfo);
}
}
$elFromTable = count($this->clipObj->elFromTable($table));
if (!$root && !$DBmount && $elFromTable && $GLOBALS['TCA'][$table]['ctrl']['sortby']) {
$menuItems['pasteafter'] = $this->DB_paste($table, -$uid, 'after', $elInfo);
}
}
// Delete:
$elInfo = array(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $this->backendUser->uc['titleLen']));
if (!in_array('delete', $this->disabledItems, true) && !$root && !$DBmount && $this->backendUser->isPSet($lCP, $table, 'delete')) {
$menuItems['spacer2'] = 'spacer';
$menuItems['delete'] = $this->DB_delete($table, $uid, $elInfo);
}
if (!in_array('history', $this->disabledItems, true)) {
$menuItems['history'] = $this->DB_history($table, $uid);
}
$localItems = array();
if (!$this->cmLevel && !in_array('moreoptions', $this->disabledItems, true)) {
// Creating menu items here:
if ($this->editOK) {
$localItems['spacer3'] = 'spacer';
$localItems['moreoptions'] = $this->linkItem($this->label('more'), '', 'TYPO3.ClickMenu.fetch(' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript() . '&cmLevel=1&subname=moreoptions') . ');return false;', false, true);
$menuItemHideUnhideAllowed = false;
$hiddenField = '';
// Check if column for disabled is defined
//.........这里部分代码省略.........
示例14: checkFullLanguagesAccess
/**
* Check if user has access to all existing localizations for a certain record
*
* @param string $table The table
* @param array $record The current record
* @return boolean
* @todo Define visibility
*/
public function checkFullLanguagesAccess($table, $record)
{
$recordLocalizationAccess = $this->checkLanguageAccess(0);
if ($recordLocalizationAccess && (BackendUtility::isTableLocalizable($table) || isset($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']))) {
if (isset($GLOBALS['TCA'][$table]['ctrl']['transForeignTable'])) {
$l10nTable = $GLOBALS['TCA'][$table]['ctrl']['transForeignTable'];
$pointerField = $GLOBALS['TCA'][$l10nTable]['ctrl']['transOrigPointerField'];
$pointerValue = $record['uid'];
} else {
$l10nTable = $table;
$pointerField = $GLOBALS['TCA'][$l10nTable]['ctrl']['transOrigPointerField'];
$pointerValue = $record[$pointerField] > 0 ? $record[$pointerField] : $record['uid'];
}
$recordLocalizations = BackendUtility::getRecordsByField($l10nTable, $pointerField, $pointerValue, '', '', '', '1');
if (is_array($recordLocalizations)) {
foreach ($recordLocalizations as $localization) {
$recordLocalizationAccess = $recordLocalizationAccess && $this->checkLanguageAccess($localization[$GLOBALS['TCA'][$l10nTable]['ctrl']['languageField']]);
if (!$recordLocalizationAccess) {
break;
}
}
}
}
return $recordLocalizationAccess;
}
示例15: getLocalizations
/**
* Gets all localizations of the current record.
*
* @param string $table The table
* @param array $parentRec The current record
* @param string $bgColClass Class for the background color of a column
* @param string $pad Pad reference
* @return string HTML table rows
* @todo Define visibility
*/
public function getLocalizations($table, $parentRec, $bgColClass, $pad)
{
$lines = array();
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
if ($table != 'pages' && \TYPO3\CMS\Backend\Utility\BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
$where = array();
$where[] = $tcaCtrl['transOrigPointerField'] . '=' . intval($parentRec['uid']);
$where[] = $tcaCtrl['languageField'] . '<>0';
if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
$where[] = $tcaCtrl['delete'] . '=0';
}
if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
$where[] = 't3ver_wsid=' . $parentRec['t3ver_wsid'];
}
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', $table, implode(' AND ', $where));
if (is_array($rows)) {
$modeData = '';
if ($pad == 'normal') {
$mode = $this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut';
$modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
}
foreach ($rows as $rec) {
$lines[] = '
<tr>
<td class="' . $bgColClass . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin-left: 38px;')) . '</td>
<td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])) . $modeData . ' </td>
<td class="' . $bgColClass . '" align="center" nowrap="nowrap"> </td>
</tr>';
}
}
}
return implode('', $lines);
}