$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(); foreach ($articles as $article) { $return[] = $list->processItem($article); } return array('iTotalRecords' => Article::GetTotalCount(), 'iTotalDisplayRecords' => $articlesCount, 'sEcho' => (int) $_REQUEST['sEcho'], 'aaData' => $return);