Explorar el Código

fixed sortBy param in acl query builder

Piotr Labudda hace 8 años
padre
commit
a84dc5df41
Se han modificado 2 ficheros con 11 adiciones y 6 borrados
  1. 1 0
      SE/se-lib/AclQueryBuilder.php
  2. 10 6
      SE/se-lib/AclQueryFeatures.php

+ 1 - 0
SE/se-lib/AclQueryBuilder.php

@@ -216,6 +216,7 @@ class AclQueryBuilder {
         } else throw new Exception("SortBy parse error - unknown sort order '{$sortPartEx[1]}' #" . __LINE__);
       }
       $this->orderBy[] = [$fieldName, $colSortDir];
+      DBG::log($this->orderBy, 'array', "sortBy");
     }
     return $this;
   }

+ 10 - 6
SE/se-lib/AclQueryFeatures.php

@@ -305,6 +305,7 @@ class AclQueryFeatures {
       } else if ('limitstart' === $k) {
       } else if ('order_by' === $k) {
       } else if ('order_dir' === $k) {
+      } else if ('sortBy' === $k) {
       } else {
         throw new Exception("Not Implemented param '{$k}' = '{$v}'");
       }
@@ -355,12 +356,15 @@ class AclQueryFeatures {
     //  'order_by' => 'ID',
     //  'order_dir' => 'desc',
     // TODO: sortBy from wfs query
-    $sortBy = $this->hasParam('order_by')
-      ? ( $this->hasParam('order_dir')
-          ? $this->getParam('order_by') . " " . $this->getParam('order_dir')
-          : $this->getParam('order_by')
-        )
-      : '';
+    $sortBy = ($this->hasParam('sortBy')) ? $this->getParam('sortBy') : null;
+    if (!$sortBy) {
+      $sortBy = $this->hasParam('order_by')
+        ? ( $this->hasParam('order_dir')
+            ? $this->getParam('order_by') . " " . $this->getParam('order_dir')
+            : $this->getParam('order_by')
+          )
+        : '';
+    }
     $limit = V::get('limit', 10, $this->_params, 'int');
     $offset = V::get('limitstart', 0, $this->_params, 'int');