本文整理汇总了PHP中PageModel::findWithDetails方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::findWithDetails方法的具体用法?PHP PageModel::findWithDetails怎么用?PHP PageModel::findWithDetails使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::findWithDetails方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Get config value from transformed arrData and add logic to modify the value here
* @param $strKey
*
* @return mixed|string
*/
public function __get($strKey)
{
$varValue = $this->arrData[$strKey];
switch ($strKey) {
case 'strAction':
if ($varValue && ($objActionPage = \PageModel::findWithDetails($varValue)) !== null) {
$varValue = \Controller::generateFrontendUrl($objActionPage->row(), null, null, true);
} else {
$varValue = Url::removeQueryString(array('file'), \Environment::get('uri'));
// remove all query parameters within ajax request
if (Ajax::isRelated(Form::FORMHYBRID_NAME) !== false) {
$varValue = AjaxAction::removeAjaxParametersFromUrl($varValue);
}
}
// async form
if ($this->async) {
$varValue = AjaxAction::generateUrl(Form::FORMHYBRID_NAME, 'asyncFormSubmit');
}
// add hash
if ($this->addHashToAction) {
$varValue .= '#' . ($this->customHash ?: $this->strFormId);
}
break;
case 'arrDefaultValues':
$varValue = FormHelper::getAssocMultiColumnWizardList($varValue, 'field');
break;
}
return $varValue;
}
示例2: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var \PageModel $objPage */
global $objPage;
// Set the trail and level
if ($this->defineRoot && $this->rootPage > 0) {
$trail = array($this->rootPage);
$level = 0;
} else {
$trail = $objPage->trail;
$level = $this->levelOffset > 0 ? $this->levelOffset : 0;
}
$lang = null;
$host = null;
// Overwrite the domain and language if the reference page belongs to a differnt root page (see #3765)
if ($this->defineRoot && $this->rootPage > 0) {
$objRootPage = \PageModel::findWithDetails($this->rootPage);
// Set the language
if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
$lang = $objRootPage->rootLanguage;
}
// Set the domain
if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
$host = $objRootPage->domain;
}
}
$this->Template->request = ampersand(\Environment::get('indexFreeRequest'));
$this->Template->skipId = 'skipNavigation' . $this->id;
$this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
$this->Template->items = $this->renderNavigation($trail[$level], 1, $host, $lang);
}
示例3: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var \PageModel $objPage */
global $objPage;
$lang = null;
$host = null;
// Start from the website root if there is no reference page
if (!$this->rootPage) {
$this->rootPage = $objPage->rootId;
} else {
$objRootPage = \PageModel::findWithDetails($this->rootPage);
// Set the language
if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
$lang = $objRootPage->rootLanguage;
}
// Set the domain
if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
$host = $objRootPage->domain;
}
}
$this->Template->formId = 'tl_quicknav_' . $this->id;
$this->Template->targetPage = $GLOBALS['TL_LANG']['MSC']['targetPage'];
$this->Template->button = specialchars($GLOBALS['TL_LANG']['MSC']['go']);
$this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicknav'];
$this->Template->request = ampersand(\Environment::get('request'), true);
$this->Template->items = $this->getQuicknavPages($this->rootPage, 1, $host, $lang);
}
示例4: getActiveLayoutSections
public function getActiveLayoutSections(\DataContainer $dc)
{
$callback = $GLOBALS['TL_DCA']['tl_article']['fields']['inColumn']['bit3_merger_original_options_callback'];
if (is_array($callback)) {
$object = \System::importStatic($callback[0]);
$methodName = $callback[1];
$sections = $object->{$methodName}($dc);
} else {
$sections = call_user_func($callback, $dc);
}
if ($dc->activeRecord->pid) {
$page = \PageModel::findWithDetails($dc->activeRecord->pid);
// Get the layout sections
foreach (array('layout', 'mobileLayout') as $key) {
if (!$page->{$key}) {
continue;
}
$layout = \LayoutModel::findByPk($page->{$key});
if ($layout === null) {
continue;
}
$modules = deserialize($layout->modules);
if (empty($modules) || !is_array($modules)) {
continue;
}
// Find all sections with an article module (see #6094)
foreach ($modules as $module) {
if ($module['mod'] != 0 && $module['enable']) {
$this->joinModule($module['col'], $module['mod'], $sections);
}
}
}
}
return array_values(array_unique($sections));
}
示例5: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var \PageModel $objPage */
global $objPage;
$lang = null;
$host = null;
// Start from the website root if there is no reference page
if (!$this->rootPage) {
$this->rootPage = $objPage->rootId;
} else {
$objRootPage = \PageModel::findWithDetails($this->rootPage);
// Set the language
if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
$lang = $objRootPage->rootLanguage;
}
// Set the domain
if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
$host = $objRootPage->domain;
}
}
$this->showLevel = 0;
$this->hardLimit = false;
$this->levelOffset = 0;
$this->Template->items = $this->renderNavigation($this->rootPage, 1, $host, $lang);
}
示例6: getPageViewButton
/**
* Return the page view button
* @param string
* @param string
* @param string
* @param string
* @param string
* @param string
* @param array
* @return string
*/
public function getPageViewButton($href, $label, $title, $class, $attributes, $table, $root)
{
$objPage = \PageModel::findWithDetails(\Input::get('page_id'));
if (null === $objPage) {
return '';
}
return '<a href="contao/main.php?do=feRedirect&page=' . $objPage->id . '" target="_blank" class="header_preview" title="' . specialchars($title) . '"' . $attributes . '>' . $label . '</a>';
}
示例7: compile
/**
* Generate the module
*/
protected function compile()
{
// add miscellaneous vars to the template
$this->addTemplateVars();
// get href for the detail-page
$objDetailPage = \PageModel::findWithDetails($this->detailPage);
if ($objDetailPage === NULL) {
$href = NULL;
} else {
$href = $this->generateFrontendUrl($objDetailPage->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/member/%s', $objDetailPage->language);
}
$objMember = $this->Database->prepare('SELECT * FROM tl_member WHERE disable = ?')->execute(0);
$arrRows = array();
while ($row = $objMember->fetchAssoc()) {
foreach ($row as $k => $v) {
if ($k == 'id' || $k == 'tstamp' || $k == 'password' || $k == 'avatar') {
continue;
}
$row[$k] = $v;
}
// score and grade
$row['score'] = $this->getScore($row['id']);
$row['averageRating'] = $this->getAverageRating($row['id']);
$row['ratingEnities'] = $this->getRatingEnities($row['id']);
$row['gradeLabel'] = $this->getGrade($row['id'], 'label');
$row['gradeIcon'] = $this->getGrade($row['id'], 'label');
// link to detail page
$row['hrefDetailPage'] = $href ? sprintf($href, $row['id']) : false;
// get avatar of member
$arrSize = deserialize($this->avatarSizeListing);
$title = $row['firstname'] . ' ' . $row['lastname'];
$row['avatar'] = $this->getAvatar($objMember->id, $arrSize, 'avatar', $title, 'avatar_thumb', $this);
// Show only Members from a selected group
if ($this->limitUsers) {
$arrGroups = deserialize($this->listedGroups);
$oMember = \MemberModel::findByPk($objMember->id);
if ($oMember !== null) {
if (count(array_intersect(deserialize($oMember->groups), $arrGroups)) < 1) {
continue;
}
}
}
$arrRows[] = $row;
}
// Sorting
$arrSorting = array();
if (!empty($this->sortingField1) && !empty($this->sortingDirection1)) {
$arrSorting[$this->sortingField1] = constant($this->sortingDirection1);
}
if (!empty($this->sortingField2) && !empty($this->sortingDirection2)) {
$arrSorting[$this->sortingField2] = constant($this->sortingDirection2);
}
if (!empty($this->sortingField3) && !empty($this->sortingDirection3)) {
$arrSorting[$this->sortingField3] = constant($this->sortingDirection3);
}
$arrRows = sortArrayByFields($arrRows, $arrSorting);
$this->Template->rows = count($arrRows) ? $arrRows : false;
}
示例8: getSearchablePages
/**
* Add FAQs to the indexer
*
* @param array $arrPages
* @param integer $intRoot
* @param boolean $blnIsSitemap
*
* @return array
*/
public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
{
$arrRoot = array();
if ($intRoot > 0) {
$arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
}
$arrProcessed = array();
$time = \Date::floorToMinute();
// Get all categories
$objFaq = \FaqCategoryModel::findAll();
// Walk through each category
if ($objFaq !== null) {
while ($objFaq->next()) {
// Skip FAQs without target page
if (!$objFaq->jumpTo) {
continue;
}
// Skip FAQs outside the root nodes
if (!empty($arrRoot) && !in_array($objFaq->jumpTo, $arrRoot)) {
continue;
}
// Get the URL of the jumpTo page
if (!isset($arrProcessed[$objFaq->jumpTo])) {
$objParent = \PageModel::findWithDetails($objFaq->jumpTo);
// The target page does not exist
if ($objParent === null) {
continue;
}
// The target page has not been published (see #5520)
if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop <= $time + 60) {
continue;
}
if ($blnIsSitemap) {
// The target page is protected (see #8416)
if ($objParent->protected) {
continue;
}
// The target page is exempt from the sitemap (see #6418)
if ($objParent->sitemap == 'map_never') {
continue;
}
}
// Generate the URL
$arrProcessed[$objFaq->jumpTo] = $objParent->getAbsoluteUrl(\Config::get('useAutoItem') ? '/%s' : '/items/%s');
}
$strUrl = $arrProcessed[$objFaq->jumpTo];
// Get the items
$objItems = \FaqModel::findPublishedByPid($objFaq->id);
if ($objItems !== null) {
while ($objItems->next()) {
$arrPages[] = sprintf($strUrl, $objItems->alias ?: $objItems->id);
}
}
}
}
return $arrPages;
}
示例9: getSearchablePages
/**
* Add product items to the indexer
* @param array
* @param integer
* @param boolean
* @return array
*/
public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
{
$arrRoot = array();
if ($intRoot > 0) {
$arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
}
$time = time();
$arrProcessed = array();
// Get all catalog categories
$objCatalog = \ProductCatalogModel::findByProtected('');
// Walk through each archive
if ($objCatalog !== null) {
while ($objCatalog->next()) {
// Skip catalog categories without target page
if (!$objCatalog->jumpTo) {
continue;
}
// Skip catalog categories outside the root nodes
if (!empty($arrRoot) && !in_array($objCatalog->jumpTo, $arrRoot)) {
continue;
}
// Get the URL of the jumpTo page
if (!isset($arrProcessed[$objCatalog->jumpTo])) {
$objParent = \PageModel::findWithDetails($objCatalog->jumpTo);
// The target page does not exist
if ($objParent === null) {
continue;
}
// The target page has not been published (see #5520)
if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop < $time) {
continue;
}
// The target page is exempt from the sitemap (see #6418)
if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
continue;
}
// Set the domain (see #6421)
$domain = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/';
// Generate the URL
$arrProcessed[$objCatalog->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s', $objParent->language);
}
$strUrl = $arrProcessed[$objCatalog->jumpTo];
// Get the items
$objProduct = \ProductModel::findPublishedByPid($objCatalog->id);
if ($objProduct !== null) {
while ($objProduct->next()) {
$objElement = \ContentModel::findPublishedByPidAndTable($objProduct->id, 'tl_product');
if ($objElement !== null) {
$arrPages[] = $this->getLink($objProduct, $strUrl);
}
}
}
}
}
return $arrPages;
}
示例10: getSearchablePages
/**
* Add FAQs to the indexer
*
* @param array $arrPages
* @param integer $intRoot
* @param boolean $blnIsSitemap
*
* @return array
*/
public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
{
$arrRoot = array();
if ($intRoot > 0) {
$arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
}
$arrProcessed = array();
$time = \Date::floorToMinute();
// Get all categories
$objFaq = \FaqCategoryModel::findAll();
// Walk through each category
if ($objFaq !== null) {
while ($objFaq->next()) {
// Skip FAQs without target page
if (!$objFaq->jumpTo) {
continue;
}
// Skip FAQs outside the root nodes
if (!empty($arrRoot) && !in_array($objFaq->jumpTo, $arrRoot)) {
continue;
}
// Get the URL of the jumpTo page
if (!isset($arrProcessed[$objFaq->jumpTo])) {
$objParent = \PageModel::findWithDetails($objFaq->jumpTo);
// The target page does not exist
if ($objParent === null) {
continue;
}
// The target page has not been published (see #5520)
if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop <= $time + 60) {
continue;
}
// The target page is exempt from the sitemap (see #6418)
if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
continue;
}
// Generate the URL
$feUrl = $objParent->getFrontendUrl(\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s');
if (strncmp($feUrl, 'http://', 7) !== 0 && strncmp($feUrl, 'https://', 8) !== 0) {
$feUrl = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/' . $feUrl;
}
$arrProcessed[$objFaq->jumpTo] = $feUrl;
}
$strUrl = $arrProcessed[$objFaq->jumpTo];
// Get the items
$objItems = \FaqModel::findPublishedByPid($objFaq->id);
if ($objItems !== null) {
while ($objItems->next()) {
$arrPages[] = sprintf($strUrl, $objItems->alias != '' && !\Config::get('disableAlias') ? $objItems->alias : $objItems->id);
}
}
}
}
return $arrPages;
}
示例11: getAllNews
/**
* get all news items by page pid
* @param array
* @param integer
* @param boolean
* @return array
*/
public static function getAllNews($arrPages, $intRoot = 0, $blnIsSitemap = false)
{
$arrRoot = array();
if ($intRoot > 0) {
$arrRoot = \Database::getInstance()->getChildRecords($intRoot, 'tl_page');
}
$time = time();
$arrProcessed = array();
// Get all news archives
$objArchive = \NewsArchiveModel::findByProtected('');
// Walk through each archive
if ($objArchive !== null) {
while ($objArchive->next()) {
// Skip news archives without target page
if (!$objArchive->jumpTo) {
continue;
}
// Skip news archives outside the root nodes
if (!empty($arrRoot) && !in_array($objArchive->jumpTo, $arrRoot)) {
continue;
}
// Get the URL of the jumpTo page
if (!isset($arrProcessed[$objArchive->jumpTo])) {
$objParent = \PageModel::findWithDetails($objArchive->jumpTo);
// The target page does not exist
if ($objParent === null) {
continue;
}
// The target page has not been published (see #5520)
if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop < $time) {
continue;
}
// The target page is exempt from the sitemap (see #6418)
if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
continue;
}
// Set the domain (see #6421)
// $domain = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/';
// Generate the URL
// $arrProcessed[$objArchive->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), ((\Config::get('useAutoItem') && !\Config::get('disableAlias')) ? '/%s' : '/items/%s'), $objParent->language);
}
$strUrl = $arrProcessed[$objArchive->jumpTo];
// Get the items
$objArticle = \NewsModel::findPublishedDefaultByPid($objArchive->id);
if ($objArticle !== null) {
while ($objArticle->next()) {
$arrPages[] = $objArticle->id;
}
}
}
}
return $arrPages;
}
示例12: getRelationLink
/**
* Generate a link to the relation submission form page
*
* @param \PageModel $objPage
* @param \Model $objEntity
* @param array $arrRelation
*
* @return string The url to the relation submission page
*/
public function getRelationLink(\PageModel $objPage, \Model $objEntity, array $arrRelation)
{
$objPage = \PageModel::findWithDetails($objPage->id);
$strParam = $arrRelation['request_parameter'] ?: $arrRelation['submissionField'];
if (\Config::get('useAutoItem') && $arrRelation['useAutoItem']) {
$varPath = !\Config::get('disableAlias') ? '/' : '/' . $strParam . '/';
$varValue = !\Config::get('disableAlias') && $objEntity->alias ? $objEntity->alias : $objEntity->id;
return \Controller::generateFrontendUrl($objPage->row(), $varPath . $varValue, $objPage->language, true);
}
$strQuery = $strParam . '=' . (!\Config::get('disableAlias') && $objEntity->alias ? $objEntity->alias : $objEntity->id);
return Url::addQueryString($strQuery, \Controller::generateFrontendUrl($objPage->row(), null, $objPage->language, true));
}
示例13: generateLink
/**
* Generate the canonical link
*
* @param $objPage
* @return string
*/
private static function generateLink($objPage)
{
$strUrl = '';
$strDomain = \Environment::get('base');
$objCanonicalPage = \PageModel::findWithDetails($objPage->canonicalJumpTo);
if ($objCanonicalPage !== null) {
if ($objCanonicalPage->domain != '') {
$strDomain = (\Environment::get('ssl') ? 'https://' : 'http://') . $objCanonicalPage->domain . TL_PATH . '/';
}
$strUrl = $strDomain . \Controller::generateFrontendUrl($objCanonicalPage->row(), null, $objCanonicalPage->language);
}
return $strUrl;
}
示例14: checkoutForm
/**
* Return the payment form
* @param IsotopeProductCollection The order being places
* @param Module The checkout module instance
* @return string
*/
public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule)
{
// get current host and
$strDescription = \Environment::get('host');
$objContact = \PageModel::findWithDetails($this->wirecard_contact);
$arrParams = array('customerId' => $this->wirecard_customer_id, 'language' => $GLOBALS['TL_LANGUAGE'], 'paymentType' => 'SELECT', 'amount' => number_format($objOrder->getTotal(), 2, '.', ''), 'currency' => $objOrder->currency, 'orderDescription' => $strDescription, 'successUrl' => \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder), 'cancelUrl' => \Environment::get('base') . $objModule->generateUrlForStep('process'), 'failureUrl' => \Environment::get('base') . $objModule->generateUrlForStep('failed'), 'serviceUrl' => \Environment::get('base') . \Controller::generateFrontendUrl($objContact->row()), 'confirmUrl' => \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id, 'customerStatement' => $strDescription, 'order_id' => $objOrder->id, 'order_uniqid' => $objOrder->uniqid, 'secret' => $this->wirecard_secret, 'REQUEST_TOKEN' => REQUEST_TOKEN);
$arrParams['requestFingerprintOrder'] = implode(',', array_keys($arrParams)) . ',requestFingerprintOrder';
$arrParams['requestFingerprint'] = $this->calcHashArray($arrParams);
$objTemplate = new \Isotope\Template('iso_payment_wirecard');
$objTemplate->setData($this->arrData);
$objTemplate->action = 'https://checkout.wirecard.com/page/init.php';
$objTemplate->params = array_filter(array_diff_key($arrParams, array('secret' => '')));
return $objTemplate->parse();
}
示例15: checkAlias
/**
* Check the news alias for duplicates
*
* @param mixed $varValue
* @param DataContainer $dc
*
* @return string
*
* @throws Exception
*/
public function checkAlias($varValue, DataContainer $dc)
{
// check if there is a news article with the same alias
if (($objNews = \NewsModel::findByAlias($varValue)) !== null) {
// get the redirect page
if (($objTarget = \PageModel::findWithDetails($objNews->getRelated('pid')->jumpTo)) !== null) {
// get the page
$objPage = \PageModel::findWithDetails($dc->id);
// check if page is on the same domain and language
if ($objPage->domain == $objTarget->domain && (\Config::get('addLanguageToUrl') && $objPage->rootLanguage == $objTarget->rootLanguage)) {
// append id
$varValue .= '-' . $dc->id;
}
}
}
// return the alias
return $varValue;
}