I am trying to develop a block plugin for our moodle courses that will email all students every week who have not attended the course that week.
I have been able to create a block with a schedule task via the Task API.
The first problem I am running into, is how do I get the context of each block/course?
I tried using this code in task execute() function:
```global $COURSE;
$context = context_course::instance($COURSE->id);```
But this can't find the class `context_course` when it runs.
Any idea how I could achieve this?
Thanks.