Upon discussing with my co-worker Jeff H, a SchoolTool support person, there is no existing solution to automatically pull grade data from moodle and copy it into SchoolTool. A couple immediate questions that came to my mind where
yes - Moodle can share its grade data, no problem. I have actually written similar code a few years back for another moodle customer. That customer is now using a different enrollment and authentication system, called Genius SIS, but I digress.
Some SQL to pull grade data from the moodle instance.
SELECT u.firstname AS 'f name' , u.lastname AS 'l name', c.fullname AS 'Course',
CASE WHEN gi.itemtype = 'Course'
THEN c.fullname + ' Course Total'
ELSE gi.itemname
END
AS 'Item Name', ROUND(gg.finalgrade) AS Score, ROUND(gg.rawgrademax) AS Max, ROUND(gg.finalgrade / gg.rawgrademax * 100) AS grade,
IF (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) > 65,'Yes' , 'No') AS Pass
FROM mdl_course AS c
JOIN mdl_context AS ctx ON c.id = ctx.instanceid
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id
JOIN mdl_user AS u ON u.id = ra.userid
JOIN mdl_grade_grades AS gg ON gg.userid = u.id
JOIN mdl_grade_items AS gi ON gi.id = gg.itemid
JOIN mdl_course_categories AS cc ON cc.id = c.category
#WHERE gi.courseid = c.id AND gi.itemname != 'Attendance'
ORDER BY `Name` ASC
I conceptualized these steps as 'proof of concept'
- create a php page that pulls the data and writes it to a CSV file
- Use the cron script to call the php file
- Send the CSV file to a shareable space
Reasons not to write a plugin or custom code to automatically write data to the schooltool gradebook.
1 - Its creates an inverted pyramid - where I may be the only one who can support the code. Not ideal. And Jeff said the the teachers in SchoolTool must still manually review and import data that has been sent by API calls - which makes sense. Before it appears in the gradebook. If the API changes - the database tables change their schema, at all, even a little, crash!! Boom !! - your tight little app now needs maintenance. I guess its like a lot of other situations, a customer wants something, you want to deliver it for them, its good service. BUT, should you? Is it a smart thing to do? Know the implications of building something like this. Think about 12 months from now, will it still work? Will you still be around to change and update - maintain it? Could someone else come up to speed on it?
Hmmm, always such an emphasis on the Gradebook. We could set this up and get it working, if we followed the API and if the API was realiable - there is not alot to it.
Such a nice blog. SMS API PHP you will be able to send messages to devices on other networks by using the PHP programming language.
ReplyDelete