本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::fixVersioningPid方法的具体用法?PHP BackendUtility::fixVersioningPid怎么用?PHP BackendUtility::fixVersioningPid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::fixVersioningPid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolve
/**
* Returns RichTextElement as class name if RTE widget should be rendered.
*
* @return string|void New class name or void if this resolver does not change current class name.
*/
public function resolve()
{
$table = $this->data['tableName'];
$fieldName = $this->data['fieldName'];
$row = $this->data['databaseRow'];
$parameterArray = $this->data['parameterArray'];
$backendUser = $this->getBackendUserAuthentication();
if (!$parameterArray['fieldConf']['config']['readOnly'] && $backendUser->isRTE()) {
// @todo: Most of this stuff is prepared by data providers within $this->data already
$specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
// If "richtext" is within defaultExtras
if (isset($specialConfiguration['richtext'])) {
// Operates by reference on $row! 'pid' is changed ...
BackendUtility::fixVersioningPid($table, $row);
list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']);
// If the pid-value is not negative (that is, a pid could NOT be fetched)
if ($tsConfigPid >= 0) {
// Fetch page ts config and do some magic with it to find out if RTE is disabled on TS level.
$rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid));
$rteTcaTypeValue = $this->data['recordTypeValue'];
$rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $fieldName, $rteTcaTypeValue);
if (!$rteSetupConfiguration['disabled']) {
// Finally, we're sure the editor should really be rendered ...
return RichtextElement::class;
}
}
}
}
return null;
}
示例2: addData
/**
* Fetch existing record from database
*
* @param array $result
* @return array
* @throws \UnexpectedValueException
*/
public function addData(array $result)
{
if ($result['command'] !== 'edit') {
return $result;
}
$databaseRow = $this->getRecordFromDatabase($result['tableName'], $result['vanillaUid']);
if (!array_key_exists('pid', $databaseRow)) {
throw new \UnexpectedValueException('Parent record does not have a pid field', 1437663061);
}
// Warning: By reference! In case the record is in a workspace, the -1 in pid will be
// changed to the real pid of the life record here.
BackendUtility::fixVersioningPid($result['tableName'], $databaseRow);
$result['databaseRow'] = $databaseRow;
return $result;
}
示例3: render
/**
* This will render a <textarea> OR RTE area form field,
* possibly with various control/validation features
*
* @return array As defined in initializeResultArray() of AbstractNode
*/
public function render()
{
$table = $this->globalOptions['table'];
$fieldName = $this->globalOptions['fieldName'];
$row = $this->globalOptions['databaseRow'];
$parameterArray = $this->globalOptions['parameterArray'];
$resultArray = $this->initializeResultArray();
$backendUser = $this->getBackendUserAuthentication();
$validationConfig = array();
// "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found.
$specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
// Setting up the altItem form field, which is a hidden field containing the value
$altItem = '<input type="hidden" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
BackendUtility::fixVersioningPid($table, $row);
list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']);
// If the pid-value is not negative (that is, a pid could NOT be fetched)
$rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid));
$rteTcaTypeValue = BackendUtility::getTCAtypeValue($table, $row);
$rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $fieldName, $rteTcaTypeValue);
// Get RTE object, draw form and set flag:
$rteObject = BackendUtility::RTEgetObj();
$dummyFormEngine = new FormEngine();
$rteResult = $rteObject->drawRTE($dummyFormEngine, $table, $fieldName, $row, $parameterArray, $specialConfiguration, $rteSetupConfiguration, $rteTcaTypeValue, '', $tsConfigPid, $this->globalOptions, $this->initializeResultArray(), $this->getValidationDataAsDataAttribute($validationConfig));
// This is a compat layer for "other" RTE's: If the result is not an array, it is the html string,
// otherwise it is a structure similar to our casual return array
// @todo: This interface needs a full re-definition, RTE should probably be its own type in the
// @todo: end, and other RTE implementations could then just override this.
if (is_array($rteResult)) {
$html = $rteResult['html'];
$rteResult['html'] = '';
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $rteResult);
} else {
$html = $rteResult;
}
// Wizard
$html = $this->renderWizards(array($html, $altItem), $parameterArray['fieldConf']['config']['wizards'], $table, $row, $fieldName, $parameterArray, $parameterArray['itemFormElName'], $specialConfiguration, TRUE);
$resultArray['html'] = $html;
return $resultArray;
}
示例4: checkEditAccess
/**
* Checks access for element
*
* @param string $table Table name
* @param int $uid Record uid
* @return bool
*/
protected function checkEditAccess($table, $uid)
{
$record = BackendUtility::getRecord($table, $uid);
BackendUtility::fixVersioningPid($table, $record);
if (is_array($record)) {
// If pages:
if ($table === 'pages') {
$calculatedPermissions = $this->getBackendUserAuthentication()->calcPerms($record);
$hasAccess = $calculatedPermissions & Permission::PAGE_EDIT;
} else {
// Fetching pid-record first.
$calculatedPermissions = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $record['pid']));
$hasAccess = $calculatedPermissions & Permission::CONTENT_EDIT;
}
// Check internals regarding access:
if ($hasAccess) {
$hasAccess = $this->getBackendUserAuthentication()->recordEditAccessInternals($table, $record);
}
} else {
$hasAccess = false;
}
return (bool) $hasAccess;
}
示例5: 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 Table name, must be found in $GLOBALS['TCA']
* @param string $idList 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 $operation 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()
*/
public function fetchRecord($table, $idList, $operation)
{
if ((string) $idList === 'prev') {
$idList = $this->prevPageID;
}
if ($GLOBALS['TCA'][$table]) {
// For each ID value (int) we
$ids = GeneralUtility::trimExplode(',', $idList, TRUE);
foreach ($ids as $id) {
// If ID is not blank:
if ((string) $id !== '') {
// For new records to be created, find default values:
if ($operation == 'new') {
// Default values:
// Used to store default values as found here:
$newRow = array();
// 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($GLOBALS['TCA'][$table]['columns'][$theF])) {
$newRow[$theF] = $theV;
}
}
}
if ($id < 0) {
$record = BackendUtility::getRecord($table, abs($id), 'pid');
$pid = $record['pid'];
unset($record);
} else {
$pid = (int) $id;
}
$pageTS = BackendUtility::getPagesTSconfig($pid);
if (isset($pageTS['TCAdefaults.'])) {
$TCAPageTSOverride = $pageTS['TCAdefaults.'];
if (is_array($TCAPageTSOverride[$table . '.'])) {
foreach ($TCAPageTSOverride[$table . '.'] as $theF => $theV) {
if (isset($GLOBALS['TCA'][$table]['columns'][$theF])) {
$newRow[$theF] = $theV;
}
}
}
}
// Default values as submitted:
if (!empty($this->defVals[$table]) && is_array($this->defVals[$table])) {
foreach ($this->defVals[$table] as $theF => $theV) {
if (isset($GLOBALS['TCA'][$table]['columns'][$theF])) {
$newRow[$theF] = $theV;
}
}
}
// Fetch default values if a previous record exists
if ($id < 0 && $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
// Fetches the previous record:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . abs($id) . BackendUtility::deleteClause($table));
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// Gets the list of fields to copy from the previous record.
$fArr = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues'], TRUE);
foreach ($fArr as $theF) {
if (isset($GLOBALS['TCA'][$table]['columns'][$theF]) && !isset($newRow[$theF])) {
$newRow[$theF] = $row[$theF];
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
// Finally, call renderRecord:
$this->renderRecord($table, uniqid('NEW', TRUE), $id, $newRow);
} else {
$id = (int) $id;
// Fetch database values
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . $id . BackendUtility::deleteClause($table));
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
BackendUtility::fixVersioningPid($table, $row);
$this->renderRecord($table, $id, $row['pid'], $row);
$this->lockRecord($table, $id, $table === 'tt_content' ? $row['pid'] : 0);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
}
}
}
$this->emitFetchRecordPostProcessingSignal();
}
示例6: readPageAccess
public function readPageAccess($id, $perms_clause)
{
if ((string) $id != '') {
$id = intval($id);
if (!$id) {
if ($GLOBALS['BE_USER']->isAdmin()) {
$path = '/';
$pageinfo['_thePath'] = $path;
return $pageinfo;
}
} else {
$pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $id, '*', $perms_clause ? ' AND ' . $perms_clause : '');
if ($pageinfo['uid'] && $GLOBALS['BE_USER']->isInWebMount($id, $perms_clause)) {
\TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('pages', $pageinfo);
\TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid('pages', $pageinfo);
list($pageinfo['_thePath'], $pageinfo['_thePathFull']) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath(intval($pageinfo['uid']), $perms_clause, 15, 1000);
return $pageinfo;
}
}
}
return false;
}
示例7: getLanguageIcon
/**
* Initializes language icons etc.
*
* @param string $table Table name
* @param array $row Record
* @param string $sys_language_uid Sys language uid OR ISO language code prefixed with "v", eg. "vDA
* @return string
* @todo Define visibility
*/
public function getLanguageIcon($table, $row, $sys_language_uid)
{
$mainKey = $table . ':' . $row['uid'];
if (!isset($this->cachedLanguageFlag[$mainKey])) {
BackendUtility::fixVersioningPid($table, $row);
list($tscPID) = $this->getTSCpid($table, $row['uid'], $row['pid']);
/** @var $t8Tools \TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider */
$t8Tools = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TranslationConfigurationProvider');
$this->cachedLanguageFlag[$mainKey] = $t8Tools->getSystemLanguages($tscPID, $this->backPath);
}
// Convert sys_language_uid to sys_language_uid if input was in fact a string (ISO code expected then)
if (!MathUtility::canBeInterpretedAsInteger($sys_language_uid)) {
foreach ($this->cachedLanguageFlag[$mainKey] as $rUid => $cD) {
if ('v' . $cD['ISOcode'] === $sys_language_uid) {
$sys_language_uid = $rUid;
}
}
}
$out = '';
if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']) {
$out .= IconUtility::getSpriteIcon($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']);
$out .= ' ';
} elseif ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title']) {
$out .= '[' . $this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'] . ']';
$out .= ' ';
}
return $out;
}
示例8: getRecordPath
/**
* Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage"
* Each part of the path will be limited to $titleLimit characters
* Deleted pages are filtered out.
*
* @param integer Page uid for which to create record path
* @param string $clause is additional where clauses, eg.
* @param integer Title limit
* @param integer Title limit of Full title (typ. set to 1000 or so)
* @return mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set.
*/
public static function getRecordPath($uid, $clause = '', $titleLimit = 1000, $fullTitleLimit = 0)
{
$loopCheck = 100;
$output = $fullOutput = '/';
while ($uid != 0 && $loopCheck > 0) {
$loopCheck--;
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', 'uid=' . intval($uid) . (strlen(trim($clause)) ? ' AND ' . $clause : ''));
if (is_resource($res)) {
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
\TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('pages', $row);
if (is_array($row)) {
\TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid('pages', $row);
$uid = $row['pid'];
$output = '/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $titleLimit)) . $output;
if ($row['deleted']) {
$output = '<span class="deletedPath">' . $output . '</span>';
}
if ($fullTitleLimit) {
$fullOutput = '/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $fullTitleLimit)) . $fullOutput;
}
} else {
break;
}
} else {
break;
}
}
if ($fullTitleLimit) {
return array($output, $fullOutput);
} else {
return $output;
}
}
示例9: checkAccess
/**
* Checks the page access rights (Code for access check mostly taken from alt_doc.php)
* as well as the table access rights of the user.
*
* @param string $cmd The command that should be performed ('new' or 'edit')
* @param string $table The table to check access for
* @param string $theUid The record uid of the table
* @return boolean Returns TRUE is the user has access, or FALSE if not
* @todo Define visibility
*/
public function checkAccess($cmd, $table, $theUid)
{
// Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
// First, resetting flags.
$hasAccess = 0;
// Admin users always have access:
if ($GLOBALS['BE_USER']->isAdmin()) {
return TRUE;
}
// If the command is to create a NEW record...:
if ($cmd == 'new') {
// If the pid is numerical, check if it's possible to write to this page:
if (MathUtility::canBeInterpretedAsInteger($this->inlineFirstPid)) {
$calcPRec = BackendUtility::getRecord('pages', $this->inlineFirstPid);
if (!is_array($calcPRec)) {
return FALSE;
}
// Permissions for the parent page
$CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
// If pages:
if ($table == 'pages') {
// Are we allowed to create new subpages?
$hasAccess = $CALC_PERMS & 8 ? 1 : 0;
} else {
// Are we allowed to edit content on this page?
$hasAccess = $CALC_PERMS & 16 ? 1 : 0;
}
} else {
$hasAccess = 1;
}
} else {
// Edit:
$calcPRec = BackendUtility::getRecord($table, $theUid);
BackendUtility::fixVersioningPid($table, $calcPRec);
if (is_array($calcPRec)) {
// If pages:
if ($table == 'pages') {
$CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
$hasAccess = $CALC_PERMS & 2 ? 1 : 0;
} else {
// Fetching pid-record first.
$CALC_PERMS = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $calcPRec['pid']));
$hasAccess = $CALC_PERMS & 16 ? 1 : 0;
}
// Check internals regarding access:
$isRootLevelRestrictionIgnored = BackendUtility::isRootLevelRestrictionIgnored($table);
if ($hasAccess || (int) $calcPRec['pid'] === 0 && $isRootLevelRestrictionIgnored) {
$hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
}
}
}
if (!$GLOBALS['BE_USER']->check('tables_modify', $table)) {
$hasAccess = 0;
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['checkAccess']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['checkAccess'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['checkAccess'] as $_funcRef) {
$_params = array('table' => $table, 'uid' => $theUid, 'cmd' => $cmd, 'hasAccess' => $hasAccess);
$hasAccess = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
}
}
if (!$hasAccess) {
$deniedAccessReason = $GLOBALS['BE_USER']->errorMsg;
if ($deniedAccessReason) {
debug($deniedAccessReason);
}
}
return $hasAccess ? TRUE : FALSE;
}
示例10: notifyStageChange
//.........这里部分代码省略.........
break;
}
}
}
break;
case 0:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']);
break;
default:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
}
break;
case 10:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']) + $emails;
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']) + $emails;
break;
default:
// Do nothing
}
} else {
$emails = $notificationAlternativeRecipients;
}
// prepare and then send the emails
if (count($emails)) {
// Path to record is found:
list($elementTable, $elementUid) = explode(':', $elementName);
$elementUid = (int) $elementUid;
$elementRecord = BackendUtility::getRecord($elementTable, $elementUid);
$recordTitle = BackendUtility::getRecordTitle($elementTable, $elementRecord);
if ($elementTable == 'pages') {
$pageUid = $elementUid;
} else {
BackendUtility::fixVersioningPid($elementTable, $elementRecord);
$pageUid = $elementUid = $elementRecord['pid'];
}
// fetch the TSconfig settings for the email
// old way, options are TCEMAIN.notificationEmail_body/subject
$TCEmainTSConfig = $tcemainObj->getTCEMAIN_TSconfig($pageUid);
// new way, options are
// pageTSconfig: tx_version.workspaces.stageNotificationEmail.subject
// userTSconfig: page.tx_version.workspaces.stageNotificationEmail.subject
$pageTsConfig = BackendUtility::getPagesTSconfig($pageUid);
$emailConfig = $pageTsConfig['tx_version.']['workspaces.']['stageNotificationEmail.'];
$markers = array('###RECORD_TITLE###' => $recordTitle, '###RECORD_PATH###' => BackendUtility::getRecordPath($elementUid, '', 20), '###SITE_NAME###' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], '###SITE_URL###' => GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir, '###WORKSPACE_TITLE###' => $workspaceRec['title'], '###WORKSPACE_UID###' => $workspaceRec['uid'], '###ELEMENT_NAME###' => $elementName, '###NEXT_STAGE###' => $newStage, '###COMMENT###' => $comment, '###USER_REALNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_FULLNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_USERNAME###' => $tcemainObj->BE_USER->user['username']);
// add marker for preview links if workspace extension is loaded
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
$this->workspaceService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
// only generate the link if the marker is in the template - prevents database from getting to much entries
if (GeneralUtility::isFirstPartOfStr($emailConfig['message'], 'LLL:')) {
$tempEmailMessage = $GLOBALS['LANG']->sL($emailConfig['message']);
} else {
$tempEmailMessage = $emailConfig['message'];
}
if (strpos($tempEmailMessage, '###PREVIEW_LINK###') !== FALSE) {
$markers['###PREVIEW_LINK###'] = $this->workspaceService->generateWorkspacePreviewLink($elementUid);
}
unset($tempEmailMessage);
$markers['###SPLITTED_PREVIEW_LINK###'] = $this->workspaceService->generateWorkspaceSplittedPreviewLink($elementUid, TRUE);
}
// Hook for preprocessing of the content for formmails:
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/version/class.tx_version_tcemain.php']['notifyStageChange-postModifyMarkers'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/version/class.tx_version_tcemain.php']['notifyStageChange-postModifyMarkers'] as $_classRef) {
$_procObj =& GeneralUtility::getUserObj($_classRef);
$markers = $_procObj->postModifyMarkers($markers, $this);
}
示例11: render
/**
* This will render a <textarea> OR RTE area form field,
* possibly with various control/validation features
*
* @return array As defined in initializeResultArray() of AbstractNode
*/
public function render()
{
$table = $this->data['tableName'];
$fieldName = $this->data['fieldName'];
$row = $this->data['databaseRow'];
$parameterArray = $this->data['parameterArray'];
$backendUser = $this->getBackendUserAuthentication();
$this->resultArray = $this->initializeResultArray();
$this->defaultExtras = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
$this->pidOfPageRecord = $table === 'pages' && MathUtility::canBeInterpretedAsInteger($row['uid']) ? (int) $row['uid'] : (int) $row['pid'];
BackendUtility::fixVersioningPid($table, $row);
$this->pidOfVersionedMotherRecord = (int) $row['pid'];
$this->vanillaRteTsConfig = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pidOfPageRecord));
$this->processedRteConfiguration = BackendUtility::RTEsetup($this->vanillaRteTsConfig['properties'], $table, $fieldName, $this->data['recordTypeValue']);
$this->client = $this->clientInfo();
$this->domIdentifier = preg_replace('/[^a-zA-Z0-9_:.-]/', '_', $parameterArray['itemFormElName']);
$this->domIdentifier = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $this->domIdentifier));
$this->initializeLanguageRelatedProperties();
// Get skin file name from Page TSConfig if any
$skinFilename = trim($this->processedRteConfiguration['skin']) ?: 'EXT:rtehtmlarea/Resources/Public/Css/Skin/htmlarea.css';
$skinFilename = $this->getFullFileName($skinFilename);
$skinDirectory = dirname($skinFilename);
// jQuery UI Resizable style sheet and main skin stylesheet
$this->resultArray['stylesheetFiles'][] = $skinDirectory . '/jquery-ui-resizable.css';
$this->resultArray['stylesheetFiles'][] = $skinFilename;
$this->enableRegisteredPlugins();
// Configure toolbar
$this->setToolbar();
// Check if some plugins need to be disabled
$this->setPlugins();
// Merge the list of enabled plugins with the lists from the previous RTE editing areas on the same form
$this->pluginEnabledCumulativeArray = $this->pluginEnabledArray;
$this->addInstanceJavaScriptRegistration();
$this->addOnSubmitJavaScriptCode();
// Add RTE JavaScript
$this->loadRequireModulesForRTE();
// Create language labels
$this->createJavaScriptLanguageLabelsFromFiles();
// Get RTE init JS code
$this->resultArray['additionalJavaScriptPost'][] = $this->getRteInitJsCode();
$html = $this->getMainHtml();
$this->resultArray['html'] = $this->renderWizards(array($html), $parameterArray['fieldConf']['config']['wizards'], $table, $row, $fieldName, $parameterArray, $parameterArray['itemFormElName'], $this->defaultExtras, true);
return $this->resultArray;
}
示例12: isRTEforField
/**
* Checking if the RTE is available/enabled for a certain table/field and if so, it returns TRUE.
* Used to determine if the RTE button should be displayed.
*
* @param string $table Table name
* @param array $row Record row (needed, if there are RTE dependencies based on other fields in the record)
* @param string $field Field name
* @return boolean Returns TRUE if the rich text editor would be enabled/available for the field name specified.
* @todo Define visibility
*/
public function isRTEforField($table, $row, $field)
{
$specConf = $this->getSpecConfForField($table, $row, $field);
if (!count($specConf)) {
return FALSE;
}
$p = BackendUtility::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
BackendUtility::fixVersioningPid($table, $row);
list($tscPID, $thePidValue) = BackendUtility::getTSCpid($table, $row['uid'], $row['pid']);
// If the pid-value is not negative (that is, a pid could NOT be fetched)
if ($thePidValue >= 0) {
if (!isset($this->rteSetup[$tscPID])) {
$this->rteSetup[$tscPID] = $this->getBackendUser()->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
}
$RTEtypeVal = BackendUtility::getTCAtypeValue($table, $row);
$thisConfig = BackendUtility::RTEsetup($this->rteSetup[$tscPID]['properties'], $table, $field, $RTEtypeVal);
if (!$thisConfig['disabled']) {
return TRUE;
}
}
}
return FALSE;
}
示例13: main
/**
* Main function, rendering the document with the iFrame with the RTE in.
*
* @return void
*/
public function main()
{
// Translate id to the workspace version:
if ($versionedRecord = BackendUtility::getWorkspaceVersionOfRecord($this->getBackendUserAuthentication()->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
$this->P['uid'] = $versionedRecord['uid'];
}
// If all parameters are available:
if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
// Getting the raw record (we need only the pid-value from here...)
$rawRecord = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
BackendUtility::fixVersioningPid($this->P['table'], $rawRecord);
// override the default jumpToUrl
$this->doc->JScodeArray['jumpToUrl'] = '
function jumpToUrl(URL,formEl) {
if (document.editform) {
if (!TBE_EDITOR.isFormChanged()) {
window.location.href = URL;
} else if (formEl) {
if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
}
} else {
window.location.href = URL;
}
}
';
// Setting JavaScript of the pid value for viewing:
if ($this->popView) {
$this->doc->JScode = $this->doc->wrapScriptTags(BackendUtility::viewOnClick($rawRecord['pid'], '', BackendUtility::BEgetRootLine($rawRecord['pid'])));
}
// Initialize FormEngine - for rendering the field:
/** @var FormEngine $formEngine */
$formEngine = GeneralUtility::makeInstance(FormEngine::class);
// SPECIAL: Disables all wizards - we are NOT going to need them.
$formEngine->disableWizards = 1;
// Fetching content of record:
/** @var DataPreprocessor $dataPreprocessor */
$dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
$dataPreprocessor->lockRecords = 1;
$dataPreprocessor->fetchRecord($this->P['table'], $this->P['uid'], '');
// Getting the processed record content out:
$processedRecord = reset($dataPreprocessor->regTableItems_data);
$processedRecord['uid'] = $this->P['uid'];
$processedRecord['pid'] = $rawRecord['pid'];
// TSconfig, setting width:
$fieldTSConfig = FormEngineUtility::getTSconfigForTableRow($this->P['table'], $processedRecord, $this->P['field']);
if ((string) $fieldTSConfig['RTEfullScreenWidth'] !== '') {
$width = $fieldTSConfig['RTEfullScreenWidth'];
} else {
$width = '100%';
}
// Get the form field and wrap it in the table with the buttons:
$formContent = $formEngine->getSoloField($this->P['table'], $processedRecord, $this->P['field']);
$formContent = '
<!-- RTE wizard: -->
<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
<tr>
<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
<td></td>
</tr>
</table>';
// Adding hidden fields:
$formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . FormEngine::getHiddenTokenField('tceAction');
// Finally, add the whole setup:
$this->content .= $formEngine->printNeededJSFunctions_top() . $formContent . $formEngine->printNeededJSFunctions();
} else {
// ERROR:
$this->content .= $this->doc->section($this->getLanguageService()->getLL('forms_title'), '<span class="text-danger">' . $this->getLanguageService()->getLL('table_noData', TRUE) . '</span>', 0, 1);
}
// Setting up the buttons and markers for docHeader
$docHeaderButtons = $this->getButtons();
$markers['CONTENT'] = $this->content;
// Build the <body> for the module
$this->content = $this->doc->startPage('');
$this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
示例14: getRecordPath
/**
* Return record path (visually formatted, using BackendUtility::getRecordPath() )
*
* @param string $table Table name
* @param array $rec Record array
* @return string The record path.
* @see BackendUtility::getRecordPath()
*/
public function getRecordPath($table, $rec)
{
BackendUtility::fixVersioningPid($table, $rec);
list($tscPID, $thePidValue) = BackendUtility::getTSCpidCached($table, $rec['uid'], $rec['pid']);
if ($thePidValue >= 0) {
return BackendUtility::getRecordPath($tscPID, $this->readPerms(), 15);
}
return '';
}
示例15: getRecordPropertiesFromRow
/**
* Returns an array with record properties, like header and pid, based on the row
*
* @param string $table Table name
* @param array $row Input row
* @return array|NULL Output array
*/
public function getRecordPropertiesFromRow($table, $row)
{
if ($GLOBALS['TCA'][$table]) {
BackendUtility::fixVersioningPid($table, $row);
$out = array('header' => BackendUtility::getRecordTitle($table, $row), 'pid' => $row['pid'], 'event_pid' => $this->eventPid($table, isset($row['_ORIG_pid']) ? $row['t3ver_oid'] : $row['uid'], $row['pid']), 't3ver_state' => $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] ? $row['t3ver_state'] : '', '_ORIG_pid' => $row['_ORIG_pid']);
return $out;
}
return null;
}