本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::getRecordRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::getRecordRaw方法的具体用法?PHP BackendUtility::getRecordRaw怎么用?PHP BackendUtility::getRecordRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::getRecordRaw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Find relations pointing to non-existing records
* Fix methods: API in \TYPO3\CMS\Core\Database\ReferenceIndex that allows to
* change the value of a reference (or remove it) [Only for managed relations!]
*
* @return array
* @todo Define visibility
*/
public function main()
{
global $TYPO3_DB;
// Initialize result array:
$listExplain = ' Shows the missing record as header and underneath a list of record fields in which the references are found. ' . $this->label_infoString;
$resultArray = array('message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'], 'headers' => array('offlineVersionRecords_m' => array('Offline version records (managed)', 'These records are offline versions having a pid=-1 and references should never occur directly to their uids.' . $listExplain, 3), 'deletedRecords_m' => array('Deleted-flagged records (managed)', 'These records are deleted with a flag but references are still pointing at them. Keeping the references is useful if you undelete the referenced records later, otherwise the references are lost completely when the deleted records are flushed at some point. Notice that if those records listed are themselves deleted (marked with "DELETED") it is not a problem.' . $listExplain, 2), 'nonExistingRecords_m' => array('Non-existing records to which there are references (managed)', 'These references can safely be removed since there is no record found in the database at all.' . $listExplain, 3), 'offlineVersionRecords_s' => array('Offline version records (softref)', 'See above.' . $listExplain, 2), 'deletedRecords_s' => array('Deleted-flagged records (softref)', 'See above.' . $listExplain, 2), 'nonExistingRecords_s' => array('Non-existing records to which there are references (softref)', 'See above.' . $listExplain, 2)), 'offlineVersionRecords_m' => array(), 'deletedRecords_m' => array(), 'nonExistingRecords_m' => array(), 'offlineVersionRecords_s' => array(), 'deletedRecords_s' => array(), 'nonExistingRecords_s' => array());
// Select DB relations from reference table
$recs = $TYPO3_DB->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table<>' . $TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex') . ' AND ref_uid>0' . $filterClause, '', 'sorting DESC');
// Traverse the records
$tempExists = array();
if (is_array($recs)) {
foreach ($recs as $rec) {
$suffix = $rec['softref_key'] != '' ? '_s' : '_m';
$idx = $rec['ref_table'] . ':' . $rec['ref_uid'];
// Get referenced record:
if (!isset($tempExists[$idx])) {
$tempExists[$idx] = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordRaw($rec['ref_table'], 'uid=' . (int) $rec['ref_uid'], 'uid,pid' . ($GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete'] ? ',' . $GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete'] : ''));
}
// Compile info string for location of reference:
$infoString = $this->infoStr($rec);
// Handle missing file:
if ($tempExists[$idx]['uid']) {
if ($tempExists[$idx]['pid'] == -1) {
$resultArray['offlineVersionRecords' . $suffix][$idx][$rec['hash']] = $infoString;
ksort($resultArray['offlineVersionRecords' . $suffix][$idx]);
} elseif ($GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete'] && $tempExists[$idx][$GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete']]) {
$resultArray['deletedRecords' . $suffix][$idx][$rec['hash']] = $infoString;
ksort($resultArray['deletedRecords' . $suffix][$idx]);
}
} else {
$resultArray['nonExistingRecords' . $suffix][$idx][$rec['hash']] = $infoString;
ksort($resultArray['nonExistingRecords' . $suffix][$idx]);
}
}
}
ksort($resultArray['offlineVersionRecords_m']);
ksort($resultArray['deletedRecords_m']);
ksort($resultArray['nonExistingRecords_m']);
ksort($resultArray['offlineVersionRecords_s']);
ksort($resultArray['deletedRecords_s']);
ksort($resultArray['nonExistingRecords_s']);
return $resultArray;
}
示例2: main
/**
* Main method
*
* @param CLickMenu $backRef
* @param array $menuItems
* @param string $table
* @param int $uid
*
* @return array
*/
public function main($backRef, array $menuItems, $table = '', $uid = 0)
{
if ($table === 'tt_content') {
$this->setLanguageService($GLOBALS['LANG']);
// add "paste reference after" if user is allowed to use CType shortcut
if ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', 'explicitAllow')) {
if ($menuItems['pasteafter']) {
unset($menuItems['pasteafter']);
$selItem = $backRef->clipObj->getSelectedRecord();
$targetItem = BackendUtility::getRecordRaw('tt_content', 'uid = ' . $uid, 'colPos,tx_gridelements_container,tx_gridelements_columns');
$elInfo = array(GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $this->getBackendUser()->uc['titleLen']), $backRef->root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $backRef->rec), $this->getBackendUser()->uc['titleLen']), $backRef->clipObj->currentMode());
$menuItems['pasteafter'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, false);
if ($backRef->clipObj->currentMode() === 'copy') {
$menuItems['pastereference'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, true);
}
}
}
}
return $menuItems;
}
示例3: ADMCMD_previewCmds
/**
* Creates ADMCMD parameters for the "viewpage" extension / frontend
*
* @param array $pageInfo Page record
* @return string Query-parameters
* @internal
*/
public static function ADMCMD_previewCmds($pageInfo)
{
$simUser = '';
$simTime = '';
if ($pageInfo['fe_group'] > 0) {
$simUser = '&ADMCMD_simUser=' . $pageInfo['fe_group'];
} elseif ((int) $pageInfo['fe_group'] === -2) {
// -2 means "show at any login". We simulate first available fe_group.
/** @var PageRepository $sysPage */
$sysPage = GeneralUtility::makeInstance(PageRepository::class);
$activeFeGroupRow = BackendUtility::getRecordRaw('fe_groups', '1=1' . $sysPage->enableFields('fe_groups'), 'uid');
if (!empty($activeFeGroupRow)) {
$simUser = '&ADMCMD_simUser=' . $activeFeGroupRow['uid'];
}
}
if ($pageInfo['starttime'] > $GLOBALS['EXEC_TIME']) {
$simTime = '&ADMCMD_simTime=' . $pageInfo['starttime'];
}
if ($pageInfo['endtime'] < $GLOBALS['EXEC_TIME'] && $pageInfo['endtime'] != 0) {
$simTime = '&ADMCMD_simTime=' . ($pageInfo['endtime'] - 1);
}
return $simUser . $simTime;
}
示例4: doesRecordExist
/**
* Checks if record can be selected based on given permission criteria
*
* @param string $table Record table name
* @param int $id Record UID
* @param int|string $perms Permission restrictions to observe: Either an integer that will be bitwise AND'ed or a string, which points to a key in the ->pMap array
* @return bool Returns TRUE if the record given by $table, $id and $perms can be selected
*
* @throws \RuntimeException
*/
public function doesRecordExist($table, $id, $perms)
{
$id = (int) $id;
if ($this->bypassAccessCheckForRecords) {
return is_array(BackendUtility::getRecordRaw($table, 'uid=' . $id, 'uid'));
}
// Processing the incoming $perms (from possible string to integer that can be AND'ed)
if (!MathUtility::canBeInterpretedAsInteger($perms)) {
if ($table != 'pages') {
switch ($perms) {
case 'edit':
case 'delete':
case 'new':
// This holds it all in case the record is not page!!
if ($table === 'sys_file_reference' && array_key_exists('pages', $this->datamap)) {
$perms = 'edit';
} else {
$perms = 'editcontent';
}
break;
}
}
$perms = (int) $this->pMap[$perms];
} else {
$perms = (int) $perms;
}
if (!$perms) {
throw new \RuntimeException('Internal ERROR: no permissions to check for non-admin user', 1270853920);
}
// For all tables: Check if record exists:
$isWebMountRestrictionIgnored = BackendUtility::isWebMountRestrictionIgnored($table);
if (is_array($GLOBALS['TCA'][$table]) && $id > 0 && ($isWebMountRestrictionIgnored || $this->isRecordInWebMount($table, $id) || $this->admin)) {
if ($table != 'pages') {
// Find record without checking page:
$mres = $this->databaseConnection->exec_SELECTquery('uid,pid', $table, 'uid=' . (int) $id . $this->deleteClause($table));
// THIS SHOULD CHECK FOR editlock I think!
$output = $this->databaseConnection->sql_fetch_assoc($mres);
BackendUtility::fixVersioningPid($table, $output, true);
// If record found, check page as well:
if (is_array($output)) {
// Looking up the page for record:
$mres = $this->doesRecordExist_pageLookUp($output['pid'], $perms);
$pageRec = $this->databaseConnection->sql_fetch_assoc($mres);
// Return TRUE if either a page was found OR if the PID is zero AND the user is ADMIN (in which case the record is at root-level):
$isRootLevelRestrictionIgnored = BackendUtility::isRootLevelRestrictionIgnored($table);
if (is_array($pageRec) || !$output['pid'] && ($isRootLevelRestrictionIgnored || $this->admin)) {
return true;
}
}
return false;
} else {
$mres = $this->doesRecordExist_pageLookUp($id, $perms);
return $this->databaseConnection->sql_num_rows($mres);
}
}
return false;
}
示例5: createExceptionRule
function createExceptionRule($pid, $cruserId, $eventUid, $exceptionRuleDescription)
{
$event = BackendUtility::getRecordRaw('tx_cal_event', 'uid=' . $eventUid);
$insertFields = array();
$insertFields['tstamp'] = time();
$insertFields['crdate'] = time();
$insertFields['pid'] = $pid;
$insertFields['cruser_id'] = $cruserId;
$insertFields['title'] = 'Exception rule for event ' . $eventUid;
$insertFields['start_date'] = $event['start_date'];
$this->insertRuleValues($exceptionRuleDescription, $insertFields);
$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_cal_exception_event', $insertFields);
if (FALSE === $result) {
throw new \RuntimeException('Could not write tx_cal_exception_event_mm record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458149);
}
$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_cal_exception_event_mm', array('tablenames' => 'tx_cal_exception_event', 'uid_local' => $eventUid, 'uid_foreign' => $GLOBALS['TYPO3_DB']->sql_insert_id()));
if (FALSE === $result) {
throw new \RuntimeException('Could not write tx_cal_exception_event_mm record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458150);
}
}
示例6: getTable
//.........这里部分代码省略.........
// In offline workspace, look for alternative record:
BackendUtility::workspaceOL($table, $row, $this->getBackendUser()->workspace, TRUE);
if (is_array($row)) {
$accRows[] = $row;
$currentIdList[] = $row['uid'];
if ($doSort) {
if ($prevUid) {
$this->currentTable['prev'][$row['uid']] = $prevPrevUid;
$this->currentTable['next'][$prevUid] = '-' . $row['uid'];
$this->currentTable['prevUid'][$row['uid']] = $prevUid;
}
$prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
$prevUid = $row['uid'];
}
}
}
$database->sql_free_result($result);
$this->totalRowCount = count($accRows);
// CSV initiated
if ($this->csvOutput) {
$this->initCSV();
}
// Render items:
$this->CBnames = array();
$this->duplicateStack = array();
$this->eCounter = $this->firstElementNumber;
$iOut = '';
$cc = 0;
foreach ($accRows as $row) {
// Render item row if counter < limit
if ($cc < $this->iLimit) {
$cc++;
$this->translations = FALSE;
$iOut .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
// If localization view is enabled it means that the selected records are
// either default or All language and here we will not select translations
// which point to the main record:
if ($this->localizationView && $l10nEnabled) {
// For each available translation, render the record:
if (is_array($this->translations)) {
foreach ($this->translations as $lRow) {
// $lRow isn't always what we want - if record was moved we've to work with the
// placeholder records otherwise the list is messed up a bit
if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
$tmpRow = BackendUtility::getRecordRaw($table, 't3ver_move_id="' . (int) $lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table), $selFieldList);
$lRow = is_array($tmpRow) ? $tmpRow : $lRow;
}
// In offline workspace, look for alternative record:
BackendUtility::workspaceOL($table, $lRow, $this->getBackendUser()->workspace, TRUE);
if (is_array($lRow) && $backendUser->checkLanguageAccess($lRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) {
$currentIdList[] = $lRow['uid'];
$iOut .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 18);
}
}
}
}
}
// Counter of total rows incremented:
$this->eCounter++;
}
// Record navigation is added to the beginning and
// end of the table if in single table mode
if ($this->table) {
$iOut = $this->renderListNavigation('top') . $iOut . $this->renderListNavigation('bottom');
} else {
// show that there are more records than shown
if ($this->totalItems > $this->itemsLimitPerTable) {
$countOnFirstPage = $this->totalItems > $this->itemsLimitSingleTable ? $this->itemsLimitSingleTable : $this->totalItems;
$hasMore = $this->totalItems > $this->itemsLimitSingleTable;
$iOut .= '<tr><td colspan="' . count($this->fieldArray) . '" style="padding: 5px;">
<a href="' . htmlspecialchars($this->listURL() . '&table=' . rawurlencode($table)) . '">' . '<img' . IconUtility::skinImg($this->backPath, 'gfx/pildown.gif', 'width="14" height="14"') . ' alt="" />' . ' <i>[1 - ' . $countOnFirstPage . ($hasMore ? '+' : '') . ']</i></a>
</td></tr>';
}
}
// The header row for the table is now created:
$out .= $this->renderListHeader($table, $currentIdList);
}
// The list of records is added after the header:
$out .= $iOut;
unset($iOut);
// ... and it is all wrapped in a table:
$out = '
<!--
DB listing of elements: "' . htmlspecialchars($table) . '"
-->
<table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist' . ($listOnlyInSingleTableMode ? ' typo3-dblist-overview' : '') . '">
' . $out . '
</table>';
// Output csv if...
if ($this->csvOutput) {
// This ends the page with exit.
$this->outputCSV($table);
}
}
// Return content:
return $out;
}
示例7: updateRefIndexTable
/**
* Call this function to update the sys_refindex table for a record (even one just deleted)
* NOTICE: Currently, references updated for a deleted-flagged record will not include those from within flexform fields in some cases where the data structure is defined by another record since the resolving process ignores deleted records! This will also result in bad cleaning up in tcemain I think... Anyway, thats the story of flexforms; as long as the DS can change, lots of references can get lost in no time.
*
* @param string $tableName Table name
* @param int $uid UID of record
* @param bool $testOnly If set, nothing will be written to the index but the result value will still report statistics on what is added, deleted and kept. Can be used for mere analysis.
* @return array Array with statistics about how many index records were added, deleted and not altered plus the complete reference set for the record.
* @todo Define visibility
*/
public function updateRefIndexTable($tableName, $uid, $testOnly = FALSE)
{
// First, secure that the index table is not updated with workspace tainted relations:
$this->WSOL = FALSE;
// Init:
$result = array('keptNodes' => 0, 'deletedNodes' => 0, 'addedNodes' => 0);
// If this table cannot contain relations, skip it
if (isset(static::$nonRelationTables[$tableName])) {
return $result;
}
// Fetch tableRelationFields and save them in cache if not there yet
$cacheId = static::$cachePrefixTableRelationFields . $tableName;
if (!$this->runtimeCache->has($cacheId)) {
$tableRelationFields = $this->fetchTableRelationFields($tableName);
$this->runtimeCache->set($cacheId, $tableRelationFields);
} else {
$tableRelationFields = $this->runtimeCache->get($cacheId);
}
// Get current index from Database with hash as index using $uidIndexField
$currentRelations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_refindex') . ' AND recuid=' . (int) $uid . ' AND workspace=' . (int) $this->getWorkspaceId(), '', '', '', 'hash');
// If the table has fields which could contain relations and the record does exist (including deleted-flagged)
if ($tableRelationFields !== '' && BackendUtility::getRecordRaw($tableName, 'uid=' . (int) $uid, 'uid')) {
// Then, get relations:
$relations = $this->generateRefIndexData($tableName, $uid);
if (is_array($relations)) {
// Traverse the generated index:
foreach ($relations as $k => $datRec) {
if (!is_array($relations[$k])) {
continue;
}
$relations[$k]['hash'] = md5(implode('///', $relations[$k]) . '///' . $this->hashVersion);
// First, check if already indexed and if so, unset that row (so in the end we know which rows to remove!)
if (isset($currentRelations[$relations[$k]['hash']])) {
unset($currentRelations[$relations[$k]['hash']]);
$result['keptNodes']++;
$relations[$k]['_ACTION'] = 'KEPT';
} else {
// If new, add it:
if (!$testOnly) {
$GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_refindex', $relations[$k]);
}
$result['addedNodes']++;
$relations[$k]['_ACTION'] = 'ADDED';
}
}
$result['relations'] = $relations;
} else {
return FALSE;
}
}
// If any old are left, remove them:
if (!empty($currentRelations)) {
$hashList = array_keys($currentRelations);
if (!empty($hashList)) {
$result['deletedNodes'] = count($hashList);
$result['deletedNodes_hashList'] = implode(',', $hashList);
if (!$testOnly) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_refindex', 'hash IN (' . implode(',', $GLOBALS['TYPO3_DB']->fullQuoteArray($hashList, 'sys_refindex')) . ')');
}
}
}
return $result;
}
示例8: getPositionPlaceholder
/**
* Gets a placeholder for a given page
*
* @param array $page
* @return array
*/
protected function getPositionPlaceholder($page)
{
if (-1 !== intval($page['pid'])) {
// original, dont do anything
return $page;
} elseif (0 === intval($page['t3ver_state'])) {
// page has changed, but not moved
$page = BackendUtility::getRecord('pages', $page['t3ver_oid']);
} elseif (4 === intval($page['t3ver_state'])) {
// page has moved. get placeholder for new position
$page = BackendUtility::getRecordRaw('pages', $where = sprintf('t3ver_move_id=%d AND t3ver_state=3', $page['t3ver_oid']), $fields = '*');
}
return $page;
}
示例9: generateTitle
/**
* Generates the title and puts the record title behind
*
* @param string $table
* @param string $uid
* @return string
* @todo Define visibility
*/
public function generateTitle($table, $uid)
{
$out = $table . ':' . $uid;
if ($labelField = $GLOBALS['TCA'][$table]['ctrl']['label']) {
$record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordRaw($table, 'uid=' . intval($uid));
$out .= ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $record, TRUE) . ')';
}
return $out;
}
示例10: renderListRow
//.........这里部分代码省略.........
$this->addElement_tdCssClass['_PATH_'] = 'col-path';
$this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa';
$this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb';
/**
* @hook checkChildren
* @date 2014-02-11
* @request Alexander Grein <alexander.grein@in2code.de>
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
if (is_object($hookObject) && method_exists($hookObject, 'checkChildren')) {
$hookObject->checkChildren($table, $row, $level, $theData, $this);
}
}
}
// Create element in table cells:
$theData['uid'] = $row['uid'];
if ($table === 'tt_content') {
$theData['tx_gridelements_container'] = $row['tx_gridelements_container'];
}
if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
$theData['parent'] = $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']];
}
$rowOutput .= $this->addElement(1, $theIcon, $theData, $row_bgColor, '', '', '', $level);
if ($this->localizationView && $this->l10nEnabled) {
// For each available translation, render the record:
if (is_array($this->translations)) {
foreach ($this->translations as $lRow) {
// $lRow isn't always what we want - if record was moved we've to work with the
// placeholder records otherwise the list is messed up a bit
if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
$where = 't3ver_move_id="' . (int) $lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table);
$tmpRow = BackendUtility::getRecordRaw($table, $where, $this->selFieldList);
$lRow = is_array($tmpRow) ? $tmpRow : $lRow;
}
// In offline workspace, look for alternative record:
BackendUtility::workspaceOL($table, $lRow, $this->backendUser->workspace, true);
if (is_array($lRow) && $this->backendUser->checkLanguageAccess($lRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) {
$this->currentIdList[] = $lRow['uid'];
if ($row['tx_gridelements_container']) {
$lRow['_CSSCLASS'] = 't3-gridelements-child" data-trigger-container="' . $row['tx_gridelements_container'] . $expanded;
}
$rowOutput .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 20, $level);
}
}
}
}
if ($theData['_EXPANDABLE_'] && $level < 8 && ($row['l18n_parent'] == 0 || !$this->localizationView)) {
if (!empty($theData['_CHILDREN_'])) {
$expanded = $this->expandedGridelements[$row['uid']] ? '" style="display: table-row;' : '';
$lastGridColumn = '';
$originalMoveUp = $this->showMoveUp;
$originalMoveDown = $this->showMoveDown;
$prevPrevUid = (int) $theData['_CHILDREN_'][0]['uid'];
$prevUid = (int) $theData['_CHILDREN_'][1]['uid'];
foreach ($theData['_CHILDREN_'] as $key => $child) {
if ($key > 1) {
if ($prevUid) {
$this->currentTable['prev'][$child['uid']] = $prevPrevUid;
$this->currentTable['next'][$prevUid] = -(int) $child['uid'];
$this->currentTable['prevUid'][$child['uid']] = $prevUid;
}
$prevPrevUid = isset($this->currentTable['prev'][$child['uid']]) ? -$prevUid : $row['pid'];
$prevUid = $child['uid'];
}
示例11: switch
function processCmdmap_postProcess(&$command, &$table, &$id, &$value, &$tce)
{
switch ($table) {
case 'tx_cal_event':
$select = '*';
$table = 'tx_cal_event';
$where = 'uid = ' . $id;
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
if ($result) {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
/* If we're in a workspace, don't notify anyone about the event */
if ($row['pid'] > 0 && !$GLOBALS['BE_USER']->workspace) {
/* Check Page TSConfig for a preview page that we should use */
$pageIDForPlugin = $this->getPageIDForPlugin($row['pid']);
$page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), "doktype");
if ($page['doktype'] != 254) {
$tx_cal_api = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Api');
$tx_cal_api =& $tx_cal_api->tx_cal_api_without($pageIDForPlugin);
$notificationService =& \TYPO3\CMS\Cal\Utility\Functions::getNotificationService();
if ($command == 'delete') {
/* If the deleted event is temporary, reset the MD5 of the parent calendar */
if ($row['isTemp']) {
$calendar_id = $row['calendar_id'];
$insertFields = array('md5' => '');
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_cal_calendar', 'uid=' . $calendar_id, $insertFields);
}
/** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
$rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator');
$rgc->cleanIndexTableOfUid($id, $table);
/* Delete all deviations of the event */
$GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_event_deviation', 'parentid=' . $id);
} else {
$notificationService->notifyOfChanges($row, array($command => $value));
}
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($result);
}
break;
case 'tx_cal_calendar':
/* If a calendar has been deleted, we might need to clean up. */
if ($command == 'delete') {
/* Using getRecordRaw rather than getRecord since the record has already been deleted. */
$calendarRow = BackendUtility::getRecordRaw('tx_cal_calendar', 'uid=' . $id);
/* If the calendar is an External URL or ICS file, then we need to clean up */
if ($calendarRow['type'] == 1 or $calendarRow['type'] == 2) {
$service = new \TYPO3\CMS\Cal\Service\ICalendarService();
$service->deleteTemporaryEvents($id);
$service->deleteTemporaryCategories($id);
$service->deleteScheduledUpdates($id);
$service->deleteSchedulerTask($id);
}
}
if ($command == 'copy') {
$newCalendarIds = $tce->copyMappingArray['tx_cal_calendar'];
// check if source of copy has a scheduler task attached
$calendarRow = BackendUtility::getRecord('tx_cal_calendar', $id);
if ($calendarRow['schedulerId'] > 0) {
$scheduler = new \TYPO3\CMS\Scheduler\Scheduler();
$service = new \TYPO3\CMS\Cal\Service\ICalendarService();
foreach ($newCalendarIds as $newCalendarId) {
$service->createSchedulerTask($scheduler, 0, $newCalendarId);
}
}
}
break;
case 'tx_cal_exception_event_group':
case 'tx_cal_exception_event':
if ($command == 'delete') {
$select = '*';
$where = 'uid = ' . $id;
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
if ($result) {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
/* If we're in a workspace, don't notify anyone about the event */
if ($row['pid'] > 0 && !$GLOBALS['BE_USER']->workspace) {
/* Check Page TSConfig for a preview page that we should use */
$pageIDForPlugin = $this->getPageIDForPlugin($row['pid']);
$page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), "doktype");
if ($page['doktype'] != 254) {
$tx_cal_api = new \TYPO3\CMS\Cal\Controller\Api();
$tx_cal_api =& $tx_cal_api->tx_cal_api_without($pageIDForPlugin);
/** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
$rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator');
$rgc->cleanIndexTableOfUid($id, $table);
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($result);
}
}
break;
case 'tx_cal_event_deviation':
if ($command == 'delete') {
$select = 'tx_cal_event.uid, tx_cal_event.pid';
$where = 'tx_cal_index.event_uid = tx_cal_event.uid and tx_cal_index.event_deviation_uid = ' . $id;
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, 'tx_cal_index, tx_cal_event', $where);
if ($result) {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
//.........这里部分代码省略.........
示例12: genTree_traverse
/**
* Recursive traversal of page tree:
*
* @param integer $rootID Page root id (must be online, valid page record - or zero for page tree root)
* @param integer $depth Depth
* @param integer $echoLevel Echo Level
* @param string $callBack Call back function (from this class or subclass)
* @param string $versionSwapmode DON'T set from outside, internal. (indicates we are inside a version of a page) - will be "SWAPMODE:-1" or empty
* @param integer $rootIsVersion DON'T set from outside, internal. (1: Indicates that rootID is a version of a page, 2: ...that it is even a version of a version (which triggers a warning!)
* @param string $accumulatedPath Internal string that accumulates the path
* @return void
* @access private
* @todo $versionSwapmode needs to be cleaned up, since page and branch version (0, 1) does not exist anymore
* @todo Define visibility
*/
public function genTree_traverse($rootID, $depth, $echoLevel = 0, $callBack = '', $versionSwapmode = '', $rootIsVersion = 0, $accumulatedPath = '')
{
// Register page:
$this->recStats['all']['pages'][$rootID] = $rootID;
$pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordRaw('pages', 'uid=' . intval($rootID), 'deleted,title,t3ver_count,t3ver_wsid');
$accumulatedPath .= '/' . $pageRecord['title'];
// Register if page is deleted:
if ($pageRecord['deleted']) {
$this->recStats['deleted']['pages'][$rootID] = $rootID;
}
// If rootIsVersion is set it means that the input rootID is that of a version of a page. See below where the recursive call is made.
if ($rootIsVersion) {
$this->recStats['versions']['pages'][$rootID] = $rootID;
// If it has been published and is in archive now...
if ($pageRecord['t3ver_count'] >= 1 && $pageRecord['t3ver_wsid'] == 0) {
$this->recStats['versions_published']['pages'][$rootID] = $rootID;
}
// If it has been published and is in archive now...
if ($pageRecord['t3ver_wsid'] == 0) {
$this->recStats['versions_liveWS']['pages'][$rootID] = $rootID;
}
// If it doesn't belong to a workspace...
if (!isset($this->workspaceIndex[$pageRecord['t3ver_wsid']])) {
$this->recStats['versions_lost_workspace']['pages'][$rootID] = $rootID;
}
// In case the rootID is a version inside a versioned page
if ($rootIsVersion == 2) {
$this->recStats['versions_inside_versioned_page']['pages'][$rootID] = $rootID;
}
}
if ($echoLevel > 0) {
echo LF . $accumulatedPath . ' [' . $rootID . ']' . ($pageRecord['deleted'] ? ' (DELETED)' : '') . ($this->recStats['versions_published']['pages'][$rootID] ? ' (PUBLISHED)' : '');
}
if ($echoLevel > 1 && $this->recStats['versions_lost_workspace']['pages'][$rootID]) {
echo LF . ' ERROR! This version belongs to non-existing workspace (' . $pageRecord['t3ver_wsid'] . ')!';
}
if ($echoLevel > 1 && $this->recStats['versions_inside_versioned_page']['pages'][$rootID]) {
echo LF . ' WARNING! This version is inside an already versioned page or branch!';
}
// Call back:
if ($callBack) {
$this->{$callBack}('pages', $rootID, $echoLevel, $versionSwapmode, $rootIsVersion);
}
$pt3 = \TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
// Traverse tables of records that belongs to page:
foreach ($GLOBALS['TCA'] as $tableName => $cfg) {
if ($tableName != 'pages') {
// Select all records belonging to page:
$pt4 = \TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
$resSub = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid' . ($GLOBALS['TCA'][$tableName]['ctrl']['delete'] ? ',' . $GLOBALS['TCA'][$tableName]['ctrl']['delete'] : ''), $tableName, 'pid=' . intval($rootID) . ($this->genTree_traverseDeleted ? '' : \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableName)));
$this->performanceStatistics['genTree_traverse():TraverseTables:']['MySQL']['(ALL)'] += \TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $pt4;
$this->performanceStatistics['genTree_traverse():TraverseTables:']['MySQL'][$tableName] += \TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $pt4;
$pt5 = \TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
$count = $GLOBALS['TYPO3_DB']->sql_num_rows($resSub);
if ($count) {
if ($echoLevel == 2) {
echo LF . ' \\-' . $tableName . ' (' . $count . ')';
}
}
while ($rowSub = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resSub)) {
if ($echoLevel == 3) {
echo LF . ' \\-' . $tableName . ':' . $rowSub['uid'];
}
// If the rootID represents an "element" or "page" version type, we must check if the record from this table is allowed to belong to this:
if ($versionSwapmode == 'SWAPMODE:-1' || $versionSwapmode == 'SWAPMODE:0' && !$GLOBALS['TCA'][$tableName]['ctrl']['versioning_followPages']) {
// This is illegal records under a versioned page - therefore not registered in $this->recStats['all'] so they should be orphaned:
$this->recStats['illegal_record_under_versioned_page'][$tableName][$rowSub['uid']] = $rowSub['uid'];
if ($echoLevel > 1) {
echo LF . ' ERROR! Illegal record (' . $tableName . ':' . $rowSub['uid'] . ') under versioned page!';
}
} else {
$this->recStats['all'][$tableName][$rowSub['uid']] = $rowSub['uid'];
// Register deleted:
if ($GLOBALS['TCA'][$tableName]['ctrl']['delete'] && $rowSub[$GLOBALS['TCA'][$tableName]['ctrl']['delete']]) {
$this->recStats['deleted'][$tableName][$rowSub['uid']] = $rowSub['uid'];
if ($echoLevel == 3) {
echo ' (DELETED)';
}
}
// Check location of records regarding tree root:
if (!$GLOBALS['TCA'][$tableName]['ctrl']['rootLevel'] && $rootID == 0) {
$this->recStats['misplaced_at_rootlevel'][$tableName][$rowSub['uid']] = $rowSub['uid'];
if ($echoLevel > 1) {
echo LF . ' ERROR! Misplaced record (' . $tableName . ':' . $rowSub['uid'] . ') on rootlevel!';
}
//.........这里部分代码省略.........
示例13: deleteReminder
function deleteReminder($eventUid)
{
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('scheduler')) {
$eventRow = BackendUtility::getRecordRaw('tx_cal_fe_user_event_monitor_mm', 'uid_local=' . $eventUid);
$taskId = $eventRow['schedulerId'];
if ($taskId > 0) {
$scheduler = new \TYPO3\CMS\Scheduler\Scheduler();
try {
$task = $scheduler->fetchTask($taskId);
$scheduler->removeTask($task);
} catch (OutOfBoundsException $e) {
}
}
} else {
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('gabriel')) {
$monitoringUID = 'tx_cal_fe_user_event_monitor_mm:' . $eventUid;
$GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_gabriel', ' crid="' . $eventUid . '"');
}
}
}
示例14: updateRefIndexTable
/**
* Call this function to update the sys_refindex table for a record (even one just deleted)
* NOTICE: Currently, references updated for a deleted-flagged record will not include those from within flexform fields in some cases where the data structure is defined by another record since the resolving process ignores deleted records! This will also result in bad cleaning up in tcemain I think... Anyway, thats the story of flexforms; as long as the DS can change, lots of references can get lost in no time.
*
* @param string $table Table name
* @param integer $uid UID of record
* @param boolean $testOnly If set, nothing will be written to the index but the result value will still report statistics on what is added, deleted and kept. Can be used for mere analysis.
* @return array Array with statistics about how many index records were added, deleted and not altered plus the complete reference set for the record.
* @todo Define visibility
*/
public function updateRefIndexTable($table, $uid, $testOnly = FALSE)
{
// First, secure that the index table is not updated with workspace tainted relations:
$this->WSOL = FALSE;
// Init:
$result = array('keptNodes' => 0, 'deletedNodes' => 0, 'addedNodes' => 0);
// Get current index from Database:
$currentRels = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND recuid=' . (int) $uid, '', '', '', 'hash');
// First, test to see if the record exists (including deleted-flagged)
if (BackendUtility::getRecordRaw($table, 'uid=' . (int) $uid, 'uid')) {
// Then, get relations:
$relations = $this->generateRefIndexData($table, $uid);
if (is_array($relations)) {
// Traverse the generated index:
foreach ($relations as $k => $datRec) {
$relations[$k]['hash'] = md5(implode('///', $relations[$k]) . '///' . $this->hashVersion);
// First, check if already indexed and if so, unset that row (so in the end we know which rows to remove!)
if (isset($currentRels[$relations[$k]['hash']])) {
unset($currentRels[$relations[$k]['hash']]);
$result['keptNodes']++;
$relations[$k]['_ACTION'] = 'KEPT';
} else {
// If new, add it:
if (!$testOnly) {
$GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_refindex', $relations[$k]);
}
$result['addedNodes']++;
$relations[$k]['_ACTION'] = 'ADDED';
}
}
$result['relations'] = $relations;
} else {
return FALSE;
}
}
// If any old are left, remove them:
if (count($currentRels)) {
$hashList = array_keys($currentRels);
if (count($hashList)) {
$result['deletedNodes'] = count($hashList);
$result['deletedNodes_hashList'] = implode(',', $hashList);
if (!$testOnly) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_refindex', 'hash IN (' . implode(',', $GLOBALS['TYPO3_DB']->fullQuoteArray($hashList, 'sys_refindex')) . ')');
}
}
}
return $result;
}
示例15: getTable
//.........这里部分代码省略.........
}
$prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
$prevUid = $row['uid'];
}
}
}
$db->sql_free_result($result);
$this->totalRowCount = count($accRows);
// CSV initiated
if ($this->csvOutput) {
$this->initCSV();
}
// Render items:
$this->CBnames = array();
$this->duplicateStack = array();
$this->eCounter = $this->firstElementNumber;
$cc = 0;
foreach ($accRows as $row) {
// Render item row if counter < limit
if ($cc < $this->iLimit) {
$cc++;
$this->translations = false;
$rowOutput .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
// If localization view is enabled it means that the selected records are
// either default or All language and here we will not select translations
// which point to the main record:
if ($this->localizationView && $l10nEnabled) {
// For each available translation, render the record:
if (is_array($this->translations)) {
foreach ($this->translations as $lRow) {
// $lRow isn't always what we want - if record was moved we've to work with the
// placeholder records otherwise the list is messed up a bit
if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
$where = 't3ver_move_id="' . (int) $lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table);
$tmpRow = BackendUtility::getRecordRaw($table, $where, $selFieldList);
$lRow = is_array($tmpRow) ? $tmpRow : $lRow;
}
// In offline workspace, look for alternative record:
BackendUtility::workspaceOL($table, $lRow, $backendUser->workspace, true);
if (is_array($lRow) && $backendUser->checkLanguageAccess($lRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) {
$currentIdList[] = $lRow['uid'];
$rowOutput .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 18);
}
}
}
}
}
// Counter of total rows incremented:
$this->eCounter++;
}
// Record navigation is added to the beginning and end of the table if in single
// table mode
if ($this->table) {
$rowOutput = $this->renderListNavigation('top') . $rowOutput . $this->renderListNavigation('bottom');
} else {
// Show that there are more records than shown
if ($this->totalItems > $this->itemsLimitPerTable) {
$countOnFirstPage = $this->totalItems > $this->itemsLimitSingleTable ? $this->itemsLimitSingleTable : $this->totalItems;
$hasMore = $this->totalItems > $this->itemsLimitSingleTable;
$colspan = $this->showIcon ? count($this->fieldArray) + 1 : count($this->fieldArray);
$rowOutput .= '<tr><td colspan="' . $colspan . '">
<a href="' . htmlspecialchars($this->listURL() . '&table=' . rawurlencode($table)) . '" class="btn btn-default">' . '<span class="t3-icon fa fa-chevron-down"></span> <i>[1 - ' . $countOnFirstPage . ($hasMore ? '+' : '') . ']</i></a>
</td></tr>';
}
}
// The header row for the table is now created:
$out .= $this->renderListHeader($table, $currentIdList);
}
$collapseClass = $tableCollapsed && !$this->table ? 'collapse' : 'collapse in';
$dataState = $tableCollapsed && !$this->table ? 'collapsed' : 'expanded';
// The list of records is added after the header:
$out .= $rowOutput;
// ... and it is all wrapped in a table:
$out = '
<!--
DB listing of elements: "' . htmlspecialchars($table) . '"
-->
<div class="panel panel-space panel-default">
<div class="panel-heading">
' . $tableHeader . '
</div>
<div class="table-fit ' . $collapseClass . '" id="recordlist-' . htmlspecialchars($table) . '" data-state="' . $dataState . '">
<table data-table="' . htmlspecialchars($table) . '" class="table table-striped table-hover' . ($listOnlyInSingleTableMode ? ' typo3-dblist-overview' : '') . '">
' . $out . '
</table>
</div>
</div>
';
// Output csv if...
// This ends the page with exit.
if ($this->csvOutput) {
$this->outputCSV($table);
}
}
// Return content:
return $out;
}