ArticleList::getColumnKeys PHP Method

getColumnKeys() public method

Get column keys
public getColumnKeys ( ) : array
return array
    public function getColumnKeys()
    {
        return array_keys($this->cols);
    }

Usage Example

Esempio n. 1
0
    // limit articles of filtered types by default
    foreach ((array) \ArticleType::GetArticleTypes(true) as $one_art_type_name) {
        $one_art_type = new \ArticleType($one_art_type_name);
        if ($one_art_type->getFilterStatus()) {
            $articlesParams[] = new ComparisonOperation('type', new Operator('not', 'string'), $one_art_type->getTypeName());
        }
    }
}
// search
if (isset($_REQUEST['sSearch']) && strlen($_REQUEST['sSearch']) > 0) {
    $search_phrase = $_REQUEST['sSearch'];
    //$articlesParams[] = new ComparisonOperation('search_phrase', new Operator('is', 'integer'), $search_phrase);
    $articlesParams[] = new ComparisonOperation('search_phrase', new Operator('like', 'string'), "__match_all." . $search_phrase);
}
// sorting
$cols = $list->getColumnKeys();
$sortOptions = array('Number' => 'bynumber', 'Order' => 'bysectionorder', 'Name' => 'byname', 'Comments' => 'bycomments', 'Reads' => 'bypopularity', 'CreateDate' => 'bycreationdate', 'PublishDate' => 'bypublishdate');
$sortBy = 'bysectionorder';
$sortDir = 'asc';
$sortingCols = min(1, (int) $_REQUEST['iSortingCols']);
for ($i = 0; $i < $sortingCols; $i++) {
    $sortOptionsKey = (int) $_REQUEST['iSortCol_' . $i];
    if (!empty($sortOptions[$cols[$sortOptionsKey]])) {
        $sortBy = $sortOptions[$cols[$sortOptionsKey]];
        $sortDir = $_REQUEST['sSortDir_' . $i];
        break;
    }
}
// get articles
$articles = Article::GetList($articlesParams, array(array('field' => $sortBy, 'dir' => $sortDir)), $start, $limit, $articlesCount, true);
$return = array();