本文整理汇总了PHP中PageModel::loadDetails方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::loadDetails方法的具体用法?PHP PageModel::loadDetails怎么用?PHP PageModel::loadDetails使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::loadDetails方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFileMetaInformationToRequest
/**
* Add the file meta information to the request
*
* @param string $strUuid
* @param string $strPtable
* @param integer $intPid
*/
public static function addFileMetaInformationToRequest($strUuid, $strPtable, $intPid)
{
$objFile = \FilesModel::findByUuid($strUuid);
if ($objFile === null) {
return;
}
$arrMeta = deserialize($objFile->meta);
if (empty($arrMeta)) {
return;
}
$objPage = null;
$db = \Database::getInstance();
switch ($strPtable) {
case 'tl_article':
$objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT pid FROM tl_article WHERE id=?)")->execute($intPid);
break;
case 'tl_news':
$objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_news_archive WHERE id=(SELECT pid FROM tl_news WHERE id=?))")->execute($intPid);
break;
case 'tl_news_archive':
$objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_news_archive WHERE id=?)")->execute($intPid);
break;
case 'tl_calendar_events':
$objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_calendar WHERE id=(SELECT pid FROM tl_calendar_events WHERE id=?))")->execute($intPid);
break;
case 'tl_calendar':
$objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_calendar WHERE id=?)")->execute($intPid);
break;
case 'tl_faq_category':
$objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_faq_category WHERE id=?)")->execute($intPid);
break;
default:
// HOOK: support custom modules
if (isset($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']) && is_array($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'])) {
foreach ($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'] as $callback) {
if (($val = \System::importStatic($callback[0])->{$callback[1]}($strPtable, $intPid)) !== false) {
$objPage = $val;
}
}
}
break;
}
if ($objPage === null || $objPage->numRows < 1) {
return;
}
$objModel = new \PageModel();
$objModel->setRow($objPage->row());
$objModel->loadDetails();
// Convert the language to a locale (see #5678)
$strLanguage = str_replace('-', '_', $objModel->rootLanguage);
if (isset($arrMeta[$strLanguage])) {
if (\Input::post('alt') == '' && !empty($arrMeta[$strLanguage]['title'])) {
\Input::setPost('alt', $arrMeta[$strLanguage]['title']);
}
if (\Input::post('caption') == '' && !empty($arrMeta[$strLanguage]['caption'])) {
\Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
}
}
}
示例2: getPageDetails
/**
* Get the details of a page including inherited parameters
*
* @param mixed $intId A page ID or a Model object
*
* @return \PageModel The page model or null
*
* @deprecated Use PageModel::findWithDetails() or PageModel->loadDetails() instead
*/
public static function getPageDetails($intId)
{
if ($intId instanceof \PageModel) {
return $intId->loadDetails();
} elseif ($intId instanceof \Model\Collection) {
/** @var \PageModel $objPage */
$objPage = $intId->current();
return $objPage->loadDetails();
} elseif (is_object($intId)) {
$strKey = __METHOD__ . '-' . $intId->id;
// Try to load from cache
if (\Cache::has($strKey)) {
return \Cache::get($strKey);
}
// Create a model from the database result
$objPage = new \PageModel();
$objPage->setRow($intId->row());
$objPage->loadDetails();
\Cache::set($strKey, $objPage);
return $objPage;
} else {
// Invalid ID
if (!strlen($intId) || $intId < 1) {
return null;
}
$strKey = __METHOD__ . '-' . $intId;
// Try to load from cache
if (\Cache::has($strKey)) {
return \Cache::get($strKey);
}
$objPage = \PageModel::findWithDetails($intId);
\Cache::set($strKey, $objPage);
return $objPage;
}
}
示例3: storeFileMetaInformation
/**
* Pre-fill the "alt" and "caption" fields with the file meta data
*
* @param mixed $varValue
* @param DataContainer $dc
*
* @return mixed
*/
public function storeFileMetaInformation($varValue, DataContainer $dc)
{
if ($dc->activeRecord->singleSRC == $varValue) {
return $varValue;
}
$objFile = FilesModel::findByUuid($varValue);
if ($objFile !== null) {
$arrMeta = deserialize($objFile->meta);
if (!empty($arrMeta)) {
$objPage = $this->Database->prepare("SELECT * FROM tl_page WHERE id=(SELECT pid FROM " . ($dc->activeRecord->ptable ?: 'tl_article') . " WHERE id=?)")->execute($dc->activeRecord->pid);
if ($objPage->numRows) {
$objModel = new PageModel();
$objModel->setRow($objPage->row());
$objModel->loadDetails();
// Convert the language to a locale (see #5678)
$strLanguage = str_replace('-', '_', $objModel->rootLanguage);
if (isset($arrMeta[$strLanguage])) {
Input::setPost('alt', $arrMeta[$strLanguage]['title']);
Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
}
}
}
}
return $varValue;
}
示例4: getUrl
/**
* Get the category URL
*
* @param \PageModel $page
*
* @return string
*/
public function getUrl(\PageModel $page)
{
$page->loadDetails();
return $page->getFrontendUrl('/' . NewsCategories::getParameterName($page->rootId) . '/' . $this->alias);
}