Home > Mobile >  Do I need to develope a new function in MOODLE to get a web service that return the list of session
Do I need to develope a new function in MOODLE to get a web service that return the list of session

Time:11-09

so I'm using MOODLE 3.11.3 (Build: 20211019) and we exposed a number of web services. we need to use the attendance plugin and I'd like very much to get the list of sessions by course, is that possible without touching the code

CodePudding user response:

In Moodle, the web service functions are usually in externallib.php or pluginname\classes\external.php

So for the attendance activity they are in

https://github.com/danmarsden/moodle-mod_attendance/blob/MOODLE_311_STABLE/externallib.php

There are a couple of related functions like get_courses_with_today_sessions() and get_session() but not a list of sessions for a course.

If you have access to the database, then you could use something like

SELECT *
FROM {course} c
JOIN {attendance} a ON a.course = c.id
JOIN {attendance_sessions} s ON s.attendanceid = a.id
  • Related