ILP block (add-on)

 
 
Picture of Mark Johnson
New tab plugin: Timeline
Group Developers

In an effort to improve the ILP's usability, I've written a new tab plugin that I call "Timeline". It's features are:

  • Displays all entries from selected reports in chronological order (newest at the top)
  • Displays comments in-line (exactly like the Reports tab, in fact it uses the same code)
  • Allows adding and deletion of comments via AJAX
  • Allows adding and deletion of report entries via AJAX for reports that are visible on the tab

You can get the code from my github fork: https://github.com/marxjohnson/moodle-block_ilp/tree/timeline
It's still a work in progress, there seems to be a few bugs with permissions in the new actions that I'm get to iron out, but for the most part it's feature-complete.

A question I have: is there a supported way for ILP plugins to add their own CSS without needing to modify the main styles.css file?

 
Average of ratings: -
Picture of James Ballard
Re: New tab plugin: Timeline
Group Particularly helpful Moodlers

Thanks Mark,

Are you able to put this in a repository that just contains the plug-in and not the full ILP?

This way we can sub-tree or submodule it to the main ILP and provide some feedback. We can also look at the .css issue as this would be great to include custom css stuff.

Yours

James

 
Average of ratings: -
Picture of Mark Johnson
Re: New tab plugin: Timeline
Group Developers

Hi James,
I'm not sure quite what the best way to do that would be, as there's some actions that the plugin requires as well as the class and javascript.

Would it work if I create a repository containing actions/{action files}, classes/dashboard/tabs/{plugin files}, the modified styles.css and none of the "core" files?

Thanks
Mark

 
Average of ratings: -
Picture of James Ballard
Re: New tab plugin: Timeline
Group Particularly helpful Moodlers

I'll take a look at a merge with squashed commits for now, which should work for my testing and give us an idea of how easy/difficult the architecture is for this wink

Longer term I'm also thinking about how we might manage contributed plug-ins in the main build via sub-module or sub-tree. 

As this is the first contributed plug-in we may need to work with you to alter the structure to make this easier. I know Nigel is already doing some preliminary work on this.

Yours

James

 
Average of ratings: -
Picture of Mark Johnson
Re: New tab plugin: Timeline
Group Developers

Ok cool, if you need me to do anything else let me know!

 
Average of ratings: -
Picture of Nigel Daley
Re: New tab plugin: Timeline
 

Hi Mark

Great work, I saw the documentation you did top as well top stuff. I m going to look into the problem with the css. The problem with the css has been apparent to me from the beginning of the project. James has suggested that I look at the way the main theme works as this may present a solution. You should be able to include JS anywhere in your code using the $PAGE->requires->js_init_call function (see line 34-40 of ilp_mis_attendance_plugin_byclass.html)

Also a heads up I am going to be moving all plugins from the classes directory to their own Plugins directory in the root of ILP. Each type of plugin will have a directory underneath plugins. Only the parent plugin classes will remain in the classes directory, meaning hopefully only core code changes will be needed.

 
Average of ratings: -
Picture of Nigel Daley
Re: New tab plugin: Timeline
 

Ok I have not tested this yet but you should to include css by using the following function:

$PAGE->requires->css(cssfileurl);

 
Average of ratings: -
Picture of Mark Johnson
Re: New tab plugin: Timeline
Group Developers

Thanks for the pointers Nigel. However, there's a problem with this method;

$PAGE->requires->css() can only be called before $OUTPUT->header() since the css <link> tag lives in the head.  The way the ILP's templates are constructed means that the header is output before the classes are initialised, meaning that CSS cannot be required within the classes in this way.

To avoid problems like this, my strategy is always to do all the queries and rendering first, store the HTML content in a variable, then finish by echoing $OUTPUT->header(), the content, then $OUTPUT->footer().  I'm not sure this would be workable with the current architecture of the block's views and templates (it can also be quite a memory-intensive strategy), but I thought it worth sharing!

 
Average of ratings: -
The fox I once modeled, vertex by vertex, so to me it is no ordinary fox
Re: New plugin
 

Hi James,

I need to include jquery in an ILP plugin & other mods, so would like to locate it where it can be shared e.g. moodle/local -   Do you/Nigel/ULCC have any thoughts on this?

Kind regards

Jago

 

 
Average of ratings: -