Next / Previous buttons

Next / Previous buttons

by Charles Angel -
Number of replies: 6

Here's a simple but great feature you can add...many courses I have worked on are slide shows (interactive or not).  The student gets some information on one slide (maybe even interacts with it...ie: if it is a flash file) and then hits a next button.

Moodle is setup for this perfectly.  Each slide might be added as a resource.  If Moodle included Next/Previous buttons at the top and bottom of the resource info, then it could act just like this.  Next and Previous would simply go to the next / previous resource in that topic/week. 

It could also only show the next/previous button if the next/previous slide is of type resource...so quizzes, forums, etc would not get added to the slide show.

Average of ratings: -
In reply to Charles Angel

Re: Next / Previous buttons

by Pat Deegan -

Hi. I've just implemented a simple version of this by creating a generalized version of the navmenu function (from weblib).

The code returns useful info about the entire sequence of course modules, as well as specific pointers to the 'current', 'previous' and 'next' CMs.

I've attached the function itself below. You can use it, say in resource/view.php, like this


	/* Add the next/prev links if found */
	$sequenceInfo =& module_sequence_info($course, $cm);
	if ($sequenceInfo)
	{
		if ($sequenceInfo["next"] && $sequenceInfo["next"]["url"] && $sequenceInfo["next"]["name"])
		{
			$continueLink = "<A HREF=\"" . $sequenceInfo["next"]["url"]  . "\">"
							. $sequenceInfo["next"]["name"] . " &gt;&gt;&gt;</a>";
		}

		if ($sequenceInfo["prev"] && $sequenceInfo["prev"]["url"] && $sequenceInfo["prev"]["name"])
		{
			$prevLink = "<A HREF=\"" . $sequenceInfo["prev"]["url"]  . "\">&lt;&lt;&lt;"
							. $sequenceInfo["prev"]["name"] . "</a>";
		}

	}

Since the function is independant of policy (it returns all modules), you can either modify it or the relevant view.php to skip over other types of resources or whatever.

Regards,
Pat D.

In reply to Charles Angel

Re: Next / Previous buttons

by Jussi Ahtikari -
I have been building a module for a similar purpose. The idea in my module is that you implement each slide as a single html file. After this you create a simple xml-file where each html file and the order of the files are listed. When this is done, you can simply add expressions like "%NEXT_FILE%" OR "%PREVIOUS_FILE%" to your html-files. The module converts these expressions automatically to links to next or previous slide based on the information in the xml-file. Slides can be divided to subfolders, and the module can also automatically create list (table of contents) of the slides.

When slides are created in this way, they can easily be moved from one moodle environment (or course) to another. You just copy all the html files and the xml file to the target system and then create link to the first slide. This can be done in five minutes.

I could probably post this module to somewhere if someone thinks it's usefull. It has been build mainly for my personal use so there isn't any documentation, but it should be quite easy to use.
In reply to Jussi Ahtikari

Re: Next / Previous buttons

by Ray Kingdon -
Yes, that sounds useful but... the type of structure I use is more like a html HOWTO with a contents page and then "running" chapter pages. The buttons are next and previous but an up button (back to contents) is a boon. I did create a HOWTO set of html pages starting from a sgml file, it ain't easy! and then I changed distributions and lost the "knack".

A neat way of preparing and showing HOWTO-like resources would be great. It would be good to work to some sort of standard. The SGML files don't look too bad (I've attached my humble attempt) but it's not html and as I said the steps in going from SGML to HTML is a black art. I also don't think that route would be of any practical interest to your typical Moodle teacher.

Maybe your XML approach could be extended?
In reply to Ray Kingdon

Re: Next / Previous buttons

by Jussi Ahtikari -
I'm not sure I fully understood what kind of material you are trying to create. However, the solution I have created is quite flexible. It gives you full control about what kinds of links are included in the html pages. It is quite easy to create pages with just next and previous links but not "up" link back to contents.

I use Dreamweaver to create html pages and I have made a template where next, previous and contents links are always in the same place. After the template is ready, I just create new pages based on the template and configure the xml file. If I would for example want to remove contents link from all the pages, I would just have to update one file (the Dreamweaver template).
In reply to Jussi Ahtikari

Re: Next / Previous buttons

by Ray Kingdon -
Sorry to cause confusion blush I'm sure what you have created would be useful to me. In courses I use a contents page linked to a number of topics where each topic have a number of pages. It's tedious and error prone creating the links by hand to join the topic pages together and also provide links back to the contents page, some help setting up the links would be great.
In reply to Ray Kingdon

Re: Next / Previous buttons

by Jussi Ahtikari -
That sounds pretty much the same thing I have been doing. I have implemented each topic shown on the contents page as an individual subfolder. Each of these subfolders contains html pages of a single topic. I had the same problem with creating links to join different pages and creating links back to contents page. So I made a solution I described earlier where there is no need to create static links to the contents page or to any other page. You just put expressions like %NEXT_PAGE% or %CONTENTS_PAGE% in you html files, and then create a simple xml file where the order of the files and the subfolder hierarchy is described. After this the module reads the xml file and replaces the expressions with correct urls.