Minor - format code

pull/3235/head
Julio Montoya 6 years ago
parent 65e9c93e6e
commit aad2abe7e9
  1. 15
      main/exercise/exercise_submit.php
  2. 32
      main/inc/ajax/exercise.ajax.php

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -19,8 +20,6 @@ use ChamiloSession as Session;
* Notice : This script is also used to show a question before modifying it by
* the administrator
*
* @package chamilo.exercise
*
* @author Olivier Brouckaert
* @author Julio Montoya <gugli100@gmail.com>
* Fill in blank option added (2008)
@ -101,7 +100,6 @@ $currentAnswer = isset($_REQUEST['num_answer']) ? (int) $_REQUEST['num_answer']
$logInfo = [
'tool' => TOOL_QUIZ,
'tool_id' => $exerciseId,
'tool_id_detail' => 0,
'action' => $learnpath_id,
'action_details' => $learnpath_id,
];
@ -467,10 +465,6 @@ if (!isset($questionListInSession)) {
$questionList = explode(',', $exercise_stat_info['data_tracking']);
}
Session::write('questionList', $questionList);
if ($debug > 0) {
error_log('$_SESSION[questionList] was set');
}
} else {
if (isset($objExercise) && isset($exerciseInSession)) {
$questionList = Session::read('questionList');
@ -607,7 +601,7 @@ if ($debug) {
error_log('8. Question list loaded '.print_r($questionList, 1));
}
//Real question count
// Real question count.
$question_count = 0;
if (!empty($questionList)) {
$question_count = count($questionList);
@ -626,13 +620,12 @@ if ($formSent && isset($_POST)) {
error_log('9. $formSent was set');
}
// Initializing
if (!is_array($exerciseResult)) {
$exerciseResult = [];
$exerciseResultCoordinates = [];
}
//Only for hotspot
// Only for hotspot
if (!isset($choice) && isset($_REQUEST['hidden_hotspot_id'])) {
$hotspot_id = (int) $_REQUEST['hidden_hotspot_id'];
$choice = [$hotspot_id => ''];
@ -892,7 +885,7 @@ $is_visible_return = $objExercise->is_visible(
if ($is_visible_return['value'] == false) {
echo $is_visible_return['message'];
if (!in_array($origin, ['learnpath', 'embeddable'])) {
Display :: display_footer();
Display::display_footer();
}
exit;
}

@ -460,6 +460,18 @@ switch ($action) {
$attemptList = Event::getAllExerciseEventByExeId($exeId);
}
// No exe id? Can't save answer.
if (empty($exeId)) {
// Fires an error.
echo 'error';
if ($debug) {
error_log('exe_id is empty');
}
exit;
}
Session::write('exe_id', $exeId);
// Updating Reminder algorithm.
if ($objExercise->type == ONE_PER_PAGE) {
$bd_reminder_list = explode(',', $exercise_stat_info['questions_to_check']);
@ -482,21 +494,9 @@ switch ($action) {
}
}
// No exe id? Can't save answer.
if (empty($exeId)) {
// Fires an error.
echo 'error';
if ($debug) {
error_log('exe_id is empty');
}
exit;
}
Session::write('exe_id', $exeId);
// Getting the total weight if the request is simple
$total_weight = 0;
if ($type == 'simple') {
if ($type === 'simple') {
foreach ($question_list as $my_question_id) {
$objQuestionTmp = Question::read($my_question_id, $objExercise->course);
$total_weight += $objQuestionTmp->selectWeighting();
@ -510,7 +510,7 @@ switch ($action) {
error_log("Saving question_id = $my_question_id ");
}
if ($type == 'simple' && $question_id != $my_question_id) {
if ($type === 'simple' && $question_id != $my_question_id) {
continue;
}
@ -537,7 +537,7 @@ switch ($action) {
: null;
}
if ($type == 'all') {
if ($type === 'all') {
$total_weight += $objQuestionTmp->selectWeighting();
}
@ -637,7 +637,7 @@ switch ($action) {
$duration = 0;
$now = time();
if ($type == 'all') {
if ($type === 'all') {
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exeId);
}

Loading…
Cancel
Save