Hey,
So the goal i have is to make my own html block. Its only purpose would be to list all the courses full name where the searched user is a teacher. This would help my fellow editors, who wants to filter by teacher so they can find the problem more faster and easily.
There would be an input search bar where you can type a name, and after a submit pressed, it would list out the courses' full name.
I'm really a newbie when it comes to moodle development, so its a bit rough for me, started my own, and successfully printed out an sql select but its a bit more complicated.
Example of the end product:
- Search for a teachers name
- Get a list for the courses he/she has, and where he/she has teacher role.
- Able to click on the listed course name to navigate to the searched course.
Environment: 3.9. Moodle
Theme : Moove
Picture of the basic concept is attached. I hope its understandable.
SQL what i used and worked with, only its a bit too much information (easily fixed), i just need to make it work search by the input.
/////////////////////////////////////////////////////////////////////
SELECT distinct c.id, c.fullname, u.username, u.firstname, u.lastname FROM mdl_course as c, mdl_role_assignments AS ra, mdl_user AS u, mdl_context AS ct WHERE c.id = ct.instanceid AND ra.roleid =3 AND ra.userid = u.id AND ct.id = ra.contextid;//////////////////////////////////////////////////////////////////////////////////////////
Any help is very well appreciated,
Sincerely,
Richard Major