Skip to content

Commit

Permalink
Improve mail format for test submission by user - refs CT#7885
Browse files Browse the repository at this point in the history
  • Loading branch information
ywarnier committed Oct 13, 2015
1 parent d804ede commit 3c6c5bc
Showing 1 changed file with 83 additions and 86 deletions.
169 changes: 83 additions & 86 deletions main/exercice/exercise.class.php
Expand Up @@ -4035,26 +4035,26 @@ public function send_mail_notification_for_exam($question_list_answers, $origin,
. '&action=qualify';
$user_info = api_get_user_info(api_get_user_id());

$msg = '<p>'.get_lang('ExerciseAttempted').' :</p>
<p>'.get_lang('AttemptDetails').' : </p>
<table class="data_table">
<tr>
<td><h3>'.get_lang('CourseName').'</h3></td>
<td><h3>#course#</h3></td>
</tr>
<tr>
<td>'.get_lang('TestAttempted').'</span></td>
<td>#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>#email#</td>
</tr>
</table>';
$msg = get_lang('ExerciseAttempted').'<br /><br />'
.get_lang('AttemptDetails').' : <br /><br />'.
'<table>'
.'<tr>'
.'<td><em>'.get_lang('CourseName').'</em></td>'
.'<td><b>#course#</b></td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('TestAttempted').'</td>'
.'<td>#exercise#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentName').'</td>'
.'<td>#firstName# #lastName#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentEmail').'</td>'
.'<td>#email#</td>'
.'</tr>'
.'</table>';
$open_question_list = null;

$msg = str_replace("#email#", $user_info['email'], $msg);
Expand All @@ -4064,8 +4064,7 @@ public function send_mail_notification_for_exam($question_list_answers, $origin,
$msg = str_replace("#course#", $courseInfo['name'], $msg1);

if ($origin != 'learnpath') {
$msg.= get_lang('ClickToCommentAndGiveFeedback').', <br />
<a href="#url#">#url#</a>';
$msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
Expand Down Expand Up @@ -4111,48 +4110,48 @@ function send_notification_for_open_questions($question_list_answers, $origin, $
. '&action=qualify';
$user_info = api_get_user_info(api_get_user_id());

$msg = '<p>'.get_lang('OpenQuestionsAttempted').' :</p>
<p>'.get_lang('AttemptDetails').' : </p>
<table class="data_table">
<tr>
<td><h3>'.get_lang('CourseName').'</h3></td>
<td><h3>#course#</h3></td>
</tr>
<tr>
<td>'.get_lang('TestAttempted').'</span></td>
<td>#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>#mail#</td>
</tr>
</table>';
$msg = get_lang('OpenQuestionsAttempted').'<br /><br />'
.get_lang('AttemptDetails').' : <br /><br />'
.'<table>'
.'<tr>'
.'<td><em>'.get_lang('CourseName').'</em></td>'
.'<td><b>#course#</b></td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('TestAttempted').'</td>'
.'<td>#exercise#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentName').'</td>'
.'<td>#firstName# #lastName#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentEmail').'</td>'
.'<td>#mail#</td>'
.'</tr>'
.'</table>';
$open_question_list = null;
foreach ($question_list_answers as $item) {
$question = $item['question'];
$answer = $item['answer'];
$answer_type = $item['answer_type'];

if (!empty($question) && !empty($answer) && $answer_type == FREE_ANSWER) {
$open_question_list.='
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>
<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>
</tr>
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>
<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>
</tr>';
$open_question_list .=
'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>'
.'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>'
.'</tr>'
.'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>'
.'<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>'
.'</tr>';
}
}

if (!empty($open_question_list)) {
$msg .= '<p><br />'.get_lang('OpenQuestionsAttemptedAre').' :</p>
<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
$msg .= '<p><br />'.get_lang('OpenQuestionsAttemptedAre').' :</p>'.
'<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
$msg .= $open_question_list;
$msg .= '</table><br />';

Expand All @@ -4164,8 +4163,7 @@ function send_notification_for_open_questions($question_list_answers, $origin, $
$msg = str_replace("#course#", $course_info['name'],$msg1);

if ($origin != 'learnpath') {
$msg .= get_lang('ClickToCommentAndGiveFeedback').', <br />
<a href="#url#">#url#</a>';
$msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
Expand Down Expand Up @@ -4215,39 +4213,39 @@ function send_notification_for_oral_questions($question_list_answers, $origin, $
$answer_type = $item['answer_type'];

if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) {
$oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>
<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>
</tr>
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>
<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>
</tr></table>';
$oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
.'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>'
.'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>'
.'</tr>'
.'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>'
.'<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>'
.'</tr></table>';
}
}

if (!empty($oral_question_list)) {
$msg = '<p>'.get_lang('OralQuestionsAttempted').' :</p>
<p>'.get_lang('AttemptDetails').' : </p>
<table class="data_table">
<tr>
<td><h3>'.get_lang('CourseName').'</h3></td>
<td><h3>#course#</h3></td>
</tr>
<tr>
<td>'.get_lang('TestAttempted').'</span></td>
<td>#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>#mail#</td>
</tr>
</table>';
$msg = get_lang('OralQuestionsAttempted').'<br /><br />
'.get_lang('AttemptDetails').' : <br /><br />'
.'<table>'
.'<tr>'
.'<td><em>'.get_lang('CourseName').'</em></td>'
.'<td><b>#course#</b></td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('TestAttempted').'</td>'
.'<td>#exercise#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentName').'</td>'
.'<td>#firstName# #lastName#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentEmail').'</td>'
.'<td>#mail#</td>'
.'</tr>'
.'</table>';
$msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />';
$msg1 = str_replace("#exercise#", $this->exercise, $msg);
$msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
Expand All @@ -4256,8 +4254,7 @@ function send_notification_for_oral_questions($question_list_answers, $origin, $
$msg = str_replace("#course#", $course_info['name'], $msg1);

if ($origin != 'learnpath') {
$msg.= get_lang('ClickToCommentAndGiveFeedback').', <br />
<a href="#url#">#url#</a>';
$msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
Expand Down

0 comments on commit 3c6c5bc

Please sign in to comment.