How to use javascript on course main page

How to use javascript on course main page

by Murilo Baptista -
Number of replies: 7

Hello, I'm making a map so the student can see the progress in the course and the student can go to the next topic with an input and instead of going to another page how a normal activity module does I wanted the map to stay on the course main page, here is what I've done in the activity module and where I wanted the map to be at:



Where I wanted the map to be at:



What I want to ask is if there is a way to do that and how to do it, if I change the renderer it is possible to do that or I need to make a custom theme or what should I do?

Average of ratings: -
In reply to Murilo Baptista

Re: How to use javascript on course main page

by Murilo Baptista -
The idea that I had was that the student would be able, primarily to go through the map to open the activities he wants and I only wanted this because the subject of the course is gaming development and I thought the map can help the student get a little more immersed on the subject. The javascript still has a lot of work to be done but where I get many problems is working with moodle.I tried making this work with block plugin but my theme doesn't support blocks on the content region and now I'm wondering if I have to make a course format to the map to the header or the top of the content. Thanks.


In reply to Murilo Baptista

Re: How to use javascript on course main page

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

A course format would probably be the correct way to do this, but it would be a lot of work too. And I have never written one.

Just another option, you might start by cloning the label module to something new, and add all your javascript fancy stuff to that. Then add the new  label to the course page. Optionally using stealth mode to hide the activities from displaying normally on the same page.

In reply to Justin Hunt

Re: How to use javascript on course main page

by Murilo Baptista -

Thank you Justin for your awnser you saved me a lot of time, stealth mode is really useful and I didn't know it existed now I'm looking through the label module to see how it outputs on the course page.

In reply to Murilo Baptista

Re: How to use javascript on course main page

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

I have not tried this myself, but another user posted about their custom label plugin which does some fancy things here.

https://moodle.org/mod/forum/discuss.php?d=375398

Maybe its useful.

In reply to Justin Hunt

Re: How to use javascript on course main page

by Murilo Baptista -

Thanks a lot Justin with your help I was able to make it work I used my js inside the moustache though I don't if there is a better way, this is how it looks now. I still have a lot of work on the map to do but at least now I know I can show it where I want smile 

Average of ratings: Useful (1)
In reply to Murilo Baptista

Re: How to use javascript on course main page

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Murilo,

I have not tried it myself, but I wonder if the Taskchain plugin can do what you are trying to do?

Average of ratings: Useful (1)
In reply to AL Rachels

Re: How to use javascript on course main page

by Murilo Baptista -

I don't know but I was able to make it work with that Unilabel plugin on Justin's awnser.