Blocks

 
 
tim
Moodle 2.0 navigation block auto expand
 

Hello all,

Looking at the navigation block in Moodle 2.0. It currently auto-expands the 'Site pages' part of the tree. I'd like to stop this happening but I'm not sure where to look for this setting.

Is it part of the block settings or something in my theme? Any help much appreciated.

Thanks,

Tim

 
Average of ratings: -
Picture of Katerina Nemcova
Re: Moodle 2.0 navigation block auto expand
 

Hi Tim,

Have you found a solution to this issue? I'm having the same problem...

Thanks

Katerina

 
Average of ratings: -
Picture of Jel Coward
Re: Moodle 2.0 navigation block auto expand
 

Just a 'me too' I'm afraid. .......I was googling this issue and found this thread. I cannot see any settings in the Navigation block to 'auto-collapse' the trees on first view.

Any thoughts from others please?

Cheers

Jel

 
Average of ratings: -
Picture of Rabih Taha
Re: Moodle 2.0 navigation block auto expand
 

Hello all, it is first time i post in moodle, i had same problem and it was annoying i seached a lot and also read this post, i solved the problem but i dunno if in a suitable way or not.

I tell u how anyway in case u like to do the same,

the navigation menu is infact a yui treeview and it depends on <li> <ul> tags, simply to collapse a node in the tree u must add the collapsed class in the style sheet, which though looks easy but u have to find where moodle do actualy render the block code.

 

Anyway here what i have done

 

go to blocks\navigation in ur root moddle directory

open renderer.php file

and change this line

if ($item->has_children() && (!$item->forceopen || $item->collapse)) {

to this

if ($item->has_children() && ($depth > 1)) {

 

this add the collapsed class to all links in the navigation block whose depth >1 so they are collapsed by default after rendering.

 

For me it is working fine with no problems after, and i did not counter a bug , but not sure it is 100% safe as i am just a programmer and not developing anything in moodle core and does not know if it may affect other aspects though i doubt it.

Try it if it suits u maybe as temporary solution till u find better.

 

Regards.

 
Average of ratings: -
Picture of Jamie Hibbard
Re: Moodle 2.0 navigation block auto expand
 

I know this is old, but i have got here via search and it helpped however I changed

 

go to blocks\navigation in ur root moddle directory

open renderer.php file

and change this line - 129

if ($item->has_children() && (!$item->forceopen || $item->collapse)) {

to

if ($item->has_children() && (!$item->forceopen || $item->collapse) && $item->text!="Courses") {

If you have renamed it Just type in what you called it.

 

I also stopped it showing an icon if the category was empty as we use them as just web pages

line - 143

if ($isbranch) {

to

if ($isbranch && $item->children->count() > 1) {

 
Average of ratings: -
Picture of Herson Cruz
Re: Moodle 2.0 navigation block auto expand
 

Hi,

This isn't working for me, I always get navigation expanded when clicking "My home" for example.

Using Moodle 2.2.2+ (Build: 20120504)

Thanks,

 

 
Average of ratings: -