Preparing for the future feature to let the user to set users per page
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:09:58 +0000 (18:09 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:09:58 +0000 (18:09 +0000)
mod/workshop/allocation/manual/lib.php

index 1ce9811f042fa1007dbabc97b77d7b41aecde876..99fc32920301bb48647d71a3363f4c9954bc1f74 100644 (file)
@@ -132,6 +132,7 @@ class workshop_manual_allocator implements workshop_allocator {
         global $PAGE, $OUTPUT, $DB;
         $pagingvar  = 'page';
         $page       = optional_param($pagingvar, 0, PARAM_INT);
+        $perpage    = 10;   // todo let the user modify this
 
         $hlauthorid     = -1;           // highlight this author
         $hlreviewerid   = -1;           // highlight this reviewer
@@ -203,7 +204,7 @@ class workshop_manual_allocator implements workshop_allocator {
             $participants = array_intersect_key($participants, array($hlauthorid => null, $hlreviewerid => null));
         } else {
             // slice the list of participants according to the current page
-            $participants = array_slice($participants, $page * workshop::PERPAGE, workshop::PERPAGE, true);
+            $participants = array_slice($participants, $page * $perpage, $perpage, true);
         }
 
         // this will hold the information needed to display user names and pictures
@@ -314,7 +315,7 @@ class workshop_manual_allocator implements workshop_allocator {
         $pagingbar              = new moodle_paging_bar();
         $pagingbar->totalcount  = $numofparticipants;
         $pagingbar->page        = $page;
-        $pagingbar->perpage     = workshop::PERPAGE;
+        $pagingbar->perpage     = $perpage;
         $pagingbar->baseurl     = $PAGE->url;
         $pagingbar->pagevar     = $pagingvar;