Note: You are currently viewing documentation for Moodle 3.1. Up-to-date documentation for the latest stable version of Moodle is probably available here: Block layout.

Block layout: Difference between revisions

From MoodleDocs
m (formatting)
(sticky blocks link)
Line 1: Line 1:
==Default block layout for new courses==
==Default block layout for new courses==
{{Moodle 1.6}}
*[[Sticky blocks]] may be used in Moodle 1.6.


To amend the '''default block layout''' for new courses, add one or more of the following lines (omitting the forward slashes) to ''config.php'' and amend the block names as required.
 
{{Moodle 1.5}}
To amend the default block layout for new courses in Moodle 1.5, add one or more of the following lines (omitting the forward slashes) to ''config.php'' and amend the block names as required.
  // These variables define DEFAULT block variables for new courses
  // These variables define DEFAULT block variables for new courses
  // If this one is set it overrides all others and is the only one used.
  // If this one is set it overrides all others and is the only one used.
Line 18: Line 22:
==Resetting the block layout for existing courses==
==Resetting the block layout for existing courses==


The '''block layout for existing courses''' may be reset by copying the following script into a text file, saving it as ''resetblocks.php'', copying it into the Moodle root directory, then visiting <code><nowiki>http://yourmoodlesite.org/resetblocks.php</nowiki></code>. Please note that a database backup is recommended before using the script. ;-)
The block layout for existing courses may be reset by copying the following script into a text file, saving it as ''resetblocks.php'', copying it into the Moodle root directory, then visiting <code><nowiki>http://yourmoodlesite.org/resetblocks.php</nowiki></code>. Please note that a database backup is recommended before using the script. ;-)
  <?php
  <?php
  require_once('config.php');
  require_once('config.php');

Revision as of 17:14, 20 March 2006

Default block layout for new courses

Template:Moodle 1.6


Template:Moodle 1.5 To amend the default block layout for new courses in Moodle 1.5, add one or more of the following lines (omitting the forward slashes) to config.php and amend the block names as required.

// These variables define DEFAULT block variables for new courses
// If this one is set it overrides all others and is the only one used.
//      $CFG->defaultblocks_override =    'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
//
// These variables define the specific settings for defined course formats.
// They override any settings defined in the formats own config file.
//      $CFG->defaultblocks_site = 'site_main_menu,admin,course_list:course_summary,calendar_month';
//      $CFG->defaultblocks_social =  'participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,admin,course_list';
//      $CFG->defaultblocks_topics =  'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
//      $CFG->defaultblocks_weeks =  'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
// These blocks are used when no other default setting is found.

// $CFG->defaultblocks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';

(code copied from config-dist.php)

Resetting the block layout for existing courses

The block layout for existing courses may be reset by copying the following script into a text file, saving it as resetblocks.php, copying it into the Moodle root directory, then visiting http://yourmoodlesite.org/resetblocks.php. Please note that a database backup is recommended before using the script. ;-)

<?php
require_once('config.php');
require_once($CFG->libdir.'/blocklib.php');
$courses = get_records('course');
foreach($courses as $course) {
   $page = page_create_object(PAGE_COURSE_VIEW, $course->id);
   blocks_repopulate_page($page);
}
print_heading('Done!');
?>