Accordion Resource

Re: Accordion Resource

by Frankie Kam -
Number of replies: 7
Picture of Plugin developers

Hi Abrar.

Well I've successfully implemented your mod and minor hacks as pointed out on your module page. THANK YOU FOR A WONDERFUL RESOURCE!

Initially I though that it could be used just for multi-lines labels. Then it dawned upon me that I could use it to store embedded Web 2.0 code so that I can save vertical space on my Moodle coursepages.

Here'a screenshot of the Accordion resource in a closed-state on my site:

 

If I do a mouse over with my mouse pointer, the Accordian tab changes colour to a green pattern and colour (actually the original colour was blue but I wanted something that harmonised with my coursepage theme's colour):

 

And after I click on the green rounded tab, the Accordion opens up and I get:

 

I can immediately see the application of your Moodle 1.9.x  Accordion resource (does Moodle 2.0.x have this mod?):

I. Reduce / Eliminate the infamous Moodle "Scroll of Death" (SOD)

  • by emdedding Web 2.0 embed code (e.g., Moodle labels, Youtube, Blip.tv, any HTML code, etc.).
  • On my Moodle courses, I use the Accordion resource together with the Collapsible Topics format to keep things simple and neat. This helps to cut down the SOD to a manageable level.  What do you think?

II. Aesthetic Visual effect

  • Nice pop-down effect of the embedded HTML or Web 2.0 code object (e.g., Blip.tv or Youtube video)

II. A choice of NOT using links which lead to pop-up WIndows

  • With this Accordion Resource, a link to a webpage or that in turn opens out to a new Window, can be done away with. Instead of this clumbersome way of displaying Web 2.0 code, you can now have an Accordion link that opens to reveal the Web 2.0 object (e.g. Youtube or Blip.tv video) up in a pop-down method without leaving the Moodle coursepage!


Installing the mod

Your code works, but I spend a couple of hours to figure out exactly how to edit the file "..\course\lib.php" as it was not clear from the module page. Type the hack code wrongly or in the wrong way, and you end up crashing your lib.php code. So a backup of the original lib.php is a must so that you can restore it in case the worst happens.

Well for the benefit of others, the bold-faced black colour code shows where exactly the hack code is to be inserted inside the lib.php file. Here it is:

...starting from line 1356...
if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(".format_string($groupings[$mod->groupingid]->name).')</span>';
}

} elseif ($mod->modname=="accordion") {
include('../mod/accordion/accordionlib.php');
} else { // Normal activity
...

The code and files I used to implement your Accordian Resource can be downloaded from here. Caution! Read the instructions by Abrar found here.

I also used http://pixlr.com/express/ to change the colour of the Accordian bars to suit my Moodle theme. Works for me.

If anyone needs any help getting this Accordion resource running on his or her Moodle site, feel free to contact me at boonsengkam at gmail dot com. And for a LIVE demo, you can login to my website http://scm.moodleace.com by using:
Username: student
Password: moodle
Specifically, you can head over to http://scm.moodleace.com/course/view.php?id=8

Lastly Abrar, if you are reading this, THANK YOU.

Regards
Frankie Kam
Melaka, Malaysia
"Malaysia can Moodle"

In reply to Frankie Kam

Re: Accordion Resource

by Frankie Kam -
Picture of Plugin developers

Correction, I've deleted the earlier link which contained the lib.php file that I used because it caused an error when the user clicked on the Course Category link.

Instead, here is the current stable list of files that I use on my website now. No more login / course category problems anymore.

http://min.us/mvtq7K

The golden rule in Moodle administration is this: ALWAYS MAKE A BACKUP OF YOUR ORIGINAL FILES, especially those FILES that will be EDITED with a HACK or will be overwritten. This is so that you can always restore your system back to its working state. IN ALL THINGS, PROCEED WITH CAUTION AND DO THINGS ONE AT A TIME.

In conclusion, I managed to get the Accordion Resource working for my Moodle 1.9.7 site. If you want to use this good resource, read all the instructions careful and backup backup backup before making any changes.

Frankie

In reply to Frankie Kam

Re: Accordion Resource

by Frankie Kam -
Picture of Plugin developers

Here's a Youtube video showing the Accordion Resource in action.

In reply to Frankie Kam

Re: Accordion Resource

by Frankie Kam -
Picture of Plugin developers

Here's my video tutorial:

In reply to Frankie Kam

Re: Accordion Resource

by Jordi Lopez -

I'll give it a try...Really nice resource, thanks for sharing Frankie !

In reply to Jordi Lopez

Re: Accordion Resource

by Jordi Lopez -

... Jordi here again, before getting hands-on: do we know if your nice hack works in Moodle 2.0 ? smile

 thanks in advance

In reply to Jordi Lopez

Re: Accordion Resource

by Jordi Lopez -

After some test, following Frankie's hack instructions, i answer my own question, unless i'm doing something wrong:

  >>  Doesn't work for Moodle 2.0 : once you modify lib.php with the hack, moodle gets secrewed !

In reply to Jordi Lopez

Re: Accordion Resource

by Frankie Kam -
Picture of Plugin developers

Hi Jordi

Sorry to hear that Accordion doesn't work with M2. I admire the fact that you tried to get it to work. Maybe the author could try to customise it for M2. One day perhaps. In the meantime, another way to reduce the scroll of death in M2 is the menu block. Perhaps you can give that one a try.

Frankie Kam