Courses and course formats

Collapsed Topics for Moodle 2.5 Build: 20130514 updated

 
 
Gareth J Barnard
Collapsed Topics for Moodle 2.5 Build: 20130514 updated
Group DevelopersGroup Particularly helpful Moodlers

Hi all,

EDIT: If you installed V2.5.2 or V2.5.2.1 then please use V2.5.2.2 below and read CONTRIB-4436 and the comments below.

Download from: https://moodle.org/plugins/pluginversion.php?id=3272.

Contains the following fixes:

  1. Fixed issue with sections not showing their contents in editing mode when open all has been used, then they are individually closed and reopened. Thanks to Marc Hermon for reporting this.
  2. Added small icon which shows up when updating.
  3. Ensure the correct arrow is used when not using JavaScript.
  4. Radically changed the toggle persistence storage mechanism to be based on a base 64 system using the following subset of ASCII: ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy". This is more efficient than the actual Base64 system of: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" because there is no complex conversion from the character to the value it represents. I also decided not to include "01" as that makes detection of the old mechanism simple for upgrade purposes.  This was done to support courses with sections greater than fifty two. Currently there is no upper limit bar what your machine is capable of serving. The length of the toggle persistence data increases and decreases automatically in responce to the number of sections. There are six sections per digit.
  5. Finally fixed having the 'toggle' word on toggles and not on the navigation menu with AJAX drag and drop working - CONTRIB-4403.
  6. Implemented MDL-33546.
  7. Fixed size of toggles altering when using AJAX drag and drop.
  8. Ran the code through the infamous 'Code Checker' version 2013060600, release 2.2.7 and cleared as much as possible.
  9. Note: Once you upgrade to this version and beyond then going back will mean loss of the user preferences as you will need to remove all 'topcoll_toggle_x' rows from the 'user_preferences' table first.

Cheers,

Gareth

 
Average of ratings: -
Picture of Halldór Kristjánsson
Re: Collapsed Topics for Moodle 2.5 Build: 20130514 updated
 

Just upgraded to the new version (2.5.2.1) and now when i create new courses i get this message above each week:

Notice: String offset cast occurred in C:\xampp\htdocs\Moodle\course\format\topcoll\togglelib.php on line 68


I haven't found anything that could be causing this and my google searches aren't helping me

anyone know what could be the problem ?

attached a screenshot for clarification.

Best regards,
Halldór Örn


 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics for Moodle 2.5 Build: 20130514 updated
Group DevelopersGroup Particularly helpful Moodlers

Dear Halldór Örn,

Are you running PHP 5.4? As a quick Google on 'Notice: String offset cast occurred' gives:

http://mark-story.com/posts/view/new-errors-in-php-5-4

I'm running PHP 5.3.21 which is why it did not come up in testing.

So therefore the code:

$this->toggles[$togglecharpos-1]

needs to be corrected.

So can you try using substr - http://php.net/manual/en/function.substr.php - such as 'substr($this->toggles, $togglecharpos-1, 1)' and see if it solves the issue.  I did think of using it but thought the array access would be more efficient.

In the mean time as it's a 'Notice', turning off debugging messages should remove it.

Cheers,

Gareth

 
Average of ratings: -
Gareth J Barnard
Re: Collapsed Topics for Moodle 2.5 Build: 20130514 updated
Group DevelopersGroup Particularly helpful Moodlers

Ok, additional:

Looking at http://stackoverflow.com/questions/16697988/php-5-4-string-offset-cast-occurred - it appears that the value of $togglecharpos is not an integer because it is generated by 'get_toggle_pos($togglenum)' which uses ceil() - http://php.net/manual/en/function.ceil.php - which returns a float, therefore can you change the 'get_toggle_pos($togglenum)' method to return:

return intvar(ceil($togglenum / 6));

Instead of the substr fix and see if that fixes the issue.

Oh how I wish PHP was type safe!

Cheers,

Gareth

 
Average of ratings: -
Picture of Halldór Kristjánsson
Re: Collapsed Topics for Moodle 2.5 Build: 20130514 updated
 

Looks like your google skills are far superior to mine :P

This fixed it for me,
although you wrote intvar(), you probably meant intval() smile

Thank you,
Halldór Örn smile

 
Average of ratings: -