Saturday, January 7, 2012

An adaptation of Gareth Barnard's excellent Collapsible Weeks course format for Moodle 1.9.x.

Today I decided to adapt the Collapsed Weeks course format, originally developed, and copyrighted by the talented Gareth Barnard. The result of the adaptation is that the course format can now be organised by week, and you can display the topic title for any week.

Here's a screenshot:

Screen 1: Adapted Coursepage format from Garath Barnard's Collapsible Weekly format.
Student / Normal mode view.

  1. The toggle bars are organised by week number.
  2. The week duration dates are shown when the Section is opened.
  3. The toggle bar may show the topic for that week (appended to the Week number).
  4. There is no Weekly Outline text at the top of the page

It shows the Week number when the toggle bar is closed. The week duration dates are shown when you click  the toggle bar. For example, "Week 1". You can now opt to show just the Week number - leave the Section text empty - or, you could show a topic on the toggle bar. You do this by typing a section text! For example, typing "All about MindMaps" in the section text, will display "Week 2: All about MindMaps" on the toggle bar.

The next screen shows all this detail very clearly.

Screen 2: Hybrid Coursepage format.
With Turn Editing On

Here's some background to the adaptation of Gareth's work. One of my favourite course formats for Moodle 1.9 is the Collapsed Topics format, also the brainchild of Gareth. It also comes in the Moodle 2.x flavour. It reduces the Scroll-Of-Death for course pages with almost-endless activities.

Screen 3: A colour-modified Collapsed Topics Format.
But alas! No date information.

However, because the Collapsed Topics format does not display any week dates, at times I would change to the Weekly Format. But that wouldn't stop the Scroll-Of-Death. I would then also try the Collapsible Weekly format.

Screen 4: Collapsible Weekly Format in its original colour scheme.

If one wishes to adapt the orginal format, Gareth was gracious enough to leave information on line 266 of format.php. With the adaptation, I no longer need to switch between the, already excellent, two course formats by Gareth. So that's the reason for this adaptation.  I leave you with just one more screenshot from one of my activity-rich production course pages:

Screen 5. What the "new" course format looks like on my production site.
"Loving it,....loving it!"

You can download the adapted Collapsible Weekly format from here. Be sure to backup your server's weekcoll folder first! Extract the contents of the zip file and copy the weekcoll folder to yourMoodleSite/course/format/weekcoll. You can change the colours of the course format. Just modify the weeks_collapsed.css file. 

So what do you think of this adaptation of Gareth's Collapsible Weeks course format? Do you think it could be useful for your own Moodle 1.9 coursepage? If you're running on Moodle 2.x, then I am sure that the code for Moodle 2.x's weekcoll format could also be modified to suit your need.


Important Footnote: 
In the original post, I commited the cardinal sin of not attributing the Collapsible Weekly course format to its rightful owner -  Gareth Barnard. Worse, I had said that the work to result in a hybrid which I claimed to be mine. All this without obtaining prior permission from Gareth. I apologize to Gareth for this oversight which was committed in my excitement of the coding work. I have learnt an important lesson, and I want to set the record straight that both the Collapsed Topic and Collapsible Weekly formats are the result of hard work by Gareth Barnard. He alone deserves the FULL CREDIT for these two formats that greatly reduce the Scroll-Of-Death in Moodle course pages.

If this post appears on my blog, it is only because I have obtained permission from the original author, Gareth, and have made sure that I have fulfilled the requirements the GNU GPL v3. Meaning  I am free to build upon the work, but MUST attribute the original author (Gareth Barnard) and acknowledge his copyright over the plugin. 

If you like this post or site
a small donation would be nice but would last only a day,
otherwise leaving a comment (or a compliment) below will last me a month!


  1. Dear Frankie,

    With respect after reading this blog entry which states that the format is yours, the fact that you have to replace the existing 'weekcoll' folder replacing the original 'Collapsed Weeks' and you do not mention me in any shape or form - you are in breach of Copyright as I clearly put at the top of 'format.php' in Collaped Weeks the Creative Common's licence '' where you are free to build upon the work but you MUST attribute the original author - i.e. ME - unless you get permission - which you have not. I went to a substaintail amount of effort to create the format checking all of the required licences and contacting the authors where needed. Plus, to be a new course format it needs to be in its own folder with all of the changes that implies.

    You state in the post that the Collapsed Weeks solution is 'cluttered' and yet did not read the readme or see the comments around line 266 of format.php which reduces the 'clutter' as you say. You appear to have climbed a moutain instead of contacting me to reduce the clutter with a one / two line change and give you the same solution. I would have willingly helped you in this endeavour and produced an improved version that benefits all and indeed acknowledged your input - please see my Readme.txt and all the posts I make on this forum.

    Please kindly remove links to this version and work with me to produce a version that solves your specific issue and I can put in the main baseline for all versions of Moodle for all you use without you having to maintain a seperate branch. Or attribute me as the original author and state 'I have adapted the Collapsed Weeks course format developed by Gareth Barnard...'.


    Gareth J Barnard

    Developer of Collapsed Weeks.

  2. Hi Gareth.

    My humble apologies for my grave oversight and violation of your copyrighted work which I can only attribute the cause of to my sheer stupidity and ignorance (which is without excuse) - caused by my excitement and haste of the coding work that I did for my production site.

    I am sorry for not mentioning your name, the original author, and for wrongly claiming the work as a 'new' hybrid. That was wrong and I am sorry for what happened.

    I have reworded the orginal blog post. Please check it out and email me if it is aceptable to you. I know that this is closing the door after the horse has bolted, but if it isn't too late, I would like to ask your permission for me to do this adaptation and for your permission for me to post the modified blog post on the subject. If you do not agree to the post in any way, please let me know what I can do to further reword it. If I am unable to satisfy the copyright and ethical requirements (which I so conveniently overlooked in my ignorance) to your satisfaction, I will remove the post, no questions asked.

    Thank you once again for pointing out my sins, and I will be careful not to let it ever happen again!

    A slightly wiser Frankie Kam

  3. Dear Frankie,

    Thank you for the correction. It also appears that I cannot use the Creative Commons licence with Moodle plugins as stated by Tim Hunt in the Moodle forum post ( - oh what an issue this is and I apologise for any mistake I may have made! Therefore I need to change my licence to GNU GPL v3 ( - for which section 5 makes good reading in terms of stating that a person 'modified' code - for which I do at the top of format.php.



    P.S. Does the enhancement as posted in the forum match what you wanted? Perhaps we could work together and make this a joint revision with credit to both of us?

  4. Hi Garreth
    Yes, You got it right. Your enhancement to Moodle 2.x' Collapsible Weekly plugin was what I wanted. Okay, we can work together to make it a joint revision with MAIN credit to you and some to me. Me, I'm just happy to use your enhanced plugin (Moodle 1.9x or Moodle 2.x) in my online courses.


Ratings and Recommendations by outbrain