Hello,
I've been working on this since several days now. What I am planning to do, is add a functionnality that sends out emails to students 30, 20 and 2 days before their enrolement in a course ends.
This aims at warning them, so they can planify their work better. I'm quite a novice in Moodle developpment so I'd be happy if you could give me your point of view on what i'm doing.
****************************
- SQL request that gets, for each course enrolment : student id, course name and timestamp remaining before enrolment end. This query fills a table that contains all important info for emailing.
SELECT u.id as uid,
c.fullname as nom_cours,
(IF(ue.timeend!=0,ue.timeend-UNIX_TIMESTAMP(),0)) as tps_restant
FROM mdl_course c,
mdl_enrol e,
mdl_user_enrolments ue,
mdl_user u
WHERE u.id=ue.userid
AND c.id=e.courseid
AND e.id=ue.enrolid
****************************
- PHP code that converts timestamp into days. (or seconds in days actually). Thats the type of thing I am doing :
ceil(timestamp/86400);
****************************
- I'd like to make a CRON file (if that's the only solution) to check, every day in my table how many days are remaining for each enrolment, en send out emails if the remaining time of a student enrolement in a course is equal to 30, 20 or 2 days.
****************************
But I have no clue of how to make a CRON file... I've read some things like "it has to be deployed on the server via a terminal" or "Moodle has cran files that are used to execute other cron files" but I'm not sure where to start. If you've got any ideas, I'd be happy to hear them =D
Thanks a lot !
Cheers,
David
****************************