Courses and course formats

 
 
Picture of Kevin Freeborn
Edit Course Format PHP to remove Topic Number
 

I would like to edit my topic format PHP file to remove topic numbering for courses.  I have attached a copy of the file.  If someone could provide the required edits I would be greatful.

 

Thanks,

Kevin

 
Average of ratings: -
Volcano
Re: Edit Course Format PHP to remove Topic Number
Group Developers

On line 177, change:

 echo '<td class="left side">'.$section.'</td>';

to

 echo '<td class="left side"></td>'; //Section number removed GVA

 
Average of ratings: -
Picture of Kevin Freeborn
Re: Edit Course Format PHP to remove Topic Number
 

Thanks Gary!

Kevin

 
Average of ratings: -
Picture of Kevin Freeborn
Re: Edit Course Format PHP to remove Topic Number
 

Hmmm?  I did this and the section numbers are gone from the Section Headings but, now they have moved to the top of the page??

Suggestions.

Thanks,
Kevin

 
Average of ratings: -
Picture of Ger Tielemans
Re: Edit Course Format PHP to remove Topic Number
 

The easiest way is not to remove the numbers, but give them the color of the background of the sidebars of your sections for topics in your css.

The advantage is that students or teachers who still want to use the sectionnumbers can see them by doying a select on the place of the number. Then it will be visble in reversed color...

 
Average of ratings: -
Picture of Luke Wilkins
Re: Edit Course Format PHP to remove Topic Number
 

Would someone be able to tell me which CSS file i would need to edit???

 
Average of ratings: -
Picture of Daniel Costa
Re: Edit Course Format PHP to remove Topic Number
 
Hello Luke,

I'm not sure that you can remove the number from the css, but I think you can have a look at:

#course-view .section .left

hope this help

Daniel
 
Average of ratings: -
Picture of Glen Gross
Re: Edit Course Format PHP to remove Topic Number
 
Luke,

To get rid of the Topic Numbers in a Theme I changed the file: styles_color.css found in the theme folder.

I used the suggestion to change the number to the background color of the theme. The line that I changed was:

#course-view .section .left {
}

Since my background color is white I changed the line to:

#course-view .section .left {
color:#FFFFFF;
}

Best regards,
Glen
 
Average of ratings: -
Picture of Julie Carothers
Re: Edit Course Format PHP to remove Topic Number
 
I cant find:
#course-view .section .left {
}

in the formal white theme

can someone direct me to it?
thanks!!!
 
Average of ratings: -
Picture of Tiffany Morgan
Re: Edit Course Format PHP to remove Topic Number
 
I realize I'm replying to a 2 year old post. I'm wondering on version 1.9 if changing the color of the topic number remains the recommended/most efficient way to hide or remove the topic number from view when using the topic format.

It appears so, but wanted to make sure...
 
Average of ratings: -
slightly edited copy of http://xkcd.com/358/
Re: Edit Course Format PHP to remove Topic Number
 

No, I don't think it should have been 2 years ago either. The best way is to use "display:none" in your CSS. So:

#course-view .section .left {
 display:none;
}
 
Average of ratings: -
Picture of Tiffany Morgan
Re: Edit Course Format PHP to remove Topic Number
 
Wonderful! That sounds much better. I didnt like the idea of hiding it that way very much. Im still waiting to get my access to the CSS on the server so my hands are tied for a while but this will be a big help.

Thanks!
 
Average of ratings: -
Picture of Steven A.
Re: Edit Course Format PHP to remove Topic Number
Group Particularly helpful Moodlers
Alan, your solution gets rid of the numbers, but it also hides the entire left section, which might not be ideal for some people. Here's how I kept the left section from disappearing.


un-highlighted topics (lightbulb off)

.section .side {
background: #f5f5f5; /*this is the background colour of un-highlighted topics*/
color: #f5f5f5; /*this controls the colour of the number*/
}

highlighted topics (lightbulb on)

#course-view .current .side {
background: #d4d4d4; /*this is the background colour of the highlighted topic*/
color:#ffffff; /*this is the colour of the number*/
font-size: 0px; /*this reduces the size of the number to zero, effectively removing it*/
}

Note: the colours don't matter at all, just ensure that the colour of the un-highlighted section and font therein are the same so that the numbers won't be invisible (unless you click-drag your mouse over the area, in which case you'll see them).

Why not just go with font-size:0px in both highlighted and un-highlighted topics?
-Because then the left side becomes very skinny relative to the right side.

 
Average of ratings: -
Picture of Steven A.
Re: Edit Course Format PHP to remove Topic Number
Group Particularly helpful Moodlers
I thought again about the changes I suggested above and have decided for myself to have the number and background colours the same for both un-highlighted and highlighted topics (rather than reducing the font size to zero for highlighted topics).

.section .side {
background: #f5f5f5;
color: #f5f5f5;
}

#course-view .current .side {
background: #d4d4d4;
color:#d4d4d4;
}

That code looks a bit cleaner. smile
 
Average of ratings: -
Picture of web master
Re: Edit Course Format PHP to remove Topic Number
 
Is this for 1.9.2?  If so, what file?
 
Average of ratings: -
Picture of Ger Tielemans
Re: Edit Course Format PHP to remove Topic Number
 
The styles sheets of the theme you are using.
 
Average of ratings: -
Picture of William Lu
Re: Edit Course Format PHP to remove Topic Number
 

Thanks, works for me in Moodle2.0/Standard theme/core.php

 
Average of ratings: -
Picture of Tan M
Re: Edit Course Format PHP to remove Topic Number
 

Hi Gary,

Thanks for the message on this -- I tried it out and it worked great.

I was wondering if you knew how to accomplish the same objective for only certain courses instead of for every single course on the site.

There are certain courses where having the topic number display is highly beneficial, while for others it would be better to have them hidden.  Do you know how to pick and choose?

Also, I wonder if it would be useful to have a selection for reverse numbering -- like a countdown of topics.  So if there were 10 topics in a course, the topmost section would be 10, followed by 9, 8, etc.

 
Average of ratings: -
Picture of Just H
Re: Edit Course Format PHP to remove Topic Number
 
Hi Tan

Haven't needed to do so personally so not sure if the best/easiest way but for "I was wondering if you knew how to accomplish the same objective for only certain courses instead of for every single course on the site." one way of doing it would be to create two themes (one with numbers and one without) and select the relevant theme when setting up the course.

Regards
H
 
Average of ratings: -
Picture of Steve Power
Re: Edit Course Format PHP to remove Topic Number
 

Harry

This of course requires that you allow course level themes. We do not since these override user themes which we use to provide different coloured backgrounds to accomodate users with Meers-Irlen syndrome.

My solution has been to create copies of the weeks and topics themes. I have weeks with and without week numbers and topics with and without week numbers.

The differences in both topics and weeks are simply the change in the line Gary described. I have not seen them at the top of the page as described by Kevin.

Regards
Steve

 
Average of ratings: -
Picture of Stephen Overall
Re: Edit Course Format PHP to remove Topic Number
 

Here is my update to this five-year-old thread for Moodle 1.9.12+ in 2011.

To completely remove the topic number from the left side of each topic (after Topic 0) in every course format and theme in Moodle 1.9.12+, edit line 197 in moodle/course/format/topics/format.php from...

(orginal core line)

echo '<td id="sectionblock-'.$section.'" class="left side">'.$currenttext.$section.'</td>';

to...

echo '<td id="sectionblock-'.$section.'" class="left side">'.$currenttext.'</td>';

Note: Be sure to leave the final period at the end of variable $currenttext so the rest of the page can continue to load normally.

You can still discover the topic number by using your mouse to rollover and see the "Show only topic N" tooltip on the fold/unfold square on the righthand side of each topic.

 
Average of ratings: -
Picture of Dawn Quinn
Re: Edit Course Format PHP to remove Topic Number
 
I would like to change the words Topic Outline in one teacher's course. I can edit words and phrases in site admin but just want to do this on a case by case basis.

I'm sure I need to change the CSS somewhere. Can you point me in the right direction please?

 
Average of ratings: -
Gareth J Barnard
Re: Edit Course Format PHP to remove Topic Number
Group DevelopersGroup Particularly helpful Moodlers
Dear Dawn,

On further investigation it appears to me that for the standard topics format the same is true as my reply for my Collapsed Topics format. Editing CSS etc. will not work for a single course because the format is getting the string 'Topic Outline' from moodle.php using the get_string function, therefore the only solution I can find will be to invent a new course format with a different name but with the change made at the approprate place in format.php - and all of the other files that need to change to reflect a new course format.

The other solution would be an enhancement to the 'Topics' format that will allow a per course definition of the word in the same way as you are able to edit the topic summaries.

Cheers,

Gareth
 
Average of ratings: -