本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::titleAttribForPages方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::titleAttribForPages方法的具体用法?PHP BackendUtility::titleAttribForPages怎么用?PHP BackendUtility::titleAttribForPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::titleAttribForPages方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNewNode
/**
* Creates a node with the given record information
*
* @param array $record
* @param int $mountPoint
* @return \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode
*/
public static function getNewNode($record, $mountPoint = 0)
{
if (self::$titleLength === NULL) {
self::$useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
self::$addIdAsPrefix = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
self::$addDomainName = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showDomainNameWithTitle');
self::$backgroundColors = $GLOBALS['BE_USER']->getTSConfigProp('options.pageTree.backgroundColor');
self::$titleLength = (int) $GLOBALS['BE_USER']->uc['titleLen'];
}
/** @var $subNode \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */
$subNode = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class);
$subNode->setRecord($record);
$subNode->setCls($record['_CSSCLASS']);
$subNode->setType('pages');
$subNode->setId($record['uid']);
$subNode->setMountPoint($mountPoint);
$subNode->setWorkspaceId($record['_ORIG_uid'] ?: $record['uid']);
$subNode->setBackgroundColor(self::$backgroundColors[$record['uid']]);
$field = 'title';
$text = $record['title'];
if (self::$useNavTitle && trim($record['nav_title']) !== '') {
$field = 'nav_title';
$text = $record['nav_title'];
}
if (trim($text) === '') {
$visibleText = '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', TRUE) . ']';
} else {
$visibleText = $text;
}
$visibleText = GeneralUtility::fixed_lgd_cs($visibleText, self::$titleLength);
$suffix = '';
if (self::$addDomainName) {
$domain = self::getDomainName($record['uid']);
$suffix = $domain !== '' ? ' [' . $domain . ']' : '';
}
$qtip = str_replace(' - ', '<br />', htmlspecialchars(BackendUtility::titleAttribForPages($record, '', FALSE)));
$prefix = '';
$lockInfo = BackendUtility::isRecordLocked('pages', $record['uid']);
if (is_array($lockInfo)) {
$qtip .= '<br />' . htmlspecialchars($lockInfo['msg']);
$prefix .= IconUtility::getSpriteIcon('status-warning-in-use', array('class' => 'typo3-pagetree-status'));
}
// Call stats information hook
$stat = '';
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
$_params = array('pages', $record['uid']);
$fakeThis = NULL;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
$stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $fakeThis);
}
}
$prefix .= htmlspecialchars(self::$addIdAsPrefix ? '[' . $record['uid'] . '] ' : '');
$subNode->setEditableText($text);
$subNode->setText(htmlspecialchars($visibleText), $field, $prefix, htmlspecialchars($suffix) . $stat);
$subNode->setQTip($qtip);
if ((int) $record['uid'] !== 0) {
$spriteIconCode = IconUtility::getSpriteIconForRecord('pages', $record);
} else {
$spriteIconCode = IconUtility::getSpriteIcon('apps-pagetree-root');
}
$subNode->setSpriteIconCode($spriteIconCode);
if (!$subNode->canCreateNewPages() || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
$subNode->setIsDropTarget(FALSE);
}
if (!$subNode->canBeEdited() || !$subNode->canBeRemoved() || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
$subNode->setDraggable(FALSE);
}
return $subNode;
}
示例2: main
/**
* Main function creating the content for the module.
*
* @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
*/
public function main()
{
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$this->getLanguageService()->includeLLFile('EXT:wizard_crpages/Resources/Private/Language/locallang.xlf');
$theCode = '';
$this->tsConfig = BackendUtility::getPagesTSconfig($this->pObj->id);
$this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array();
// Create new pages here?
$pageRecord = BackendUtility::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $this->getBackendUser()->getPagePermsClause(8));
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$menuItems = $pageRepository->getMenu($this->pObj->id, '*', 'sorting', '', false);
if (is_array($pageRecord)) {
$data = GeneralUtility::_GP('data');
if (is_array($data['pages'])) {
if (GeneralUtility::_GP('createInListEnd')) {
$endI = end($menuItems);
$thePid = -(int) $endI['uid'];
if (!$thePid) {
$thePid = $this->pObj->id;
}
} else {
$thePid = $this->pObj->id;
}
$firstRecord = true;
$previousIdentifier = '';
foreach ($data['pages'] as $identifier => $dat) {
if (!trim($dat['title'])) {
unset($data['pages'][$identifier]);
} else {
$data['pages'][$identifier]['hidden'] = GeneralUtility::_GP('hidePages') ? 1 : 0;
$data['pages'][$identifier]['nav_hide'] = GeneralUtility::_GP('hidePagesInMenus') ? 1 : 0;
if ($firstRecord) {
$firstRecord = false;
$data['pages'][$identifier]['pid'] = $thePid;
} else {
$data['pages'][$identifier]['pid'] = '-' . $previousIdentifier;
}
$previousIdentifier = $identifier;
}
}
if (!empty($data['pages'])) {
reset($data);
$dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
$dataHandler->stripslashes_values = 0;
// set default TCA values specific for the user
$TCAdefaultOverride = $this->getBackendUser()->getTSConfigProp('TCAdefaults');
if (is_array($TCAdefaultOverride)) {
$dataHandler->setDefaultsFromUserTS($TCAdefaultOverride);
}
$dataHandler->start($data, array());
$dataHandler->process_datamap();
BackendUtility::setUpdateSignal('updatePageTree');
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_create'));
} else {
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_noCreate'), FlashMessage::ERROR);
}
$theCode .= $flashMessage->render();
// Display result:
$menuItems = $pageRepository->getMenu($this->pObj->id, '*', 'sorting', '', false);
$lines = array();
foreach ($menuItems as $record) {
BackendUtility::workspaceOL('pages', $record);
if (is_array($record)) {
$lines[] = '<span class="text-nowrap" title="' . BackendUtility::titleAttribForPages($record, '', false) . '">' . $this->iconFactory->getIconForRecord('pages', $record, Icon::SIZE_SMALL)->render() . htmlspecialchars(GeneralUtility::fixed_lgd_cs($record['title'], $this->getBackendUser()->uc['titleLen'])) . '</span>';
}
}
$theCode .= '<h4>' . $this->getLanguageService()->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
} else {
// Display create form
$this->typeSelectHtml = $this->getTypeSelectHtml();
$tableData = array();
for ($a = 0; $a < 5; $a++) {
$tableData[] = $this->getFormLine($a);
}
$theCode .= '
<h4>' . $this->getLanguageService()->getLL('wiz_newPages') . ':</h4>
<div class="form-group t3js-wizardcrpages-container">
' . implode(LF, $tableData) . '
</div>
<div class="form-group">
<input class="btn btn-default t3js-wizardcrpages-createnewfields" type="button" value="' . $this->getLanguageService()->getLL('wiz_newPages_addMoreLines') . '" />
</div>
<div class="form-group">
<div class="checkbox">
<label for="createInListEnd">
<input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" />
' . $this->getLanguageService()->getLL('wiz_newPages_listEnd') . '
</label>
</div>
<div class="checkbox">
<label for="hidePages">
<input type="checkbox" name="hidePages" id="hidePages" value="1" />
' . $this->getLanguageService()->getLL('wiz_newPages_hidePages') . '
</label>
</div>
//.........这里部分代码省略.........
示例3: getHeader
/**
* Makes the header (icon+title) for a page (or other record). Used in most modules under Web>*
* $table and $row must be a tablename/record from that table
* $path will be shown as alt-text for the icon.
* The title will be truncated to 45 chars.
*
* @param string $table Table name
* @param array $row Record row
* @param string $path Alt text
* @param boolean $noViewPageIcon Set $noViewPageIcon TRUE if you don't want a magnifier-icon for viewing the page in the frontend
* @param array $tWrap is an array with indexes 0 and 1 each representing HTML-tags (start/end) which will wrap the title
* @param bool $enableClickMenu If TRUE, render click menu code around icon image
* @return string HTML content
* @todo Define visibility
*/
public function getHeader($table, $row, $path, $noViewPageIcon = FALSE, $tWrap = array('', ''), $enableClickMenu = TRUE)
{
$viewPage = '';
if (is_array($row) && $row['uid']) {
$iconImgTag = IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($path)));
$title = strip_tags(BackendUtility::getRecordTitle($table, $row));
$viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid'], $this->backPath, '');
if ($table == 'pages') {
$path .= ' - ' . BackendUtility::titleAttribForPages($row, '', 0);
}
} else {
$iconImgTag = IconUtility::getSpriteIcon('apps-pagetree-page-domain', array('title' => htmlspecialchars($path)));
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
}
if ($enableClickMenu) {
$iconImgTag = $this->wrapClickMenuOnIcon($iconImgTag, $table, $row['uid']);
}
return '<span class="typo3-moduleHeader">' . $iconImgTag . $viewPage . $tWrap[0] . htmlspecialchars(GeneralUtility::fixed_lgd_cs($title, 45)) . $tWrap[1] . '</span>';
}
示例4: main
/**
* Main function creating the content for the module.
*
* @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
*/
public function main()
{
$GLOBALS['LANG']->includeLLFile('EXT:wizard_crpages/locallang.xlf');
$theCode = '';
$this->tsConfig = BackendUtility::getPagesTSconfig($this->pObj->id);
$this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array();
// Create loremIpsum code:
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('lorem_ipsum')) {
$this->loremIpsumObject = GeneralUtility::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
}
// Create new pages here?
$m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);
$pRec = BackendUtility::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause);
$sys_pages = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', FALSE);
if (is_array($pRec)) {
$data = GeneralUtility::_GP('data');
if (is_array($data['pages'])) {
if (GeneralUtility::_GP('createInListEnd')) {
$endI = end($menuItems);
$thePid = -(int) $endI['uid'];
if (!$thePid) {
$thePid = $this->pObj->id;
}
} else {
$thePid = $this->pObj->id;
}
$firstRecord = TRUE;
$previousIdentifier = '';
foreach ($data['pages'] as $identifier => $dat) {
if (!trim($dat['title'])) {
unset($data['pages'][$identifier]);
} else {
$data['pages'][$identifier]['hidden'] = GeneralUtility::_GP('hidePages') ? 1 : 0;
$data['pages'][$identifier]['nav_hide'] = GeneralUtility::_GP('hidePagesInMenus') ? 1 : 0;
if ($firstRecord) {
$firstRecord = FALSE;
$data['pages'][$identifier]['pid'] = $thePid;
} else {
$data['pages'][$identifier]['pid'] = '-' . $previousIdentifier;
}
$previousIdentifier = $identifier;
}
}
if (!empty($data['pages'])) {
reset($data);
$tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce->stripslashes_values = 0;
// set default TCA values specific for the user
$TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
if (is_array($TCAdefaultOverride)) {
$tce->setDefaultsFromUserTS($TCAdefaultOverride);
}
$tce->start($data, array());
$tce->process_datamap();
BackendUtility::setUpdateSignal('updatePageTree');
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create'));
} else {
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
}
$theCode .= $flashMessage->render();
// Display result:
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
$lines = array();
foreach ($menuItems as $rec) {
BackendUtility::workspaceOL('pages', $rec);
if (is_array($rec)) {
$lines[] = '<nobr>' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec, array('title' => BackendUtility::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>';
}
}
$theCode .= '<h4>' . $GLOBALS['LANG']->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
} else {
// Display create form
$lines = array();
$tableData = array();
for ($a = 0; $a < 9; $a++) {
$tableData[] = $this->getFormLine($a);
}
$lines[] = '<table id="formFieldContainer" class="t3-table"><tbody id="formFieldContainerBody">' . implode(LF, $tableData) . '</tbody></table>';
$theCode .= '<h4>' . $GLOBALS['LANG']->getLL('wiz_newPages') . ':</h4>' . implode('', $lines) . '<br class="clearLeft" />' . '<input type="button" id="createNewFormFields" value="' . $GLOBALS['LANG']->getLL('wiz_newPages_addMoreLines') . '" />' . '<br /><br />';
$theCode .= '<div class="checkbox"><label for="createInListEnd"><input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" />' . $GLOBALS['LANG']->getLL('wiz_newPages_listEnd') . '</label></div>';
$theCode .= '<div class="checkbox"><label for="hidePages"><input type="checkbox" name="hidePages" id="hidePages" value="1" />' . $GLOBALS['LANG']->getLL('wiz_newPages_hidePages') . '</label></div>';
$theCode .= '<div class="checkbox"><label for="hidePagesInMenus"><input type="checkbox" name="hidePagesInMenus" id="hidePagesInMenus" value="1" />' . $GLOBALS['LANG']->getLL('wiz_newPages_hidePagesInMenus') . '</label></div>';
$theCode .= '<input type="submit" name="create" value="' . $GLOBALS['LANG']->getLL('wiz_newPages_lCreate') . '" /> <input type="reset" value="' . $GLOBALS['LANG']->getLL('wiz_newPages_lReset') . '" /><br />';
/** @var \TYPO3\CMS\Core\Page\PageRenderer */
$pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
$pageRenderer->loadJquery();
$pageRenderer->loadRequireJsModule('TYPO3/CMS/WizardCrpages/WizardCreatePages');
// Add inline code
$inlineJavaScriptCode = 'var tpl = "' . addslashes(str_replace(array(LF, TAB), array('', ''), $this->getFormLine('#'))) . '", i, line, div, bg, label;';
$pageRenderer->addJsInlineCode('wizard_crpages', $inlineJavaScriptCode);
$pageRenderer->addCssInlineBlock('TYPO3\\CMS\\WizardCrpages\\Controller\\CreatePagesWizardModuleFunctionController', '
#formFieldContainer {float: left; margin: 0 0 10px 0;}
.clearLeft {clear: left;}
#formFieldContainer label {width: 70px; display: inline-block;}
//.........这里部分代码省略.........
示例5: getTitleAttrib
/**
* Creates title attribute content for pages.
* Uses API function in t3lib_BEfunc which will retrieve lots of useful information for pages.
*
* @param array $row The table row.
* @return string
* @todo Define visibility
*/
public function getTitleAttrib($row)
{
return \TYPO3\CMS\Backend\Utility\BackendUtility::titleAttribForPages($row, '1=1 ' . $this->clause, 0);
}
示例6: main
/**
* Main function creating the content for the module.
*
* @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
* @todo Define visibility
*/
public function main()
{
global $SOBE, $LANG;
$theCode = '';
$this->tsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($this->pObj->id);
$this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array();
// Create loremIpsum code:
if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('lorem_ipsum')) {
$this->loremIpsumObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
}
// Create new pages here?
$m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);
$pRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause);
$sys_pages = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
if (is_array($pRec)) {
$data = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('data');
if (is_array($data['pages'])) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('createInListEnd')) {
$endI = end($menuItems);
$thePid = -intval($endI['uid']);
if (!$thePid) {
$thePid = $this->pObj->id;
}
} else {
$thePid = $this->pObj->id;
}
$firstRecord = TRUE;
$previousIdentifier = '';
foreach ($data['pages'] as $identifier => $dat) {
if (!trim($dat['title'])) {
unset($data['pages'][$identifier]);
} else {
$data['pages'][$identifier]['hidden'] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hidePages') ? 1 : 0;
if ($firstRecord) {
$firstRecord = FALSE;
$data['pages'][$identifier]['pid'] = $thePid;
} else {
$data['pages'][$identifier]['pid'] = '-' . $previousIdentifier;
}
$previousIdentifier = $identifier;
}
}
if (count($data['pages'])) {
reset($data);
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler');
$tce->stripslashes_values = 0;
// set default TCA values specific for the user
$TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
if (is_array($TCAdefaultOverride)) {
$tce->setDefaultsFromUserTS($TCAdefaultOverride);
}
$tce->start($data, array());
$tce->process_datamap();
\TYPO3\CMS\Backend\Utility\BackendUtility::setUpdateSignal('updatePageTree');
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create'));
} else {
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
}
$theCode .= $flashMessage->render();
// Display result:
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
$lines = array();
foreach ($menuItems as $rec) {
\TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('pages', $rec);
if (is_array($rec)) {
$lines[] = '<nobr>' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec, array('title' => \TYPO3\CMS\Backend\Utility\BackendUtility::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>';
}
}
$theCode .= '<h4>' . $LANG->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
} else {
// Display create form
$lines = array();
for ($a = 0; $a < 9; $a++) {
$lines[] = $this->getFormLine($a);
}
$theCode .= '<h4>' . $LANG->getLL('wiz_newPages') . ':</h4>' . '<div id="formFieldContainer">' . implode('', $lines) . '</div>' . '<br class="clearLeft" />' . '<input type="button" id="createNewFormFields" value="' . $LANG->getLL('wiz_newPages_addMoreLines') . '" />' . '<br /><br />
<input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> <label for="createInListEnd">' . $LANG->getLL('wiz_newPages_listEnd') . '</label><br />
<input type="checkbox" name="hidePages" id="hidePages" value="1" /> <label for="hidePages">' . $LANG->getLL('wiz_newPages_hidePages') . '</label><br /><br />
<input type="submit" name="create" value="' . $LANG->getLL('wiz_newPages_lCreate') . '" /> <input type="reset" value="' . $LANG->getLL('wiz_newPages_lReset') . '" /><br />';
// Add ExtJS inline code
$extCode = '
var tpl = "' . addslashes(str_replace(array(LF, TAB), array('', ''), $this->getFormLine('#'))) . '", i, line, div, bg, label;
var lineCounter = 9;
Ext.get("createNewFormFields").on("click", function() {
div = Ext.get("formFieldContainer");
for (i = 0; i < 5; i++) {
label = lineCounter + i + 1;
bg = label % 2 === 0 ? 6 : 4;
line = String.format(tpl, (lineCounter + i), label, bg);
div.insertHtml("beforeEnd", line);
}
lineCounter += 5;
});
//.........这里部分代码省略.........
示例7: getPageInfoBox
/**
* Creates an info-box for the current page (identified by input record).
*
* @param array $rec Page record
* @param boolean $edit If set, there will be shown an edit icon, linking to editing of the page properties.
* @return string HTML for the box.
* @deprecated and unused since 6.0, will be removed two versions later
* @todo Define visibility
*/
public function getPageInfoBox($rec, $edit = 0)
{
\TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
// If editing of the page properties is allowed:
if ($edit) {
$params = '&edit[pages][' . $rec['uid'] . ']=edit';
$editIcon = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
} else {
$editIcon = $this->noEditIcon('noEditPage');
}
// Setting page icon, link, title:
$outPutContent = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec, array('title' => \TYPO3\CMS\Backend\Utility\BackendUtility::titleAttribForPages($rec))) . $editIcon . ' ' . htmlspecialchars($rec['title']);
// Init array where infomation is accumulated as label/value pairs.
$lines = array();
// Owner user/group:
if ($this->pI_showUser) {
// User:
$users = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
$groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']);
$users = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($users, $groupArray);
$lines[] = array($GLOBALS['LANG']->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')');
}
// Created:
$lines[] = array($GLOBALS['LANG']->getLL('pI_crDate') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['crdate']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes) . ')');
// Last change:
$lines[] = array($GLOBALS['LANG']->getLL('pI_lastChange') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['tstamp']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes) . ')');
// Last change of content:
if ($rec['SYS_LASTCHANGED']) {
$lines[] = array($GLOBALS['LANG']->getLL('pI_lastChangeContent') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['SYS_LASTCHANGED']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['SYS_LASTCHANGED'], $this->agePrefixes) . ')');
}
// Spacer:
$lines[] = '';
// Display contents of certain page fields, if any value:
$dfields = explode(',', 'alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
foreach ($dfields as $fV) {
if ($rec[$fV]) {
$lines[] = array($GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel('pages', $fV)), \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue('pages', $fV, $rec[$fV]));
}
}
// Finally, wrap the elements in the $lines array in table cells/rows
foreach ($lines as $fV) {
if (is_array($fV)) {
if (!$fV[2]) {
$fV[1] = htmlspecialchars($fV[1]);
}
$out .= '
<tr>
<td class="bgColor4" nowrap="nowrap"><strong>' . htmlspecialchars($fV[0]) . ' </strong></td>
<td class="bgColor4">' . $fV[1] . '</td>
</tr>';
} else {
$out .= '
<tr>
<td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
</tr>';
}
}
// Wrap table tags around...
$outPutContent .= '
<!--
Page info box:
-->
<table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
' . $out . '
</table>';
// ... and return it.
return $outPutContent;
}