9 namespace Fossology\Lib\Util;
20 function __construct()
22 $this->logger =
new Logger(self::class);
32 if (array_key_exists(
'iSortingCols', $inputArray)) {
33 if ($inputArray[
'iSortingCols'] > count($columNamesInDatabase)) {
34 $this->logger->warning(
35 "did have enough columNames for " . $inputArray[
'iSortingCols'] .
40 $columNamesInDatabase, $defaultSearch);
42 $this->logger->warning(
"did not find iSortingCols in inputArray");
56 $orderArray = array();
57 $sortedCols = array();
58 for ($i = 0; $i < $inputArray[
'iSortingCols']; $i ++) {
59 $whichCol =
'iSortCol_' . $i;
60 $colNumber = $inputArray[$whichCol];
61 $sortedCols[] = intval($colNumber);
63 $isSortable = $inputArray[
'bSortable_' . $i];
64 if ($isSortable !==
"true") {
67 $name = $columNamesInDatabase[$colNumber];
69 $whichDir =
'sSortDir_' . $i;
70 $order = $inputArray[$whichDir];
71 $orderArray[] = $name .
" " . $order;
74 foreach ($defaultSearch as $search) {
75 $colNumber = $search[0];
77 if (in_array($colNumber, $sortedCols)) {
80 $isSortable = $inputArray[
'bSortable_' . $colNumber];
81 if ($isSortable !==
"true") {
85 $name = $columNamesInDatabase[$colNumber];
86 $orderArray[] = $name .
" " . $order;
98 public function getSortingString($inputArray, $columNamesInDatabase, $defaultSearch = array())
101 return empty($orderArray) ?
"" :
"ORDER BY " . implode(
", ", $orderArray);
getSortingString($inputArray, $columNamesInDatabase, $defaultSearch=array())
getSortingParametersFromArray($inputArray, $columNamesInDatabase, $defaultSearch=array())
getSortingParametersFromArrayImpl($inputArray, $columNamesInDatabase, $defaultSearch=array())