Add new configuration parameter "send_score_in_exam_notification_mail_to_manager"

See BT#11918
remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 79f8dee67a
commit 03a24ebd34
  1. 64
      main/exercise/exercise.class.php
  2. 26
      main/inc/lib/exercise.lib.php
  3. 2
      main/install/configuration.dist.php

@ -5241,13 +5241,19 @@ class Exercise
/**
* Sends a notification when a user ends an examn
*
* @param integer $exe_id
* @param array $question_list_answers
* @param string $origin
* @param int $exe_id
* @param float $score
* @param float $weight
* @return bool
*/
public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id)
public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id, $score, $weight)
{
if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
return null;
if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
return false;
}
// Email configuration settings
$courseCode = api_get_course_id();
$courseInfo = api_get_course_info($courseCode);
@ -5267,26 +5273,36 @@ class Exercise
. '&action=qualify';
$user_info = api_get_user_info(api_get_user_id());
$scoreLabel = '';
if (api_get_configuration_value('send_score_in_exam_notification_mail_to_manager') == true) {
$scoreLabel = ExerciseLib::show_score($score, $weight, false, true);
$scoreLabel = "<tr>
<td>".get_lang('Score')."</td>
<td>&nbsp;$scoreLabel</td>
</tr>";
}
$msg = get_lang('ExerciseAttempted').'<br /><br />'
.get_lang('AttemptDetails').' : <br /><br />'.
'<table>'
.'<tr>'
.'<td><em>'.get_lang('CourseName').'</em></td>'
.'<td>&nbsp;<b>#course#</b></td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('TestAttempted').'</td>'
.'<td>&nbsp;#exercise#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentName').'</td>'
.'<td>&nbsp;#firstName# #lastName#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentEmail').'</td>'
.'<td>&nbsp;#email#</td>'
.'</tr>'
.'</table>';
.get_lang('AttemptDetails').' : <br /><br />
<table>
<tr>
<td><em>'.get_lang('CourseName').'</em></td>
<td>&nbsp;<b>#course#</b></td>
</tr>
<tr>
<td>'.get_lang('TestAttempted').'</td>
<td>&nbsp;#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>&nbsp;#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>&nbsp;#email#</td>
</tr>
'.$scoreLabel.'
</table>';
$open_question_list = null;
$msg = str_replace("#email#", $user_info['email'], $msg);
@ -5333,7 +5349,7 @@ class Exercise
*
* @param integer $exe_id
*/
function send_notification_for_open_questions($question_list_answers, $origin, $exe_id)
public function send_notification_for_open_questions($question_list_answers, $origin, $exe_id)
{
if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
return null;

@ -3771,19 +3771,18 @@ HOTSPOT;
);
}
// Send notification ..
if (!api_is_allowed_to_edit(null, true) && !api_is_excluded_user_type()
// Send notification
if (!api_is_allowed_to_edit(null, true) &&
!api_is_excluded_user_type()
) {
if (api_get_course_setting(
'email_alert_manager_on_new_quiz'
) == 1
) {
$objExercise->send_mail_notification_for_exam(
$question_list_answers,
$origin,
$exe_id
);
}
$objExercise->send_mail_notification_for_exam(
$question_list_answers,
$origin,
$exe_id,
$total_score,
$total_weight
);
$objExercise->send_notification_for_open_questions(
$question_list_answers,
$origin,
@ -3810,8 +3809,7 @@ HOTSPOT;
$score,
$weight,
$check_pass_percentage = false
)
{
) {
$ribbon = '<div class="title-score">';
if ($check_pass_percentage) {
$is_success = self::is_success_exercise_result(

@ -261,4 +261,6 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
//$_configuration['user_portal_load_notification_by_ajax'] = false;
// When exporting a LP, all files and folders in the same path of an html will be exported too.
//$_configuration['add_all_files_in_lp_export'] = false;
// Send exercise student score to manager in email notification
//$_configuration['send_score_in_exam_notification_mail_to_manager'] = false;

Loading…
Cancel
Save