本文整理汇总了PHP中t3lib_BEfunc::titleAttribForPages方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_BEfunc::titleAttribForPages方法的具体用法?PHP t3lib_BEfunc::titleAttribForPages怎么用?PHP t3lib_BEfunc::titleAttribForPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::titleAttribForPages方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 name
* @param array Record row
* @param string Alt text
* @param boolean 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
* @return string HTML content
*/
function getHeader($table, $row, $path, $noViewPageIcon = 0, $tWrap = array('', ''))
{
global $TCA;
if (is_array($row) && $row['uid']) {
$iconImgTag = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($path)));
$title = strip_tags($row[$TCA[$table]['ctrl']['label']]);
$viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid'], $this->backPath, '');
if ($table == 'pages') {
$path .= ' - ' . t3lib_BEfunc::titleAttribForPages($row, '', 0);
}
} else {
$iconImgTag = t3lib_iconWorks::getSpriteIcon('apps-pagetree-page-domain', array('title' => htmlspecialchars($path)));
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
}
return '<span class="typo3-moduleHeader">' . $this->wrapClickMenuOnIcon($iconImgTag, $table, $row['uid']) . $viewPage . $tWrap[0] . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, 45)) . $tWrap[1] . '</span>';
}
示例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
*/
function main()
{
global $SOBE, $LANG;
$theCode = '';
$m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);
// create new pages here?
$pRec = t3lib_BEfunc::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause);
$sys_pages = t3lib_div::makeInstance('t3lib_pageSelect');
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
if (is_array($pRec)) {
$data = t3lib_div::_GP('data');
if (is_array($data['pages'])) {
if (t3lib_div::_GP('createInListEnd')) {
$endI = end($menuItems);
$thePid = -intval($endI['uid']);
if (!$thePid) {
$thePid = $this->pObj->id;
}
} else {
$thePid = $this->pObj->id;
}
$firstRecord = true;
foreach ($data['pages'] as $identifier => $dat) {
if (!trim($dat['title'])) {
unset($data['pages'][$identifier]);
} else {
$data['pages'][$identifier]['hidden'] = t3lib_div::_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 = t3lib_div::makeInstance('t3lib_TCEmain');
$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();
t3lib_BEfunc::setUpdateSignal('updatePageTree');
$flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create'));
} else {
$flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), t3lib_FlashMessage::ERROR);
}
$theCode .= $flashMessage->render();
// Display result:
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
$lines = array();
foreach ($menuItems as $rec) {
t3lib_BEfunc::workspaceOL('pages', $rec);
if (is_array($rec)) {
$lines[] = '<nobr>' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>';
}
}
$theCode .= '<h4>' . $LANG->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
} else {
// Create loremIpsum code:
if (t3lib_extMgm::isLoaded('lorem_ipsum')) {
$loremIpsumObj = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
}
// Display create form
$lines = array();
for ($a = 0; $a < 9; $a++) {
$lines[] = '<label for="page_new_' . $a . '"> ' . $LANG->getLL('wiz_newPages_page') . ' ' . ($a + 1) . ': </label><input type="text" id="page_new_' . $a . '" name="data[pages][NEW' . $a . '][title]"' . $this->pObj->doc->formWidth(35) . ' />' . (is_object($loremIpsumObj) ? '<a href="#" onclick="' . htmlspecialchars($loremIpsumObj->getHeaderTitleJS('document.forms[0][\'data[pages][NEW' . $a . '][title]\'].value', 'title')) . '">' . $loremIpsumObj->getIcon('', $this->pObj->doc->backPath) . '</a>' : '');
}
$theCode .= '<h4>' . $LANG->getLL('wiz_newPages') . ':</h4>' . implode('<br />', $lines) . '<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') . '" onclick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')) . ')" /> <input type="reset" value="' . $LANG->getLL('wiz_newPages_lReset') . '" /><br />';
}
} else {
$theCode .= $GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_errorMsg1'));
}
// CSH
$theCode .= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardcrpages', $GLOBALS['BACK_PATH'], '<br />|');
$out = $this->pObj->doc->section($LANG->getLL('wiz_crMany'), $theCode, 0, 1);
return $out;
}
示例3: getTitleAttrib
/**
* Creates title attribute content for pages.
* Uses API function in t3lib_BEfunc which will retrieve lots of useful information for pages.
*
* @param array The table row.
* @return string
*/
function getTitleAttrib($row)
{
return t3lib_BEfunc::titleAttribForPages($row, '1=1 ' . $this->clause, 0);
}
示例4: getPageInfoBox
/**
* Creates an info-box for the current page (identified by input record).
*
* @param array Page record
* @param boolean If set, there will be shown an edit icon, linking to editing of the page properties.
* @return string HTML for the box.
*/
function getPageInfoBox($rec, $edit = 0)
{
global $LANG;
// If editing of the page properties is allowed:
if ($edit) {
$params = '&edit[pages][' . $rec['uid'] . ']=edit';
$editIcon = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
} else {
$editIcon = $this->noEditIcon('noEditPage');
}
// Setting page icon, link, title:
$outPutContent = t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::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 = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
$groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']);
$users = t3lib_BEfunc::blindUserNames($users, $groupArray);
$lines[] = array($LANG->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')');
}
// Created:
$lines[] = array($LANG->getLL('pI_crDate') . ':', t3lib_BEfunc::datetime($rec['crdate']) . ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes) . ')');
// Last change:
$lines[] = array($LANG->getLL('pI_lastChange') . ':', t3lib_BEfunc::datetime($rec['tstamp']) . ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes) . ')');
// Last change of content:
if ($rec['SYS_LASTCHANGED']) {
$lines[] = array($LANG->getLL('pI_lastChangeContent') . ':', t3lib_BEfunc::datetime($rec['SYS_LASTCHANGED']) . ' (' . t3lib_BEfunc::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(t3lib_BEfunc::getItemLabel('pages', $fV)), t3lib_BEfunc::getProcessedValue('pages', $fV, $rec[$fV]));
}
}
// Page hits (depends on "sys_stat" extension)
if ($this->pI_showStat && t3lib_extMgm::isLoaded('sys_stat')) {
// Counting total hits:
$count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_stat', 'page_id=' . intval($rec['uid']));
if ($count) {
// Get min/max
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('min(tstamp) AS min,max(tstamp) AS max', 'sys_stat', 'page_id=' . intval($rec['uid']));
$rrow2 = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
$lines[] = '';
$lines[] = array($LANG->getLL('pI_hitsPeriod') . ':', t3lib_BEfunc::date($rrow2[0]) . ' - ' . t3lib_BEfunc::date($rrow2[1]) . ' (' . t3lib_BEfunc::calcAge($rrow2[1] - $rrow2[0], $this->agePrefixes) . ')');
$lines[] = array($LANG->getLL('pI_hitsTotal') . ':', $rrow[0]);
// Last 10 days
$nextMidNight = mktime(0, 0, 0) + 1 * 3600 * 24;
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextMidNight . '-tstamp)/(24*3600)) AS day', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextMidNight - 10 * 24 * 3600), 'day');
$days = array();
while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
$days[$rrow[1]] = $rrow[0];
}
$headerH = array();
$contentH = array();
for ($a = 9; $a >= 0; $a--) {
$headerH[] = '
<td class="bgColor5" nowrap="nowrap"> ' . date('d', $nextMidNight - ($a + 1) * 24 * 3600) . ' </td>';
$contentH[] = '
<td align="center">' . ($days[$a] ? intval($days[$a]) : '-') . '</td>';
}
// Compile first hit-table (last 10 days)
$hitTable = '
<table border="0" cellpadding="0" cellspacing="1" class="typo3-page-hits">
<tr>' . implode('', $headerH) . '</tr>
<tr>' . implode('', $contentH) . '</tr>
</table>';
$lines[] = array($LANG->getLL('pI_hits10days') . ':', $hitTable, 1);
// Last 24 hours
$nextHour = mktime(date('H'), 0, 0) + 3600;
$hours = 16;
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextHour . '-tstamp)/3600) AS hours', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextHour - $hours * 3600), 'hours');
$days = array();
while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
$days[$rrow[1]] = $rrow[0];
}
$headerH = array();
$contentH = array();
for ($a = $hours - 1; $a >= 0; $a--) {
$headerH[] = '
<td class="bgColor5" nowrap="nowrap"> ' . intval(date('H', $nextHour - ($a + 1) * 3600)) . ' </td>';
$contentH[] = '
<td align="center">' . ($days[$a] ? intval($days[$a]) : '-') . '</td>';
}
// Compile second hit-table (last 24 hours)
$hitTable = '
<table border="0" cellpadding="0" cellspacing="1" class="typo3-page-stat">
<tr>' . implode('', $headerH) . '</tr>
<tr>' . implode('', $contentH) . '</tr>
//.........这里部分代码省略.........
示例5: getNewNode
/**
* Creates a node with the given record information's
*
* @param array $record
* @return t3lib_tree_pagetree_Node
*/
public static function getNewNode($record, $mountPoint = 0)
{
$useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
$addIdAsPrefix = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
$addDomainName = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showDomainNameWithTitle');
$titleLength = intval($GLOBALS['BE_USER']->uc['titleLen']);
/** @var $subNode t3lib_tree_pagetree_Node */
$subNode = t3lib_div::makeInstance('t3lib_tree_pagetree_Node');
$subNode->setRecord($record);
$subNode->setCls($record['_CSSCLASS']);
$subNode->setType('pages');
$subNode->setId($record['uid']);
$subNode->setMountPoint($mountPoint);
$subNode->setWorkspaceId($record['_ORIG_uid'] ? $record['_ORIG_uid'] : $record['uid']);
$field = 'title';
$text = $record['title'];
if ($useNavTitle && trim($record['nav_title']) !== '') {
$field = 'nav_title';
$text = $record['nav_title'];
}
if (trim($text) === '') {
$visibleText = '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.no_title', TRUE) . ']';
} else {
$visibleText = $text;
}
$visibleText = t3lib_div::fixed_lgd_cs($visibleText, $titleLength);
$suffix = '';
if ($addDomainName) {
$domain = self::getDomainName($record['uid']);
$suffix = $domain !== '' ? ' [' . $domain . ']' : '';
}
$qtip = str_replace(' - ', '<br />', htmlspecialchars(t3lib_BEfunc::titleAttribForPages($record, '', FALSE)));
$prefix = '';
$lockInfo = t3lib_BEfunc::isRecordLocked('pages', $record['uid']);
if (is_array($lockInfo)) {
$qtip .= '<br />' . htmlspecialchars($lockInfo['msg']);
$prefix .= t3lib_iconWorks::getSpriteIcon('status-warning-in-use', array('class' => 'typo3-pagetree-status'));
}
$prefix .= htmlspecialchars($addIdAsPrefix ? '[' . $record['uid'] . '] ' : '');
$subNode->setEditableText($text);
$subNode->setText(htmlspecialchars($visibleText), $field, $prefix, htmlspecialchars($suffix));
$subNode->setQTip($qtip);
if ($record['uid'] !== 0) {
$spriteIconCode = t3lib_iconWorks::getSpriteIconForRecord('pages', $record);
} else {
$spriteIconCode = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root');
}
$subNode->setSpriteIconCode($spriteIconCode);
if (!$subNode->canCreateNewPages() || intval($record['t3ver_state']) === 2) {
$subNode->setIsDropTarget(FALSE);
}
if (!$subNode->canBeEdited() || !$subNode->canBeRemoved() || intval($record['t3ver_state']) === 2) {
$subNode->setDraggable(FALSE);
}
return $subNode;
}
示例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
*/
function main()
{
global $SOBE, $LANG;
$theCode = '';
$this->tsConfig = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
$this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array();
// Create loremIpsum code:
if (t3lib_extMgm::isLoaded('lorem_ipsum')) {
$this->loremIpsumObject = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
}
$m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);
// create new pages here?
$pRec = t3lib_BEfunc::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause);
$sys_pages = t3lib_div::makeInstance('t3lib_pageSelect');
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
if (is_array($pRec)) {
$data = t3lib_div::_GP('data');
if (is_array($data['pages'])) {
if (t3lib_div::_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'] = t3lib_div::_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 = t3lib_div::makeInstance('t3lib_TCEmain');
$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();
t3lib_BEfunc::setUpdateSignal('updatePageTree');
$flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create'));
} else {
$flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), t3lib_FlashMessage::ERROR);
}
$theCode .= $flashMessage->render();
// Display result:
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
$lines = array();
foreach ($menuItems as $rec) {
t3lib_BEfunc::workspaceOL('pages', $rec);
if (is_array($rec)) {
$lines[] = '<nobr>' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(t3lib_div::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') . '" onclick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')) . ')" /> <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;
});
';
//.........这里部分代码省略.........