本文整理汇总了PHP中t3lib_BEfunc::deleteClause方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_BEfunc::deleteClause方法的具体用法?PHP t3lib_BEfunc::deleteClause怎么用?PHP t3lib_BEfunc::deleteClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::deleteClause方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOverLayRecordForCertainLanguageImplementation
/**
* This method is the implementation of an abstract parent method.
* The method should return the overlay record for a certain language.
*
* (non-PHPdoc)
* @see classes/tx_languagevisibility_element#getOverLayRecordForCertainLanguageImplementation($languageId)
*/
protected function getOverLayRecordForCertainLanguageImplementation($languageId)
{
$ctrl = $GLOBALS['TCA'][$this->table]['ctrl'];
// we can't use the exclude fields here because we might loose (hidden) parent-records
if (is_object($GLOBALS['TSFE']->sys_page)) {
$excludeClause = $GLOBALS['TSFE']->sys_page->deleteClause($this->table);
} else {
$excludeClause = t3lib_BEfunc::deleteClause($this->table);
}
if (isset($ctrl['versioningWS']) && $ctrl['versioningWS'] > 0) {
$workspaces = '0,' . $GLOBALS['BE_USER']->workspace;
$workspaceCondition = 't3ver_wsid IN (' . rtrim($workspaces, ',') . ') AND ';
} else {
$workspaceCondition = '';
}
// Select overlay record (Live workspace, initial placeholders included):
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->table, 'pid=' . intval($this->getPid()) . ' AND ' . $workspaceCondition . $ctrl['languageField'] . '=' . intval($languageId) . ($languageId > 0 ? ' AND ' . $ctrl['transOrigPointerField'] . '=' . intval($this->getUid()) : '') . $excludeClause, '', '', '1');
$olrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$olrow = $this->getContextIndependentWorkspaceOverlay($this->table, $olrow);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
if (!$this->getEnableFieldResult($olrow)) {
$olrow = array();
}
return $olrow;
}
示例2: autoPublishWorkspaces
/**
* This method is called by the Scheduler task that triggers
* the autopublication process
* It searches for workspaces whose publication date is in the past
* and publishes them
*
* @return void
*/
public function autoPublishWorkspaces()
{
global $TYPO3_CONF_VARS;
// Temporarily set admin rights
// FIXME: once workspaces are cleaned up a better solution should be implemented
$currentAdminStatus = $GLOBALS['BE_USER']->user['admin'];
$GLOBALS['BE_USER']->user['admin'] = 1;
// Select all workspaces that needs to be published / unpublished:
$workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0
AND
((publish_time!=0 AND publish_time<=' . intval($GLOBALS['EXEC_TIME']) . ')
OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . intval($GLOBALS['EXEC_TIME']) . '))' . t3lib_BEfunc::deleteClause('sys_workspace'));
$workspaceService = t3lib_div::makeInstance('tx_Workspaces_Service_Workspaces');
foreach ($workspaces as $rec) {
// First, clear start/end time so it doesn't get select once again:
$fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0);
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . intval($rec['uid']), $fieldArray);
// Get CMD array:
$cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1);
// $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
// Execute CMD array:
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values = 0;
$tce->start(array(), $cmd);
$tce->process_cmdmap();
}
// Restore admin status
$GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus;
}
示例3: getStoragePids
/**
*
* @return string;
*/
public function getStoragePids()
{
$pids = array();
$toList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('tx_templavoila_tmplobj.uid,tx_templavoila_tmplobj.pid', 'tx_templavoila_tmplobj', 'tx_templavoila_tmplobj.datastructure=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->filename, 'tx_templavoila_tmplobj') . t3lib_BEfunc::deleteClause('tx_templavoila_tmplobj'));
foreach ($toList as $toRow) {
$pids[$toRow['pid']]++;
}
return implode(',', array_keys($pids));
}
示例4: getUnreferencedElementsRecords
/**
* Returns an array of UIDs which are not referenced on
* the page with the given uid (= parent id).
*
* @param array $allReferencedElementsArr: Array with UIDs of referenced elements
* @return array Array with UIDs of tt_content records
* @access protected
*/
function getUnreferencedElementsRecords($allReferencedElementsArr)
{
global $TYPO3_DB, $BE_USER;
$elementRecordsArr = array();
$res = $TYPO3_DB->exec_SELECTquery('uid', 'tt_content', 'uid NOT IN (' . implode(',', $allReferencedElementsArr) . ')' . ' AND t3ver_wsid=' . intval($BE_USER->workspace) . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'sorting');
if ($res) {
while (($elementRecordArr = $TYPO3_DB->sql_fetch_assoc($res)) !== FALSE) {
$elementRecordsArr[] = $elementRecordArr['uid'];
}
}
return $elementRecordsArr;
}
示例5: user_createCountrySelector
/**
* Creates the values for a country selector in the TCA, using the alpha 2 codes as array keys.
*
* @param array[] $parameters
*
* @return void
*/
function user_createCountrySelector(array &$parameters)
{
$parameters['items'] = array(array('', ''));
$table = 'static_countries';
$titleField = 'cn_short_local';
$keyField = 'cn_iso_2';
$allFields = $keyField . ', ' . $titleField;
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($allFields, $table, '1 = 1' . t3lib_BEfunc::deleteClause($table), '', $titleField);
/** @var $row string[] */
foreach ($rows as $row) {
$parameters['items'][] = array($row[$titleField], $row[$keyField]);
}
}
示例6: getAdminAccountStatus
/**
* Checks whether a an BE user account named admin with default password exists.
*
* @return tx_reports_reports_status_Status An tx_reports_reports_status_Status object representing whether a default admin account exists
*/
protected function getAdminAccountStatus()
{
$value = $GLOBALS['LANG']->getLL('status_ok');
$message = '';
$severity = tx_reports_reports_status_Status::OK;
$whereClause = 'username = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users') . ' AND password = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('5f4dcc3b5aa765d61d8327deb882cf99', 'be_users') . t3lib_BEfunc::deleteClause('be_users');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$value = $GLOBALS['LANG']->getLL('status_insecure');
$severity = tx_reports_reports_status_Status::ERROR;
$editUserAccountUrl = 'alt_doc.php?returnUrl=mod.php?M=tools_txreportsM1&edit[be_users][' . $row['uid'] . ']=edit';
$message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_admin'), '<a href="' . $editUserAccountUrl . '">', '</a>');
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
return t3lib_div::makeInstance('tx_reports_reports_status_Status', $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity);
}
示例7: getRecursiveUidList
/**
* Generates a list of pids of all sub pages for the given depth.
*
* @param integer the pid of the page
* @param integer the depth for the search
* @return string the list of pids
* @author of method Michael Oehlhof <typo3@oehlhof.de>
* @access public
*/
function getRecursiveUidList($parentUid, $depth)
{
global $TCA;
if ($depth != -1) {
$depth = $depth - 1;
//decreasing depth
}
# Get ressource records:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($parentUid) . ') ' . t3lib_BEfunc::deleteClause('pages') . t3lib_BEfunc::versioningPlaceholderClause('pages'));
if ($depth > 0) {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$parentUid .= ',' . $this->getRecursiveUidList($row['uid'], $depth);
}
}
return $parentUid;
}
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:25,代码来源:class.tx_kbeventboard_addCategoriesToFlexForm.php
示例8: getContentTree_getLocalizationInfoForElement
/**
* Returns information about localization of traditional content elements (non FCEs).
* It will be added to the content tree by getContentTree().
*
* @param array $contentTreeArr: Part of the content tree of the element to create the localization information for.
* @param array $tt_content_elementRegister: Array of sys_language UIDs with some information as the value
* @return array Localization information
* @access protected
* @see getContentTree_element()
*/
function getContentTree_getLocalizationInfoForElement($contentTreeArr, &$tt_content_elementRegister)
{
global $TYPO3_DB;
$localizationInfoArr = array();
if ($contentTreeArr['el']['table'] == 'tt_content' && $contentTreeArr['el']['sys_language_uid'] <= 0) {
// Finding translations of this record and select overlay record:
$fakeElementRow = array('uid' => $contentTreeArr['el']['uid'], 'pid' => $contentTreeArr['el']['pid']);
t3lib_beFunc::fixVersioningPID('tt_content', $fakeElementRow);
$res = $TYPO3_DB->exec_SELECTquery('*', 'tt_content', 'pid=' . $fakeElementRow['pid'] . ' AND sys_language_uid>0' . ' AND l18n_parent=' . intval($contentTreeArr['el']['uid']) . t3lib_BEfunc::deleteClause('tt_content'));
$attachedLocalizations = array();
while (TRUE == ($olrow = $TYPO3_DB->sql_fetch_assoc($res))) {
t3lib_BEfunc::workspaceOL('tt_content', $olrow);
if (!isset($attachedLocalizations[$olrow['sys_language_uid']])) {
$attachedLocalizations[$olrow['sys_language_uid']] = $olrow['uid'];
}
}
$TYPO3_DB->sql_free_result($res);
// Traverse the available languages of the page (not default and [All])
if (is_array($this->allSystemWebsiteLanguages) && is_array($this->allSystemWebsiteLanguages['rows'])) {
foreach (array_keys($this->allSystemWebsiteLanguages['rows']) as $sys_language_uid) {
if ($sys_language_uid > 0) {
if (isset($attachedLocalizations[$sys_language_uid])) {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'exists';
$localizationInfoArr[$sys_language_uid]['localization_uid'] = $attachedLocalizations[$sys_language_uid];
$tt_content_elementRegister[$attachedLocalizations[$sys_language_uid]]++;
} elseif ($contentTreeArr['el']['CType'] != 'templavoila_pi1') {
// Only localize content elements with "Default" langauge set
if ((int) $contentTreeArr['el']['sys_language_uid'] === 0) {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'localize';
}
} elseif (!$contentTreeArr['ds_meta']['langDisable'] && ((int) $contentTreeArr['el']['sys_language_uid'] === -1 || (int) $contentTreeArr['el']['sys_language_uid'] === 0)) {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'localizedFlexform';
} else {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'no_localization';
}
}
}
}
}
return $localizationInfoArr;
}
示例9: init
/**
* Initializes the Module
* @return void
*/
function init()
{
/*{{{*/
global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
parent::init();
$this->enableFields_tickets = t3lib_BEfunc::deleteClause($this->tickets_table) . t3lib_BEfunc::BEenableFields($this->tickets_table);
$this->enableFields_fe_users = t3lib_BEfunc::deleteClause($this->users_table) . t3lib_BEfunc::BEenableFields($this->users_table);
$this->enableFields_category = t3lib_BEfunc::deleteClause($this->category_table) . t3lib_BEfunc::BEenableFields($this->category_table);
$this->enableFields_address = t3lib_BEfunc::deleteClause($this->address_table) . t3lib_BEfunc::BEenableFields($this->address_table);
$this->enableFields_pages = t3lib_BEfunc::deleteClause($this->pages_table) . t3lib_BEfunc::BEenableFields($this->pages_table);
$this->lib = t3lib_div::makeInstance('tx_ketroubletickets_lib');
// get the page ts config
$this->pageTSConfig = t3lib_BEfunc::getPagesTSconfig($this->id);
/*
if (t3lib_div::_GP('clear_all_cache')) {
$this->include_once[] = PATH_t3lib.'class.t3lib_tcemain.php';
}
*/
}
示例10: getSingleField_beforeRender
function getSingleField_beforeRender($table, $field, &$row, &$PA)
{
global $TCA;
if ($table == 'tx_caretaker_instance' && $field === 'testconfigurations') {
switch ($PA['fieldConf']['config']['tag']) {
case 'testconfigurations.test_service':
/* * /
if (count($PA['fieldConf']['config']['items']) != count($TCA['tx_caretaker_test']['columns']['test_service']['config']['items'])) {
t3lib_div::loadTCA('tx_caretaker_test');
$PA['fieldConf']['config']['items'] = $TCA['tx_caretaker_test']['columns']['test_service']['config']['items'];
}
// */
break;
case 'testconfigurations.test_conf':
$test = $this->getFFValue($table, $row, $field, str_replace('test_conf', 'test_service', $PA['itemFormElName']));
// get related test configuration
$testrow = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,test_service,test_conf', 'tx_caretaker_test', 'uid=' . intval($test) . t3lib_BEfunc::deleteClause('tx_caretaker_test'));
$row['test_service'] = $testrow[0]['test_service'];
if ($PA['itemFormElValue'] == NULL) {
$PA['itemFormElValue'] = $testrow[0]['test_conf'];
}
if (is_array($PA['itemFormElValue'])) {
$PA['itemFormElValue'] = t3lib_div::array2xml($PA['itemFormElValue']);
}
if (!is_array($PA['fieldConf']['config']['ds'])) {
t3lib_div::loadTCA('tx_caretaker_test');
$PA['fieldConf']['config']['ds'] = $TCA['tx_caretaker_test']['columns']['test_conf']['config']['ds'];
}
// var_dump($PA['fieldConf']['config']['ds']);
/* * /
$row['test_service'] = $test;
if (!is_array($PA['fieldConf']['config']['ds'])) {
t3lib_div::loadTCA('tx_caretaker_test');
$PA['fieldConf']['config']['ds'] = $TCA['tx_caretaker_test']['columns']['test_conf']['config']['ds'];
}
// FIXME
$PA['itemFormElValue']='';
// */
break;
}
}
}
开发者ID:alexanderfiss,项目名称:caretaker,代码行数:42,代码来源:class.tx_caretaker_hooks_tceforms_getSingleFieldClass.php
示例11: getRecordOverlay
/**
* Import from t3lib_page in order to eate backend version
* Creates language-overlay for records in general (where translation is found in records from the same table)
*
* @param string $table: Table name
* @param array $row: Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
* @param integer $sys_language_content: Pointer to the sys_language uid for content on the site.
* @param string $OLmode: Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false)
* @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return false if no translation is found.
*/
function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '')
{
global $TCA, $TYPO3_DB;
if ($row['uid'] > 0 && $row['pid'] > 0) {
if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
if (!$TCA[$table]['ctrl']['transOrigPointerTable']) {
// Will try to overlay a record only if the sys_language_content value is larger that zero.
if ($sys_language_content > 0) {
// Must be default language or [All], otherwise no overlaying:
if ($row[$TCA[$table]['ctrl']['languageField']] <= 0) {
// Select overlay record:
$res = $TYPO3_DB->exec_SELECTquery('*', $table, 'pid=' . intval($row['pid']) . ' AND ' . $TCA[$table]['ctrl']['languageField'] . '=' . intval($sys_language_content) . ' AND ' . $TCA[$table]['ctrl']['transOrigPointerField'] . '=' . intval($row['uid']) . t3lib_BEfunc::BEenableFields($table) . t3lib_BEfunc::deleteClause($table), '', '', '1');
$olrow = $TYPO3_DB->sql_fetch_assoc($res);
// Merge record content by traversing all fields:
if (is_array($olrow)) {
foreach ($row as $fN => $fV) {
if ($fN != 'uid' && $fN != 'pid' && isset($olrow[$fN])) {
if ($TCA[$table]['l10n_mode'][$fN] != 'exclude' && ($TCA[$table]['l10n_mode'][$fN] != 'mergeIfNotBlank' || strcmp(trim($olrow[$fN]), ''))) {
$row[$fN] = $olrow[$fN];
}
}
}
} elseif ($OLmode === 'hideNonTranslated' && $row[$TCA[$table]['ctrl']['languageField']] == 0) {
// Unset, if non-translated records should be hidden. ONLY done if the source record really is default language and not [All] in which case it is allowed.
unset($row);
}
// Otherwise, check if sys_language_content is different from the value of the record - that means a japanese site might try to display french content.
} elseif ($sys_language_content != $row[$TCA[$table]['ctrl']['languageField']]) {
unset($row);
}
} else {
// When default language is displayed, we never want to return a record carrying another language!:
if ($row[$TCA[$table]['ctrl']['languageField']] > 0) {
unset($row);
}
}
}
}
}
return $row;
}
示例12: getLangRecords
/**
*
* @param integer $pageId
* @return array
*/
public static function getLangRecords($pageId)
{
if (!static::$sysLanguageRecordAll) {
static::$sysLanguageRecordAll = TRUE;
tx_rnbase::load('tx_rnbase_util_DB');
$records = tx_rnbase_util_DB::doSelect('*', 'sys_language', array());
foreach ($records as $record) {
static::$sysLanguageRecords[(int) $record['uid']] = $record;
}
}
$records = static::$sysLanguageRecords;
if ($pageId) {
// check all page overlays to get all available languages for the page
$available = tx_rnbase_util_DB::doSelect('sys_language.uid', array('sys_language,pages_language_overlay', 'sys_language'), array('where' => 'pages_language_overlay.sys_language_uid=sys_language.uid' . ' AND pages_language_overlay.pid=' . (int) $pageId . t3lib_BEfunc::deleteClause('pages_language_overlay'), 'orderby' => 'sys_language.title ASC'));
$records = array();
foreach ($available as $langRow) {
$langUid = (int) $langRow['uid'];
$records[$langUid] = self::getLangRecord($langUid);
}
}
return $records;
}
示例13: getCrawlerConfigurationRecords
/**
* Get all available configuration records.
*
* @access protected
* @return array which contains the available configuration records.
*/
protected function getCrawlerConfigurationRecords()
{
$records = array();
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_crawler_configuration', '1=1' . t3lib_BEfunc::deleteClause('tx_crawler_configuration'));
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$records[] = $row;
}
$GLOBALS['TYPO3_DB']->sql_free_result($result);
return $records;
}
示例14: getCategoryFolders
/**
* [Describe function...]
*
* @param [type] $where: ...
* @return [type] ...
*/
function getCategoryFolders($where)
{
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pid', 'tt_news_cat', 'pid>=0' . $where . t3lib_BEfunc::deleteClause('tt_news_cat'), 'pid');
$list = array();
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$list[] = $row['pid'];
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
// debug($list, ' ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 3);
return $list;
}
示例15: fetchRecord
/**
* A function which can be used for load a batch of records from $table into internal memory of this object.
* The function is also used to produce proper default data for new records
* Ultimately the function will call renderRecord()
*
* @param string Table name, must be found in $TCA
* @param string Comma list of id values. If $idList is "prev" then the value from $this->prevPageID is used. NOTICE: If $operation is "new", then negative ids are meant to point to a "previous" record and positive ids are PID values for new records. Otherwise (for existing records that is) it is straight forward table/id pairs.
* @param string If "new", then a record with default data is returned. Further, the $id values are meant to be PID values (or if negative, pointing to a previous record). If NOT new, then the table/ids are just pointing to an existing record!
* @return void
* @see renderRecord()
*/
function fetchRecord($table, $idList, $operation)
{
global $TCA;
if ((string) $idList == 'prev') {
$idList = $this->prevPageID;
}
if ($TCA[$table]) {
t3lib_div::loadTCA($table);
// For each ID value (integer) we
$ids = t3lib_div::trimExplode(',', $idList, 1);
foreach ($ids as $id) {
if (strcmp($id, '')) {
// If ID is not blank:
// For new records to be created, find default values:
if ($operation == 'new') {
// Default values:
$newRow = array();
// Used to store default values as found here:
// Default values as set in userTS:
$TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
if (is_array($TCAdefaultOverride[$table . '.'])) {
foreach ($TCAdefaultOverride[$table . '.'] as $theF => $theV) {
if (isset($TCA[$table]['columns'][$theF])) {
$newRow[$theF] = $theV;
}
}
}
if ($id < 0) {
$record = t3lib_beFunc::getRecord($table, abs($id), 'pid');
$pid = $record['pid'];
unset($record);
} else {
$pid = intval($id);
}
$pageTS = t3lib_beFunc::getPagesTSconfig($pid);
if (isset($pageTS['TCAdefaults.'])) {
$TCAPageTSOverride = $pageTS['TCAdefaults.'];
if (is_array($TCAPageTSOverride[$table . '.'])) {
foreach ($TCAPageTSOverride[$table . '.'] as $theF => $theV) {
if (isset($TCA[$table]['columns'][$theF])) {
$newRow[$theF] = $theV;
}
}
}
}
// Default values as submitted:
if (is_array($this->defVals[$table])) {
foreach ($this->defVals[$table] as $theF => $theV) {
if (isset($TCA[$table]['columns'][$theF])) {
$newRow[$theF] = $theV;
}
}
}
// Fetch default values if a previous record exists
if ($id < 0 && $TCA[$table]['ctrl']['useColumnsForDefaultValues']) {
// Fetches the previous record:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . abs($id) . t3lib_BEfunc::deleteClause($table));
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// Gets the list of fields to copy from the previous record.
$fArr = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['useColumnsForDefaultValues'], 1);
foreach ($fArr as $theF) {
if (isset($TCA[$table]['columns'][$theF])) {
$newRow[$theF] = $row[$theF];
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
// Finally, call renderRecord:
$this->renderRecord($table, uniqid('NEW'), $id, $newRow);
} else {
$id = intval($id);
// Fetch database values
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . intval($id) . t3lib_BEfunc::deleteClause($table));
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
t3lib_BEfunc::fixVersioningPid($table, $row);
$this->renderRecord($table, $id, $row['pid'], $row);
$contentTable = $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'];
$this->lockRecord($table, $id, $contentTable == $table ? $row['pid'] : 0);
// Locking the pid if the table edited is the content table.
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
}
}
}
}