mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
Whoops - ranges for categories on each page were incorrect. Plus added
sesskey to page numbers.
This commit is contained in:
parent
4a987dfa67
commit
cb06a092dc
1 changed files with 5 additions and 4 deletions
|
@ -127,6 +127,7 @@ class quiz_category_object {
|
||||||
* display list of page numbers for navigation
|
* display list of page numbers for navigation
|
||||||
*/
|
*/
|
||||||
function display_page_numbers( $page=0 ) {
|
function display_page_numbers( $page=0 ) {
|
||||||
|
global $USER;
|
||||||
|
|
||||||
echo "<div class=\"paging\">{$this->str->page}:\n";
|
echo "<div class=\"paging\">{$this->str->page}:\n";
|
||||||
foreach (range(1,$this->pagecount) as $currentpage) {
|
foreach (range(1,$this->pagecount) as $currentpage) {
|
||||||
|
@ -134,7 +135,7 @@ class quiz_category_object {
|
||||||
echo " $currentpage \n";
|
echo " $currentpage \n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<a href=\"category.php?id={$this->course->id}&page=$currentpage\">";
|
echo "<a href=\"category.php?id={$this->course->id}&page=$currentpage&sesskey={$USER->sesskey}\">";
|
||||||
echo " $currentpage </a>\n";
|
echo " $currentpage </a>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,14 +211,14 @@ class quiz_category_object {
|
||||||
|
|
||||||
// if pagination required work out range
|
// if pagination required work out range
|
||||||
if (!empty($page)) {
|
if (!empty($page)) {
|
||||||
$firstcat = $page * PAGE_LENGTH;
|
$firstcat = ($page-1) * PAGE_LENGTH + 1;
|
||||||
$lastcat = $firstcat+ PAGE_LENGTH - 1;
|
$lastcat = $firstcat + PAGE_LENGTH - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$firstcat = 1;
|
$firstcat = 1;
|
||||||
$lastcat = $this->topcount;
|
$lastcat = $this->topcount;
|
||||||
}
|
}
|
||||||
|
//echo "$firstcat $lastcat $page"; die;
|
||||||
$this->build_edit_table_body($this->categories, $page, $firstcat, $lastcat);
|
$this->build_edit_table_body($this->categories, $page, $firstcat, $lastcat);
|
||||||
print_table($this->edittable);
|
print_table($this->edittable);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue