Numbering on Weeks/Topics

Numbering on Weeks/Topics

by Michael Scalero -
Number of replies: 38

Hello,

I had an instructor ask me how to remove the numbering in the Topics format next to all the weeks/topics. I am not sure that this can be removed, but he was pretty animate in wanting to remove them.

Please see me screenshot for clariofication. Any advice is appreciated!

Mike Scalero

Average of ratings: -
In reply to Michael Scalero

Re: Numbering on Weeks/Topics

by Colin Fraser -
Picture of Documentation writers Picture of Testers

I would suggest that you are probably in the wrong place as this question has no bearing on a course format, you will need to hack core code if you have to do this. Probably the General Developer forum would be a better place for this question - more likely to get an appropriate response. 

But that begs the question of why would someone be so agitated about a simple thing? Even if a course is non-linear, and I have a couple of courses like that myself, do the number really matter? 

In reply to Michael Scalero

Re: Numbering on Weeks/Topics

by Itamar Tzadok -

One simple way the instructor can remove these numbers (provided the site is set to trust content) is by adding a label on the course main page, and in the back-end of the label (html mode) entering the text:

<style type="text/css">.section .left{font-size:0;}</style>

smile

Average of ratings: Useful (4)
In reply to Itamar Tzadok

Re: Numbering on Weeks/Topics

by Glenys Hanson -

Wow! It works. I nearly didn't try it because it seemed such a strange way of going about it.

Thanks yet again, Itamar.

Glenys

PS The reason I sometimes want to do this, Colin, is that can I have introductory stuff in the first section, then I have; 1st Week, 2nd Week, etc.  and it looks funny to see:

2. 1st Week.

or

2. 3-7 January

In reply to Glenys Hanson

Re: Numbering on Weeks/Topics

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Did you try this on 2.0 or 1.9 Glenys? I would like to do this but when I tried on 2.0 it didn't work even though I have trusted content enabled.thoughtful I tried it on 1.9 and it worked immediately!

In reply to Mary Cooch

Re: Numbering on Weeks/Topics

by Glenys Hanson -

Hi Mary,

I had tried it only on 1.9. I noticed the label itself became invisible. Eek! If I want the numbering back, what do I do? It was just in a Sandbox so no worries.

I've just tried it in the only Moodle 2 course I have access to as a teacher which is Moodle for Language Teaching and TinyMce stripped out the code. It also wouldn't accept just the code in html - I had to write something normally as well. I've had this kind of problem before with TinyMce... and not only in Moodle.

Cheers,

Glenys

In reply to Glenys Hanson

Re: Numbering on Weeks/Topics

by Itamar Tzadok -

This workaround works on 2 too. It is just that you need to disable the editor from your profile, add the label and re-enable the editor. Since this is done once in a course the overhead is not an overkill.

The label should be invisible. That's the beauty of it. If you want the numbers back, simply turn editing on and you should see the command icons of the label where you put the label. Then click on the edit or delete icon to perform the respective action on the label.

smile

Average of ratings: Useful (1)
In reply to Itamar Tzadok

Re: Numbering on Weeks/Topics

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Ah.. I have got it to work on standard theme in 2.0 but not in magazine, which was the theme I was using before - so maybe it is theme dependent -either way; it is a really useful thing to know so thanks again Itamarsmile

In reply to Mary Cooch

Re: Numbering on Weeks/Topics

by Itamar Tzadok -

You're welcome Mary. Indeed, these things tend to be theme dependent. The simple css definition works where there is no more specific definition of the same class on the page. The Magazine theme does add a more specific definition and the following should override it in that theme:

<style type="text/css">.course-content ul.topics li.section .left{font-size:0;}</style>

smile

In reply to Itamar Tzadok

Re: Numbering on Weeks/Topics

by Blair Roy -

I inserted the code into a label in my course and it worked.   I have not enabled trusted content. 

Will the code stick or get erased at some point? I do not understand the trusted content fully so was reluctant to enable it and was surprised that the numbers disappeared and it seemed to work.

Thanks in advance.

Blair

In reply to Blair Roy

Re: Numbering on Weeks/Topics

by Itamar Tzadok -

Should stick.

Afaict from a quick investigation this is probably because text cleaning attempts first the HTML Purifier which allows style tags, and only if not available the cleaning goes by trusted content. HTML Purifier is enabled by default and I guess you haven't touched this config setting either.

And so it works. smile

In reply to Itamar Tzadok

Re: Numbering on Weeks/Topics

by Blair Roy -

Thanks so much for your explanation!  You are correct in that I have not changed the HTML Purifier setting.  

It is great that it works and was so easy with no system configuration changes.

Take care,

Blair

In reply to Itamar Tzadok

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Numbering on Weeks/Topics

by Itamar Tzadok -

Sometimes you can rollback such a nasty typoed label by simply clicking the browser's back to go to the previous page which should be the label's editing page (assuming you have just added/saved that label) where you can either fix or clear the label and save again. smile 

In reply to Glenys Hanson

Re: Numbering on Weeks/Topics

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Yes Glenys I understand this, and that was my first thought, when I saw Moodle for the very first time "Why is the title topic listed as 1?"  So perhaps a little inertia on my part, but it still begs the question when there are so few who actually have access to the code and it cannot be overriden from inside Moodle. Would it not be simpler to have an optional numbering sequence in the course settings page?

In reply to Colin Fraser

Re: Numbering on Weeks/Topics

by Glenys Hanson -

Hi Colin,

There are many things I think could be simpler in Moodle but I realise that what seems just a little modification to me has immense ramifications to all the code underneath.

I'm just grateful to people like Itamar, Mary, Ben, you Colin (and many others I won't mention just because they haven't contributed to this particular thread), who so often provide simple solutions/workarounds that I immediately understand and can put into practice.

Cheers,

Glenys

In reply to Glenys Hanson

Re: Numbering on Weeks/Topics

by ben reynolds -

I think Glenys just called us all a name -- "Useful."

Proud to be in that company, and thanks big grin

In reply to Itamar Tzadok

Re: Numbering on Weeks/Topics

by ben reynolds -

Mary's blog turned me on to this Itamar trick, and I have an immediate use for it. Thus, once again, Itamar, you are VERY useful!

Thanks!

In reply to ben reynolds

Re: Numbering on Weeks/Topics

by Simon Borgert -

I also recieved this tip via a YouTube video from Mary - thanks heaps for such an easy solution

In reply to Simon Borgert

Re: Numbering on Weeks/Topics

by Nigel Mitchell -

Thanks Mary et al for this tip. It worked for me, and I similarly pasted 

<style>.headingblock.header{display:none;}</style>

in a label to hide the words Topic Outline.

It worked fine in my browser (I use Chrome) but when I tested the page in other browsers (Firefox, Safari and for the occasion I even opened up IE) the text I thought I had hidden reappeared.

Would a more lasting fix be to make the change in the theme?

In reply to Nigel Mitchell

Re: Numbering on Weeks/Topics

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Itamar makes some other suggestions towards the bottom of this thread here (regarding removing topic outline) if that helps: http://moodle.org/mod/forum/discuss.php?d=60325

In reply to Mary Cooch

Re: Numbering on Weeks/Topics

by Nigel Mitchell -

Thanks for the suggestion, Mary.

Once again, when I insert the code in a label it changed the appearence of the page in Chrome, but when I open the same page in Firefox the "Topic Outline" header is still there.

In reply to Nigel Mitchell

Re: Numbering on Weeks/Topics

by Nigel Mitchell -

On further testing it seems that the heading and numbers disappear when I am logged in (as admin on the site and teacher on the course), but they are still visible for other users and guests.

In reply to Nigel Mitchell

Re: Numbering on Weeks/Topics

by Nigel Mitchell -

And now I've solved my own problem. 

I had hidden the labels containing the code, but if they are hidden, only I can see them and they only do their magic for me. 

The trick is obviously to put the code on th4 end of some text that would be there anyway. Then it works for everyone.

In reply to Nigel Mitchell

Re: Numbering on Weeks/Topics

by Itamar Tzadok -

Or just put the code in an otherwise empty label. The code is not displayed but still active and there is nothing else in the label which is displyed.  Then you don't have to hide the label but no one (but you) will know that it is there. smile

In reply to Itamar Tzadok

Re: Numbering on Weeks/Topics

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Itamar - I tried your "getting rid of the topic outline" code in a label in my school's 1.9 and it worked a treat - brilliant - because all our open access courses now look like proper pagessmile But on my test and training Moodle 2.0s it didnt' make any difference even though I tried it with standard theme - then I remembered about swapping to "use standard webforms" in my profile - tried it again -and it works fine now, so thanks! But why do I have to do that to get it working in 2.0? (I am investigating the vagaries of the TinyMCE editor at the moment you seewink http://moodle.org/mod/forum/discuss.php?d=184252

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

Re: Numbering on Weeks/Topics

by Itamar Tzadok -

Am not sure yet Mary. I suppose it has something to do with the TinyMCE filtering. In your investigation, have you tried embeding in a forum post while using standard webforms?  smile

In reply to Mary Cooch

Re: Numbering on Weeks/Topics

by Rachel Fransen -

I just want to say thank you for defining how to "disable editing from your profile."

I never knew about that option to "use standard web forms"!!

Now that I changed my profile, I was able to paste the style code just fine and it works perfect! Thank you!

In reply to Nigel Mitchell

Re: Numbering on Weeks/Topics

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

Indde, it would be better to use 'display:none' instead of 'font-size:0' so there is less for the browser to do as I would have thought that it would process this directive before performing font size calculations.

Cheers,

Gareth

In reply to Michael Scalero

Re: Numbering on Weeks/Topics

by Erick French -

Is there a definitive detailed solution for removing the numbers in 2.2?

In reply to Erick French

Re: Numbering on Weeks/Topics

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

Dear Erick,

As far as I know, no, however...

If you have access to the code, go to course/format/topics and edit format.php.  Change line 176 from:

echo '<div class="left side">'.$currenttext.$section.'</div>'

to

echo '<div class="left side">&nbsp;</div>';

If you do not have access to the code you need to use the 'display:none' technique described in this thread.

Cheers,

Gareth

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

Re: Numbering on Weeks/Topics

by Mina Thabet -

Hello Gareth,

Any suggestions on making this change to 2.3? The file format.php only has 56 line and does not include the mentioed code.

Thank you,

Mina

In reply to Mina Thabet

Re: Numbering on Weeks/Topics

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

Dear Mina,

Moodle 2.3.2+ (Build: 20120920) does not have the section numbers displayed, so no need for a code change.  If it did then it would be in the 'section_left_content' method in '/course/format/renderer.php'.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Numbering on Weeks/Topics

by Mina Thabet -

Thank you Gareth,

I do have it displaying in 2.3 (see screenshot).

I looked in renderer.php file, however there is no mention to Topic. Is that what I should be looking for?

 

Thanks again,

Mina

 

In reply to Mina Thabet

Re: Numbering on Weeks/Topics

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

Dear Mina,

That's the default section name - different from the original question which was the section number on the left.  Please see attached.

If you want to maniplate it edit the 'callback_topics_get_section_name' function in '/course/format/topics/lib.php'.

Cheers,

Gareth

Attachment dsn.png
In reply to Gareth J Barnard

Re: Numbering on Weeks/Topics

by Mina Thabet -

Gareth,

That was very helpful, thank you. I learned that I can insert a couple of spaces in the "section name" field and save, and that will remove any topic displays.

Thank you so much for your help.

~Mina