Adding course title to topic 0 - in the theme

Adding course title to topic 0 - in the theme

by Mike Wilson -
Number of replies: 11

Hi folks,

I want to add the course title inside of topic 0. I don't want to change any core files so I can't change any of the format files eg. course\format\topics\format.php.

Does any-one know of any easy way of achieving this by only changing files within the theme?

We're using a heavily adapted version of Afterburner, but it's probably the same solution for any theme.

Cheers

Average of ratings: -
In reply to Mike Wilson

Re: Adding course title to topic 0 - in the theme

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

I think it is time this was fixed in Moodle...as most teachers/tutors/admins want to change Topic outline or Weekly outline to Course name. It can be done and I wonder why it hasn't.

Anyway, the easiest solution for you would be to hide Topic outline from the top of the page using CSS, and if you have the latest version of Afterburner then you can add this in the settings page of that theme in the CSS text input area. Then you are free to add the course name as the 'section name' if you put a tick in the 'check box' inside Topic 0 when using the HTML editor when editing is enabled.

The CSS is as follows:

div#region-main div.region-content div.course-content h2.headingblock { display: none; }

Hope this helps?

Mary

In reply to Mary Evans

Re: Adding course title to topic 0 - in the theme

by Mike Wilson -

Hi Mary,

Thanks for the advise, but I don't think I phrased my question very well. I've already hidden the topic title using the following in afterburner_styles.css

.path-course-view .headingblock {
    display: none;

}

What I really want to do is automatically have the course name displayed on all course pages, at the very top of topic zero.

I've used to the following line in layout\default.php. This displays the course name just before the course content:

<?php $course_title = "<div id='course-title'>$COURSE->fullname</div>"; ?>

<?php echo $OUTPUT->main_content() ?>

I'm struggling to display this within topic zero without changing the individual course formats, which I don't want to do.

I probably should be using renderers but I haven't got my head round those yet smile

Mike

In reply to Mike Wilson

Re: Adding course title to topic 0 - in the theme

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

I'm not sure you can display it automatically in Topic0 without editing renderers etc, so I think what you have done might be the best way of doing it.

Whether you can hack it around using css so that the course name positions itself just below the top edge of Topic0 and then the content of Topic0 itself has a top margin to provide space for the course name might be an 'ugly' way of getting the look you want, without having to dip into renderers - although that is probably the best bet in the long run smile - unless anyone else can come up with a way of doing it to share

HTH

Richard

In reply to Mike Wilson

Re: Adding course title to topic 0 - in the theme

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Try this:

Development: Themes 2.0 How to change 'Topic outline' and 'Weekly outline' to Page heading

I've just spent the last hour or so writing it. smile

Hope it does what you want it to. It works OK in the theme I used.

Cheers

Mary

Average of ratings: Useful (1)
In reply to Mary Evans

Re: Adding course title to topic 0 - in the theme

by Juho Viitasalo -

I have to warn that the course layout is used in different places. This means that changing the layout file can have some unwanted effect somewhere else. At least the message page that previously didn't have any heading now has one.

Files in which $PAGE->set_pagelayout('course') is called:
/blocks/communit/communitycourse.php
/course/publish/backup.php
/course/publish/hubselector.php
/course/publish/index.php
/course/publish/metadata.php
/course/resources.php
/course/view.php
/enrol/index.php
/files/coursefilesedit.php
/files/index.php
/message/edit.php
/message/index.php
/mod/glossary/showentry.php
/notes/index.php

In reply to Juho Viitasalo

Re: Adding course title to topic 0 - in the theme

by Juho Viitasalo -

One possible confusion could arise when the user is on some course and goes to edit her messaging options from her profile settings menu. The course title above the messaging settings could be interpreted so that these messaging options are course specific. I think this is not the case.

This problem is associated to file:
/message/edit.php

In reply to Juho Viitasalo

Re: Adding course title to topic 0 - in the theme

by Juho Viitasalo -
In reply to Juho Viitasalo

Re: Adding course title to topic 0 - in the theme

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi

I presume this is following on from the Moodle Doc?

I was taking a day off but wanted to say that I will be looking at this problem over the weekend.

Your PATCH in Moodle Tracker is interesting, I'll test all this out at the same time I'm hoping to fix the tutorial.

Thanks for bringing up the problems.

Cheers

Mary

In reply to Mary Evans

Re: Adding course title to topic 0 - in the theme

by Steve Towson -

Hi Mary.

Does this still work with moodle 2.6?

In reply to Steve Towson

Re: Adding course title to topic 0 - in the theme

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

No! sad

In reply to Mary Evans

Re: Adding course title to topic 0 - in the theme

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

Might be possible by overriding 'format_topics_renderer' in '/course/format/topics/renderer.php' in the theme.  No time to try.