X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplset.php;h=1c29af20bd087ad1f55a89e918e3ac26ec3cd500;hb=f992b7a5586a214d1704c9e74b7d1299e2c87a03;hp=13628c1376f0ee7033e5cc29abf1e434507698dc;hpb=24bb393609c4e87e8578ddaca906c32d99a299bf;p=platal.git diff --git a/classes/plset.php b/classes/plset.php index 13628c1..1c29af2 100644 --- a/classes/plset.php +++ b/classes/plset.php @@ -1,6 +1,6 @@ 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 @@ -312,14 +324,15 @@ abstract class MultipageView implements PlView $res = $this->set->get($this->limit()); $show_bounds = $this->bounds(); - $end = end($res); if ($show_bounds) { + $start = current($res); + $end = end($res); if ($show_bounds == 1) { - $first = $this->getBoundValue($res[0]); + $first = $this->getBoundValue($start); $last = $this->getBoundValue($end); } elseif ($show_bounds == -1) { $first = $this->getBoundValue($end); - $last = $this->getBoundValue($res[0]); + $last = $this->getBoundValue($start); } $page->assign('first', $first); $page->assign('last', $last); @@ -329,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));