コード例 #1
0
ファイル: blog_list.php プロジェクト: baardev/lbtb
 public function view()
 {
     $this->loadblogSections();
     $blogList = new ProblogList();
     $blogList->displayUnapprovedPages();
     $blogList->includeSystemPages(true);
     $blogList->includeInactivePages(true);
     $blogList->sortBy('cDateAdded', 'desc');
     if (isset($_GET['cParentID']) && $_GET['cParentID'] > 0) {
         $path = Page::getByID($_GET['cParentID'])->getCollectionPath();
         $blogList->filterByPath($path);
     }
     //$blogList->filter(false,"(CHAR_LENGTH(cv.cvName) > 4 OR cv.cvName NOT REGEXP '^[0-9]')");
     $blogList->filter(false, "ak_is_canonical_page < 1");
     if (empty($_GET['cParentID'])) {
         $sections = $this->get('sections');
         $keys = array_keys($sections);
         if (is_array($keys)) {
             foreach ($keys as $id) {
                 $fs .= ' OR ';
                 $path = Page::getByID($id)->getCollectionPath() . '/';
                 $fs .= "pp.cPath LIKE '{$path}%'";
             }
             $blogList->filter(false, "(pp.cPath LIKE '/!drafts/%'{$fs})");
         }
     }
     $blogList->displayUnapprovedPages();
     if (!empty($_GET['like'])) {
         $blogList->filterByName($_GET['like']);
     }
     if ($_GET['only_unaproved'] > 0) {
         $blogList->filter(false, "p.cIsActive != 1");
     }
     $blogList->setItemsPerPage($this->num);
     if (!empty($_GET['cat'])) {
         $cat = $_GET['cat'];
         $blogList->filter(false, "ak_blog_category LIKE '%\n{$cat}\n%'");
     }
     if (!empty($_GET['tag'])) {
         $tag = $_GET['tag'];
         $blogList->filter(false, "ak_tags LIKE '%\n{$tag}\n%'");
     }
     //$blogList->debug();
     $blogResults = $blogList->get();
     $this->set('blogResults', $blogResults);
     $this->set('blogList', $blogList);
     $this->set('cat_values', $this->getblogCats());
     $this->set('tag_values', $this->getblogTags());
     $this->set('sortOrder', $this->request('ccm_order_by_direction'));
     if ($this->request('ccm_order_by_direction') == 'asc') {
         $nextSort = 'desc';
     } else {
         $nextSort = 'asc';
     }
     $this->set('nextSort', $nextSort);
     $this->set('controller', $this);
 }