If the preference has already been fetched before, the saved value is returned. Get_pref() Given the name of a user preference (without grade_report_ prefix), locally saves then returns the value of that preference. The grade_report class has the following methods which you can use, provided the right steps have been taken to initialise the object first: groupwheresql An SQL constraint to append to the queries used by this object to build the report. groupsql An SQL fragment used to add linking information to the group tables. group_selector A HTML select element used to select the current group. A method is provided to replace get_string() and use this cache currentgroup The current group being displayed. lang_strings Array of cached language strings (using get_string() all the time takes a long time!). Must be given to constructor if paging is required. Methods are given to get and set these easily gradebookroles The roles for this report, pulled out of $CFG->gradebookroles baseurl Base url for sorting by first/last name (not needed by all reports) pbarurl Base url for paging page Current page (for paging). The grade_report class makes the following variables available to your new class, if you use its constructor in your child class' constructor:Ĭourseid Required by constructor gpr Grade plugin return tracking object, required by constructor context Required by constructor gtree The grade_tree must be instantiated in child classes: not all reports need the whole tree prefs Array of user preferences related to this report. The lib.php contains an extension of the grade_report class, and should be named.Create a lib.php file (or copy it from other report).The rest of this tutorial will follow the path of flexitable. We use flexitable for simple reports, as you can see in the user report (grade_report_user class). You are free to develop that class any way you want, but by using the existing methods set up in grade_report, you can avoid tedious repetition of code. Then go the the define roles and make sure that your permissions are set correct. If the report is made available to multiple users you may need to update the tables by going to the admin section of your Moodle installation, just like when you are upgrading. I did not need to add setting.php file using Moodle 2.1. Once i added the file to the grade\report\ directory, it corrected. ![]() ![]() If the file was not present, i received this error "Section Error!". I also needed to include the settings.php file in my new grade\report\ directory. The next section discusses one easy approach using flexitable. This is all you need to do to create a new report! Now, of course, you'll want the code to actually DO something, usually fetch and display some data. Create an upgrade.php file in the db folder with the following content: You do not need to create a new link to your report, it will be automatically detected and added to the gradebook plugin drop-down menu, if you've followed all these steps!ħ. Grade/report//lang/en_utf8/gradereport_.php Include at least the modulename, and optionally the strings for different capabilities. Create a version.php file with the current dates:Ħ.Create a language file for your report. You should change the capabilities as needed.Ĥ. Create an access.php file in the db folder with the following content. Create a /db sub-folder under the new report folderģ. These steps all involve creating new files, but in all cases they can be copy-pasted from existing reports, to make your life easier.ġ. The simplest example report to look at while following this guide is grade/report/overview. The second section gives an example of a possible implementation, although you are free to develop outside of these suggestions. The first section highlights the basic setup steps, the bare minimum to get your plug-in detected and usable. This page is a small tutorial on how to create a new report for the Moodle gradebook. A few reports are already included in the release, but it is fast and easy to create new reports of any kind. ![]() ![]() One of the great features of the new gradebook implementation in Moodle 1.9 is the support for plug-in reports.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |