Display data on Course Home Page

Display data on Course Home Page

by JJ Booth -
Number of replies: 4

I'm in the process of developing my first plugin for Moodle. I've settled on Activity Module since I want this to appear on the Course Home page.

Right now my biggest problem is how to display data on the main course page (basically where the description of the module appears).

All of my testing so far puts data on a separate page, and that's just not what I want.

This data will be unique to each user, so I can't just set the description once and forget about it. (I will be populating this field with a list of items pulled from an external database, but let's not get ahead of ourselves!)

I just need a way to display text generated on-the-fly from code on the Course Home page!

Help!


Attachment plugin_two.PNG
Average of ratings: -
In reply to JJ Booth

Re: Display data on Course Home Page

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi JJ,

base your plugin on the Label type activity module instead of the Page. Then your information will appear on the course page instead of a separate page.

Best regards,

Michael
Average of ratings: Useful (1)
In reply to Michael Milette

Re: Display data on Course Home Page

by JJ Booth -
Hi Michael,

Yes I know it's been a year but I'm still working on this same problem!

Plugin Two (my plugin) is actually a clone of Label. It appears exactly where I want it to appear, but I have no idea where in the PHP to change what is displayed!

For example, I want to write custom PHP code and have it return information that is displayed the same way that label displays information.

Any ideas where I can turn for help with this?

-J.J.
In reply to JJ Booth

Re: Display data on Course Home Page

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi JJ,

Another option might be to create a filter plugin and just put its tag in a regular label activity.

Here is an example of a very simple filter that I wrote a few years ago whose functionality has since been integrated into FilterCodes. You are welcome to adapt it to your needs:

LangX filter for Moodle
https://github.com/michael-milette/moodle-filter_langx

Hope you find this information helpful.

Best regards,

Michael Milette