Minor - fix PHP errors from exercises in 1.11.x

pull/2715/head
Julio Montoya 7 years ago
parent 628c083f3a
commit e2c5b5a320
  1. 4
      main/exercise/exercise_report.php
  2. 20
      main/inc/lib/exercise.lib.php
  3. 19
      src/CoreBundle/Resources/views/Mailer/Exercise/result_alert_body.html.twig

@ -198,7 +198,7 @@ if (isset($_REQUEST['comments']) &&
} }
for ($i = 0; $i < $loop_in_track; $i++) { for ($i = 0; $i < $loop_in_track; $i++) {
$my_marks = isset($_POST['marks_'.$array_content_id_exe[$i]]) ? $_POST['marks_'.$array_content_id_exe[$i]] : ''; $my_marks = isset($_POST['marks_'.$array_content_id_exe[$i]]) ? $_POST['marks_'.$array_content_id_exe[$i]] : 0;
$my_comments = ''; $my_comments = '';
if (isset($_POST['comments_'.$array_content_id_exe[$i]])) { if (isset($_POST['comments_'.$array_content_id_exe[$i]])) {
$my_comments = $_POST['comments_'.$array_content_id_exe[$i]]; $my_comments = $_POST['comments_'.$array_content_id_exe[$i]];
@ -216,6 +216,7 @@ if (isset($_REQUEST['comments']) &&
['question_id = ? AND exe_id = ?' => [$my_questionid, $id]] ['question_id = ? AND exe_id = ?' => [$my_questionid, $id]]
); );
$sessionId = api_get_session_id();
$params = [ $params = [
'exe_id' => $id, 'exe_id' => $id,
'question_id' => $my_questionid, 'question_id' => $my_questionid,
@ -223,6 +224,7 @@ if (isset($_REQUEST['comments']) &&
'insert_date' => api_get_utc_datetime(), 'insert_date' => api_get_utc_datetime(),
'author' => api_get_user_id(), 'author' => api_get_user_id(),
'teacher_comment' => $my_comments, 'teacher_comment' => $my_comments,
'session_id' => $sessionId
]; ];
Database::insert($TBL_TRACK_ATTEMPT_RECORDING, $params); Database::insert($TBL_TRACK_ATTEMPT_RECORDING, $params);
} }

@ -1,6 +1,7 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use ChamiloSession as Session; use ChamiloSession as Session;
/** /**
@ -4943,21 +4944,24 @@ EOT;
public static function getEmailNotification($senderId, $course_info, $test, $url) public static function getEmailNotification($senderId, $course_info, $test, $url)
{ {
$teacher_info = api_get_user_info($senderId); $teacher_info = api_get_user_info($senderId);
$from_name = api_get_person_name( $fromName = api_get_person_name(
$teacher_info['firstname'], $teacher_info['firstname'],
$teacher_info['lastname'], $teacher_info['lastname'],
null, null,
PERSON_NAME_EMAIL_ADDRESS PERSON_NAME_EMAIL_ADDRESS
); );
$view = new Template('', false, false, false, false, false, false); $params = [
$view->assign('course_title', Security::remove_XSS($course_info['name'])); 'course_title' => Security::remove_XSS($course_info['name']),
$view->assign('test_title', Security::remove_XSS($test)); 'test_title' => Security::remove_XSS($test),
$view->assign('url', $url); 'url' => $url,
$view->assign('teacher_name', $from_name); 'teacher_name' => $fromName,
$template = $view->get_template('mail/exercise_result_alert_body.tpl'); ];
return $view->fetch($template); return Container::getTwig()->render(
'ChamiloCoreBundle:Mailer:Exercise/result_alert_body.html.twig',
$params
);
} }
/** /**

@ -0,0 +1,19 @@
<div id="email-message" style="padding-top:10px; padding-bottom:10px;">
<p><strong>{{ 'DearStudentEmailIntroduction'|get_lang }}</strong> {{ 'AttemptVCC'|get_lang }} </p>
<div style="border-color: #bce8f1; padding: 15px; background-color: #d9edf7; margin-bottom: 15px; font-size: 16px; color:#31708f;">
<p>
<strong>{{ 'CourseName'|get_lang }}: </strong>
{{ course_title }}
<br>
<strong>{{ 'Exercise'|get_lang }}: </strong>
{{ test_title }}
</p>
</div>
<p>{{ 'ClickLinkToViewComment'|get_lang }}</p>
<p><a style="font-weight: bold; color: #2BA6CB;" href="{{ url }}">{{ url }}</a></p>
<div style="text-align: right;">
<p><strong>{{ 'Regards'|get_lang }}</strong><br>
{{ teacher_name }}</p>
</div>
</div>
Loading…
Cancel
Save