Learning From Moodle

Attending online classes was a new experience for my children and us as parents. The way we used to follow up their progress or check if they already submitted their homework had changed. On the first grades, they usually had a notebook where the teacher asked them to record all the homework they had to do, now the list is already in Moodle, the learning management system that the academy chose.

Problem

With the notebook approach, it was just one place where to find a list of pending homework and the due dates, however with Moodle, I had to look course by course and see what is pending. I wanted a one-page list where to see all those pending assignments, forum participation and quizzes but could not find a Moodle module that does that.

Solution

Create a program that uses the Moodle API to:

  • Retrieve the list of pending assignments.
  • Scan the open forums and see if the student already post a comment.
  • Check if the open quizes have already one attempt and identify which was completed based on the grading status.
  • Record all those findings in a table for caching purposes.

To create such list, our program needs access to the student’s information stored in Moodle and that is why it needs the student’s username and password to create a key (API) that will use every time the program have to refresh information from Moodle, the username and password is not stored, only the key but both have the same permissions.

To build this program I used these components:

  • Linux: As the operating system of the laptop where all the rest is running.
  • Apache: The web server software that communicates with your browser.
  • PHP: An easy to learn script language I learn in the early 00’s.
  • Yii2 Framework: A code template that is old enought so I could find examples and forums with answer to common errors.
  • Bootstrap: This used to beautify the webiste look, know as the frontend. It is a set of cascade style sheets and javascript well documented and widely used.
  • Visual Studio Code: I used only as a code editor and liked the code highlighting.
  • Postgres: This a robust database engine used to storing the records retrieved from Moodle.
  • Datagrip: A visual tool to manage Postgresql and other databases. Creating tables and testing SQL statements was easy doing it here.
  • Moodle API: This is the language used by my program to communicate with Moodle and request the information. I took me time to realize that the API documention is built-in Moodle, these are the methods used:
    • mod_assign_get_assignments
    • core_completion_get_activities_completion_status
    • mod_assign_get_submission_status
    • core_course_get_courses_by_field
    • mod_forum_get_forums_by_courses
    • mod_forum_get_forum_discussions
    • core_filters_get_available_in_context
    • core_grades_grader_gradingpanel_point_fetch
    • mod_quiz_get_quizzes_by_courses
    • mod_quiz_get_user_best_grade

The outcome can be seen at https://app.smartparent.online and currently only works with my kids academy’s Moodle but it may work with any other Moodle that have the API activated. You can tell if it is active if the mobile Moodle app can connect to it, this program does the same type of connections. The picture below is an screenshot of the parent’s view:

SmartParent Sreenshots

Mistakes

Since this program stores the students’ courses status for caching purposes, this may not be an option for some who are careful with their personal data. I did this tool for me and if someone wants to use it regardless the permissions they have to grant, write me an email. A proper approach would be creating a mobile app or a module for Moodle.

Conclusion

By analyzing my children’s data retrieved from Moodle, I learnt that I could create a table showing how many assignments per day are done. Knowing that information, I greet or encourage my children to keep up with their homework, so this is not only to see what was pending but to identify when is their most busy time submitting their assignments.

Regardless the vast documentation, it was easier to find the name of the API method I needed by looking the web server logs while accessing the information I want from the Moodle mobile app, so if the mobile app can get that info, it must be possible from my program.

It is possible that there is a Moodle module that already does this and I did not searched enough so I ended up reinventing the wheel, anyway it was fun and had the chance to update my software development skills.

Thanks for reading until here!