Why should we convert activity Foo! to use pagelib? It's already a fully-functional activity module. We have already done all of the coding necessary to display a proper Moodle page for our activity. There are actually several benefits of taking the effort to make this change, such as:
Easier and more consistent page management
Breadcrumb navigation is automatically generated
It adds block support
Easier future upgrades and code maintenance
It is easier to create additional pages for the module
Better alignment with Moodle programming guidelines
Let's start by creating our local pagelib.php
file. We will base our file on examples from the core activity modules. In particular, we will use the quiz module's pagelib.php
and view.php
files as a template. We need to make only minor updates in order to get our page working correctly.
In this section of code, note the inclusion of the core pagelib file. Also, note the inclusion of /course...