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


PHP PageList::filterByAttribute方法代码示例

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


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

示例1: getPages

 function getPages($query = null)
 {
     Loader::model('page_list');
     $db = Loader::db();
     $bID = $this->bID;
     if ($this->bID) {
         $q = "select * from btDateNav 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();
     //$pl->sortByPublicDate();
     $pl->sortByPublicDateDescending();
     $num = (int) $row['num'];
     if ($num > 0) {
         $pl->setItemsPerPage($num);
     }
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     $cParentID = $row['cThis'] ? $this->cID : $row['cParentID'];
     if ($this->displayFeaturedOnly == 1) {
         Loader::model('attribute/categories/collection');
         $cak = CollectionAttributeKey::getByHandle('is_featured');
         if (is_object($cak)) {
             $pl->filterByIsFeatured(1);
         }
     }
     $pl->filter('cvName', '', '!=');
     if ($row['ctID']) {
         $pl->filterByCollectionTypeID($row['ctID']);
     }
     $pl->filterByAttribute('exclude_nav', false);
     if ($row['cParentID'] != 0) {
         $pl->filterByParentID($cParentID);
     }
     if ($num > 0) {
         $pages = $pl->getPage();
     } else {
         $pages = $pl->get();
     }
     $this->set('pl', $pl);
     return $pages;
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:56,代码来源:date_nav.php

示例2: foreach

$nh = \Loader::helper('navigation');
?>

<?php 
if (count($skills) > 0) {
    ?>
    <div class="row">
        <?php 
    foreach ($skills as $i => $skill) {
        ?>
            <?php 
        $url = '';
        $page = Page::getCurrentPage();
        $pageList = new PageList();
        $pageList->filterByParentID($page->getCollectionId());
        $pageList->filterByAttribute('worldskills_skill_id', $skill['id']);
        $pages = $pageList->get(1);
        if (is_array($pages) && isset($pages[0])) {
            $url = $nh->getLinkToCollection($pages[0]);
        }
        ?>
            <div class="col-md-3">
                <?php 
        if ($url) {
            ?>
                    <a href="<?php 
            echo h($url);
            ?>
" class="thumbnail">
                <?php 
        } else {
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:31,代码来源:view.php

示例3: PageList

            <?php 
        if ($i % 6 == 0) {
            ?>
               <div class="clearfix">
                    <p>&nbsp;</p>
               </div>
            <?php 
        }
        ?>

            <?php 
        $url = '';
        $page = Page::getCurrentPage();
        $pageList = new PageList();
        $pageList->filterByParentID($page->getCollectionId());
        $pageList->filterByAttribute('worldskills_member_id', $member['id']);
        $pages = $pageList->get(1);
        if (is_array($pages) && isset($pages[0])) {
            $url = $nh->getLinkToCollection($pages[0]);
        }
        ?>

            <div class="col-sm-2">
                <p>
                    <?php 
        if ($url) {
            ?>
                        <a href="<?php 
            echo h($url);
            ?>
">
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:31,代码来源:view.php

示例4: view

 /**
  * Call model data needed by view
  *
  * @param int $userID The user ID of who we're viewing
  * @return null
  */
 public function view($userID = 0)
 {
     // Load helpers
     Loader::model('page_list');
     $nh = Loader::helper('navigation');
     $ah = Loader::helper('concrete/avatar');
     $th = Loader::helper('text');
     $ih = Loader::helper('image');
     // Set helpers for view
     // Set the page view first
     $this->set('bodyData', ['pageViewName' => 'ProfilePageView']);
     parent::view($userID);
     // Load the current user
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $profile = $this->get('profile');
     // Basic flags identifying the type of user
     // Whether or not the logged in user is viewing their own "profile"
     $userIsViewingSelf = $u->getUserID() === $profile->getUserID();
     // User is a CO
     $userIsCityOrganizer = in_array('City Organizers', $profile->getUserObject()->getUserGroups());
     /**
      * New dashboard variables
      *
      */
     // Remaining variables/logic only needed for "self viewing"
     if ($userIsViewingSelf) {
         /**
          * Helper
          *
          */
         $html = Loader::helper('html');
         $this->addHeaderItem($html->javascript('swfobject.js'));
         /**
          * User data
          *
          */
         // Whether the logged in user has set their first and last name
         $this->set('userHasSetName', (bool) trim($ui->getAttribute('first_name') . ' ' . $ui->getAttribute('last_name')));
         // The home city for the logged in user (false otherwise)
         $userHomeCity = $ui->getAttribute('home_city');
         $this->set('userHomeCity', $userHomeCity);
         // Whether the logged in user has chosen an avatar/display picture
         $this->set('userPicture', $ah->getImagePath($ui));
         // Walks owned by user
         $pl = new PageList();
         $pl->filterByCollectionTypeHandle('walk');
         $pl->filterByUserID($u->getUserID());
         // Include the names of draft walks, not last published
         $pl->displayUnapprovedPages();
         $this->set('userWalks', $pl->get());
         // Whether the logged in user has created any blog posts
         $pl = new PageList();
         $pl->filterByCollectionTypeHandle(['walk_blog_entry', 'city_blog_entry']);
         $pl->filterByUserID($u->getUserID());
         $this->set('userBlogPosts', $pl->get());
         /**
          * User city data
          *
          */
         if ($userHomeCity) {
             // Set the city
             $city = $ui->getAttribute('home_city');
             // Load organizer user for this city
             $cityOrganizer = UserInfo::getByID($userHomeCity->getCollectionUserID());
             if ($cityOrganizer) {
                 // The email address of the city organizer for the logged in user's
                 // home city
                 $cityOrganizerEmailAddress = $cityOrganizer->getUserEmail();
                 $this->set('cityOrganizerEmailAddress', $cityOrganizerEmailAddress);
             }
             // Whether the city has a blog page set up for it
             $pl = new PageList();
             $pl->filterByCollectionTypeHandle('blog');
             $pl->filterByParentID($userHomeCity->getCollectionID());
             $cityHasBlogSetup = (bool) $pl->getTotal();
             $this->set('cityHasBlogSetup', $cityHasBlogSetup);
             // List of basic data for three walks we want to highlight to city
             // organizers/walk leaders that showcase creative/unique walks
             $pl = new PageList();
             $pl->filterByCollectionTypeHandle('walk');
             $pl->filter(false, 'p1.uID !=' . $u->getUserID());
             $pl->filterByAttribute('exclude_page_list', false);
             $pl->sortBy('RAND()');
             // Load this list of featured walks
             $featuredWalkData = array_map(function ($page) use($nh, $ih) {
                 $_city = Page::getByID($page->getCollectionParentID());
                 $_country = Page::getByID($_city->getCollectionParentID());
                 $_thumb = $page->getAttribute('thumbnail');
                 $countryName = $_country->getCollectionName();
                 if ($countryName === 'United States') {
                     $countryName = 'United States of America';
                 }
                 $countryName = str_replace(' ', '_', $countryName);
//.........这里部分代码省略.........
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:101,代码来源:controller.php


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