Display blocks in selected modules

Display blocks in selected modules

by Sebastien M. -
Number of replies: 12
Hi All:

Is there a block control feature in Moodle? For example how can one control which block is being displayed in each module. With the standard installation (I'm using CVS) the blocks only appear on the front page and on the courses front end.

I would like to display some blocks (e.g. Main menu) in other modules (e.g. I would like the main menu to appear when browsing the ressources).

Any known work around?

Thanks in advance

sebastien

BTW: if the mod needs coding I'm ready for it. I would appreciate any input on where I should begin to implement my mod.
Average of ratings: -
In reply to Sebastien M.

Re: Display blocks in selected modules

by Sebastien M. -

OK I droped the idea of displaying the "core main menu block" elsewhere since it is so intimatly linked with other info.

Instead I created my static Main Menu using a new block which is now displayed on my front end and courses front end.

What should I do if I want this block to be displayed site wide (e.g. in other modules like resources)? I understand that the course/formats are used only for displaying courses (or front page) but are not used for other activities such as resources or lessons.

I thought of doing a cut-n-paste of the routine detecting the courses blocks, for each module where my block is needed.

Does that make any sense?

Any thoughts would be most appreciated.

Sebastien
In reply to Sebastien M.

Re: Display Main Menu Sitewide

by Sebastien M. -
For those of you who might be interested in displaying the Main Menu block sitewide, I did the following mod:

First, In block_site_main_menu.php, replace

$this->course = $course;

BY

$this->course = get_record('course', 'id', '1');


Secondly, using something like phpMyAdmin, look into the course table and add the block id into the list of blocks of the courses where you want the Main Menu to appear.

This mod is great to display general ressources sitewide.

This is a personal/intuitive mod and I would not garanty that is is stable... For example, I wouldn't try to edit the main menu block in the courses pages ... as this could start serious conflicts...

Cheers

seb

In reply to Sebastien M.

Re: Display Main Menu Sitewide

by Dennis Delaney -
I read this entry dating back to 2005 and hope that the development team may have addressed this need in some way since that time.

I want to display a block, not only on the Front Page, but on New Pages and other locations. Is there a setting, besides the hard code suggestion (which I will lose with every update of Moodle) that would
allow me to add the display of BLOCKS in additional locations?
In reply to Dennis Delaney

Re: Display Main Menu Sitewide

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
We have just addressed it, for Moodle 2.0, which is not finished yet.
In reply to Tim Hunt

Re: Display Main Menu Sitewide

by SVI eSolutions -

Is there still no option on adding blocks site wide, so on all modules through-out the site?

I have recently installed 1.9 and want the blocks to appear on all pages so that it feel more like a standard web site.

Thanks

In reply to SVI eSolutions

Re: Display Main Menu Sitewide

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

As I said, the feature will be in Moodle 2.0. Well, time has moved on. Moodle 2.0 is released and the feature is there. What you want is not possible in Moodle 1.9.

In reply to Tim Hunt

Re: Display Main Menu Sitewide

by SVI eSolutions -

Thanks for answering my question so quickly.

Can you also tell me if the blocks, such as the menus, will/could also appear next to the course content? Not only on the course main page?

Will it also be able to create content pages in 2.0, for example a help page that is not included in a course but is accessible to everyone using the site?

Thanking you in advance!

In reply to SVI eSolutions

Re: Display Main Menu Sitewide

by Adam Landow -

The Main Menu of the site is essentially a ‘container’ block that can be used to hold resources. These resources can be, amongst other things, HTML pages.

Example of use:

a) After logging in as the ‘admin’ user, navigate to the front page of the Moodle installation.

b) Turn editing on by using selecting Settings-> Front Page Settings->Turn Editing On. The page layout will change to reflect that editing is now, in fact, on.

c) In the main menu block, use the ‘Add a Resource’ drop-down menu to select a page.

d) Edit the resulting page appropriately.

e) Click ‘Save and return to course’.

f) Note that the ‘Site Help page is now accessible on the ‘Main menu’ and as under the Navigation menu as a ‘Site page’.

g) Turn editing off and log out to view the results of your actions.

In reply to Adam Landow

Re: Display Main Menu Sitewide

by SVI eSolutions -

Thank you for the quick reply. It seems like the perfect solution and easy too, the only problem is that once you enter the course you can not see the "Main Menu" block it only seems available on the page with the list of courses.

Do you know how to add the "Main Menu" to all pages? I tried to add it as a sticky block but it does not appear in the list of blocks that can be added!

In reply to SVI eSolutions

Re: Display Main Menu Sitewide

by Adam Landow -

The reply was actually copied and pasted from some work I did for a customer!

I don't know how to add the main menu to all courses- a quck look in the forums suggest that it might not be possible. I've seen suggestions to just make a corresponding course block in each course that looks like 'main menu'- inelegant if you have many courses.

There is another possible solution, but not as elegant: you could write an external page and add it as a link : more copy and paste below:

There is a global theme setting found at Site Administration->Appearance-> Themes->Theme settings that provides for arbitrary custom menu items- it’s the last one on the page.

A basic HTML page, or Moodle resource page can be written and linked to from here.

Another use could be a link back to other affiliated websites.

Example of use:

a)      A page is created in Dreamweaver or other HTML editor. It is saved in a way that is accessible via a URL.

This example will use an existing help page found at http://my.unep.edu.au/Sitehelp/tabid/97/Default.aspx as an example of a publically accessible page.

b)      In the Moodle settings page ite Administration->Appearance-> Themes->Theme settings (after, of course logging in as the admin user) a line is added to link to the page created in step a.

Figure 1- Adding a custom menu item to the theme

After saving, the menu item will be available globally. It’s presentation will be defined by the current theme- in the modified Formal White theme used in the development environment it looks like this:

In reply to Adam Landow

Re: Display Main Menu Sitewide

by SVI eSolutions -

Which version of Moodle are you using? I'm using 1.9.11 and the last choice on this page is : hideactivitytypenavlink not the custom menu items that you mention...

Though I also installed 2.0 as a test and it seems possible on that version...

In reply to SVI eSolutions

Re: Display Main Menu Sitewide

by Adam Landow -

Version 2. I highly recommend upgrading to it smile

Although, to be honest I've not had much to do with v1.x, as I've only been a 'moodler' since mid last year, and the client I've been working with on this made the decision to use v2 on the basis it was to be released last July smile