示例#1
0
文件: kb.php 项目: Hildy/cerb5
 static function getFields()
 {
     return SearchFields_KbArticle::getFields();
 }
示例#2
0
文件: App.php 项目: joegeck/cerb4
 private function _getListAction($path, $keychain)
 {
     @($root = DevblocksPlatform::importGPC($_REQUEST['root'], 'integer', 0));
     // how many, and what page?
     @($p_page = DevblocksPlatform::importGPC($_REQUEST['p'], 'integer', 0));
     @($limit = DevblocksPlatform::importGPC($_REQUEST['limit'], 'integer', 10));
     // sort field and order
     @($sort = DevblocksPlatform::importGPC($_REQUEST['sort'], 'string', ''));
     $sort_field = SearchFields_KbArticle::ID;
     $sort_asc = true;
     switch ($sort) {
         case 'views':
             $sort_field = SearchFields_KbArticle::VIEWS;
             $sort_asc = false;
             break;
         case 'updated':
             $sort_field = SearchFields_KbArticle::UPDATED;
             $sort_asc = false;
             break;
         default:
             $sort_field = SearchFields_KbArticle::ID;
             $sort_asc = true;
     }
     $params = array();
     if (0 != $root) {
         $params[] = new DevblocksSearchCriteria(SearchFields_KbArticle::CATEGORY_ID, '=', $root);
     }
     $params[SearchFields_KbArticle::TOP_CATEGORY_ID] = new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys(@$keychain->rights['acl_kb_topics']));
     list($results, $null) = DAO_KbArticle::search($params, $limit, $p_page, $sort_field, $sort_asc, false);
     $this->_renderResults($results, SearchFields_KbArticle::getFields(), 'article', 'articles');
 }