} } // filter out PrintDesk articles $articlesParams[] = new ComparisonOperation('type', new Operator('not', 'string'), 'printdesk'); // 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 $sortOptions = array(0 => 'bynumber', 2 => 'bysectionorder', 3 => 'byname', 12 => 'bycomments', 13 => 'bypopularity', 16 => 'bycreationdate', 17 => '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[$sortOptionsKey])) { $sortBy = $sortOptions[$sortOptionsKey]; $sortDir = $_REQUEST['sSortDir_' . $i]; break; } } // get articles $articles = Article::GetList($articlesParams, array(array('field' => $sortBy, 'dir' => $sortDir)), $start, $limit, $articlesCount, true); $list = new ContextList(TRUE); $return = array(); foreach ($articles as $article) { $return[] = $list->processItem($article); } return array('iTotalRecords' => Article::GetTotalCount(), 'iTotalDisplayRecords' => $articlesCount, 'sEcho' => (int) $_REQUEST['sEcho'], 'aaData' => $return);