@@ 252-273 (lines=22) @@ | ||
249 | * @access public |
|
250 | * @return void |
|
251 | */ |
|
252 | function learner_completed_course( $status = 'in-progress', $user_id = 0, $course_id = 0, $comment_id = 0 ) { |
|
253 | ||
254 | ||
255 | if( 'complete' != $status ) { |
|
256 | return; |
|
257 | } |
|
258 | ||
259 | $send = false; |
|
260 | ||
261 | if( isset( Sensei()->settings->settings['email_learners'] ) ) { |
|
262 | if( in_array( 'learner-completed-course', (array) Sensei()->settings->settings['email_learners'] ) ) { |
|
263 | $send = true; |
|
264 | } |
|
265 | } else { |
|
266 | $send = true; |
|
267 | } |
|
268 | ||
269 | if( $send ) { |
|
270 | $email = $this->emails['learner-completed-course']; |
|
271 | $email->trigger( $user_id, $course_id ); |
|
272 | } |
|
273 | } |
|
274 | ||
275 | /** |
|
276 | * Send email to teacher on course completion |
|
@@ 281-302 (lines=22) @@ | ||
278 | * @access public |
|
279 | * @return void |
|
280 | */ |
|
281 | function teacher_completed_course( $status = 'in-progress', $learner_id = 0, $course_id = 0, $comment_id = 0 ) { |
|
282 | ||
283 | ||
284 | if( 'complete' != $status ) { |
|
285 | return; |
|
286 | } |
|
287 | ||
288 | $send = false; |
|
289 | ||
290 | if( isset( Sensei()->settings->settings['email_teachers'] ) ) { |
|
291 | if( in_array( 'teacher-completed-course', (array) Sensei()->settings->settings['email_teachers'] ) ) { |
|
292 | $send = true; |
|
293 | } |
|
294 | } else { |
|
295 | $send = true; |
|
296 | } |
|
297 | ||
298 | if( $send ) { |
|
299 | $email = $this->emails['teacher-completed-course']; |
|
300 | $email->trigger( $learner_id, $course_id ); |
|
301 | } |
|
302 | } |
|
303 | ||
304 | /** |
|
305 | * Send email to teacher on course beginning |
|
@@ 367-387 (lines=21) @@ | ||
364 | * @param int $passmark |
|
365 | * @param string $quiz_grade_type |
|
366 | */ |
|
367 | function teacher_quiz_submitted( $learner_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0, $quiz_grade_type = 'manual' ) { |
|
368 | ||
369 | $send = false; |
|
370 | ||
371 | // Only trigger if the quiz was marked as manual grading, or auto grading didn't complete |
|
372 | if( 'manual' == $quiz_grade_type || is_wp_error( $grade ) ) { |
|
373 | if( isset( Sensei()->settings->settings['email_teachers'] ) ) { |
|
374 | if( in_array( 'teacher-quiz-submitted', (array) Sensei()->settings->settings['email_teachers'] ) ) { |
|
375 | $send = true; |
|
376 | } |
|
377 | } else { |
|
378 | $send = true; |
|
379 | } |
|
380 | ||
381 | if( $send ) { |
|
382 | $email = $this->emails['teacher-quiz-submitted']; |
|
383 | $email->trigger( $learner_id, $quiz_id ); |
|
384 | } |
|
385 | ||
386 | } |
|
387 | } |
|
388 | ||
389 | /** |
|
390 | * Send email to teacher when a new private message is received |