本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::getTCEFORM_TSconfig方法的具体用法?PHP BackendUtility::getTCEFORM_TSconfig怎么用?PHP BackendUtility::getTCEFORM_TSconfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::getTCEFORM_TSconfig方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main function
* Will issue a location-header, redirecting either BACK or to a new FormEngine instance...
*
* @return void
*/
public function main()
{
// Get this record
$origRow = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
// Get TSconfig for it.
$TSconfig = BackendUtility::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
// Set [params][pid]
if (substr($this->P['params']['pid'], 0, 3) === '###' && substr($this->P['params']['pid'], -3) === '###') {
$keyword = substr($this->P['params']['pid'], 3, -3);
if (strpos($keyword, 'PAGE_TSCONFIG_') === 0) {
$this->pid = (int) $TSconfig[$this->P['field']][$keyword];
} else {
$this->pid = (int) $TSconfig['_' . $keyword];
}
} else {
$this->pid = (int) $this->P['params']['pid'];
}
// Make redirect:
// If pid is blank OR if id is set, then return...
if ((string) $this->id !== '') {
$redirectUrl = GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
} else {
// Otherwise, show the list:
$urlParameters = array();
$urlParameters['id'] = $this->pid;
$urlParameters['table'] = $this->P['params']['table'];
$urlParameters['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
$redirectUrl = BackendUtility::getModuleUrl('web_list', $urlParameters);
}
HttpUtility::redirect($redirectUrl);
}
示例2: main
/**
* Main function
* Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
*
* @return void
* @todo Define visibility
*/
public function main()
{
// Get this record
$origRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']);
// Get TSconfig for it.
$TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
// Set [params][pid]
if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') {
$this->pid = intval($TSconfig['_' . substr($this->P['params']['pid'], 3, -3)]);
} else {
$this->pid = intval($this->P['params']['pid']);
}
// Make redirect:
// If pid is blank OR if id is set, then return...
if (!strcmp($this->pid, '') || strcmp($this->id, '')) {
$redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
} else {
// Otherwise, show the list:
$urlParameters = array();
$urlParameters['id'] = $this->pid;
$urlParameters['table'] = $this->P['params']['table'];
$urlParameters['returnUrl'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI');
$redirectUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParameters);
}
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
}
示例3: init
/**
* Initialization of the class.
*
* @return void
* @todo Define visibility
*/
public function init()
{
// Init GPvars:
$this->P = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P');
$this->returnEditConf = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnEditConf');
// Get this record
$origRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']);
// Set table:
$this->table = $this->P['params']['table'];
// Get TSconfig for it.
$TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig($this->P['table'], is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
// Set [params][pid]
if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') {
$this->pid = intval($TSconfig['_' . substr($this->P['params']['pid'], 3, -3)]);
} else {
$this->pid = intval($this->P['params']['pid']);
}
// Return if new record as parent (not possibly/allowed)
if (!strcmp($this->pid, '')) {
\TYPO3\CMS\Core\Utility\HttpUtility::redirect(\TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']));
}
// Else proceed:
// If a new id has returned from a newly created record...
if ($this->returnEditConf) {
$eC = unserialize($this->returnEditConf);
if (is_array($eC[$this->table]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->P['uid'])) {
// Getting id and cmd from returning editConf array.
reset($eC[$this->table]);
$this->id = intval(key($eC[$this->table]));
$cmd = current($eC[$this->table]);
// ... and if everything seems OK we will register some classes for inclusion and instruct the object to perform processing later.
if ($this->P['params']['setValue'] && $cmd == 'edit' && $this->id && $this->P['table'] && $this->P['field'] && $this->P['uid']) {
if ($LiveRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getLiveVersionOfRecord($this->table, $this->id, 'uid')) {
$this->id = $LiveRec['uid'];
}
$this->processDataFlag = 1;
}
}
}
}
示例4: removeInvalidElements
/**
* Checks the array for elements which might contain unallowed default values and will unset them!
* Looks for the "tt_content_defValues" key in each element and if found it will traverse that array as fieldname /
* value pairs and check.
* The values will be added to the "params" key of the array (which should probably be unset or empty by default).
*
* @param array $wizardItems Wizard items, passed by reference
* @return void
*/
public function removeInvalidElements(&$wizardItems)
{
// Get TCEFORM from TSconfig of current page
$row = array('pid' => $this->id);
$TCEFORM_TSconfig = BackendUtility::getTCEFORM_TSconfig('tt_content', $row);
$headersUsed = array();
// Traverse wizard items:
foreach ($wizardItems as $key => $cfg) {
// Exploding parameter string, if any (old style)
if ($wizardItems[$key]['params']) {
// Explode GET vars recursively
$tempGetVars = GeneralUtility::explodeUrl2Array($wizardItems[$key]['params'], true);
// If tt_content values are set, merge them into the tt_content_defValues array,
// unset them from $tempGetVars and re-implode $tempGetVars into the param string
// (in case remaining parameters are around).
if (is_array($tempGetVars['defVals']['tt_content'])) {
$wizardItems[$key]['tt_content_defValues'] = array_merge(is_array($wizardItems[$key]['tt_content_defValues']) ? $wizardItems[$key]['tt_content_defValues'] : array(), $tempGetVars['defVals']['tt_content']);
unset($tempGetVars['defVals']['tt_content']);
$wizardItems[$key]['params'] = GeneralUtility::implodeArrayForUrl('', $tempGetVars);
}
}
// If tt_content_defValues are defined...:
if (is_array($wizardItems[$key]['tt_content_defValues'])) {
$backendUser = $this->getBackendUser();
// Traverse field values:
foreach ($wizardItems[$key]['tt_content_defValues'] as $fN => $fV) {
if (is_array($GLOBALS['TCA']['tt_content']['columns'][$fN])) {
// Get information about if the field value is OK:
$config =& $GLOBALS['TCA']['tt_content']['columns'][$fN]['config'];
$authModeDeny = $config['type'] == 'select' && $config['authMode'] && !$backendUser->checkAuthMode('tt_content', $fN, $fV, $config['authMode']);
// explode TSconfig keys only as needed
if (!isset($removeItems[$fN])) {
$removeItems[$fN] = GeneralUtility::trimExplode(',', $TCEFORM_TSconfig[$fN]['removeItems'], true);
}
if (!isset($keepItems[$fN])) {
$keepItems[$fN] = GeneralUtility::trimExplode(',', $TCEFORM_TSconfig[$fN]['keepItems'], true);
}
$isNotInKeepItems = !empty($keepItems[$fN]) && !in_array($fV, $keepItems[$fN]);
if ($authModeDeny || $fN === 'CType' && in_array($fV, $removeItems[$fN]) || $isNotInKeepItems) {
// Remove element all together:
unset($wizardItems[$key]);
break;
} else {
// Add the parameter:
$wizardItems[$key]['params'] .= '&defVals[tt_content][' . $fN . ']=' . rawurlencode($fV);
$tmp = explode('_', $key);
$headersUsed[$tmp[0]] = $tmp[0];
}
}
}
}
}
// remove headers without elements
foreach ($wizardItems as $key => $cfg) {
$tmp = explode('_', $key);
if ($tmp[0] && !$tmp[1] && !in_array($tmp[0], $headersUsed)) {
unset($wizardItems[$key]);
}
}
}
示例5: getTSconfigForTableRow
/**
* Returns TSconfig for given table and row
*
* @param string $table The table name
* @param array $row The table row - Must at least contain the "uid" value, even if "NEW..." string.
* The "pid" field is important as well, negative values will be interpreted as pointing to a record from the same table.
* @param string $field Optionally specify the field name as well. In that case the TSconfig for this field is returned.
* @return mixed The TSconfig values - probably in an array
* @internal
*/
public static function getTSconfigForTableRow($table, $row, $field = '')
{
static $cache;
if (is_null($cache)) {
$cache = array();
}
$cacheIdentifier = $table . ':' . $row['uid'];
if (!isset($cache[$cacheIdentifier])) {
$cache[$cacheIdentifier] = BackendUtility::getTCEFORM_TSconfig($table, $row);
}
if ($field) {
return $cache[$cacheIdentifier][$field];
}
return $cache[$cacheIdentifier];
}
示例6: init
/**
* Initialization of the class.
*
* @return void
*/
protected function init()
{
// Init GPvars:
$this->P = GeneralUtility::_GP('P');
$this->returnEditConf = GeneralUtility::_GP('returnEditConf');
// Get this record
$record = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
// Set table:
$this->table = $this->P['params']['table'];
// Get TSconfig for it.
$TSconfig = BackendUtility::getTCEFORM_TSconfig($this->P['table'], is_array($record) ? $record : array('pid' => $this->P['pid']));
// Set [params][pid]
if (substr($this->P['params']['pid'], 0, 3) === '###' && substr($this->P['params']['pid'], -3) === '###') {
$keyword = substr($this->P['params']['pid'], 3, -3);
if (strpos($keyword, 'PAGE_TSCONFIG_') === 0) {
$this->pid = (int) $TSconfig[$this->P['field']][$keyword];
} else {
$this->pid = (int) $TSconfig['_' . $keyword];
}
} else {
$this->pid = (int) $this->P['params']['pid'];
}
// Return if new record as parent (not possibly/allowed)
if ($this->pid === '') {
HttpUtility::redirect(GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']));
}
// Else proceed:
// If a new id has returned from a newly created record...
if ($this->returnEditConf) {
$editConfiguration = json_decode($this->returnEditConf, true);
if (is_array($editConfiguration[$this->table]) && MathUtility::canBeInterpretedAsInteger($this->P['uid'])) {
// Getting id and cmd from returning editConf array.
reset($editConfiguration[$this->table]);
$this->id = (int) key($editConfiguration[$this->table]);
$cmd = current($editConfiguration[$this->table]);
// ... and if everything seems OK we will register some classes for inclusion and instruct the object
// to perform processing later.
if ($this->P['params']['setValue'] && $cmd === 'edit' && $this->id && $this->P['table'] && $this->P['field'] && $this->P['uid']) {
$liveRecord = BackendUtility::getLiveVersionOfRecord($this->table, $this->id, 'uid');
if ($liveRecord) {
$this->id = $liveRecord['uid'];
}
$this->processDataFlag = 1;
}
}
}
}
示例7: setTSconfig
/**
* Returns TSconfig for table/row
* Multiple requests to this function will return cached content so there is no performance loss in calling
* this many times since the information is looked up only once.
*
* @param string $table The table name
* @param array $row The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.)
* @param string $field Optionally you can specify the field name as well. In that case the TSconfig for the field is returned.
* @return mixed The TSconfig values (probably in an array)
* @see BackendUtility::getTCEFORM_TSconfig()
* @todo Define visibility
*/
public function setTSconfig($table, $row, $field = '')
{
$mainKey = $table . ':' . $row['uid'];
if (!isset($this->cachedTSconfig[$mainKey])) {
$this->cachedTSconfig[$mainKey] = BackendUtility::getTCEFORM_TSconfig($table, $row);
}
if ($field) {
return $this->cachedTSconfig[$mainKey][$field];
} else {
return $this->cachedTSconfig[$mainKey];
}
}
示例8: makeCategories
/**
* Compile the categories enables for this $row of this $table.
*
* @param string $table Table name
* @param array $row Row from table
* @param int $sysLanguageUid User language ID
*
* @return array the categories in an array with the cat id as keys
*/
static function makeCategories($table, array $row, $sysLanguageUid)
{
$categories = array();
$mmField = 'module_sys_dmail_category';
if ($table == 'sys_dmail_group') {
$mmField = 'select_categories';
}
$pageTsConfig = BackendUtility::getTCEFORM_TSconfig($table, $row);
if (is_array($pageTsConfig[$mmField])) {
$pidList = $pageTsConfig[$mmField]['PAGE_TSCONFIG_IDLIST'];
if ($pidList) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_dmail_category', 'sys_dmail_category.pid IN (' . str_replace(",", "','", $GLOBALS['TYPO3_DB']->fullQuoteStr($pidList, 'sys_dmail_category')) . ')' . ' AND l18n_parent=0' . BackendUtility::BEenableFields('sys_dmail_category') . BackendUtility::deleteClause('sys_dmail_category'));
while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if ($localizedRowCat = self::getRecordOverlay('sys_dmail_category', $rowCat, $sysLanguageUid, '')) {
$categories[$localizedRowCat['uid']] = htmlspecialchars($localizedRowCat['category']);
}
}
$GLOBALS["TYPO3_DB"]->sql_free_result($res);
}
}
return $categories;
}
示例9: renderRecord
/**
* This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend!
* The objective with this function is to prepare the content for handling in TCEforms.
* Default values from outside/TSconfig is added by fetchRecord(). In this function default values from TCA is used if a field is NOT defined in $row.
* The resulting, processed row is stored in $this->regTableItems_data[$uniqueItemRef], where $uniqueItemRef is "[tablename]_[id-value]"
*
* @param string $table The table name
* @param string $id The uid value of the record (int). Can also be a string (NEW-something) if the record is a NEW record.
* @param int $pid The pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
* @param array $row The row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
* @return void
* @see fetchRecord()
*/
public function renderRecord($table, $id, $pid, $row)
{
$dateTimeFormats = $GLOBALS['TYPO3_DB']->getDateTimeFormats($table);
foreach ($GLOBALS['TCA'][$table]['columns'] as $column => $config) {
if (isset($config['config']['dbType']) && GeneralUtility::inList('date,datetime', $config['config']['dbType'])) {
$emptyValue = $dateTimeFormats[$config['config']['dbType']]['empty'];
$row[$column] = !empty($row[$column]) && $row[$column] !== $emptyValue ? strtotime($row[$column]) : 0;
}
}
// Init:
$uniqueItemRef = $table . '_' . $id;
// Fetches the true PAGE TSconfig pid to use later, if needed. (Until now, only for the RTE, but later..., who knows?)
list($tscPID) = BackendUtility::getTSCpid($table, $id, $pid);
$TSconfig = BackendUtility::getTCEFORM_TSconfig($table, array_merge($row, array('uid' => $id, 'pid' => $pid)));
// If the record has not already been loaded (in which case we DON'T do it again)...
if (!$this->regTableItems[$uniqueItemRef]) {
$this->regTableItems[$uniqueItemRef] = 1;
// set "loaded" flag.
// If the table is pages, set the previous page id internally.
if ($table == 'pages') {
$this->prevPageID = $id;
}
$this->regTableItems_data[$uniqueItemRef] = $this->renderRecordRaw($table, $id, $pid, $row, $TSconfig, $tscPID);
// Merges the processed array on-top of the raw one - this is done because some things in TCEforms may need access to other fields than those in the columns configuration!
if ($this->addRawData && is_array($row) && is_array($this->regTableItems_data[$uniqueItemRef])) {
$this->regTableItems_data[$uniqueItemRef] = array_merge($row, $this->regTableItems_data[$uniqueItemRef]);
}
}
}
示例10: processCmdmap
/**
* Process Commandmap hook
*
* @since 1.0.0
*
* @param string $command The TCEmain operation status, fx. 'update'
* @param string $table The table TCEmain is currently processing
* @param string $id The records id (if any)
* @param integer $value The uid of the element to move this element after.
* This value is negative when moving tt_content in page view.
* See \TYPO3\CMS\Core\DataHandling\DataHandler::resolvePid for more information.
* @param boolean $commandIsProcessed
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $parent : Reference to the parent object
*
* @return void
*/
public function processCmdmap($command, $table, $id, $value, &$commandIsProcessed, $parent)
{
if (!in_array($table, array('tt_content'))) {
return;
}
switch ($table) {
case 'tt_content':
/** @var \TYPO3\CMS\Dbal\Database\DatabaseConnection $databaseConnection */
$databaseConnection = $GLOBALS['TYPO3_DB'];
/** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
/** @var $flashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
$flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
switch ($command) {
case 'copy':
case 'move':
$res = $databaseConnection->sql_query('
SELECT
tt_content.uid, pages.backend_layout, pages.doktype, tt_content.colPos
FROM
tt_content
JOIN
pages
ON
pages.uid = tt_content.pid
WHERE
tt_content.uid = ' . abs($value));
$pasteAfterFieldArray = $databaseConnection->sql_fetch_assoc($res);
if (is_array($pasteAfterFieldArray)) {
$GLOBALS['BE_USER']->setAndSaveSessionData('core.yaml_configuration.newColPos', $pasteAfterFieldArray);
$originalFieldArray = $parent->recordInfo($table, $id, '*');
// If content is moved or copied to another colPos, check
// if that is allowed by TSConfig
if (isset($pasteAfterFieldArray['colPos']) && isset($originalFieldArray['colPos']) && $pasteAfterFieldArray['colPos'] !== $originalFieldArray['colPos']) {
$tsConfig = BackendUtility::getTCEFORM_TSconfig('tt_content', $pasteAfterFieldArray);
if ($originalFieldArray['CType'] !== '') {
$keepItems = explode(',', str_replace(' ', '', $tsConfig['CType']['keepItems']));
$removeItems = explode(',', str_replace(' ', '', $tsConfig['CType']['removeItems']));
foreach ($removeItems as $item) {
unset($keepItems[$item]);
}
if (!in_array($originalFieldArray['CType'], $keepItems)) {
if ($GLOBALS['BE_USER']->user['admin'] != 1) {
/** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, 'You are not allowed to place elements of type "' . $originalFieldArray['CType'] . '" in that column. Allowed items: "' . implode(', ', $keepItems) . '".', 'Content of type "' . $originalFieldArray['CType'] . '" not allowed in that column!', FlashMessage::WARNING, true);
$flashMessageQueue->enqueue($flashMessage);
$commandIsProcessed = true;
} else {
/** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, 'You are not allowed to place elements of type "' . $originalFieldArray['CType'] . '" in that column. Allowed items: "' . implode(', ', $keepItems) . '". You are an ' . 'admin so this time I will see it through the fingers . . . but boy oh boy . . . naughty naughty!', 'Content of type "' . $originalFieldArray['CType'] . '" not allowed in that column!', FlashMessage::WARNING, true);
$flashMessageQueue->enqueue($flashMessage);
}
}
}
if ($originalFieldArray['list_type'] !== '') {
$keepItems = explode(',', str_replace(' ', '', $tsConfig['list_type']['keepItems']));
$removeItems = explode(',', str_replace(' ', '', $tsConfig['list_type']['removeItems']));
foreach ($removeItems as $item) {
unset($keepItems[$item]);
}
if (!in_array($originalFieldArray['list_type'], $keepItems)) {
if ($GLOBALS['BE_USER']->user['admin'] != 1) {
/** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, 'You are not allowed to place elements of type "' . $originalFieldArray['list_type'] . '" in that column. Allowed items: "' . implode(', ', $keepItems) . '".', 'Plugins of type "' . $originalFieldArray['list_type'] . '" not allowed in that column!', FlashMessage::WARNING, true);
$flashMessageQueue->enqueue($flashMessage);
$commandIsProcessed = true;
} else {
/** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, 'You are not allowed to place elements of type "' . $originalFieldArray['list_type'] . '" in that column. Allowed items: "' . implode(', ', $keepItems) . '". You are an ' . 'admin so this time I will see it through the fingers . . . but boy oh boy . . . naughty naughty!', 'Plugins of type "' . $originalFieldArray['list_type'] . '" not allowed in that column!', FlashMessage::WARNING, true);
$flashMessageQueue->enqueue($flashMessage);
}
}
}
}
}
break;
default:
}
break;
}
}
示例11: init
/**
* Initializes the Module
*
* @return void
*/
function init()
{
// $s = microtime(TRUE);
if (!$this->MCONF['name']) {
$this->MCONF = $GLOBALS['MCONF'];
if (!$this->MCONF['name']) {
$MCONF = '';
require 'conf.php';
$this->MCONF = $MCONF;
}
}
$this->isAdmin = $GLOBALS['BE_USER']->isAdmin();
$this->id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'));
// $this->CMD = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('CMD');
$this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
$this->modTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']);
$this->TSprop = $this->modTSconfig['properties'];
$this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['tt_news']);
$tceTSC = array();
if ($this->confArr['useStoragePid']) {
$tceTSC = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig('tt_news_cat', array('pid' => $this->id));
}
$this->storagePid = $tceTSC['_STORAGE_PID'] ? $tceTSC['_STORAGE_PID'] : $this->id;
$newArticlePid = intval($this->TSprop['list.']['pidForNewArticles']);
$this->newArticlePid = $newArticlePid ? $newArticlePid : $this->id;
$this->script = 'mod.php?M=web_txttnewsM1';
if ($fieldList = $this->TSprop['list.']['fList']) {
$this->fieldList = $fieldList;
}
// get pageinfo array for the current page
$this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
$this->localCalcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
// get pageinfo array for the GRSP
$grspPI = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->storagePid, $this->perms_clause);
$this->grspCalcPerms = $GLOBALS['BE_USER']->calcPerms($grspPI);
$this->mayUserEditCategories = $this->grspCalcPerms & 16;
// get pageinfo array for newArticlePid
$newArticlePidPI = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->newArticlePid, $this->perms_clause);
$this->newArticleCalcPerms = $GLOBALS['BE_USER']->calcPerms($newArticlePidPI);
$this->mayUserEditArticles = $this->newArticleCalcPerms & 16;
$pagesTSC = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($this->id);
if ($pagesTSC['tx_ttnews.']['singlePid']) {
$this->singlePid = intval($pagesTSC['tx_ttnews.']['singlePid']);
}
$this->initCategories();
$this->setPidList();
$this->initPermsCache();
if ($this->pidList) {
$this->setEditablePages($this->pidList);
}
$this->menuConfig();
$this->mData = $GLOBALS['BE_USER']->uc['moduleData']['web_txttnewsM1'];
$this->current_sys_language = intval($this->MOD_SETTINGS['language']);
$this->searchLevels = intval($this->MOD_SETTINGS['searchLevels']);
$this->thumbs = intval($this->MOD_SETTINGS['showThumbs']);
$limit = intval($this->MOD_SETTINGS['showLimit']);
if ($limit) {
$this->showLimit = $limit;
} else {
$this->showLimit = intval($this->TSprop['list.']['limit']);
}
$this->initGPvars();
// debug((microtime(TRUE)-$s), 'time ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 3);
}
示例12: displayTypeFieldCheckCategories
/**
* This functions displays the title field of a news record and checks if the record has categories assigned that are not allowed for the current BE user.
* If there are non allowed categories an error message will be displayed.
*
* @param array $PA:
* parameter array for the current field
* @param object $fobj:
* to the parent object
* @return string HTML code for the field and the error message
*/
function displayTypeFieldCheckCategories(&$PA, $fobj)
{
$table = $PA['table'];
$field = $PA['field'];
$row = $PA['row'];
if ($GLOBALS['BE_USER']->getTSConfigVal('options.useListOfAllowedItems') && !$GLOBALS['BE_USER']->isAdmin()) {
$notAllowedItems = array();
if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['tt_news']) {
// get tt_news extConf array
$confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['tt_news']);
}
if ($confArr['useStoragePid']) {
$TSconfig = BackendUtility::getTCEFORM_TSconfig($table, $row);
$storagePid = $TSconfig['_STORAGE_PID'] ? $TSconfig['_STORAGE_PID'] : 0;
$SPaddWhere = ' AND tt_news_cat.pid IN (' . $storagePid . ')';
}
$notAllowedItems = $this->getNotAllowedItems($PA, $SPaddWhere);
if ($notAllowedItems[0]) {
// get categories of the record in db
$uidField = $row['l18n_parent'] && $row['sys_language_uid'] ? $row['l18n_parent'] : $row['uid'];
$catres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tt_news_cat.uid,tt_news_cat.title,tt_news_cat_mm.sorting AS mmsorting', 'tt_news', 'tt_news_cat_mm', 'tt_news_cat', ' AND tt_news_cat_mm.uid_local=' . $uidField . $SPaddWhere, '', 'mmsorting');
$NACats = array();
if ($catres) {
while ($catrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($catres)) {
if ($catrow['uid'] && $notAllowedItems[0] && in_array($catrow['uid'], $notAllowedItems)) {
$NACats[] = '<p style="padding:0px;color:red;font-weight:bold;">- ' . $catrow['title'] . ' <span class="typo3-dimmed"><em>[' . $catrow['uid'] . ']</em></span></p>';
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($catres);
}
if ($NACats[0]) {
$NA_Items = '<table class="warningbox" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td><img src="gfx/icon_fatalerror.gif" class="absmiddle" alt="" height="16" width="18">SAVING DISABLED!! <br />' . ($row['l18n_parent'] && $row['sys_language_uid'] ? 'The translation original of this' : 'This') . ' record has the following categories assigned that are not defined in your BE usergroup: ' . implode($NACats, chr(10)) . '</td></tr></tbody></table>';
}
}
}
// unset foreign table to prevent adding of categories to the "type" field
$PA['fieldConf']['config']['foreign_table'] = '';
$PA['fieldConf']['config']['foreign_table_where'] = '';
if (!$row['l18n_parent'] && !$row['sys_language_uid']) {
// render "type" field only for records in the default language
$fieldHTML = $fobj->getSingleField_typeSelect($table, $field, $row, $PA);
}
return $NA_Items . $fieldHTML;
}