This is a quick response to David’s post today. We are endeavoring to collaborate on the development of a Moodle block. A more detailed explanation can be found on David’s blog.
On my local Moodle installation I found that the following line didn’t work for the editing teacher at all so I changed it accordingly. This page has some more options we could try.
if ( has_capability( 'moodle/legacy:teacher', $context )) { $canview=1;
changed to
if ( has_capability( 'moodle/legacy:editingteacher', $context ) || has_capability( 'moodle/legacy:teacher', $context )) { $canview=1;
In response to David’s comment about PHP OO and a factory class. I think that is exactly what is required. Of course the learning curve is going to be rough.
Col, are you able to commit this change?