Numbering on Weeks/Topics

Numbering on Weeks/Topics

- Michael Scalero の投稿
返信数: 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

Michael Scalero への返信

Re: Numbering on Weeks/Topics

- Colin Fraser の投稿
画像 Documentation writers 画像 Particularly helpful Moodlers 画像 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? 

Michael Scalero への返信

Re: Numbering on Weeks/Topics

- 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>

笑顔

Itamar Tzadok への返信

Re: Numbering on Weeks/Topics

- 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

Glenys Hanson への返信

Re: Numbering on Weeks/Topics

- Mary Cooch の投稿
画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Testers 画像 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.思慮深い I tried it on 1.9 and it worked immediately!

Mary Cooch への返信

Re: Numbering on Weeks/Topics

- 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

Glenys Hanson への返信

Re: Numbering on Weeks/Topics

- 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.

笑顔

Itamar Tzadok への返信

Re: Numbering on Weeks/Topics

- Mary Cooch の投稿
画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Testers 画像 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 Itamar笑顔

Mary Cooch への返信

Re: Numbering on Weeks/Topics

- 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>

笑顔

Itamar Tzadok への返信

Re: Numbering on Weeks/Topics

- 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

Blair Roy への返信

Re: Numbering on Weeks/Topics

- 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. 笑顔

Itamar Tzadok への返信

Re: Numbering on Weeks/Topics

- 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

Itamar Tzadok への返信

このフォーラム投稿は削除されました。

このフォーラム投稿のコンテンツは削除されたため現在アクセスすることはできません。
削除済みユーザ への返信

このフォーラム投稿は削除されました。

このフォーラム投稿のコンテンツは削除されたため現在アクセスすることはできません。
削除済みユーザ への返信

Re: Numbering on Weeks/Topics

- 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. 笑顔 

Glenys Hanson への返信

Re: Numbering on Weeks/Topics

- Colin Fraser の投稿
画像 Documentation writers 画像 Particularly helpful Moodlers 画像 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?

Colin Fraser への返信

Re: Numbering on Weeks/Topics

- 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

Itamar Tzadok への返信

Re: Numbering on Weeks/Topics

- 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!

ben reynolds への返信

Re: Numbering on Weeks/Topics

- Simon Borgert の投稿

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

Simon Borgert への返信

Re: Numbering on Weeks/Topics

- 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?

Nigel Mitchell への返信

Re: Numbering on Weeks/Topics

- Mary Cooch の投稿
画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Testers 画像 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

Mary Cooch への返信

Re: Numbering on Weeks/Topics

- 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.

Nigel Mitchell への返信

Re: Numbering on Weeks/Topics

- 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.

Nigel Mitchell への返信

Re: Numbering on Weeks/Topics

- 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.

Nigel Mitchell への返信

Re: Numbering on Weeks/Topics

- 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. 笑顔

Itamar Tzadok への返信

Re: Numbering on Weeks/Topics

- Mary Cooch の投稿
画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Testers 画像 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 pages笑顔 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 seeウインク http://moodle.org/mod/forum/discuss.php?d=184252

Mary Cooch への返信

Re: Numbering on Weeks/Topics

- 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?  笑顔

Mary Cooch への返信

Re: Numbering on Weeks/Topics

- 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!

Nigel Mitchell への返信

Re: Numbering on Weeks/Topics

- Gareth J Barnard の投稿
画像 Core developers 画像 Particularly helpful Moodlers 画像 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

Michael Scalero への返信

Re: Numbering on Weeks/Topics

- Erick French の投稿

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

Erick French への返信

Re: Numbering on Weeks/Topics

- Gareth J Barnard の投稿
画像 Core developers 画像 Particularly helpful Moodlers 画像 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

Gareth J Barnard への返信

Re: Numbering on Weeks/Topics

- 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

Mina Thabet への返信

Re: Numbering on Weeks/Topics

- Gareth J Barnard の投稿
画像 Core developers 画像 Particularly helpful Moodlers 画像 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

Gareth J Barnard への返信

Re: Numbering on Weeks/Topics

- 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

 

Mina Thabet への返信

Re: Numbering on Weeks/Topics

- Gareth J Barnard の投稿
画像 Core developers 画像 Particularly helpful Moodlers 画像 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

添付 dsn.png
Gareth J Barnard への返信

Re: Numbering on Weeks/Topics

- 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