Generico for Moodle 3

Generico for Moodle 3

by Justin Hunt -
Number of replies: 13
Picture of Particularly helpful Moodlers Picture of Plugin developers

Just a heads up. 

Generico is now good to go on Moodle 3. It also now has the ability to add more than 20 templates. (as requested by Dan K ..  who wanted 60!!).  You will need to get the latest version  of the Generico Atto Editor plugin too.

You can set the number of templates at :

site admin -> plugins ->filters ->generico ->common settings

IMPORTANT:
After you increase the number of templates, you will need to visit the site admin -> notifications page, and Moodle will create them for you then. Its best just to scroll to the bottom and save. Later each template will have its own tab under the Generico settings, so you can edit it properly then.

 

Average of ratings: Useful (3)
In reply to Justin Hunt

Re: Generico for Moodle 3

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

One of the big changes that came along with Moodle 2.9 was the AMD system for loading javascript in Moodle. Because this affects a lot of Generico and Video Easy templates, I wrote a bit of a primer on when and when not to use AMD in Generico / Video Easy. I hope it helps.

http://poodll.com/to-amd-or-not-to-amd/

In reply to Justin Hunt

Re: Generico for Moodle 3

by Farhan Karmali -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Justin

I just started exploring generico today and its really awesome. I was working on a course format based on the collapsed topics  where each course section will show the users grade chart if there exists a grade category with the same name as the section and the progress report bar based on the number of modules in that section.


I wanted to ask can generico handle this , reading the users grade from the database and the completion ?

In reply to Farhan Karmali

Re: Generico for Moodle 3

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Farhan

It can't really do that. Because the template is comprised of html/css and javascript. There is no way to add custom PHP to fetch data from the database. 

You might have to customize it some to get grades I think. Some info about the course and currently logged in user is fetched and placed into variables for use in JS. See from around line 140 in /filter/generico/filter.php.

In future it would be nice if users could define data sources of some sort, but I am not sure how that would work.


Average of ratings: Useful (1)
In reply to Justin Hunt

Re: Generico for Moodle 3

by Farhan Karmali -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Justin


Thanks smile I guess in that case I would rather continue with my custom course format since I can use php and database calls there

In reply to Justin Hunt

Re: Generico for Moodle 3

by Andy Chaplin -

Hi Justin,

I updated the plugin yesterday and promptly a couple of the filters stopped working.  I unchecked the Load via AMD which solved one of them, and for the other I added the external js query script to the header (as suggested in the filter). Now everything is back to normal.

What seems a bit odd to me is that I'm using Moodle 2.9 and before your update everything worked with AMD and without the external script.  I would have thought that since AMD is the new system that everything would stay as normal. If feels a bit like I've taken a step backwards.

Is the change due to "techy things" that needn't concern me - I'm fine with that - or is there some particular issue that's now more picky and should be considered when putting the filters together?  (If it needs more than a couple of lines to answer that, then go with the first answer!)  smile

All the best


Andy

In reply to Andy Chaplin

Re: Generico for Moodle 3

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Regarding AMD. For code you write in the custom javascript area, that is not so sensitive, and should work with or without AMD checked (provided the jquery thing is sorted out). 

For third party libraries however, they either do or don't support AMD. If you get the setting wrong, the template will fail. (Its like when your better half says "which wallpaper do you like?")

If your Generico filter was pretty old, and did not have the "load via AMD" , then the update might have by default "checked" that box. That could cause this.

Or if your version of Moodle was pre 2.9 and you upgraded, that could cause this too.

Are either of those true?


In reply to Justin Hunt

Re: Generico for Moodle 3

by Andy Chaplin -

In both cases, no.  I've been on 2.9 for some time now and the filter was only written a few weeks ago.  (it was the one posted in Themes forum heresmile  The slider froze on the first image and the collapse toggle didn't work on the spots.

Both were set with use AMD.  For the slider I had to uncheck that and add the link in the Additional Html.  With the spots I also had to uncheck the AMD load to get the bootstrap collapse to work (though with the link already in the header, it may be that was the important part). 

It's no big deal - I was just curious!

In reply to Andy Chaplin

Re: Generico for Moodle 3

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I was able to reproduce this, and it was a bit odd. Require.js was somehow breaking. It seems to have been caused by some rogue javascript files I left in the PoodLL filter AMD directory that broke stuff. Did you also upgrade PoodLL the other day?


I removed those files and it seems ok now. If you do upgrade PoodLL, make sure you purge your cache afterwards just in case. 

PS Thats another nice template you made. I am adding an export/import template function to Generico to make sharing easier.


In reply to Justin Hunt

Re: Generico for Moodle 3

by Andy Chaplin -

Hi Justin,

Yes I did upgrade Poodll.  to be honest, I can't remember if that was the moment it stopped working, but it's certainly possible.

The export/import function is a great idea.

Keep up the good work.


Andy

In reply to Justin Hunt

Re: Generico for Moodle 3

by Andy Chaplin -

As a quick follow-up...

I've just carried out your latest Poodll update.  I then removed the additional Html script and reset the plugins to load via AMD. I purged all the caches and everything works as before.

Thanks!

In reply to Justin Hunt

Re: Generico for Moodle 3

by Andy Chaplin -

Like the place for text in the latest update!

Just one thing...  I got the following error log on my site:


[2016-01-14 09:35:05]: error: file is writable by others: (/home/xxxxxxxxx/moodle/filter/generico/genericocss.php)
[2016-01-14 09:35:05]: error: file is writable by others: (/home/xxxxxxxxx/moodle/filter/generico/genericocss.php)
[2016-01-14 09:24:22]: error: file is writable by others: (/home/xxxxxxxxx/moodle/filter/generico/genericocss.php)
[2016-01-14 09:24:22]: error: file is writable by others: (/home/xxxxxxxxx/moodle/filter/generico/genericocss.php)


It doesn't seem to affect anything, and as far as I can tell everything still works, but it might be important for someone else.  The permissions for the file have been set to 666.  Should I change them?

All the best,


Andy

In reply to Andy Chaplin

Re: Generico for Moodle 3

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

That permissions should be 644 I think. 

I wonder how that came to be that way?

I will look into it, but you can fix it with :

 chmod 644 genericocss.php 

(or just use cpanel or your ftp client )

In reply to Justin Hunt

Re: Generico for Moodle 3

by Andy Chaplin -

I changed the permissions.  There are a few plugins which seem to have permission problems when updating.  In this case all the files in the moodle/filters/generico directory are tagged with 666.  All the folders are tagged with 777, and all the other files within those folders are 666.

None of the others throw an error message though.