Collapsed Topics

Course formats ::: format_topcoll
Maintained by Gareth J BarnardGareth J Barnard
An interchangeable topic or week based format that solves the issue of the 'Scroll of Death' when a course has many topics.
Latest release:
6006 sites
148 fans
Current versions available: 24

An interchangeable topic or week (day for 2.3.1+) based format that solves the issue of the 'Scroll of Death' when a course has many topics / weeks. All sections except zero have a toggle that displays that section. One or more sections can be displayed at any given time. Toggles are persistent on a per browser session per course basis but can be made to persist longer by a small code change. Full installation instructions, code adapt-ions and credits are included in the '' file.

If you have a course with more than fifty two sections then currently the toggle persistence will not work for the fifty third section and above.  Then you need to upgrade to the Moodle 2.5 version+.


The format comes with NO support.  Please see the 'Support' section in '' file that comes with the format.  This is because the format is complex and I regret that I don't have the time / resources to freely assist with questions pertaining to specific enhancements / changes / knowledge improvement.

I will investigate genuine bugs and issue fixes in a timescale set by myself.  When reporting issues you MUST clearly state the full version and release of both Moodle and the Collapsed Topics format as contained within their 'version.php' files - if not it takes me longer to figure out, often resulting in me asking for the details anyway and slowing the process of solving your problem down.  It really helps to read the 'Reporting Issues' section in the '' file and upload and describe in detail the issue you are having on the 'Course formats' forum.


NEW: 'The Complete Guide to Collapsed Topics' (and 'Blurb') book is now available, covering: installation, upgrade, uninstallation, course and global features, resetting, capabilities, language strings, overriding icons / styles in a theme and adding a new icon set.

The Complete Guide to Collapsed Topics book

The Complete Guide to Collapsed Topics book on a book stand

Inside the Complete Guide to Collapsed Topics.

NOTE: The latest version incorporates functionality to support new UK / EU Cookie Law which is implemented as a user acceptance in the 1.9 version and no 'cookie' is used at all in 2.x versions.

Screen casts:

Privacy API support starts with V3.3.1.2 for M3.3 and V3.4.0.2 for M3.4 where the API has been implemented in the minor release of Moodle.


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6
Screenshot #7


Gareth J Barnard
Gareth J Barnard (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS


  • Thu, Oct 25, 2012, 2:27 AM
    Hi Gareth

    I already have a course working and I wondering if I instal the TC do I need to make the course from the beginning, or can I modified the one that I already have.
  • bee
    Thu, Oct 25, 2012, 3:23 AM
    Hello Gareth, Thank-you for the pointer to the Readme.txt file; I'd forgotten it was there. TC has been uninstalled and my docked blocks are again working as expected.

    The problem may have been caused by a rocky installation. I first downloaded and attempted to install a slightly older version of TC, noticed that there was a newer version available (released the day before I did the install) and downloaded and attempted to install that one instead.

    I'll try a fresh install with the latest version of TC and let you know how it goes.

  • Gareth J Barnard
    Thu, Oct 25, 2012, 5:09 AM
    Josue, all you have to do is change the 'course format' in the course settings smile

    Thanks Donna, I 'm glad the information I provided helped.
  • bee
    Thu, Oct 25, 2012, 5:20 AM
    Moodle 2.3.2 (Build: 20120910)
    Collapsed Topics v2.3.9.1 (2012101800)

    I'm getting a Plugin dependencies check saying that Collapsed Topics requires Moodle 2012062502.05.
    That's an earlier version of the Moodle build than I have, no? What are my options?

    BTW: This is the same message I got in the earlier installation attempt.
  • Gareth J Barnard
    Thu, Oct 25, 2012, 6:20 AM
    Dear Donna,

    If you are getting the message then it means that you need a later version of Moodle, in this case: 2.3.2+ (Build: 20121005). It is this way because the format depends on core code that is subject to change. So when core changes are made, I keep track of them and implement them as soon as I can updating to the last dependent version I can for the code changes. Otherwise, the code would fail.

    You have two options:

    1. Update Moodle to 2.3.2+ (Build: 20121005) or above.
    2. Go back to a previous version of Collapsed Topics, I suspect given the date.

    I'm sorry it has to be this way, but there are a few changes going on in core at the moment in this area. Normally not much happens. I have no choice but to support the latest version when I perform updates.


  • Gareth J Barnard
    Thu, Oct 25, 2012, 6:24 AM
    Sorry, correction, version 2.3.8 for option 2.
  • bee
    Fri, Oct 26, 2012, 5:11 AM
    Thank-you for the previous version tip. That's probably the way we'll go.

    (Aside: I don't have a problem with the plugin requiring a later version of Moodle, but maybe the dependency check should mention Build 20121005 then, and not 2012062502.05.)
  • Gareth J Barnard
    Fri, Oct 26, 2012, 6:40 AM
    Dear Donna,

    Perhaps it should. This is a Moodle core thing as 2012062502.05 is the branching date followed by a version - there is a 'docs' page that explains this somewhere.


  • Gareth J Barnard
    Fri, Oct 26, 2012, 7:26 AM
    Dear Donna,

    I have raised MDL-36227 ( - please feel free to vote for it.


  • Tue, Nov 6, 2012, 10:18 AM
    Is there a reason why this requires 2.3.2+, or is that requirement because that's all it has been tested on? It is unusual for a plugin to depend on a minor release (particularly a weekly build) - what core change was implemented in 2.3.2+ that this plugin depends on? I'd like to know so I can backport any relevant patches to make 2.3.2 work. Thanks.
  • Gareth J Barnard
    Tue, Nov 6, 2012, 7:03 PM
    Dear Ashley,

    It is unusual that a plugin relies on a minor release, but as already stated in the 'Readme.txt' file it relies on Moodle 2.3.2+, version 2012062502.05 (Build: 20121005) because of MDL-31976 and MDL-35276. I take great pride in testing as much as possible and do not put in such a version constraint for no reason. The current particular release was in fact tested on a slightly later version. I work on the basis that the latest version supports the latest stable release of Moodle (with all the new features and fixes that that brings), otherwise I would be getting requests to update the code to the new version. It is far better to recommend an upgrade to a new version of Moodle rather than a downgrade to get something working.

    The changes that MDL-31976 and MDL-35276 introduce change the parameter signatures of core functions. And as I inherit from the 'format_section_renderer_base' class in '/course/format/renderer.php' (a superb new object orientated polymorphic feature of Moodle 2.3 I might add, that speeds up development) I need to keep my code compatible. To save you some time, the following is the specific differences on GitHub you need to look at:


  • Tue, Nov 6, 2012, 7:25 PM
    Hi Gareth. Thanks very much! That gives me the info I need! I am applying this to a client who is running 2.3.2, so I'll see if I can backport those two tracker issues. (we don't run weekly builds and are going live with this soon hence the need to backport rather than wait for 2.3.3).

    BTW, one of our consultants mentioned to me that the + / - buttons are not present with the collapsed topics format. This is a new feature in the core formats in 2.3 which allow easy adding and removing of topic sections without having to edit the course settings. I'm sure people would love if it could support that feature some day.

    Thanks again
  • Gareth J Barnard
    Tue, Nov 6, 2012, 7:37 PM
    Dear Ash,

    No problem.

    Please tell the consultant that the + / - buttons 'are' present with the format if you look at the bottom right in editing mode (same place as topics format). If they are not, then most likely a theme hiding issue. It took me a while when I originally upgraded the format to 2.3 get this working.


  • Wed, Dec 5, 2012, 9:20 AM
    Hi Gareth, I just saw your new released version and looked through it briefly.
    I noticed one thing that may cause serious problems. In your db/upgrade.php you call course_get_format(...)->restore_topcoll_setting(...)
    restore_topcoll_setting() is the function defined only in your class, so it really worth it checking if this is an instance of your format.
    I'm just imagining the following scenario (I did not try it though):
    1. user created a course in topcoll format
    2. user changed the format from topcoll to topics (but he still uses topcoll format on his site for other courses)
    3. user tries to upgrade topcoll format, there is an entry in table format_topcoll_settings for this course but it's format is different. course_get_format() returns an instance of format_topics. There is a fatal error "function does not exist" during upgrade.

    Another thing is that I'm not sure why do you ever need restore_topcoll_setting() function and I don't like at all substituting of $this->courseid inside it. This can end up with completely unpredictable results. For example, get_course() will still return cached object of other course data.
  • Wed, Dec 5, 2012, 9:21 AM
    Apart from it I'm very glad you are making the full use of new features in course formats API. I'm sure your format is one of the best contributed formats.
Please login to post comments