Grid Format - Hiding Introduction

Grid Format - Hiding Introduction

by Andy Chaplin -
Number of replies: 11

Hi all

I made the mistake of asking two questions in one post recently, so I'm re-asking this in a separate thread now.

I'm setting up a course using the Grid Format which initially looks fine...



At the moment there are a couple of forums and a glossary (with a couple more items to come).  But when I open a section, I get this.  I've marked the relevant part black...


The introductory section is still there.  Is there some way to avoid displaying this (the black marked part)  when the student is working on a section?  Being able to do this would free up much more screen real estate and allow the focus to remain on the section.  I've checked through the settings and can't see anything obvious.

I'm not averse to tinkering with the php files if needs be, but I'm not sure where I should start looking.

All suggestions appreciated!

Average of ratings: -
In reply to Andy Chaplin

Re: Grid Format - Hiding Introduction

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Andy,

You're right, that does look a tad naff.  Its the 'One section per page' layout of the format (same as topics).

What version of Moodle are you running?

If you're interested in altering it, then in https://github.com/gjb2048/moodle-format_grid/blob/master/renderer.php override this method: https://github.com/moodle/moodle/blob/master/course/format/renderer.php#L637 and remove this: https://github.com/moodle/moodle/blob/master/course/format/renderer.php#L662-L670, but that means that section 0 will only ever be on the main page, so would need to disable it moving into the grid for 'One section per page' somehow.

Cheers,

Gareth

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: Grid Format - Hiding Introduction

by Andy Chaplin -

Hi Gareth

I'm running 2.9. (Sorry, forgot to mention that), and yes, I'm using one section per page.

If I understand you correctly, doing what you say will mean that the introduction (Section 0?) will only appear above the grid on the main page of the course, but when a tile is clicked the section displays without the introduction?

I will give it a go after work today and report back here.

Thanks for the explanation.


Andy

In reply to Andy Chaplin

Re: Grid Format - Hiding Introduction

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Andy,

Yes, but only after code changes, lots of them as described.  Thanks for the Moodle version and helps that it is 2.9 as then I don't have to support more than one branch with the change if I make it.  But if you do, please send me the code.

Cheers,

G

In reply to Gareth J Barnard

Re: Grid Format - Hiding Introduction

by Andy Chaplin -

Hi Gareth

I commented out the lines you indicated, and as far as I can tell it works perfectly.  


I'll test it over the next couple of days to make sure that there's no unforeseen domino effect!

This might be something which would be useful as an option in general when setting up courses - a toggle option maybe?  As I've never done this before, where are such suggestions posted?

Thanks again for your help!


Andy

In reply to Andy Chaplin

Re: Grid Format - Hiding Introduction

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Andy,

Thanks smile.  The only issue I can foresee is the 'move section 0 into grid' that would cause it to be no longer available.

Adding as an option is possible.  Suggestions can be made for the format on the Moodle Tracker or its GitHub or indeed here as you have already done.  If you want to learn about adding them, please read: https://docs.moodle.org/dev/Course_formats#Course_format_options.  If you have your own fork on GitHub then you can always make pull requests: https://github.com/gjb2048/moodle-format_grid/pulls.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Grid Format - Hiding Introduction

by Andy Chaplin -

Thanks for the info.

I'm a complete Noob when it comes to GitHub, but I'm trying hard to get up to pace.  Your presentation at iMoot has encouraged me to start tinkering with bits and pieces in Moodle, and I'm looking forward to trying out a few things for myself.

All the best



Andy

In reply to Gareth J Barnard

Re: Grid Format - Hiding Introduction

by Andy Chaplin -

Hi Gareth

Your fix still works fine on the 2.9 site.  I tried it on a 3.0 site and when opening the course, I just get a white page with no content at all.  As far as i could see, the code is identical.  I compared the sections from 2.9 and 3.0 and couldn't see any differences.  

Is there something else going on in the background with 3.0 that I need to do, or is it no longer possible?

All the best


Andy

In reply to Andy Chaplin

Re: Grid Format - Hiding Introduction

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Andy,

The M2.9 and M3.0 versions are functionally identical or should be.  Lost the plot over time.  What are you trying to do?

G

In reply to Gareth J Barnard

Re: Grid Format - Hiding Introduction

by Andy Chaplin -

Hi Gareth

I'm using the Grid format with all my courses and the Morecandy theme.  What I wanted was to set the Grid to show the introduction on the home page of the course, but when the user clicks on a section, then only that shows.  At the moment, in single section view you always see the course introduction which takes up quite a bit of screen space.

You showed me how to rem out a few lines in the renderer to achieve this in 2.9 and it works fine, but when I tried to do this on a 3.0 site (which is identically set up to the 2.9 site) I get a blank page when I click on a section.  The code in the renderer appears to be identical in both versions, but whereas the 2.9 version still works fine, the 3.0 version just shows a page without any content.  Hence my thought that something else has been changed in the update which affects this.

Any ideas would be appreciated!


Andy

In reply to Andy Chaplin

Re: Grid Format - Hiding Introduction

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Andy,

If the code is identical but when applying the changes one is broken, then there is a coding fault with the changes.  Turn on developer level debugging to find out.

G

In reply to Gareth J Barnard

Re: Grid Format - Hiding Introduction

by Andy Chaplin -

Hi Gareth,

I finally tracked down the issue - it was much more prosaic!  The link in your post above shows the current master and the code thqat needs to be commented out has shifted.

The code...

if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
echo $this->start_section_list();
echo $this->section_header($thissection, $course, true, $displaysection);
echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
echo $this->courserenderer->course_section_add_cm_control($course, 0, $displaysection);
echo $this->section_footer();
echo $this->end_section_list();
}

starts now at line 764.  Being a coding moron, I looked at the line numbers rather than the content of those lines.  Once I compared it with my working site it was obvious what I had done wrong.

Sorry to have wasted your time (and I have now started my own ammendments log!)

All the best


Andy