Courses and course formats

Collapsed Topics with Custom Layouts

 
Gareth J Barnard
Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Hi all,

Following the excellent example of using the database in the Grid Format - and a big thank you to all the developers of that for showing the way.  I have developed a BETA test version of Collapsed Topics for Moodle 2.2 (attached) which has all the different layouts in terms of 'No Toggle, No Topic X, No Section Number' that have been requested in the past and have previously been requested and had to be changed by a code alteration.

Now when placed in 'editing' mode you can select the layout you want which is then stored in the database on a per course basis.

I would greatly appreciate feedback as this is my first adventure with Moodle's DB and I'm not sure I've got the permissions right such that only course editors can change the layout.  The code is BETA so please do not try on a production site.  I have included details of the table I create in the readme.txt in case uninstallation fails.

If all goes well, I indtend to concatenate this format with Collapsed Weeks so that I can cut my configuration management workload in half.  And add more 'layouts' as have been requested in the past.

Cheers,

Gareth

 
Average of ratings: Useful (1)
Carlos
Re: Collapsed Topics with Custom Layouts
 

Hello Gareth,

It sounds like a really nice plugin. I´ve downloaded it and I was not able to install it... these are the errors:

format_topcoll

The number of objects with previous not set is different from 1
  • line 254 of \lib\xmldb\xmldb_object.php: call to debugging()
  • line 511 of \lib\xmldb\xmldb_table.php: call to xmldb_object->checkPreviousNextValues()
  • line 241 of \lib\xmldb\xmldb_structure.php: call to xmldb_table->arr2xmldb_table()
  • line 158 of \lib\xmldb\xmldb_file.php: call to xmldb_structure->arr2xmldb_structure()
  • line 141 of \lib\xmldb\xmldb_file.php: call to xmldb_file->arr2xmldb_structure()
  • line 385 of \lib\ddl\database_manager.php: call to xmldb_file->loadXMLStructure()
  • line 406 of \lib\ddl\database_manager.php: call to database_manager->load_xmldb_file()
  • line 345 of \lib\upgradelib.php: call to database_manager->install_from_xmldb_file()
  • line 1449 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 269 of \admin\index.php: call to upgrade_noncore()
Some FIELDS previous/next values are incorrect
  • line 1995 of \lib\datalib.php: call to debugging()
  • line 426 of \lib\xmldb\xmldb_object.php: call to xmldb_debug()
  • line 513 of \lib\xmldb\xmldb_table.php: call to xmldb_object->debug()
  • line 241 of \lib\xmldb\xmldb_structure.php: call to xmldb_table->arr2xmldb_table()
  • line 158 of \lib\xmldb\xmldb_file.php: call to xmldb_structure->arr2xmldb_structure()
  • line 141 of \lib\xmldb\xmldb_file.php: call to xmldb_file->arr2xmldb_structure()
  • line 385 of \lib\ddl\database_manager.php: call to xmldb_file->loadXMLStructure()
  • line 406 of \lib\ddl\database_manager.php: call to database_manager->load_xmldb_file()
  • line 345 of \lib\upgradelib.php: call to database_manager->install_from_xmldb_file()
  • line 1449 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 269 of \admin\index.php: call to upgrade_noncore()
Problem loading table format_topcoll_layout
  • line 1995 of \lib\datalib.php: call to debugging()
  • line 426 of \lib\xmldb\xmldb_object.php: call to xmldb_debug()
  • line 245 of \lib\xmldb\xmldb_structure.php: call to xmldb_object->debug()
  • line 158 of \lib\xmldb\xmldb_file.php: call to xmldb_structure->arr2xmldb_structure()
  • line 141 of \lib\xmldb\xmldb_file.php: call to xmldb_file->arr2xmldb_structure()
  • line 385 of \lib\ddl\database_manager.php: call to xmldb_file->loadXMLStructure()
  • line 406 of \lib\ddl\database_manager.php: call to database_manager->load_xmldb_file()
  • line 345 of \lib\upgradelib.php: call to database_manager->install_from_xmldb_file()
  • line 1449 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 269 of \admin\index.php: call to upgrade_noncore()

XML database file errors found

More information about this error

Debug info: Errors found in XMLDB file: Problem loading table format_topcoll_layout, Some FIELDS previous/next values are incorrect
Stack trace:
  • line 390 of \lib\ddl\database_manager.php: ddl_exception thrown
  • line 406 of \lib\ddl\database_manager.php: call to database_manager->load_xmldb_file()
  • line 345 of \lib\upgradelib.php: call to database_manager->install_from_xmldb_file()
  • line 1449 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 269 of \admin\index.php: call to upgrade_noncore()

Let me know if I can be of any assistance,
Carlos

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos,

Thank you so much for trying.  Help really appreciated.  To be honest I'm not sure what the messages completely mean only in relation possibly to the install.xml file in the DB folder.

Please could you tell me your exact version of Moodle so I can have a go at replicating what you saw.  Are you using MySQL?

Thanks again,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos,

I've just managed to replicate the issue by removing the 'format_topcoll' entry in my 'mdl_config_plugins' table to fool my moodle into thinking it does not have it installed.

This prompted a change to the install.xml file and an additional step that needs to be performed to uninstall it along with removing a step that was not required.

I have now attached the corrected version.  Thank you smile.

Cheers,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Please find attached a composite screen shot demonstrating what the enhancement does.

Cheers,

Gareth


 
Average of ratings: Useful (1)
Carlos
Re: Collapsed Topics with Custom Layouts
 

Dear Gareth,

Thank you for taking care of it so fast! I was able to install it... some issues I have:

When click on "set format layout" I get this:  

Notice: Undefined variable: url in C:\www\MoodleDev\course\format\topcoll\set_layout.php on line 70
Most probably incorrect set_page() url argument, it does not match the httpswwwroot!
line 1000 of \lib\pagelib.php: call to debugging()
line 70 of \course\format\topcoll\set_layout.php: call to moodle_page->set_url()

When I click "save changes" I get: (same error before +...)

else put_layout_settingstdClass Object ( [courseid] => 735 [layoutsetting] => 3 [id] => 1 )

It works, it does what I selected, but those lines of code are there, and automatic redirection does not work, so I have to manually go back to the main page of the course.

About our Moodle:  Moodle 2.2.1+ (Build: 20120119), on a Windows Server 2008r2, MS SQL Server 2008r2 and IIS7.

Carlos

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos,

Thank you smile - really odd with the redirect not working as does for me?  Humm.

It's late here so I have no time to test this evening, but I think changing line 70 in set_layout.php to:

'$PAGE->set_url($CFG->wwwroot.'/course/format/topcoll/set_layout.php');'

should solve the issue with the url.  I'm not sure about the 'put_layout_setting' issue (the function is defined in lib.php) - so see if the issue goes away after the URL fix.

Thanks again,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos,

Just double checked lib.php and the 'put_layout_setting' issue is due to debugging output I have forgotten to remove on lines 128, 134 and 136.  Please comment them out.

Cheers,

Gareth 

 
Average of ratings: Useful (1)
Carlos
Re: Collapsed Topics with Custom Layouts
 

Dear Gareth,

All errors are gone. I belive it all works now. I will test it in more courses, with different content, and I will let you know if I see anything that is not working!

Thank you for the plugin!
Carlos

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos,

Thank you so much for your help with this enhancement.  I just now need to make sure that the code only lets course editors use it and internationalise the words.

Cheers,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Note: Moodle Tracker CONTRIB-3378 now raised if you wish to comment / watch / vote / raise an issue with this enhancement.

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos et al,

Please find attached what I hope will be the finished version to test.  Everything is done bar other languages for the strings.

If everything is ok, I will check in to GitHub and backport to previous Moodle versions and Moodle 2.3.

Cheers,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Beta 4 attached.

Now on GitHub: https://github.com/gjb2048/moodle-format_topcoll/tree/CONTRIB-3378

Cheers,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Beta 5 - Attached with the ability to switch between the Collapsed Topics, Collapsed Weeks and Latest First structures and yet maintain the layout options previously implemented.

If you have installed a previous Beta, please read the readme on how to upgrade.

And do any format developers know how to solve this 'http://moodle.org/mod/forum/discuss.php?d=195944'?

Cheers,

Gareth

 
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Beta 6

 
Average of ratings: Useful (1)
Carlos
Re: Collapsed Topics with Custom Layouts
 

Hello Gareth,

I've tried to install the Beta 6, but I get this error... and it goes back to the plugins page... (to be upgrated). I removed the folder first from "Course\Formats", but that didn't seem to matter. Any idea on how can I help you to test this?

Carlos

format_topcoll

Deprecated ddllib function used!
  • line 957 of \lib\deprecatedlib.php: call to debugging()
  • line 53 of \course\format\topcoll\db\upgrade.php: call to create_table()
  • line 382 of \lib\upgradelib.php: call to xmldb_format_topcoll_upgrade()
  • line 1449 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 269 of \admin\index.php: call to upgrade_noncore()

Table "format_topcoll_layout" already exists

More information about this error

Stack trace:
  • line 469 of \lib\ddl\database_manager.php: ddl_exception thrown
  • line 958 of \lib\deprecatedlib.php: call to database_manager->create_table()
  • line 53 of \course\format\topcoll\db\upgrade.php: call to create_table()
  • line 382 of \lib\upgradelib.php: call to xmldb_format_topcoll_upgrade()
  • line 1449 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 269 of \admin\index.php: call to upgrade_noncore()
 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos,

I'm really sorry, I think I put an instruction in the Readme??  Anyway, please go to your database and manually delete the 'format_topcoll_layout' table.

I've done it this way so that 'upgrade.php' does not have to be long at this development stage.

I've had a long couple of days.  So I think the above is the latest version.  But just in case, the latest is on 'https://github.com/gjb2048/moodle-format_topcoll/tree/CONTRIB-3378' there is a 'zip' download to the left of the GitHub URL.  When unzipping, you will just have to rename the contained folder to 'topcoll'.

Many many thanks for helping me with this, really appreciated smile.

Cheers,

Gareth

 
Average of ratings: Useful (1)
Carlos
Re: Collapsed Topics with Custom Layouts
 

Hello Gareth,

Of course deleting the table made the trick! On the other hand, I didn't see it on the instructions, but I should have thought about it. I was able to install it with this message:

format_topcoll

Deprecated ddllib function used!
  • line 957 of \lib\deprecatedlib.php: call to debugging()
  • line 53 of \course\format\topcoll\db\upgrade.php: call to create_table()
  • line 382 of \lib\upgradelib.php: call to xmldb_format_topcoll_upgrade()
  • line 1449 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 269 of \admin\index.php: call to upgrade_noncore()
Success
 
Other than that... all seems to be working. And I like the picture while "editing on" smile
 
Carlos
 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Carlos,

Superb thank you smile.

I had not spotted the depreciated table creation function so will investigate.

There is an issue when setting the layout that the settings block on the left is for the site and not the course - I've had no responce to (http://moodle.org/mod/forum/discuss.php?d=195944) yet but am now looking at /course/view.php for inspiration.

I also want to incorporate a fix to CONTRIB-3225 in this release somehow.

Thank you,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

At last, release candidate one smile

 
Picture of Hartmut Scherer
Re: Collapsed Topics with Custom Layouts
Particularly helpful Moodlers

Hi Gareth,

I am glad for your continuous effort to fight the "scroll of death." Today I tried the topcoll release canditate 1 in a life course, changed the course format from topics to collapsed topics. In "Set Format Layont" on the main class page I set the structure to "latest first." It took me a while to realize that this setting refers to latest week first. 

Do you plan to add a similar feature for topics, something like "highlighted topics first"? I would love to see this as I usually have more topics than weeks.

With kind regards,

Hartmut

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Hartmut,

Thank you.  An interesting idea with highlighted topic first.  I'll give it some thought and see if I can build it into release candidate two.  As there can only be one highlighted topic I'll see if I can make it the first in the list.

Cheers,

Gareth

 
Average of ratings: Useful (1)
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Release Candidate 2 with enhancement suggested by Hartmut above added.

Cheers,

Gareth

 
Picture of Hartmut Scherer
Re: Collapsed Topics with Custom Layouts
Particularly helpful Moodlers

Hi Gareth,

Plain excellent! I am really excited that you were able to include "Current topic first." You are very fast. I tested topcol release candidate 2 as a teacher and student and it seems to work fine. I noticed one minor thing. The sequence of blocks seem to be reversed. Before I switched to the collapsed topics course format, the arrangement of the blocks was this (from top to bottom)

1 Online Users

2 Message

3 Calendar

After setting the course format to topics collapsed, the sequence of the blocks was this:

1 Calendar

2 Online Users

3 Messages

No further observations. You did a great job in a short time. Probably, you remembered that I was looking for a course format which is able to refer to the current topic. Finally, it's available. I am very sure other users will enjoy your latest development.

With kind regards,

Hartmut

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear all,

Please find attached Release Candidate 3 for which I hope will be the last before the stable version.

Cheers,

Gareth

 
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear all,

The best laid plans of mice and men has lead to Release Candidate 4 with a bug fix and some tidying up.

Plus a big thank you to Carlos Sánchez Martín (http://moodle.org/user/profile.php?id=743362) for the Spanish translation.  I had intended this to be in the full release and not associated with a bug fix.

All comments / testing appreciated smile.

Cheers,

Gareth

Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Hartmut,

No worries and thank you smile.  I really enjoyed the challenge of creating it smile.  Release candidate 3 is now in this thread.

To be honest I had not remembered that you were looking for a format that does refer to the current topic - however your prod above worked ;).

I looked at the blocks issue and it appears that Moodle in the table 'block_positions' notes down what the positions should be on a per page type basis. As my format is a different type at the course level they have to be set, but once done they are remembered.  I believe that this only happens with blocks that are added on a course and not elsewhere.  So, I think this is out of my control.

Cheers,

Gareth

 
Average of ratings: Useful (2)
Picture of Hartmut Scherer
Re: Collapsed Topics with Custom Layouts
Particularly helpful Moodlers

Hi Gareth,

I installed release candidate 3 without any problems and use it in two courses. I am looking forward to the full release.

With kind regards,

Hartmut

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Hartmut,

Thank you smile.  I am hoping that RC 3 will transform into the full release without any changes.  Is there anything I have missed?

Cheers,

Gareth

 
Average of ratings: Useful (1)
Picture of Hartmut Scherer
Re: Collapsed Topics with Custom Layouts
Particularly helpful Moodlers

Hi Gareth,

No problems detected. Students in both classes seem to be happy with the new layout. Yesterday evening I spent 2 hours setting up online components and couldn't see anything unusual with the new course format. This is Just to give you some feedback.

With kind regards,

Hartmut

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Hartmut,

That is brilliant news, thank you smile.

I'll publish to the Moodle plugin's DB soon and backport to previous Moodle versions.  Just have to get some sleep smile.

Cheers,

Gareth

 
Average of ratings: -
Picture of Hartmut Scherer
Re: Collapsed Topics with Custom Layouts
Particularly helpful Moodlers

Hi Gareth,

I tried out the collapsed topics format in the MyMobile theme on my laptop (I have no mobile device). Seems to work fine and is a real improvement for the user interface.

With kind regards,

Hartmut

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics with Custom Layouts
Core developersParticularly helpful MoodlersPlugin developers

Dear Hartmut,

Thank you smile.  I'll have a go on my iPod too smile.  I'm nearly close to Moodle Plugin's DB release but want to be sure everything is in place and correct first.  This includes a version for Moodle 1.9 which is proving trickier than I originally thought.  There is a 1.9 version and the latest stable versions for 2.x on https://github.com/gjb2048/moodle-format_topcoll/tags.  There is a slight potential issue with context checking in the version you are using, so please upgrade.

Cheers,

Gareth

 
Average of ratings: -