当前位置: 首页>>代码示例>>PHP>>正文


PHP PageList::sortByName方法代码示例

本文整理汇总了PHP中PageList::sortByName方法的典型用法代码示例。如果您正苦于以下问题:PHP PageList::sortByName方法的具体用法?PHP PageList::sortByName怎么用?PHP PageList::sortByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PageList的用法示例。


在下文中一共展示了PageList::sortByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

$cParentID = false;
if (is_object($target)) {
    $cParentID = $target->getCollectionID();
}
if (is_object($pagetype) && $pagetype->getPageTypePublishTargetTypeID() == $configuration->getPageTypePublishTargetTypeID()) {
    $configuredTarget = $pagetype->getPageTypePublishTargetObject();
    if ($configuredTarget->getSelectorFormFactor() == 'sitemap_in_page') {
        $siteMapParentID = HOME_CID;
        if ($configuredTarget->getStartingPointPageID()) {
            $siteMapParentID = $configuredTarget->getStartingPointPageID();
        }
        $ps = Loader::helper('form/page_selector');
        print $ps->selectFromSitemap('cParentID', $cParentID, $siteMapParentID, array('ptID' => $configuredTarget->getPageTypeID()));
    } else {
        $pl = new PageList();
        $pl->sortByName();
        $pl->filterByPageTypeID($configuredTarget->getPageTypeID());
        $pl->sortByName();
        $pages = $pl->get();
        if (count($pages) > 1) {
            $options = array();
            foreach ($pages as $p) {
                $options[$p->getCollectionID()] = $p->getCollectionName();
            }
            print $form->select('cParentID', $options, $cParentID);
        } else {
            if (count($pages) == 1) {
                $p = $pages[0];
                print $form->hidden('cParentID', $p->getCollectionID());
                print t('This page will be published beneath "%s."', $p->getCollectionName());
            }
开发者ID:digideskio,项目名称:concrete5,代码行数:31,代码来源:page_type.php

示例2: getPages

 function getPages($query = null)
 {
     Loader::model('page_list');
     $db = Loader::db();
     $bID = $this->bID;
     if ($this->bID) {
         $q = "select num, cParentID, cThis, orderBy, ctID, displayAliases, rss from btEasyNewsList where bID = '{$bID}'";
         $r = $db->query($q);
         if ($r) {
             $row = $r->fetchRow();
         }
     } else {
         $row['num'] = $this->num;
         $row['cParentID'] = $this->cParentID;
         $row['cThis'] = $this->cThis;
         $row['orderBy'] = $this->orderBy;
         $row['ctID'] = $this->ctID;
         $row['rss'] = $this->rss;
     }
     $pl = new PageList();
     $pl->setNameSpace('b' . $this->bID);
     $cArray = array();
     switch ($row['orderBy']) {
         case 'public_desc':
             $pl->sortBy('cvDatePublic', 'desc');
             break;
         case 'public_asc':
             $pl->sortBy('cvDatePublic', 'asc');
             break;
         case 'display_asc':
             $pl->sortByDisplayOrder();
             break;
         case 'display_desc':
             $pl->sortByDisplayOrderDescending();
             break;
         case 'chrono_asc':
             $pl->sortByPublicDate();
             break;
         case 'alpha_asc':
             $pl->sortByName();
             break;
         case 'alpha_desc':
             $pl->sortByNameDescending();
             break;
         default:
             $pl->sortByPublicDateDescending();
             break;
     }
     $num = (int) $row['num'];
     if ($num > 0) {
         $pl->setItemsPerPage($num);
     }
     $c = Page::getCurrentPage();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     $cParentID = $row['cThis'] ? $this->cID : $row['cParentID'];
     Loader::model('attribute/categories/collection');
     if ($this->displayFeaturedOnly == 1) {
         $cak = CollectionAttributeKey::getByHandle('is_featured');
         if (is_object($cak)) {
             $pl->filterByIsFeatured(1);
         }
     }
     if (!$row['displayAliases']) {
         $pl->filterByIsAlias(0);
     }
     $pl->filter('cvName', '', '!=');
     if ($row['ctID']) {
         $pl->filterByCollectionTypeID($row['ctID']);
     }
     $columns = $db->MetaColumns(CollectionAttributeKey::getIndexedSearchTable());
     if (isset($columns['AK_EXCLUDE_PAGE_LIST'])) {
         $pl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)');
     }
     if (intval($row['cParentID']) != 0) {
         $pl->filterByParentID($cParentID);
     }
     //Publish Date Filter
     $dt = Loader::helper('date');
     $pl->filter('cvDatePublic', $dt->getLocalDateTime(), '<');
     if ($num > 0) {
         $pages = $pl->getPage();
     } else {
         $pages = $pl->get();
     }
     $this->set('pl', $pl);
     return $pages;
 }
开发者ID:vipkailiai,项目名称:FCVOVA,代码行数:89,代码来源:controller.php

示例3: getPageList

 public function getPageList()
 {
     Loader::model('page_list');
     $db = Loader::db();
     $bID = $this->bID;
     if ($this->bID) {
         $q = 'select num, cParentID, cThis, orderBy, ctID, displayAliases, rss from btPageList where bID = \'' . $bID . '\'';
         $r = $db->query($q);
         if ($r) {
             $row = $r->fetchRow();
         }
     } else {
         $row['num'] = $this->num;
         $row['cParentID'] = $this->cParentID;
         $row['cThis'] = $this->cThis;
         $row['orderBy'] = $this->orderBy;
         $row['ctID'] = $this->ctID;
         $row['rss'] = $this->rss;
         $row['displayAliases'] = $this->displayAliases;
     }
     $pl = new PageList();
     $pl->setNameSpace('b' . $this->bID);
     $cArray = array();
     switch ($row['orderBy']) {
         case 'display_asc':
             $pl->sortByDisplayOrder();
             break;
         case 'display_desc':
             $pl->sortByDisplayOrderDescending();
             break;
         case 'chrono_asc':
             $pl->sortByPublicDate();
             break;
         case 'alpha_asc':
             $pl->sortByName();
             break;
         case 'alpha_desc':
             $pl->sortByNameDescending();
             break;
         case 'random':
             $pl->sortBy('RAND()');
             break;
         default:
             $pl->sortByPublicDateDescending();
             break;
     }
     $num = (int) $row['num'];
     $pl->setItemsPerPage($num);
     $c = Page::getCurrentPage();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     Loader::model('attribute/categories/collection');
     if ((int) $this->displayFeaturedOnly === 1) {
         $cak = CollectionAttributeKey::getByHandle('is_featured');
         if (is_object($cak)) {
             $pl->filterByIsFeatured(1);
         }
     }
     if (!$row['displayAliases']) {
         $pl->filterByIsAlias(0);
     }
     $pl->filter('cvName', '', '!=');
     if ($row['ctID']) {
         $pl->filterByCollectionTypeID($row['ctID']);
     }
     $columns = $db->MetaColumns(CollectionAttributeKey::getIndexedSearchTable());
     if (isset($columns['AK_EXCLUDE_PAGE_LIST'])) {
         $pl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)');
     }
     if (intval($row['cParentID']) != 0) {
         $cParentID = $row['cThis'] ? $this->cID : $row['cParentID'];
         if ($this->includeAllDescendents) {
             $pl->filterByPath(Page::getByID($cParentID)->getCollectionPath());
         } else {
             $pl->filterByParentID($cParentID);
         }
     }
     return $pl;
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:80,代码来源:controller.php


注:本文中的PageList::sortByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。