Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-30316

Pagination bar does not display all options when maxdisplay is lower than 18

    Details

    • Testing Instructions:
      Hide
      1. set public $maxdisplay = 18; in lib/outputcomponents.php to 5
      2. Create database activity.
      3. Add more than 5 entries
      4. Go to View single option
      5. Click on page 5 and try to access the rest of the entries without changing manually the url.

      p.s. it can be tested with any other interface with pagination that has more than 5 entries.

      Show
      set public $maxdisplay = 18; in lib/outputcomponents.php to 5 Create database activity. Add more than 5 entries Go to View single option Click on page 5 and try to access the rest of the entries without changing manually the url. p.s. it can be tested with any other interface with pagination that has more than 5 entries.
    • Workaround:
      Hide

      file lib/outputcomponents.php
      Class paging_bar
      function: prepare(renderer_base $output, moodle_page $page, $target)
      line: 2038

      Before:

      ...
                  if ($this->page > 15) {
                      $startpage = $this->page - 10;

      After:

      ...
                  if ($this->page > round($this->maxdisplay/3*2)) {
                      $startpage = $this->page - round($this->maxdisplay/3);

      Show
      file lib/outputcomponents.php Class paging_bar function: prepare(renderer_base $output, moodle_page $page, $target) line: 2038 Before: ... if ($this->page > 15) { $startpage = $this->page - 10; After: ... if ($this->page > round($this->maxdisplay/3*2)) { $startpage = $this->page - round($this->maxdisplay/3);
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-30316-master

      Description

      I changed the maxdisplay to 5 because the section I have to show the pagination is not big enough but I found a problem. The values to calculate which pages to display are hardcoded instead of being relative, for example:

      When viewing an interface with pagination, it only shows the first 5 pages and the user can't access the rest.
      I created a database activity with more than 5 entries and when I click on "View single" and navigate to page number 5, I can't access the rest unless I change the URL manually but then I wouldn't see the current page.

      I think this is something very specific, but I think the suggested solution can help everyone in a similar situation.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13