This is change code for topcoll - to make the four default blocks optional.
This request is a change for the MOODLE_39 branch. (I will follow up with a change to the Moodle 3.10 version).
I have it as a branch below the MOODLE_39 branch. At least, I've attempted to put it there - it's there in my .git correctly on my server - so I'm hoping it's there correctly in this upload. If I need to use a different push command other than the obvious "git push - please let me know. I tried to find examples of a different syntax for a push for sub-branch but I failed to find it. (Apologies if done wrong).
The branch name is: blocks_optional_MOODLE_39 - and it should be sub-branch of MOODLE_39.
I will be happy to make any changes you desire to accept this work.
It has a Yes/No setting in the settings screen, and it has the strings needed in the language files,
and it has the change in the lib.php file to make the four blocks come up if chosen, by default -
the code always includes your four blocks unless the settings are turned off.
I've documented everything in a file called "Changes_blocks_optional.md - which I've included here,
so that you may read/review it here, and also in the project, if desired.
The purpose of this branch "blocks_optional_MOODLE_39" is to allow the blocks display to be optional.
--> This branch "blocks_optional_MOODLE_39" is a sub-branch of MOODLE_39.
Code changes:
1) language - Added entries into language files:
modified: lang/en/format_topcoll.php
modified: lang/en_ar/format_topcoll.php
modified: lang/en_us/format_topcoll.php
Last entries in the bottom of the "en" and "en_us" files above:
// Toggle Display Blocks
$string['defaultdisplayblocks'] = 'Display the four blocks that come with this format plugin';
$string['defaultdisplayblocks_desc'] = "Display the four blocks that come with this format plugin in the course. Yes or No.";
*Note: additions for en_ar matches style of the rest of the file, or at least tries to
// Toggle Display Blocks
$string['defaultdisplayblocks'] = 'Display the four blocks that come with this format plugin to crew';
$string['defaultdisplayblocks_desc'] = "Display the four blocks that come with this format plugin in the course. Can bee Aye or Nay.";
2) New settings in settings.php, addition starts at line 50
3) Replacement code in lib.php to make the settings of the blocks conditional on the settings for defaultdisplayblocks.
Replacement code is at line 337 of lib.php:
/**
Returns the list of blocks to be automatically added for the newly created course
@return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT
each of values is an array of block names (for left and right side columns)
/
public function get_default_blocks() {
$use_def_blocks = get_config('format_topcoll', 'defaultdisplayblocks');
if ($use_def_blocks == 1) / 1 = No, 2 = Yes (default)/ {
return array(
BLOCK_POS_LEFT => array(),
BLOCK_POS_RIGHT => array()
);
}
else { / if $use_def_blocks is not 1, then we turn on the four blocks, since it is intended as the default */
return array(
BLOCK_POS_LEFT => array(),
BLOCK_POS_RIGHT => array('search_forums', 'news_items', 'calendar_upcoming', 'recent_activity')
);
}
}
Original Code at line 337 of lib.php:
/**
Returns the list of blocks to be automatically added for the newly created course
@return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT
each of values is an array of block names (for left and right side columns)
*/
public function get_default_blocks() {
return array(
BLOCK_POS_LEFT => array(),
BLOCK_POS_RIGHT => array('search_forums', 'news_items', 'calendar_upcoming', 'recent_activity')
);
}
Greetings Gabe.
This is change code for topcoll - to make the four default blocks optional.
This request is a change for the MOODLE_39 branch. (I will follow up with a change to the Moodle 3.10 version). I have it as a branch below the MOODLE_39 branch. At least, I've attempted to put it there - it's there in my .git correctly on my server - so I'm hoping it's there correctly in this upload. If I need to use a different push command other than the obvious "git push - please let me know. I tried to find examples of a different syntax for a push for sub-branch but I failed to find it. (Apologies if done wrong).
The branch name is: blocks_optional_MOODLE_39 - and it should be sub-branch of MOODLE_39.
I will be happy to make any changes you desire to accept this work.
It has a Yes/No setting in the settings screen, and it has the strings needed in the language files, and it has the change in the lib.php file to make the four blocks come up if chosen, by default - the code always includes your four blocks unless the settings are turned off.
I've documented everything in a file called "Changes_blocks_optional.md - which I've included here, so that you may read/review it here, and also in the project, if desired.
/var/www/moodle/course/format/topcoll$ cat Changes_blocks_optional.md
John Joubert - GitHub: https://github.com/John-Joubert
The purpose of this branch "blocks_optional_MOODLE_39" is to allow the blocks display to be optional. --> This branch "blocks_optional_MOODLE_39" is a sub-branch of MOODLE_39.
Code changes: 1) language - Added entries into language files: modified: lang/en/format_topcoll.php modified: lang/en_ar/format_topcoll.php modified: lang/en_us/format_topcoll.php
Last entries in the bottom of the "en" and "en_us" files above:
// Toggle Display Blocks $string['defaultdisplayblocks'] = 'Display the four blocks that come with this format plugin'; $string['defaultdisplayblocks_desc'] = "Display the four blocks that come with this format plugin in the course. Yes or No.";
*Note: additions for en_ar matches style of the rest of the file, or at least tries to // Toggle Display Blocks $string['defaultdisplayblocks'] = 'Display the four blocks that come with this format plugin to crew'; $string['defaultdisplayblocks_desc'] = "Display the four blocks that come with this format plugin in the course. Can bee Aye or Nay.";
2) New settings in settings.php, addition starts at line 50
3) Replacement code in lib.php to make the settings of the blocks conditional on the settings for defaultdisplayblocks.
Replacement code is at line 337 of lib.php: /**
Original Code at line 337 of lib.php: /**