本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::calc方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::calc方法的具体用法?PHP ContentObjectRenderer::calc怎么用?PHP ContentObjectRenderer::calc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::calc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeMenu
//.........这里部分代码省略.........
} else {
// If the mount point could not be fetched with respect to
// enableFields, unset the row so it does not become a part of the menu!
unset($row);
}
} else {
$row = $loadDB->results['pages'][$val['id']];
}
//Add versioning overlay for current page (to respect workspaces)
if (is_array($row)) {
$this->sys_page->versionOL('pages', $row, TRUE);
}
// Add external MP params, then the row:
if (is_array($row)) {
if ($MP) {
$row['_MP_PARAM'] = $MP . ($row['_MP_PARAM'] ? ',' . $row['_MP_PARAM'] : '');
}
$temp[] = $this->sys_page->getPageOverlay($row);
}
}
break;
case 'updated':
if ($value == '') {
$value = $GLOBALS['TSFE']->page['uid'];
}
$items = GeneralUtility::intExplode(',', $value);
if (MathUtility::canBeInterpretedAsInteger($this->conf['special.']['depth'])) {
$depth = MathUtility::forceIntegerInRange($this->conf['special.']['depth'], 1, 20);
} else {
$depth = 20;
}
// Max number of items
$limit = MathUtility::forceIntegerInRange($this->conf['special.']['limit'], 0, 100);
$maxAge = (int) $this->parent_cObj->calc($this->conf['special.']['maxAge']);
if (!$limit) {
$limit = 10;
}
// *'auto', 'manual', 'tstamp'
$mode = $this->conf['special.']['mode'];
// Get id's
$id_list_arr = array();
foreach ($items as $id) {
$bA = MathUtility::forceIntegerInRange($this->conf['special.']['beginAtLevel'], 0, 100);
$id_list_arr[] = $this->parent_cObj->getTreeList(-1 * $id, $depth - 1 + $bA, $bA - 1);
}
$id_list = implode(',', $id_list_arr);
// Get sortField (mode)
switch ($mode) {
case 'starttime':
$sortField = 'starttime';
break;
case 'lastUpdated':
case 'manual':
$sortField = 'lastUpdated';
break;
case 'tstamp':
$sortField = 'tstamp';
break;
case 'crdate':
$sortField = 'crdate';
break;
default:
$sortField = 'SYS_LASTCHANGED';
}
// Get
$extraWhere = ($this->conf['includeNotInMenu'] ? '' : ' AND pages.nav_hide=0') . $this->getDoktypeExcludeWhere();
示例2: prepareMenuItemsForUpdatedMenu
/**
* Fetches all menuitems if special = updated is set
*
* @param string $specialValue The value from special.value
* @param string $sortingField The sorting field
* @return array
*/
protected function prepareMenuItemsForUpdatedMenu($specialValue, $sortingField)
{
$tsfe = $this->getTypoScriptFrontendController();
$menuItems = array();
if ($specialValue == '') {
$specialValue = $tsfe->page['uid'];
}
$items = GeneralUtility::intExplode(',', $specialValue);
if (MathUtility::canBeInterpretedAsInteger($this->conf['special.']['depth'])) {
$depth = MathUtility::forceIntegerInRange($this->conf['special.']['depth'], 1, 20);
} else {
$depth = 20;
}
// Max number of items
$limit = MathUtility::forceIntegerInRange($this->conf['special.']['limit'], 0, 100);
$maxAge = (int) $this->parent_cObj->calc($this->conf['special.']['maxAge']);
if (!$limit) {
$limit = 10;
}
// *'auto', 'manual', 'tstamp'
$mode = $this->conf['special.']['mode'];
// Get id's
$id_list_arr = array();
foreach ($items as $id) {
$bA = MathUtility::forceIntegerInRange($this->conf['special.']['beginAtLevel'], 0, 100);
$id_list_arr[] = $this->parent_cObj->getTreeList(-1 * $id, $depth - 1 + $bA, $bA - 1);
}
$id_list = implode(',', $id_list_arr);
// Get sortField (mode)
switch ($mode) {
case 'starttime':
$sortField = 'starttime';
break;
case 'lastUpdated':
case 'manual':
$sortField = 'lastUpdated';
break;
case 'tstamp':
$sortField = 'tstamp';
break;
case 'crdate':
$sortField = 'crdate';
break;
default:
$sortField = 'SYS_LASTCHANGED';
}
$extraWhere = ($this->conf['includeNotInMenu'] ? '' : ' AND pages.nav_hide=0') . $this->getDoktypeExcludeWhere();
if ($this->conf['special.']['excludeNoSearchPages']) {
$extraWhere .= ' AND pages.no_search=0';
}
if ($maxAge > 0) {
$extraWhere .= ' AND ' . $sortField . '>' . ($GLOBALS['SIM_ACCESS_TIME'] - $maxAge);
}
$res = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => '0', 'uidInList' => $id_list, 'where' => $sortField . '>=0' . $extraWhere, 'orderBy' => $sortingField ?: $sortField . ' DESC', 'max' => $limit));
while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
$tsfe->sys_page->versionOL('pages', $row, true);
if (is_array($row)) {
$menuItems[$row['uid']] = $this->sys_page->getPageOverlay($row);
}
}
$this->getDatabaseConnection()->sql_free_result($res);
return $menuItems;
}