Non-fatal SQL errors when running unit tests.
[platal.git] / classes / plset.php
index 985b5be..1c29af2 100644 (file)
@@ -86,6 +86,18 @@ abstract class PlSet
      */
     abstract protected function buildFilter(PlFilterCondition &$cond, $orders);
 
+    /** This function returns the results of the given filter
+     * wihtin $limit ; available when the PlFilter getter isn't the usual get
+     * @param &$pf The filter
+     * @param $limit The PlLimit
+     * @return The results of the filter
+     */
+    protected function &getFilterResults(PlFilter &$pf, PlLimit $limit)
+    {
+        $res = $pf->get($limit);
+        return $res;
+    }
+
     /** This function returns the values of the set
      * @param $limit A PlLimit for selecting users
      * @param $orders An optional array of PFO to use before the "default" ones
@@ -104,7 +116,7 @@ abstract class PlSet
         if (is_null($limit)) {
             $limit = new PlLimit(self::DEFAULT_MAX_RES, 0);
         }
-        $it          = $pf->get($limit);
+        $it          = $this->getFilterResults($pf, $limit);
         $this->count = $pf->getTotalCount();
         return $it;
     }
@@ -285,7 +297,7 @@ abstract class MultipageView implements PlView
 
     public function limit()
     {
-        return null;
+        return new PlLimit($this->entriesPerPage, $this->offset);
     }
 
     /** Name of the template to use for displaying items of the view
@@ -330,6 +342,9 @@ abstract class MultipageView implements PlView
         $page->assign('order', Env::v('order', $this->defaultkey));
         $page->assign('orders', $this->sortkeys);
         $page->assign_by_ref('plview', $this);
+        if (is_array($res)) {
+            $page->assign('set_keys', array_keys($res));
+        }
         $page->assign_by_ref('set', $res);
         $count = $this->set->count();
         $this->pages = intval(ceil($count / $this->entriesPerPage));