Other: Navigation buttons

block_navbuttons
Maintained by DavoDavo Smith
Add customisable navigation buttons (next/prev/etc.) to the bottom of each activity page (Moodle 1.9/2.0+)
477 sites
288 downloads
28 fans
Current versions available: 4

Travis build status

Navigation buttons (for Moodle 1.9 / 2.0+)
This block adds customisable navigation buttons (first/previous/next/etc.) to the bottom of each activity/resource page in a course.

It is based on an idea from Penny Mondani: http://pennymondani.com
Thanks also to the US company that sponsored the development, who wish to remain anonymous.

Installation:

  1. Download the file and unzip it somewhere convenient.
  2. On your server, in the 'blocks' folder, create a subfolder called 'navbuttons'
  3. Upload all the files inside the 'davosmith-moodle-navbuttons-???????' folder to this new 'navbuttons' folder on your server.
  4. Log in to your Moodle site as an administrator and click on the 'Notifications' option in the Admin settings block.
  5. You need to make a small change to one Moodle core file to make this work (the change is different between Moodle 1.9 & Moodle 2.0 - see the included README.txt for details).
  6. Add the block to a course (turn editing on, select 'Navigation Buttons' from the 'Blocks - Add' menu)
  7. Customise the button appearance by clicking on 'Edit the Navigation Button settings' in the newly created block.
  8. Check the message at the bottom of the screen (under the 'Save changes' button) - it should read "Navbuttons self-test: required core modifications have been completed successfully". If not, then go back to step 5 above and check carefully.

Note: The block is only visible to users who are able to edit courses modules. Deleting the block will remove the navigation buttons (they can also be disabled through the settings).

For a quick demo, there is a screencast available here:

Screenshots

Screenshot #0

Contributors

Davo
Davo Smith (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Davo
    Mon, Nov 18, 2019, 4:26 PM
    Seems to be working with Moodle 3.8, without any changes (new version released with mod_questionnaire compatibility fix).
  • Picture of Dinis Medeiros
    Mon, Nov 18, 2019, 5:06 PM
    Thanks for the plugin.
    Why it's not in AMOS for translation? I'm PT-PT translator. Only in GitHub?
  • Davo
    Mon, Nov 18, 2019, 5:09 PM
    Dinis - because of the necessary small core change, Moodle HQ has recategorised the plugin as 'Other', rather than 'Block'. This breaks just about all of the automated systems associated with the plugins database (automatic filling-in of details from version.php, integration with AMOS, etc.)

    There is nothing I can do about it as long as the plugin is still in the 'Other' category (I had hoped to remove the core change when some new hooks were added a to the Moodle footer a couple of years back, but those hooks were implemented in a way that doesn't allow extra output to be inserted, so I'm still stuck with the core change).
  • Picture of Dinis Medeiros
    Mon, Nov 18, 2019, 5:32 PM
    Sorry about that. I will pull a request in GitHub. Thanks
  • Picture of marisol castro
    Thu, Apr 30, 2020, 8:32 AM
    I am running moodle 3.7+ and have installed the latest download of this plugin and followed each step in the readme file but the red message when I go to add the block will not disappear. I modified the /moodle/lib/outputrenders.php file with the code you provided but it is just not working for me. What am I missing?
  • Picture of Antonio Carrieri
    Wed, May 20, 2020, 6:03 PM
    Hello, great block plugin, would it be possible to show "next activity" button even if next activity is not yet accessible? i have SCORM packages as activities and even if student complete the SCORM activity, he doens't get the "next activity" button
  • Davo
    Wed, May 20, 2020, 7:07 PM
    Antonio - you could probably open up the file footer.php in the plugin and remove the lines: if (!$mod->uservisible) { continue; }

    That would mean that the next activity in the course is linked to, even if it is hidden or not available due to conditional restrictions, but that will lead to lots of error screens if the activity is still not available to the user after they've clicked on the link (so hiding an activity in the course would lead to everyone getting an error when reaching it, rather than just skipping over it to get to the next activity).

    An alternative might be more complex code that refreshes the buttons via javascript once the activity is complete, but that is beyond the scope of what I'd be able to do in my spare time (maybe could be tackled in work time, if you had a budget to pay for it).
  • Davo
    Tue, Jun 16, 2020, 12:56 AM
    Checks suggest this is still working fine with Moodle 3.9.
  • Picture of Aysenur Kazokoglu
    Thu, Sep 24, 2020, 8:37 PM
    hi,

    in our moodle with adaptable as theme, the plugin isn't working properly. as i understand the readme file correctly, we have to change the file renderers.php from the theme folder. in this file the lines connected to the footer are:

    public function get_footer_blocks($layoutrow = 'footerlayoutrow') {
    global $PAGE, $OUTPUT;
    $fields = array();
    $blockcount = 0;
    $style = '';

    if (!$this->get_footer_visibility()) {
    return '';
    }

    $output = '
    ' . $OUTPUT->course_footer() . '
    ';

    for ($i = 1; $i <= 3; $i++) {
    $footerrow = $layoutrow . $i;
    $footerrow = $PAGE->theme->settings->$footerrow;
    if ($footerrow != '0-0-0-0') {
    $fields[] = $footerrow;
    }
    }

    foreach ($fields as $field) {
    $output .= '
    ';
    $vals = explode('-', $field);
    foreach ($vals as $val) {
    if ($val > 0) {
    $blockcount ++;
    $footerheader = 'footer' . $blockcount . 'header';
    $footercontent = 'footer' . $blockcount . 'content';
    if (!empty($PAGE->theme->settings->$footercontent)) {
    $output .= '
    ';
    if (!empty($PAGE->theme->settings->$footerheader)) {
    $output .= '

    ';
    $output .= $OUTPUT->get_setting($footerheader, 'format_text');
    $output .= '

    ';
    }
    $output .= $OUTPUT->get_setting($footercontent, 'format_html');
    $output .= '
    ';
    }
    }
    }
    $output .= '
    ';
    }
    $output .= '
    ';
    return $output;
    }

    which line do we need to change to put these lines:

    require_once($CFG->dirroot.'/blocks/navbuttons/footer.php');
    $output = draw_navbuttons().$this->container_end_all(true);

    thanks for any support!
  • Davo
    Thu, Sep 24, 2020, 9:58 PM
    As stated in the README, you need to change the line $this->container_end_all(true). I don't know where that occurs in theme_adaptable, but it will be in a function called footer(), not get_footer_blocks(). If there is no footer() function in theme_adaptable, then you need to make the change to the core version of footer() instead.
  • Picture of Aysenur Kazokoglu
    Thu, Sep 24, 2020, 11:37 PM
    in the renderers.php, there is the line $output = $this->container_end_all(true); in the function public function footer() {global $CFG;
    i have to replace $output = $this->container_end_all(true); with $output = draw_navbuttons().$this->container_end_all(true);
    where do i have to add? require_once($CFG->dirroot.'/blocks/navbuttons/footer.php');
    is this correct?
  • Davo
    Thu, Sep 24, 2020, 11:39 PM
    As it says in the instructions, replace the line:
    $output = $this->container_end_all(true);

    With the lines:

    require_once($CFG->dirroot.'/blocks/navbuttons/footer.php');
    $output = draw_navbuttons().$this->container_end_all(true);

  • Picture of Aysenur Kazokoglu
    Fri, Sep 25, 2020, 3:49 PM
    hi davo, thanks, the navigation buttons are now available, but what do we need to do to remove the default navigation, next activity, previous activity. currently we have a double navigation displayed.
  • Davo
    Fri, Sep 25, 2020, 3:51 PM
    I cannot offer any advice about removing the default navigation - that is something you'll have to post on the forums or figure out for yourself (my plugin long predates the default navigation, so I've never looked into it).
  • Picture of Aysenur Kazokoglu
    Fri, Sep 25, 2020, 4:20 PM
    ok, thanks
1 2 3 4 5 6 7 8 9 10
Please login to post comments