示例#1
0
 protected function loadblogSections()
 {
     $blogSectionList = new ProblogList();
     $blogSectionList->setItemsPerPage($this->num);
     $blogSectionList->filterByBlogSection(1);
     $blogSectionList->sortBy('cvName', 'asc');
     $tmpSections = $blogSectionList->get();
     $sections = array();
     foreach ($tmpSections as $_c) {
         $sections[$_c->getCollectionID()] = $_c->getCollectionName();
     }
     $this->set('sections', $sections);
 }
示例#2
0
文件: blogify.php 项目: baardev/lbtb
 public function getPrevPost($c)
 {
     $cID = $c->getCollectionID();
     $this->loadblogSections();
     $pl = new ProblogList();
     $pl->setItemsPerPage(1);
     $pl->filter(false, "cv.cID < {$cID}");
     //$pl->filter(false,"(CHAR_LENGTH(cv.cvName) > 4 OR cv.cvName NOT REGEXP '^[0-9]')");
     $pl->filter(false, "ak_is_canonical_page < 1");
     $pl->filterByPublicDate(date('Y-m-d H:i:s'), '<=');
     $sections = $this->sections;
     $keys = array_keys($sections);
     if (is_array($keys)) {
         foreach ($keys as $id) {
             if ($fs) {
                 $fs .= ' OR ';
             }
             $path = Page::getByID($id)->getCollectionPath() . '/';
             $fs .= "pp.cPath LIKE '{$path}%'";
         }
         $pl->filter(false, "({$fs})");
     }
     $posts = $pl->get();
     $np = $posts[0];
     if ($np) {
         return Loader::helper('navigation')->getLinkToCollection($np);
     }
 }