本文整理汇总了PHP中PageModel::findMultipleByIds方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::findMultipleByIds方法的具体用法?PHP PageModel::findMultipleByIds怎么用?PHP PageModel::findMultipleByIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::findMultipleByIds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPages
/**
* Get all pages from pages field as array
* @param \DataContainer $dc
*
* @return array The pages
*/
public function getPages(\DataContainer $dc)
{
$arrOptions = array();
if (!$dc->activeRecord && !is_array($dc->activeRecord->pages)) {
return $arrOptions;
}
$arrPages = deserialize($dc->activeRecord->pages, true);
$arrOrder = deserialize($dc->activeRecord->orderPages, true);
$objPages = \PageModel::findMultipleByIds($arrPages, array('order' => 'FIELD(id,' . implode(",", $arrOrder) . ')'));
if ($objPages === null) {
return $arrOptions;
}
while ($objPages->next()) {
$arrOptions[$objPages->id] = $arrValues[$objPages->id] = $objPages->title . ' (' . $objPages->alias . \Config::get('urlSuffix') . ')';
}
return $arrOptions;
}
示例2: generate
/**
* Generate the widget and return it as string
*
* @return string
*/
public function generate()
{
$arrSet = array();
$arrValues = array();
$blnHasOrder = $this->orderField != '' && is_array($this->{$this->orderField});
if (!empty($this->varValue)) {
$objPages = \PageModel::findMultipleByIds((array) $this->varValue);
if ($objPages !== null) {
while ($objPages->next()) {
$arrSet[] = $objPages->id;
$arrValues[$objPages->id] = \Image::getHtml($this->getPageStatusIcon($objPages)) . ' ' . $objPages->title . ' (' . $objPages->alias . \Config::get('urlSuffix') . ')';
}
}
// Apply a custom sort order
if ($blnHasOrder) {
$arrNew = array();
foreach ($this->{$this->orderField} as $i) {
if (isset($arrValues[$i])) {
$arrNew[$i] = $arrValues[$i];
unset($arrValues[$i]);
}
}
if (!empty($arrValues)) {
foreach ($arrValues as $k => $v) {
$arrNew[$k] = $v;
}
}
$arrValues = $arrNew;
unset($arrNew);
}
}
// Load the fonts for the drag hint (see #4838)
\Config::set('loadGoogleFonts', true);
$return = '<input type="hidden" name="' . $this->strName . '" id="ctrl_' . $this->strId . '" value="' . implode(',', $arrSet) . '">' . ($blnHasOrder ? '
<input type="hidden" name="' . $this->strOrderName . '" id="ctrl_' . $this->strOrderId . '" value="' . $this->{$this->orderField} . '">' : '') . '
<div class="selector_container">' . ($blnHasOrder && count($arrValues) > 1 ? '
<p class="sort_hint">' . $GLOBALS['TL_LANG']['MSC']['dragItemsHint'] . '</p>' : '') . '
<ul id="sort_' . $this->strId . '" class="' . ($blnHasOrder ? 'sortable' : '') . '">';
foreach ($arrValues as $k => $v) {
$return .= '<li data-id="' . $k . '">' . $v . '</li>';
}
$return .= '</ul>
<p><a href="contao/page.php?do=' . \Input::get('do') . '&table=' . $this->strTable . '&field=' . $this->strField . '&act=show&id=' . $this->activeRecord->id . '&value=' . implode(',', $arrSet) . '&rt=' . REQUEST_TOKEN . '" class="tl_submit" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\'' . specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']) . '\',\'url\':this.href,\'id\':\'' . $this->strId . '\'});return false">' . $GLOBALS['TL_LANG']['MSC']['changeSelection'] . '</a></p>' . ($blnHasOrder ? '
<script>Backend.makeMultiSrcSortable("sort_' . $this->strId . '", "ctrl_' . $this->strOrderId . '")</script>' : '') . '
</div>';
if (!\Environment::get('isAjaxRequest')) {
$return = '<div>' . $return . '</div>';
}
return $return;
}
示例3: findJumpToPage
/**
* Find jumpTo page for current category scope
*
* @param \Isotope\Model\Product\Standard $objProduct
*
* @return \PageModel
*/
protected function findJumpToPage($objProduct)
{
global $objPage;
global $objIsotopeListPage;
$productCategories = $objProduct->getCategories(true);
$arrCategories = array();
if ($this->iso_category_scope != 'current_category' && $this->iso_category_scope != '' && $objPage->alias != 'index') {
$arrCategories = array_intersect($productCategories, $this->findCategories());
}
// If our current category scope does not match with any product category,
// use the first allowed product category in the current root page
if (empty($arrCategories)) {
$arrCategories = $productCategories;
}
$arrCategories = Frontend::getPagesInCurrentRoot($arrCategories, \FrontendUser::getInstance());
if (!empty($arrCategories) && ($objCategories = \PageModel::findMultipleByIds($arrCategories)) !== null) {
$blnMoreThanOne = $objCategories->count() > 1;
foreach ($objCategories as $objCategory) {
if ($objCategory->alias == 'index' && $blnMoreThanOne) {
continue;
}
return $objCategory;
}
}
return $objIsotopeListPage ?: $objPage;
}
示例4: findForPage
/**
* Find images for given page
* @param \PageModel
* @return array
*/
protected static function findForPage(\PageModel $objPage, $blnInherit = true)
{
if (!isset(static::$arrImages[$objPage->id])) {
static::$arrImages[$objPage->id] = false;
$arrImages = static::parsePage($objPage);
if (!empty($arrImages)) {
static::$arrImages[$objPage->id] = array('images' => $arrImages, 'inherited' => false);
} else {
$objPage->loadDetails();
$objTrails = \PageModel::findMultipleByIds(array_reverse($objPage->trail));
if (null !== $objTrails) {
foreach ($objTrails as $objTrail) {
$arrImages = static::parsePage($objTrail);
if (!empty($arrImages)) {
static::$arrImages[$objPage->id] = array('images' => $arrImages, 'inherited' => true);
break;
}
}
}
}
}
if (static::$arrImages[$objPage->id] === false || !$blnInherit && static::$arrImages[$objPage->id]['inherited']) {
return null;
}
return static::$arrImages[$objPage->id]['images'];
}