Best practice forum (Archived)

Topic format course FORCE collpased display

 
??
Topic format course FORCE collpased display
?? 发表于 2011年03月28日 Monday 20:22
 

By default the topic format displays all topics open at once, but we want it to only show 1 at a time with the "jump to.." dropdown menu at the bottom

Do you know of a way to force a topics format Totara course to display with the topics view already collapsed into just showing 1 topic?

Thanks,

CogginsSimon
Re: Topic format course FORCE collpased display
CogginsSimon 发表于 2011年03月29日 Tuesday 14:19
小组 Totara

I don't believe that there is an option to do what you want, but I had a quick look at the code and I think it's an easy fix.

Try editing the file /course/format/topics/format.php and changing this line (near the top of the file):

$topic = optional_param('topic', -1, PARAM_INT);

to:

$topic = optional_param('topic', 1, PARAM_INT);

(Change the number from -1 to 1)

That should display the first topic by default for all courses in topic format.

Simon

 

??
Re: Topic format course FORCE collpased display
?? 发表于 2011年03月29日 Tuesday 17:50
 

that fixed it to the way we wanted big grin 

thanks for the tip

??
Re: Topic format course FORCE collpased display
?? 发表于 2011年04月3日 Sunday 19:39
 

Ive noticed that (with this code changed) when you click to view a resource/activity (which take you to that page) and then go back to the course page, it jumps you back to the first topic again NOT the current topic you were viewing previously when you click the resource/activity link.

is there a way to keep it collapsed, but make it jump you back to the current topic you were viewing and not the first one each time?

 

 

CogginsSimon
Re: Topic format course FORCE collpased display
CogginsSimon 发表于 2011年04月4日 Monday 14:17
小组 Totara

Looks like you also need to modify this line (line 31):

if ($topic != -1) {

and change it to 1 instead of -1 too:

if ($topic != 1) {

 

Simon

 

??
Re: Topic format course FORCE collpased display
?? 发表于 2011年04月4日 Monday 18:48
 

thanks, that worked. big grin

??
Re: Topic format course FORCE collpased display
?? 发表于 2011年04月4日 Monday 20:28
 

found a problem with changing that last value:

now if you're viewing topic 2 onwards you can't use the jump drop-down menu to jump back to topic 1...

sad

 

??
Re: Topic format course FORCE collpased display
?? 发表于 2011年04月10日 Sunday 21:47
 

found a problem with changing that last value:

now if you're viewing topic 2 onwards you can't use the jump drop-down menu to jump back to topic 1...

sad

CogginsSimon
Re: Topic format course FORCE collpased display
CogginsSimon 发表于 2011年04月10日 Sunday 22:15
小组 Totara

Hi Ira,

Sorry about that. I've had another look and I think I've got it this time ;-)

Undo those two changes you made and instead, change:

$displaysection = course_set_display($course->id, 0);

to:

$displaysection = course_set_display($course->id, 1);

(that's line 37 in my code)

Simon

??
Re: Topic format course FORCE collpased display
?? 发表于 2011年04月10日 Sunday 23:07
 

i think we finally got it.

works alright so far approve

thanks again