本文整理汇总了PHP中TYPO3\CMS\Core\Authentication\BackendUserAuthentication::returnWebmounts方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUserAuthentication::returnWebmounts方法的具体用法?PHP BackendUserAuthentication::returnWebmounts怎么用?PHP BackendUserAuthentication::returnWebmounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Authentication\BackendUserAuthentication
的用法示例。
在下文中一共展示了BackendUserAuthentication::returnWebmounts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
//.........这里部分代码省略.........
示例2: makeValueList
//.........这里部分代码省略.........
$useAltSelectLabels = 0;
$tablePrefix = '';
$labelFieldSelect = [];
foreach ($from_table_Arr as $from_table) {
if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) {
$tablePrefix = $from_table . '_';
}
$counter = 1;
if (is_array($GLOBALS['TCA'][$from_table])) {
$labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
$altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
$items = $GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'];
foreach ($items as $labelArray) {
if (substr($labelArray[0], 0, 4) == 'LLL:') {
$labelFieldSelect[$labelArray[1]] = $this->languageService->sL($labelArray[0]);
} else {
$labelFieldSelect[$labelArray[1]] = $labelArray[0];
}
}
$useSelectLabels = 1;
}
if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
$items = $GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'];
foreach ($items as $altLabelArray) {
if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
$altLabelFieldSelect[$altLabelArray[1]] = $this->languageService->sL($altLabelArray[0]);
} else {
$altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0];
}
}
$useAltSelectLabels = 1;
}
if (!$this->tableArray[$from_table]) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($from_table);
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$selectFields = ['uid', $labelField];
if ($altLabelField) {
$selectFields[] = $altLabelField;
}
$queryBuilder->select(...$selectFields)->from($from_table)->orderBy('uid');
if (!$this->backendUserAuthentication->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
$webMounts = $this->backendUserAuthentication->returnWebmounts();
$perms_clause = $this->backendUserAuthentication->getPagePermsClause(1);
$webMountPageTree = '';
$webMountPageTreePrefix = '';
foreach ($webMounts as $webMount) {
if ($webMountPageTree) {
$webMountPageTreePrefix = ',';
}
$webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($webMount, 999, $begin = 0, $perms_clause);
}
if ($from_table === 'pages') {
$queryBuilder->where(QueryHelper::stripLogicalOperatorPrefix($perms_clause), $queryBuilder->expr()->in('uid', $queryBuilder->createNamedParameter(GeneralUtility::intExplode(',', $webMountPageTree), Connection::PARAM_INT_ARRAY)));
} else {
$queryBuilder->where($queryBuilder->expr()->in('pid', $queryBuilder->createNamedParameter(GeneralUtility::intExplode(',', $webMountPageTree), Connection::PARAM_INT_ARRAY)));
}
}
$statement = $queryBuilder->execute();
$this->tableArray[$from_table] = [];
while ($row = $statement->fetch()) {
$this->tableArray[$from_table][] = $row;
}
}
foreach ($this->tableArray[$from_table] as $key => $val) {
$GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'];
$prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] ';
if (GeneralUtility::inList($fieldValue, $tablePrefix . $val['uid']) || $fieldValue == $tablePrefix . $val['uid']) {
if ($useSelectLabels) {
if (!$out) {
$out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
}
} elseif ($val[$labelField]) {
if (!$out) {
$out = htmlspecialchars($prefixString . $val[$labelField]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $val[$labelField]);
}
} elseif ($useAltSelectLabels) {
if (!$out) {
$out = htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
}
} else {
if (!$out) {
$out = htmlspecialchars($prefixString . $val[$altLabelField]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $val[$altLabelField]);
}
}
}
}
}
}
}
return $out;
}
示例3: makeValueList
//.........这里部分代码省略.........
$labelFieldSelect = [];
foreach ($from_table_Arr as $from_table) {
if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) {
$tablePrefix = $from_table . '_';
}
$counter = 1;
if (is_array($GLOBALS['TCA'][$from_table])) {
$labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
$altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
$items = $GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'];
foreach ($items as $labelArray) {
if (substr($labelArray[0], 0, 4) == 'LLL:') {
$labelFieldSelect[$labelArray[1]] = $this->languageService->sL($labelArray[0]);
} else {
$labelFieldSelect[$labelArray[1]] = $labelArray[0];
}
}
$useSelectLabels = 1;
}
if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
$items = $GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'];
foreach ($items as $altLabelArray) {
if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
$altLabelFieldSelect[$altLabelArray[1]] = $this->languageService->sL($altLabelArray[0]);
} else {
$altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0];
}
}
$useAltSelectLabels = 1;
}
$altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : '';
$select_fields = 'uid,' . $labelField . $altLabelFieldSelect;
if (!$this->backendUserAuthentication->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
$webMounts = $this->backendUserAuthentication->returnWebmounts();
$perms_clause = $this->backendUserAuthentication->getPagePermsClause(1);
$webMountPageTree = '';
$webMountPageTreePrefix = '';
foreach ($webMounts as $key => $val) {
if ($webMountPageTree) {
$webMountPageTreePrefix = ',';
}
$webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause);
}
if ($from_table == 'pages') {
$where_clause = 'uid IN (' . $webMountPageTree . ') ' . BackendUtility::deleteClause($from_table) . ' AND ' . $perms_clause;
} else {
$where_clause = 'pid IN (' . $webMountPageTree . ') ' . BackendUtility::deleteClause($from_table);
}
} else {
$where_clause = 'uid' . BackendUtility::deleteClause($from_table);
}
$orderBy = 'uid';
$res = null;
if (!$this->tableArray[$from_table]) {
$res = $this->databaseConnection->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy);
$this->tableArray[$from_table] = array();
}
if ($res) {
while ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
$this->tableArray[$from_table][] = $row;
}
$this->databaseConnection->sql_free_result($res);
}
foreach ($this->tableArray[$from_table] as $key => $val) {
$GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'];
$prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] ';
if (GeneralUtility::inList($fieldValue, $tablePrefix . $val['uid']) || $fieldValue == $tablePrefix . $val['uid']) {
if ($useSelectLabels) {
if (!$out) {
$out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
}
} elseif ($val[$labelField]) {
if (!$out) {
$out = htmlspecialchars($prefixString . $val[$labelField]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $val[$labelField]);
}
} elseif ($useAltSelectLabels) {
if (!$out) {
$out = htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
}
} else {
if (!$out) {
$out = htmlspecialchars($prefixString . $val[$altLabelField]);
} else {
$out .= $splitString . htmlspecialchars($prefixString . $val[$altLabelField]);
}
}
}
}
}
}
}
return $out;
}