Minor - Format code - refs #8237

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent a82e76b766
commit 2a5dc9d4d3
  1. 175
      main/inc/lib/exercise.lib.php

@ -16,7 +16,7 @@ class ExerciseLib
/** /**
* Shows a question * Shows a question
* *
* @param int $questionId question id * @param int $questionId $questionId question id
* @param bool $only_questions if true only show the questions, no exercise title * @param bool $only_questions if true only show the questions, no exercise title
* @param bool $origin i.e = learnpath * @param bool $origin i.e = learnpath
* @param string $current_item current item from the list of questions * @param string $current_item current item from the list of questions
@ -24,9 +24,10 @@ class ExerciseLib
* @param bool $freeze * @param bool $freeze
* @param array $user_choice * @param array $user_choice
* @param bool $show_comment * @param bool $show_comment
* @param bool $exercise_feedback * @param null $exercise_feedback
* @param bool $show_answers * @param bool $show_answers
* */ * @return bool|int
*/
public static function showQuestion( public static function showQuestion(
$questionId, $questionId,
$only_questions = false, $only_questions = false,
@ -38,7 +39,8 @@ class ExerciseLib
$show_comment = false, $show_comment = false,
$exercise_feedback = null, $exercise_feedback = null,
$show_answers = false $show_answers = false
) { )
{
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
// Change false to true in the following line to enable answer hinting // Change false to true in the following line to enable answer hinting
$debug_mark_answer = $show_answers; $debug_mark_answer = $show_answers;
@ -110,7 +112,7 @@ class ExerciseLib
<div class="clearfix"> <div class="clearfix">
<ul class="exercise-draggable-answer ui-helper-reset ui-helper-clearfix">'; <ul class="exercise-draggable-answer ui-helper-reset ui-helper-clearfix">';
} else { } else {
$s .= '<div id="drag'.$questionId.'_question" class="drag_question"> $s .= '<div id="drag' . $questionId . '_question" class="drag_question">
<table class="data_table">'; <table class="data_table">';
} }
@ -157,7 +159,7 @@ class ExerciseLib
} elseif ($answerType == FREE_ANSWER) { } elseif ($answerType == FREE_ANSWER) {
$fck_content = isset($user_choice[0]) && !empty($user_choice[0]['answer']) ? $user_choice[0]['answer'] : null; $fck_content = isset($user_choice[0]) && !empty($user_choice[0]['answer']) ? $user_choice[0]['answer'] : null;
$form = new FormValidator('free_choice_'.$questionId); $form = new FormValidator('free_choice_' . $questionId);
$config = array( $config = array(
'ToolbarSet' => 'TestFreeAnswer' 'ToolbarSet' => 'TestFreeAnswer'
); );
@ -187,7 +189,7 @@ class ExerciseLib
echo $nano->show_button(); echo $nano->show_button();
} }
$form = new FormValidator('free_choice_'.$questionId); $form = new FormValidator('free_choice_' . $questionId);
$config = array( $config = array(
'ToolbarSet' => 'TestFreeAnswer' 'ToolbarSet' => 'TestFreeAnswer'
); );
@ -270,9 +272,14 @@ class ExerciseLib
$attributes = array(); $attributes = array();
// Unique answer switch ($answerType) {
if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) { case UNIQUE_ANSWER:
//no break
case UNIQUE_ANSWER_NO_OPTION:
//no break
case UNIQUE_ANSWER_IMAGE:
$input_id = 'choice-' . $questionId . '-' . $answerId; $input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) { if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array( $attributes = array(
'id' => $input_id, 'id' => $input_id,
@ -347,12 +354,12 @@ class ExerciseLib
} else { } else {
$s .= $answer_input; $s .= $answer_input;
} }
break;
} elseif ( case MULTIPLE_ANSWER:
$answerType == MULTIPLE_ANSWER || //no break
$answerType == MULTIPLE_ANSWER_TRUE_FALSE || case MULTIPLE_ANSWER_TRUE_FALSE:
$answerType == GLOBAL_MULTIPLE_ANSWER //no break
) { case GLOBAL_MULTIPLE_ANSWER:
$input_id = 'choice-' . $questionId . '-' . $answerId; $input_id = 'choice-' . $questionId . '-' . $answerId;
$answer = Security::remove_XSS($answer, STUDENT); $answer = Security::remove_XSS($answer, STUDENT);
@ -448,7 +455,8 @@ class ExerciseLib
} }
$s .= '</tr>'; $s .= '</tr>';
} }
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { break;
case MULTIPLE_ANSWER_COMBINATION:
// multiple answers // multiple answers
$input_id = 'choice-' . $questionId . '-' . $answerId; $input_id = 'choice-' . $questionId . '-' . $answerId;
@ -493,8 +501,8 @@ class ExerciseLib
} else { } else {
$s .= $answer_input; $s .= $answer_input;
} }
break;
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
$s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
$my_choice = array(); $my_choice = array();
@ -543,7 +551,8 @@ class ExerciseLib
$s .= '</td>'; $s .= '</td>';
} }
$s .= '</tr>'; $s .= '</tr>';
} elseif ($answerType == FILL_IN_BLANKS) { break;
case FILL_IN_BLANKS:
// display the question, with field empty, for student to fill it, // display the question, with field empty, for student to fill it,
// or filled to display the answer in the Question preview of the exercice/admin.php page // or filled to display the answer in the Question preview of the exercice/admin.php page
$displayForStudent = true; $displayForStudent = true;
@ -586,7 +595,7 @@ class ExerciseLib
// may be "" if student viewed the question, but did not fill the blanks // may be "" if student viewed the question, but did not fill the blanks
$correctItem = $studentAnswerList[$i]; $correctItem = $studentAnswerList[$i];
} }
$attributes["style"] = "width:".$listAnswerInformations["tabinputsize"][$i]."px"; $attributes["style"] = "width:" . $listAnswerInformations["tabinputsize"][$i] . "px";
$answer .= FillBlanks::getFillTheBlankHtml($separatorStartRegexp, $separatorEndRegexp, $correctItemRegexp, $questionId, $correctItem, $attributes, $answer, $listAnswerInformations, $displayForStudent, $i); $answer .= FillBlanks::getFillTheBlankHtml($separatorStartRegexp, $separatorEndRegexp, $correctItemRegexp, $questionId, $correctItem, $attributes, $answer, $listAnswerInformations, $displayForStudent, $i);
} }
// display the last common word // display the last common word
@ -600,7 +609,7 @@ class ExerciseLib
// display the common words // display the common words
$answer .= $listAnswerInformations["commonwords"][$i]; $answer .= $listAnswerInformations["commonwords"][$i];
// display the blank word // display the blank word
$attributes["style"] = "width:".$listAnswerInformations["tabinputsize"][$i]."px"; $attributes["style"] = "width:" . $listAnswerInformations["tabinputsize"][$i] . "px";
$correctItem = $listAnswerInformations["tabwords"][$i]; $correctItem = $listAnswerInformations["tabwords"][$i];
$correctItemRegexp = $correctItem; $correctItemRegexp = $correctItem;
// replace / with \/ to allow the preg_replace bellow and all the regexp char // replace / with \/ to allow the preg_replace bellow and all the regexp char
@ -611,9 +620,8 @@ class ExerciseLib
$answer .= $listAnswerInformations["commonwords"][$i]; $answer .= $listAnswerInformations["commonwords"][$i];
} }
$s .= $answer; $s .= $answer;
break;
} elseif ($answerType == CALCULATED_ANSWER) { case CALCULATED_ANSWER:
/* /*
* In the CALCULATED_ANSWER test * In the CALCULATED_ANSWER test
* you mustn't have [ and ] in the textarea * you mustn't have [ and ] in the textarea
@ -759,7 +767,8 @@ class ExerciseLib
} else { } else {
$s .= $answer; $s .= $answer;
} }
} elseif ($answerType == MATCHING) { break;
case MATCHING:
// matching type, showing suggestions and answers // matching type, showing suggestions and answers
// TODO: replace $answerId by $numAnswer // TODO: replace $answerId by $numAnswer
@ -797,7 +806,7 @@ class ExerciseLib
$s .= '</select></div></td><td width="5%" class="separate">&nbsp;</td>'; $s .= '</select></div></td><td width="5%" class="separate">&nbsp;</td>';
$s .= '<td width="40%" valign="top" >'; $s .= '<td width="40%" valign="top" >';
if (isset($select_items[$lines_count])) { if (isset($select_items[$lines_count])) {
$s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'.&nbsp; '. $select_items[$lines_count]['answer'].'</p></div>'; $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'] . '.&nbsp; ' . $select_items[$lines_count]['answer'] . '</p></div>';
} else { } else {
$s .= '&nbsp;'; $s .= '&nbsp;';
} }
@ -820,7 +829,8 @@ class ExerciseLib
} // end if() } // end if()
$matching_correct_answer++; $matching_correct_answer++;
} }
} elseif ($answerType == DRAGGABLE) { break;
case DRAGGABLE:
if ($answerCorrect != 0) { if ($answerCorrect != 0) {
$parsed_answer = $answer; $parsed_answer = $answer;
/*$lines_count = ''; /*$lines_count = '';
@ -912,7 +922,8 @@ JAVASCRIPT;
$s .= '</li>'; $s .= '</li>';
} }
} elseif ($answerType == MATCHING_DRAGGABLE) { break;
case MATCHING_DRAGGABLE:
if ($answerId == 1) { if ($answerId == 1) {
echo $objAnswerTmp->getJs(); echo $objAnswerTmp->getJs();
} }
@ -1027,12 +1038,13 @@ HTML;
} }
$matching_correct_answer++; $matching_correct_answer++;
} }
break;
} }
} // end for() } // end for()
if ($show_comment) { if ($show_comment) {
$s .= '</table>'; $s .= '</table>';
} elseif( } elseif (
in_array( in_array(
$answerType, $answerType,
[ [
@ -1089,11 +1101,11 @@ HTML;
// destruction of the Question object // destruction of the Question object
unset($objQuestionTmp); unset($objQuestionTmp);
if ($origin != 'export') { if ($origin == 'export') {
echo $s;
} else {
return $s; return $s;
} }
echo $s;
} elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) { } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
global $exerciseId, $exe_id; global $exerciseId, $exe_id;
// Question is a HOT_SPOT // Question is a HOT_SPOT
@ -1127,7 +1139,7 @@ HTML;
echo " echo "
<script> <script>
$(document).on('ready', function () { $(document).on('ready', function () {
new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion" ) . "({ new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion") . "({
questionId: $questionId, questionId: $questionId,
exerciseId: $exerciseId, exerciseId: $exerciseId,
selector: '#hotspot-preview-$questionId', selector: '#hotspot-preview-$questionId',
@ -1197,7 +1209,6 @@ HTML;
HOTSPOT; HOTSPOT;
} }
$canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1');
$relPath = api_get_path(REL_PATH); $relPath = api_get_path(REL_PATH);
$s .= " $s .= "
<div class=\"col-sm-8 col-md-9\"> <div class=\"col-sm-8 col-md-9\">
@ -1265,7 +1276,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$lp_id = 0, $lp_id = 0,
$lp_item_id = 0 $lp_item_id = 0
) { )
{
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
@ -1305,7 +1317,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$lp_id = 0, $lp_id = 0,
$lp_item_id = 0 $lp_item_id = 0
) { )
{
$current_expired_time_key = self::get_time_control_key( $current_expired_time_key = self::get_time_control_key(
$exercise_id, $exercise_id,
$lp_id, $lp_id,
@ -1338,7 +1351,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$lp_id = 0, $lp_id = 0,
$lp_item_id = 0 $lp_item_id = 0
) { )
{
$return_value = 0; $return_value = 0;
$time_control_key = self::get_time_control_key( $time_control_key = self::get_time_control_key(
$exercise_id, $exercise_id,
@ -1404,7 +1418,8 @@ HOTSPOT;
$in_hotpot_path, $in_hotpot_path,
$in_get_count = false, $in_get_count = false,
$where_condition = null $where_condition = null
) { )
{
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
/* by default in_column = 1 If parameters given, /* by default in_column = 1 If parameters given,
it is the name of the column witch is the bdd field name*/ it is the name of the column witch is the bdd field name*/
@ -1483,7 +1498,8 @@ HOTSPOT;
$userId, $userId,
$courseId, $courseId,
$sessionId $sessionId
) { )
{
$table = Database:: get_main_table( $table = Database:: get_main_table(
TABLE_STATISTIC_TRACK_E_HOTPOTATOES TABLE_STATISTIC_TRACK_E_HOTPOTATOES
); );
@ -1527,7 +1543,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$extra_where_conditions = null, $extra_where_conditions = null,
$get_count = false $get_count = false
) { )
{
//@todo replace all this globals //@todo replace all this globals
global $documentPath, $filter; global $documentPath, $filter;
@ -1675,7 +1692,7 @@ HOTSPOT;
} }
$sqlFromOption = " , $TBL_GROUP_REL_USER AS gru "; $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru ";
$sqlWhereOption = " AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id "; $sqlWhereOption = " AND gru.c_id = " . $course_id . " AND gru.user_id = user.user_id ";
$first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname"; $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname";
if ($get_count) { if ($get_count) {
@ -1832,8 +1849,7 @@ HOTSPOT;
if ($lp_obj) { if ($lp_obj) {
$url = api_get_path( $url = api_get_path(
WEB_CODE_PATH WEB_CODE_PATH
) . 'newscorm/lp_controller.php?' . api_get_cidreq( ) . 'newscorm/lp_controller.php?' . api_get_cidreq() . '&action=view&lp_id=' . $results[$i]['orig_lp_id'];
) . '&action=view&lp_id=' . $results[$i]['orig_lp_id'];
$lp_name = Display::url( $lp_name = Display::url(
$lp_obj['lp_name'], $lp_obj['lp_name'],
$url, $url,
@ -1907,8 +1923,7 @@ HOTSPOT;
} }
} }
if ($revised) { if ($revised) {
$actions .= "<a href='exercise_show.php?" . api_get_cidreq( $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=edit&id=$id'>" .
) . "&action=edit&id=$id'>" .
Display:: return_icon( Display:: return_icon(
'edit.png', 'edit.png',
get_lang('Edit'), get_lang('Edit'),
@ -1917,8 +1932,7 @@ HOTSPOT;
); );
$actions .= '&nbsp;'; $actions .= '&nbsp;';
} else { } else {
$actions .= "<a href='exercise_show.php?" . api_get_cidreq( $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=qualify&id=$id'>" .
) . "&action=qualify&id=$id'>" .
Display:: return_icon( Display:: return_icon(
'quiz.gif', 'quiz.gif',
get_lang('Qualify') get_lang('Qualify')
@ -1928,8 +1942,7 @@ HOTSPOT;
$actions .= "</a>"; $actions .= "</a>";
if ($filter == 2) { if ($filter == 2) {
$actions .= ' <a href="exercise_history.php?' . api_get_cidreq( $actions .= ' <a href="exercise_history.php?' . api_get_cidreq() . '&exe_id=' . $id . '">' .
) . '&exe_id=' . $id . '">' .
Display:: return_icon( Display:: return_icon(
'history.gif', 'history.gif',
get_lang('ViewHistoryChange') get_lang('ViewHistoryChange')
@ -1937,8 +1950,7 @@ HOTSPOT;
} }
//Admin can always delete the attempt //Admin can always delete the attempt
if (($locked == false || api_is_platform_admin( if (($locked == false || api_is_platform_admin()) && !api_is_student_boss()
)) && !api_is_student_boss()
) { ) {
$ip = TrackingUserLog::get_ip_from_user_event( $ip = TrackingUserLog::get_ip_from_user_event(
$results[$i]['exe_user_id'], $results[$i]['exe_user_id'],
@ -1946,7 +1958,7 @@ HOTSPOT;
false false
); );
$actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank"> $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">
'.Display::return_icon('info.png', $ip).' ' . Display::return_icon('info.png', $ip) . '
</a>'; </a>';
$delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '" $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '"
@ -1969,8 +1981,7 @@ HOTSPOT;
} else { } else {
$attempt_url = api_get_path( $attempt_url = api_get_path(
WEB_CODE_PATH WEB_CODE_PATH
) . 'exercice/result.php?' . api_get_cidreq( ) . 'exercice/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
$attempt_link = Display::url( $attempt_link = Display::url(
get_lang('Show'), get_lang('Show'),
$attempt_url, $attempt_url,
@ -2073,7 +2084,8 @@ HOTSPOT;
$show_percentage = true, $show_percentage = true,
$use_platform_settings = true, $use_platform_settings = true,
$show_only_percentage = false $show_only_percentage = false
) { )
{
if (is_null($score) && is_null($weight)) { if (is_null($score) && is_null($weight)) {
return '-'; return '-';
} }
@ -2252,7 +2264,8 @@ HOTSPOT;
$search = '', $search = '',
$search_all_sessions = false, $search_all_sessions = false,
$active = 2 $active = 2
) { )
{
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (!empty($course_info) && !empty($course_info['real_id'])) { if (!empty($course_info) && !empty($course_info['real_id'])) {
@ -2372,7 +2385,8 @@ HOTSPOT;
$session_id = 0, $session_id = 0,
$course_id = 0, $course_id = 0,
$only_active_exercises = true $only_active_exercises = true
) { )
{
$TBL_EXERCISES = Database:: get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISES = Database:: get_course_table(TABLE_QUIZ_TEST);
if ($only_active_exercises) { if ($only_active_exercises) {
@ -2434,7 +2448,8 @@ HOTSPOT;
$session_id = 0, $session_id = 0,
$user_list = array(), $user_list = array(),
$return_string = true $return_string = true
) { )
{
//No score given we return //No score given we return
if (is_null($my_score)) { if (is_null($my_score)) {
return '-'; return '-';
@ -2522,7 +2537,8 @@ HOTSPOT;
$courseId, $courseId,
$session_id = 0, $session_id = 0,
$return_string = true $return_string = true
) { )
{
if (empty($session_id)) { if (empty($session_id)) {
$session_id = 0; $session_id = 0;
} }
@ -2631,7 +2647,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$courseId, $courseId,
$session_id $session_id
) { )
{
$user_results = Event::get_all_exercise_results( $user_results = Event::get_all_exercise_results(
$exercise_id, $exercise_id,
$courseId, $courseId,
@ -2731,7 +2748,8 @@ HOTSPOT;
$user_id, $user_id,
$courseId, $courseId,
$session_id $session_id
) { )
{
$user_results = Event::get_all_exercise_results_by_user( $user_results = Event::get_all_exercise_results_by_user(
$user_id, $user_id,
$courseId, $courseId,
@ -2768,7 +2786,8 @@ HOTSPOT;
$courseId, $courseId,
$session_id, $session_id,
$user_count $user_count
) { )
{
$user_results = Event::get_best_exercise_results_by_user( $user_results = Event::get_best_exercise_results_by_user(
$exercise_id, $exercise_id,
$courseId, $courseId,
@ -2832,7 +2851,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$course_code, $course_code,
$session_id $session_id
) { )
{
$track_exercises = Database::get_main_table( $track_exercises = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCISES TABLE_STATISTIC_TRACK_E_EXERCISES
); );
@ -2880,7 +2900,8 @@ HOTSPOT;
public static function getNumberStudentsFillBlanksAnwserCount( public static function getNumberStudentsFillBlanksAnwserCount(
$question_id, $question_id,
$exercise_id $exercise_id
) { )
{
$listStudentsId = []; $listStudentsId = [];
$listAllStudentInfo = CourseManager::get_student_list_from_course_code( $listAllStudentInfo = CourseManager::get_student_list_from_course_code(
api_get_course_id(), api_get_course_id(),
@ -2931,7 +2952,8 @@ HOTSPOT;
$course_code, $course_code,
$session_id, $session_id,
$questionType = '' $questionType = ''
) { )
{
$track_exercises = Database::get_main_table( $track_exercises = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCISES TABLE_STATISTIC_TRACK_E_EXERCISES
); );
@ -3025,7 +3047,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$course_code, $course_code,
$session_id $session_id
) { )
{
$track_exercises = Database::get_main_table( $track_exercises = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCISES TABLE_STATISTIC_TRACK_E_EXERCISES
); );
@ -3103,7 +3126,8 @@ HOTSPOT;
$question_type = null, $question_type = null,
$correct_answer = null, $correct_answer = null,
$current_answer = null $current_answer = null
) { )
{
$track_exercises = Database::get_main_table( $track_exercises = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCISES TABLE_STATISTIC_TRACK_E_EXERCISES
); );
@ -3342,7 +3366,8 @@ HOTSPOT;
$exercise_id, $exercise_id,
$course_code, $course_code,
$session_id $session_id
) { )
{
$track_exercises = Database::get_main_table( $track_exercises = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCISES TABLE_STATISTIC_TRACK_E_EXERCISES
); );
@ -3436,7 +3461,8 @@ HOTSPOT;
$objExercise, $objExercise,
$exe_id, $exe_id,
$save_user_result = false $save_user_result = false
) { )
{
global $origin; global $origin;
// Getting attempt info // Getting attempt info
@ -3622,8 +3648,7 @@ HOTSPOT;
$category_list['none']['total'] += $my_total_weight; $category_list['none']['total'] += $my_total_weight;
} }
if ($objExercise->selectPropagateNeg( if ($objExercise->selectPropagateNeg() == 0 && $my_total_score < 0
) == 0 && $my_total_score < 0
) { ) {
$my_total_score = 0; $my_total_score = 0;
} }
@ -3713,7 +3738,7 @@ HOTSPOT;
} }
// Remove audio auto play from questions on results page - refs BT#7939 // Remove audio auto play from questions on results page - refs BT#7939
$exercise_content = preg_replace( $exercise_content = preg_replace(
['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'], ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'],
'', '',
$exercise_content $exercise_content
); );
@ -3788,7 +3813,8 @@ HOTSPOT;
$score, $score,
$weight, $weight,
$check_pass_percentage = false $check_pass_percentage = false
) { )
{
$ribbon = '<div class="title-score">'; $ribbon = '<div class="title-score">';
if ($check_pass_percentage) { if ($check_pass_percentage) {
$is_success = self::is_success_exercise_result( $is_success = self::is_success_exercise_result(
@ -3800,7 +3826,8 @@ HOTSPOT;
$ribbon_total_success_or_error = ""; $ribbon_total_success_or_error = "";
if (self::is_pass_pourcentage_enabled( if (self::is_pass_pourcentage_enabled(
$objExercise->selectPassPercentage() $objExercise->selectPassPercentage()
)) { )
) {
if ($is_success) { if ($is_success) {
$ribbon_total_success_or_error = ' ribbon-total-success'; $ribbon_total_success_or_error = ' ribbon-total-success';
} else { } else {

Loading…
Cancel
Save