I was unsure of what would be an appropriate subject for this but I hope that someone can help.
I have a scenario where I want an admin to be able to add images for each activity in the course settings.
Under the course format section, I have a file manager where a user can upload one image.
Then in my theme, I use the course_renderer.php file to customise the view of the course because I want the image to show up on there (note it's not a header or footer, it shows up for each activity). I'm doing it this way because as far as I've seen, there isn't really a way to override the course_renderer.php file from within a course format, hence doing that in my theme.
In the course_renderer.php, I added some HTML which will then put the image in for each activity. The problem here is that I've tried adding this "function MYPLUGIN_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())" in my course format lib.php, and also in my theme, however it never gets called and I can't figure out why, which means that the image never gets displayed.
To summarise the steps:
- User goes into course settings and uploads an image (this is done using my custom course format based and the topics format)
- My theme runs course_renderer.php and in "course_section_cm", it will call $fs = get_file_storage(); and all the rest of those functions to get the files and display the image for each activity
- The image then shows up for each activity on the view
It definitely gets the right image in the course renderer and it can make the URL, but it is not running the function mentioned above. Currently I am testing use "course" as my component and "format_custom" as the filearea.
I am using this to store my image (will edit to store for each activity) - https://moodle.org/mod/forum/discuss.php?d=255180
Does anyone have any ideas? Your help would be appreciated!