本文整理汇总了PHP中t3lib_BEfunc::date方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_BEfunc::date方法的具体用法?PHP t3lib_BEfunc::date怎么用?PHP t3lib_BEfunc::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::date方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* MAIN function for page information display (including hit statistics)
*
* @return string Output HTML for the module.
*/
function main()
{
global $BACK_PATH, $LANG, $SOBE;
$dblist = t3lib_div::makeInstance('tx_cms_layout');
$dblist->descrTable = '_MOD_' . $GLOBALS['MCONF']['name'];
$dblist->backPath = $BACK_PATH;
$dblist->thumbs = 0;
$dblist->script = 'index.php';
$dblist->showIcon = 0;
$dblist->setLMargin = 0;
$dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
$dblist->pI_showUser = 1;
$dblist->pI_showStat = 0;
// PAGES:
$this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth'];
// ONLY for the sake of dblist module which uses this value.
$h_func = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php');
if ($this->pObj->MOD_SETTINGS['function'] == 'tx_cms_webinfo_hits') {
$h_func .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[stat_type]', $this->pObj->MOD_SETTINGS['stat_type'], $this->pObj->MOD_MENU['stat_type'], 'index.php');
if ($this->pObj->MOD_SETTINGS['stat_type'] == 1) {
$dblist->stat_select_field = 'rl0';
}
if ($this->pObj->MOD_SETTINGS['stat_type'] == 2) {
$dblist->stat_select_field = 'rl1';
}
// Timespan
for ($a = 0; $a < 30; $a++) {
$dblist->stat_codes[] = 'HITS_days:' . -$a;
}
$timespan_b = mktime(0, 0, 0);
$timespan_e = mktime(0, 0, 0) - (30 - 1) * 3600 * 24 + 1;
$header = '<br />' . sprintf($LANG->getLL('stat_period'), t3lib_BEfunc::date($timespan_b), t3lib_BEfunc::date($timespan_e)) . '<br />';
//
$dblist->start($this->pObj->id, 'pages', 0);
$dblist->pages_noEditColumns = 1;
$dblist->generateList();
$theOutput .= $this->pObj->doc->section($LANG->getLL('hits_title'), t3lib_BEfunc::cshItem($dblist->descrTable, 'stat', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $header . $dblist->HTMLcode, 0, 1);
} else {
$h_func .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages'], 'index.php');
$dblist->start($this->pObj->id, 'pages', 0);
$dblist->generateList();
// CSH
$theOutput .= $this->pObj->doc->section($LANG->getLL('page_title'), t3lib_BEfunc::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $dblist->HTMLcode, 0, 1);
// SYS_NOTES:
if (t3lib_extMgm::isLoaded('sys_note')) {
$dblist->start($this->pObj->id, 'sys_note', 0);
$dblist->generateList();
if ($dblist->HTMLcode) {
$theOutput .= $this->pObj->doc->spacer(10);
$theOutput .= $this->pObj->doc->section($LANG->getLL('page_sysnote'), $dblist->HTMLcode, 0, 1);
}
}
// PAGE INFORMATION
if ($this->pObj->pageinfo['uid']) {
$theOutput .= $this->pObj->doc->spacer(10);
$theOutput .= $this->pObj->doc->section($LANG->getLL('pageInformation'), $dblist->getPageInfoBox($this->pObj->pageinfo, $this->pObj->CALC_PERMS & 2), 0, 1);
}
}
return $theOutput;
}
示例2: 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>
//.........这里部分代码省略.........
示例3: renderTableIcons
//.........这里部分代码省略.........
// _NO_ICON_FOUND
if ($this->optionsMatrix['_NO_ICON_FOUND']) {
$this->testRecords[] = array('_NO_ICON_FOUND' => 1);
}
if ($this->tableName == 'pages') {
$tempArray = array();
if ($this->optionsMatrix['Doktype']) {
foreach ($GLOBALS['PAGES_TYPES'] as $doktype => $dat) {
if ($dat['icon']) {
foreach ($this->testRecords as $rec) {
$tempArray[] = array_merge($rec, array('doktype' => $doktype));
}
}
}
$tableCols['Doktype'] = 'doktype';
}
if ($this->optionsMatrix['Module']) {
foreach ($GLOBALS['ICON_TYPES'] as $module => $dat) {
if ($dat['icon']) {
foreach ($this->testRecords as $rec) {
$tempArray[] = array_merge($rec, array('module' => $module));
}
}
}
$tableCols['Module'] = 'module';
}
$this->testRecords = array_merge($tempArray, $this->testRecords);
} elseif (is_array($GLOBALS['TCA'][$this->tableName]['ctrl']['typeicons']) && $this->optionsMatrix['TypeIcon']) {
$tempArray = array();
foreach ($GLOBALS['TCA'][$this->tableName]['ctrl']['typeicons'] as $typeVal => $dat) {
foreach ($this->testRecords as $rec) {
$tempArray[] = array_merge($rec, array($GLOBALS['TCA'][$this->tableName]['ctrl']['typeicon_column'] => $typeVal));
}
}
$tableCols['TypeIcon'] = $GLOBALS['TCA'][$this->tableName]['ctrl']['typeicon_column'];
$this->testRecords = array_merge($tempArray, $this->testRecords);
}
// Render table:
$tRows = array();
$sortRows = array();
// Draw header:
$tCells = array();
$tCells[] = 'Icon:';
$tCells[] = 'Name:';
foreach ($tableCols as $label => $field) {
$tCells[] = $label . ':';
}
$tRows[] = '
<tr class="bgColor5" style="font-weight: bold;">
<td>' . implode('</td>
<td>', $tCells) . '</td>
</tr>';
// Traverse fake records, render icons:
foreach ($this->testRecords as $row) {
$tCells = array();
$icon = t3lib_iconWorks::getIconImage($this->tableName, $row, $GLOBALS['BACK_PATH']);
$tCells[] = $icon;
$attrib = t3lib_div::get_tag_attributes($icon);
$fileName = substr($attrib['src'], strlen($GLOBALS['BACK_PATH']));
$tCells[] = $fileName;
$sortRows[] = $fileName;
foreach ($tableCols as $label => $field) {
switch ($label) {
case 'Hidden':
case 'Access':
case 'Del.':
case 'Incl.Sub':
$tCells[] = $row[$field] ? 'YES' : '';
break;
case 'Endtime':
case 'Starttime':
$tCells[] = $row[$field] ? t3lib_BEfunc::date($row[$field]) : '';
break;
default:
$tCells[] = $row[$field];
break;
}
}
$tRows[] = '
<tr class="bgColor4">
<td>' . implode('</td>
<td>', $tCells) . '</td>
</tr>';
}
// Create table with icons:
$output = $this->tableName . ':
<table border="0" cellpadding="0" cellspacing="1">
' . implode('', $tRows) . '
</table>';
// Show unique filenames involved:
sort($sortRows);
$sortRows = array_unique($sortRows);
$output .= '<br /><p><strong>Unique icons:</strong></p>' . count($sortRows);
$output .= '<br/><br/>';
$output .= '<p><strong>Filenames:</strong></p>' . Tx_Extdeveval_Compatibility::viewArray($sortRows);
// DEVELOPMENT purposes, do NOT rename if you don't know what you are doing!
#$this->renameIconsInTypo3Temp();
}
return $output;
}
示例4: tt_content_drawItem
/**
* Draws the preview content for a content element
*
* @param string Content element
* @param boolean Set if the RTE link can be created.
* @return string HTML
*/
function tt_content_drawItem($row, $isRTE = FALSE)
{
global $TCA;
$out = '';
$outHeader = '';
// Make header:
if ($row['header'] && $row['header_layout'] != 100) {
$infoArr = array();
$this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
$outHeader = ($row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . t3lib_BEfunc::date($row['date'])) . '<br />' : '') . $this->infoGif($infoArr) . '<b>' . $this->linkEditContent($this->renderText($row['header']), $row) . '</b><br />';
}
// Make content:
$infoArr = array();
switch ($row['CType']) {
case 'header':
if ($row['subheader']) {
$this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
$out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
}
break;
case 'text':
case 'textpic':
case 'image':
if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
if ($row['bodytext']) {
$this->getProcessedValue('tt_content', 'text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
$out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
}
}
if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
if ($row['image']) {
$infoArr = array();
$this->getProcessedValue('tt_content', 'imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames', $row, $infoArr);
$out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />';
if ($row['imagecaption']) {
$infoArr = array();
$this->getProcessedValue('tt_content', 'imagecaption_position', $row, $infoArr);
$out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
}
}
###########
if ($row['tx_damttcontent_files']) {
require_once PATH_txdam . 'lib/class.tx_dam_image.php';
require_once PATH_txdam . 'lib/class.tx_dam_tcefunc.php';
require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
$config = $TCA['tt_content']['columns']['tx_damttcontent_files']['config'];
if ($GLOBALS['BE_USER']->workspace !== 0) {
$workspaceRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'tt_content', $row['uid']);
if ($workspaceRecord) {
$row = $workspaceRecord;
}
}
$filesArray = tx_dam_db::getReferencedFiles('tt_content', $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*');
foreach ($filesArray['rows'] as $rowDAM) {
$caption = tx_dam_guiFunc::meta_compileInfoData($rowDAM, '_caption:truncate:100', 'value-string');
#$imgAttributes['title'] = tx_dam_guiFunc::meta_compileHoverText($rowDAM);
#$thumb = tx_dam_image::previewImgTag($rowDAM, '', $imgAttributes);
$thumb = tx_dam_guiFunc::thumbnail($rowDAM);
$thumb = '<div style="float:left;width:56px; overflow:auto; margin: 2px 5px 2px 0; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $thumb . '</div>';
$thumb = '<div>' . $thumb . $caption . '</div><div style="clear:both"></div>';
$out .= $thumb;
}
}
#############
}
break;
case 'bullets':
if ($row['bodytext']) {
$this->getProcessedValue('tt_content', 'layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
$out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
}
break;
case 'table':
if ($row['bodytext']) {
$this->getProcessedValue('tt_content', 'table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
$out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
}
break;
case 'uploads':
if ($row['media']) {
$this->getProcessedValue('tt_content', 'media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing', $row, $infoArr);
$out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
}
break;
case 'multimedia':
if ($row['multimedia']) {
$out .= $this->renderText($row['multimedia']) . '<br />';
$out .= $this->renderText($row['parameters']) . '<br />';
}
break;
case 'mailform':
if ($row['bodytext']) {
$this->getProcessedValue('tt_content', 'pages,subheader', $row, $infoArr);
//.........这里部分代码省略.........