/** * sends an email to the teachers of the course where the given feedback is placed. * * @global object * @uses FORMAT_PLAIN * @param object $cm the coursemodule-record * @param object $feedback * @param object $course * @return void */ function feedback_send_email_anonym($cm, $feedback, $course) { global $CFG; if ($feedback->email_notification == 0) { // No need to do anything return; } $teachers = feedback_get_receivemail_users($cm->id); if ($teachers) { $strfeedbacks = get_string('modulenameplural', 'feedback'); $strfeedback = get_string('modulename', 'feedback'); $strcompleted = get_string('completed', 'feedback'); $printusername = get_string('anonymous_user', 'feedback'); foreach ($teachers as $teacher) { $info = new stdClass(); $info->username = $printusername; $info->feedback = format_string($feedback->name, true); $info->url = $CFG->wwwroot.'/mod/feedback/show_entries_anonym.php?id='.$cm->id; $postsubject = $strcompleted.': '.$info->username.' -> '.$feedback->name; $posttext = feedback_send_email_text($info, $course); if ($teacher->mailformat == 1) { $posthtml = feedback_send_email_html($info, $course, $cm); } else { $posthtml = ''; } $eventdata = new stdClass(); $eventdata->name = 'submission'; $eventdata->component = 'mod_feedback'; $eventdata->userfrom = $teacher; $eventdata->userto = $teacher; $eventdata->subject = $postsubject; $eventdata->fullmessage = $posttext; $eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessagehtml = $posthtml; $eventdata->smallmessage = ''; message_send($eventdata); } } }
/** * sends an email to the teachers of the course where the given feedback is placed. * @param object $cm the coursemodule-record * @param $feedback * @param $course * @return void */ function feedback_send_email_anonym($cm, $feedback, $course) { global $CFG; if ($feedback->email_notification == 0) { // No need to do anything return; } // $teachers = get_course_teachers($course->id); $teachers = feedback_get_receivemail_users($cm->id); if ($teachers) { $strfeedbacks = get_string('modulenameplural', 'feedback'); $strfeedback = get_string('modulename', 'feedback'); $strcompleted = get_string('completed', 'feedback'); $printusername = get_string('anonymous_user', 'feedback'); foreach ($teachers as $teacher) { unset($info); $info->username = $printusername; $info->feedback = format_string($feedback->name, true); $info->url = $CFG->wwwroot . '/mod/feedback/show_entries_anonym.php?id=' . $cm->id; $postsubject = $strcompleted . ': ' . $info->username . ' -> ' . $feedback->name; $posttext = feedback_send_email_text($info, $course); $posthtml = $teacher->mailformat == 1 ? feedback_send_email_html($info, $course, $cm) : ''; @email_to_user($teacher, $teacher, $postsubject, $posttext, $posthtml); } } }