1. Add two fields to the quiz table: "Final_quiz", "Send_email"
2. Add the same two fields to the quiz mod.html and edit.php script so that the teacher can designate if this is the final quiz and they want email to be sent.
Here's where I get lost. Where is the sql function that stores the quiz grade? I'm thinking that here is where I can add a call to a function to send an email of course completion.
Any ideas would be greatly appreciated.
thanks,
Luis
if I have well understood your problem here is a suggestion:
In the file moodle/mod/quiz/attempt.php around line 224 you have:
if ($quiz->grade) { print_heading("$strscore: $result->sumgrades/$quiz->sumgrades ($result->percentage %)"); print_heading("$strgrade: $result->grade/$quiz->grade"); }
wich display the result immediatly after an attempt.
You may test the value of $result->percentage and adjust your email message correspondingly.
The function email_to_user($USER, $teacher, $subject, $message); defined in moodle/lib/moodlelib.php can be use to send the email with the appropriate message.
I hope it may help.
Have a good hack and an happy new year,
Bernard
The above code mentions print_heading(), which does print directly to STDOUT (I presume). But if you want to send an email, you need that output in a variable to pass it on to email_to_user().
Is there a standard php way to achieve that?
I need to send out an email on quiz completion/pass and am lost as to how to do this. I am new ;) If anyone could offer detailed steps on how to implement this it would be helpful.
---------------------------------------------
Now, ultimately here is my scenario:
Upon registering, the student provides their state instead of city (table field has not been changed from original setting).
Upon passing a final quiz, i need to send out an email notification to 1 of 50 representatives. The representative is determined by the state they entered at registration.
Is that possible?
---------------------------------------------
If I was not able to automate the process of sending email to each rep, I would have no problem having results sent to one email with User Name, State and Email information included, and then manually distributing to reps.
Thanks to all - Moodle rocks!!
- Anna