Default Block Layout for moodle 1.9

Default Block Layout for moodle 1.9

by Ale Fernandez -
Number of replies: 20
Hi,

I'm trying to change the default layout for blocks (not sticky blocks!) in moodle 1.9 when a new course is created.

This is discussed for older versions of moodle in a thread below but I thought it could do with a new thread as no answers seem to have appeared there for a while.

There's a possibility (from one of the posts in that thread) that you can edit this by altering the config file at /course/format/topics/config.php but the description given on http://docs.moodle.org/en/Block_layout is for older versions of moodle, so there's still no info on how this is done in newer versions post 1.5...

Any help greatly appreciated,

Ale
Average of ratings: -
In reply to Ale Fernandez

Re: Default Block Layout for moodle 1.9

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hi,

i think you should better make your bloc config in the main config.php file.

Have a look at config-dist.php (and search "bloc") smile

Hope this helps
In reply to Séverin Terrier

Re: Default Block Layout for moodle 1.9

by Ale Fernandez -
Hi Severin,

I've looked at the bloc config section and added

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

But when I add new courses, even after an apache graceful and when logged in as a student, they still come up with the search_forums and recent_activity blocks (which I'd removed from that line)...

Is there some kind of internal moodle way of reloading the configuration file?

Ale

In reply to Ale Fernandez

Re: Default Block Layout for moodle 1.9

by Michael Woods -
Picture of Core developers
Ale,

You've probably worked it out by now but, your code is almost right - change from

$CFG->defaultblocks = ...etc

to

$CFG->defaultblocks_topics = ...etc

It has to be done for each course format you want the default applied to.

Regards,
Michael
Average of ratings: Useful (1)
In reply to Michael Woods

Re: Default Block Layout for moodle 1.9

by Peter Campbell -
I changed the default blocks in the config.php file. It worked, but it put the default blocks on the left and right side of the page. I only want these blocks to appear on the left side, not both sides.

Here's the line of code:

$CFG->defaultblocks_override = 'course_menu,quickmail,file_manager:';

Any idea what's happening?

Thanks.
In reply to Peter Campbell

Re: Default Block Layout for moodle 1.9

by Michael Woods -
Picture of Core developers
Hi Peter,

I'm not exactly sure (and someone can correct me), but I suspect your course format default block layout is filling out the right-hand side because you didn't override them (see yourmoodle/course/format/topics/config.php).

Regards,
Michael
Average of ratings: Useful (1)
In reply to Michael Woods

Re: Default Block Layout for moodle 1.9

by Mark Pearson -
>I suspect your course format default block layout is filling out the right-hand side because you didn't override them (see yourmoodle/course/format/topics/config.php).

This I don't understand. According to the blurb in config-dist.php:
"// These variables define the specific settings for defined course formats.
// They override any settings defined in the formats own config file."

Now when I set the following:
$CFG->defaultblocks_topics = 'participants,activity_modules,admin,course_list,news_items:';
$CFG->defaultblocks_weeks = 'participants,activity_modules,admin,course_list,news_items:';
What I get when creating a weekly or topics course is Participants, Activities and Administration blocks (no course list, no news items, and no News Forum in week 0).
Any ideas?
In reply to Mark Pearson

Re: Default Block Layout for moodle 1.9

by Mark Pearson -
Silly silly silly me. It would help to check out all the settings in the config.php. Just earlier in the file I find:


// These variables define DEFAULT block variables for new courses
// If this one is set it overrides all others and is the only one used.

And, lo and behold, I had set this default override to participant, activities and Admin. So, no surprises really when I got those blocks ! What an eejit :->

In reply to Mark Pearson

Odp: Re: Default Block Layout for moodle 1.9

by Łukasz Sanokowski -
I don't understand your post. Which file in which section should I modify to change default blocks in new created courses?

Thanks in advance for response
In reply to Łukasz Sanokowski

Re: Odp: Re: Default Block Layout for moodle 1.9

by Sharon Goodson -
You would uncomment lines in config.php, in the main root directory and edit for your layout. Detailed instructions are here: http://docs.moodle.org/en/Block_layout

It indicates these setting apply for all new courses to be created, but running resetblocks.php after you're through resets the new configuration in all existing classes as well...thus the name resetblocks *lol* (see 'Resetting...' on same page).

Remember to use a colon between block titles to indicate left/right placement.




Average of ratings: Useful (1)
In reply to Sharon Goodson

Odp: Re: Odp: Re: Default Block Layout for moodle 1.9

by Łukasz Sanokowski -
Thank You. I edited file config-dist.php, because i didn't noticed that this file is only template o file config.php.

Greetings
In reply to Łukasz Sanokowski

Re: Odp: Re: Odp: Re: Default Block Layout for moodle 1.9

by Sharon Goodson -
You're welcome! You might make a copy of that to copy from after your next upgrade (or simply use the copy if there aren't changes in the upgraded config.php).
In reply to Sharon Goodson

***Default Block Layout for moodle 1.9***

by B Beals -
I'm trying to configure my course blocks default, I want to know if I can get some help on configuring the following correctly:

On the left side I want the Main Menu block to show the first thing and then the Calendar block, followed by the administration block, and then on the right side I want the Course Menu block (which I don't know the name for; I know the site_main_menu does the whole Site News etc that you add to the front page main menu block, but I'm talking the block that lists the outline, assignments, forums, resources, messages, etc. that you can also configure in the Sticky Blocks for courses) first, then the course categories of myCourses block(which could actually show on either I don't care), and finally the messages block [where users see the No Messages waiting w/ a messages.. link at the bottom of the block.

I know where to change it and how, except I don't know the names of those blocks for the config.php file.

$CFG->defaultblocks_topics = 'site_main_menu,calendar_month,admin,course_list:main_menu,activity_modules,participants,news_items,messages,calendar_upcoming';

^ is what I have right now, I know some of those titles are wrong (mainly the ones in blue) since they aren't showing up on my course pages correctly.

Thanks!
In reply to B Beals

Re: ***Default Block Layout for moodle 1.9***

by B Beals -
Also having a problem with the resetblocks.php Can someone verify that the code listed there is correct:

<?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!');
?>
I'm guessing cuz of the '$course->id' part, it's closing the php tag> and messing up the code. Any help?
In reply to B Beals

Re: ***Default Block Layout for moodle 1.9***

by Melissa Benson -
So do you edit the config file or config-dist? I see there are commented out defaultblock things in the config-dist -- do I copy and paste it in config or just uncomment out the ones in the config-dist?
In reply to Melissa Benson

Re: ***Default Block Layout for moodle 1.9***

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
config-dist has no function at all, other than to give you examples of things you might want to copy and paste into your real config.php file.
In reply to Tim Hunt

Re: ***Default Block Layout for moodle 1.9***

by Melissa Benson -
thank you!
In reply to Melissa Benson

Re: ***Default Block Layout for moodle 1.9***

by B Beals -
I'm STILL trying to configure my course blocks default, I want to know if I can get some help on configuring the following correctly:

On the left side I want the Main Menu block to show the first thing and then the Calendar block, followed by the administration block, and then on the right side I want the Course Menu block (which I don't know the name for; I know the site_main_menu does the whole Site News etc that you add to the front page main menu block, but I'm talking the block that lists the outline, assignments, forums, resources, messages, etc. that you can also configure in the Sticky Blocks for courses) first, then the course categories of myCourses block(which could actually show on either I don't care), and finally the messages block [where users see the No Messages waiting w/ a messages.. link at the bottom of the block.

I know where to change it and how, except I don't know the names of those blocks for the config.php file.

$CFG->defaultblocks_topics = 'site_main_menu,calendar_month,admin,course_list:main_menu,activity_modules,participants,news_items,messages,calendar_upcoming';

^ is what I have right now, I know some of those titles are wrong (mainly the ones in blue) since they aren't showing up on my course pages correctly.

Thanks!
In reply to B Beals

Re: ***Default Block Layout for moodle 1.9***

by B Beals -
Also having a problem with the resetblocks.php Can someone verify that the code listed there is correct:

<?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!');
?>
I'm guessing cuz of the '$course->id' part, it's closing the php tag> and messing up the code. Any help?
In reply to B Beals

Re: ***Default Block Layout for moodle 1.9***

by Noveck Gowandan -
I was in a similar dilemma.
To find all *your* options for the default blocks(in case you have lots of non-standard plugins), you can determine this through your database.

If you are using mysql:

1. You can do this through the phpmyadmin Add-on for moodle: http://moodle.org/mod/data/view.php?d=13&rid=448
or
you can go through
Mysql command line.

2. execute query:
select * from mdl_block; (or whatever your prefix is)


The resulting blocknames (see 'name' field) eg messages, news_items etc etc can be added to your config.php accordingly.


Hope this helped.
Noveck