Moodle

correcting paging links in quiz showbank

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Questions, Quiz
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

The actual links in the paging when the number of questions is greater than 20 so the paging is working are defined as something like

http://132.208.141.198/moodle_head_new/moodle_head_new/question/edit.php?qpage=1&cat=1%2C3&courseid=2

notice the double /moodle_head_new/moodle_head_new/
this happens because the
class moodle_paging_bar

add $CFG->wwwroot to the $pageurl which has been defined

$thispageurl = new moodle_url();
so the default path automatically generated is $ME
line 306 in weblib

if ($url === null) {
                global $ME;
                $url = $ME;
            }
            if (is_string($url)) {
                $url = parse_url($url);
            }

in the example case the value is

"moodle_head_new/question/edit.php"

So the $url to create the $paging bar should be different than the one used elsewhere in the showbank.

A simple HACK replacing in question/editlib.php
line 1275 $pagingbar = moodle_paging_bar::make($totalnumber, $page, $perpage, $pageurl);

by
$pageing_url = new moodle_url('edit.php');
$r = $pageing_url->params($pageurl->params());
$pagingbar = moodle_paging_bar::make($totalnumber, $page, $perpage, $pageing_url);
solve the problem either with the general question showbank and the showbank version visible when editing the quiz.

This happens as in either case the url goes to either question/edit.php or quiz/edit.php

These are the only 2 calls to this function.

Activity

Hide
Pierre Pichet added a comment -

Here is the patch

Show
Pierre Pichet added a comment - Here is the patch
Hide
Pierre Pichet added a comment -

I understand that you are quite busy this week so I take the liberty to apply the patch so that the question bank becomes at least useable on HEAD.
We could find later a more complete solution that could be to add a new parameter to the question_bank_view class.

Show
Pierre Pichet added a comment - I understand that you are quite busy this week so I take the liberty to apply the patch so that the question bank becomes at least useable on HEAD. We could find later a more complete solution that could be to add a new parameter to the question_bank_view class.
Hide
Pierre Pichet added a comment -

You are now in the position to handle this on your to-do list

Show
Pierre Pichet added a comment - You are now in the position to handle this on your to-do list
Hide
Tim Hunt added a comment -

This has been fixed already.

Show
Tim Hunt added a comment - This has been fixed already.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: