Minor - format code

pull/3623/head
Julio Montoya 5 years ago
parent dcaafe9f7d
commit bd1db37bcd
  1. 36
      main/exercise/exercise_show.php
  2. 2
      main/exercise/exercise_submit.php

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -27,7 +28,6 @@ if (empty($id)) {
// Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
//No track info
if (empty($track_exercise_info)) {
api_not_allowed($printHeaders);
}
@ -171,9 +171,9 @@ if ($allowRecordAudio && $allowTeacherCommentAudio) {
$htmlHeadXtra[] = api_get_js('record_audio/record_audio.js');
}
if ($action != 'export') {
if ($action !== 'export') {
$scoreJsCode = ExerciseLib::getJsCode();
if ($origin != 'learnpath') {
if ($origin !== 'learnpath') {
Display::display_header('');
} else {
$htmlHeadXtra[] = "<style>body { background: none; } </style>";
@ -253,7 +253,7 @@ if (!empty($track_exercise_info)) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
$show_results = false;
$show_only_total_score = true;
if ($origin != 'learnpath') {
if ($origin !== 'learnpath') {
if ($currentUserId == $student_id) {
echo Display::return_message(
get_lang('ThankYouForPassingTheTest'),
@ -293,7 +293,7 @@ if (!empty($track_exercise_info)) {
$show_results = false;
}
if ($origin == 'learnpath' && !isset($_GET['fb_type'])) {
if ($origin === 'learnpath' && !isset($_GET['fb_type'])) {
$show_results = false;
}
@ -301,7 +301,7 @@ if ($is_allowedToEdit && in_array($action, ['qualify', 'edit', 'export'])) {
$show_results = true;
}
if ($action == 'export') {
if ($action === 'export') {
ob_start();
}
@ -391,7 +391,6 @@ $arrid = [];
$arrmarks = [];
$strids = '';
$marksid = '';
$countPendingQuestions = 0;
foreach ($questionList as $questionId) {
$choice = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : '';
@ -667,7 +666,7 @@ foreach ($questionList as $questionId) {
}
}
if ($is_allowedToEdit && $isFeedbackAllowed && $action != 'export') {
if ($is_allowedToEdit && $isFeedbackAllowed && $action !== 'export') {
if (in_array($answerType, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) {
$marksname = 'marksName'.$questionId;
$arrmarks[] = $questionId;
@ -741,7 +740,12 @@ foreach ($questionList as $questionId) {
echo '
<div id="'.$marksname.'" class="hidden">
<form name="marksform_'.$questionId.'" method="post" action="">
<select name="marks" id="select_marks_'.$questionId.'" style="display:none;" class="exercise_mark_select">
<select
name="marks"
id="select_marks_'.$questionId.'"
style="display:none;"
class="exercise_mark_select"
>
<option value="'.$questionScore.'" >'.$questionScore.'</option>
</select>
</form>
@ -760,7 +764,6 @@ foreach ($questionList as $questionId) {
$my_total_weight = $questionWeighting;
$totalWeighting += $questionWeighting;
$category_was_added_for_this_test = false;
if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
if (!isset($category_list[$objQuestionTmp->category]['score'])) {
$category_list[$objQuestionTmp->category]['score'] = 0;
@ -857,7 +860,6 @@ foreach ($questionList as $questionId) {
} // end of large foreach on questions
$totalScoreText = '';
if ($answerType != MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
$pluginEvaluation = QuestionOptionsEvaluationPlugin::create();
@ -873,7 +875,7 @@ if ($answerType != MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
// Total score
$myTotalScoreTemp = $totalScore;
if ($origin != 'learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) {
if ($origin !== 'learnpath' || ($origin === 'learnpath' && isset($_GET['fb_type']))) {
if ($show_results || $show_only_total_score || $showTotalScoreAndUserChoicesInLastAttempt) {
$totalScoreText .= '<div class="question_row">';
if ($objExercise->selectPropagateNeg() == 0 && $myTotalScoreTemp < 0) {
@ -1060,13 +1062,13 @@ if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress
}
//Came from lpstats in a lp
if ($origin == 'student_progress') {
if ($origin === 'student_progress') {
?>
<button type="button" class="back" onclick="window.history.go(-1);" value="<?php echo get_lang('Back'); ?>">
<?php echo get_lang('Back'); ?>
</button>
<?php
} elseif ($origin == 'myprogress') {
} elseif ($origin === 'myprogress') {
?>
<button type="button" class="save"
onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id(); ?>'"
@ -1076,7 +1078,7 @@ if ($origin == 'student_progress') {
<?php
}
if ($origin != 'learnpath') {
if ($origin !== 'learnpath') {
//we are not in learnpath tool
Display::display_footer();
} else {
@ -1090,7 +1092,7 @@ if ($origin != 'learnpath') {
'exeId' => $id,
'fb_type' => $feedback_type,
]);
$href = ($lp_mode == 'fullscreen')
$href = ($lp_mode === 'fullscreen')
? ' window.opener.location.href="'.$url.'" '
: ' top.location.href="'.$url.'" ';
echo '<script type="text/javascript">'.$href.'</script>';
@ -1106,10 +1108,8 @@ if ($origin != 'learnpath') {
}
}
// Destroying the session
Session::erase('questionList');
unset($questionList);
Session::erase('exerciseResult');
unset($exerciseResult);
Session::erase('calculatedAnswerId');

@ -1651,7 +1651,7 @@ if (!empty($error)) {
[
'type' => 'button',
'class' => 'btn btn-info',
'data-question' => $questionId
'data-question' => $questionId,
]
),
'<span id="save_for_now_'.$questionId.'"></span>&nbsp;',

Loading…
Cancel
Save