Minor - format code

pull/2606/head
Julio Montoya 7 years ago
parent 673dd3d346
commit e3d67828a2
  1. 31
      main/exercise/exercise_show.php

@ -19,7 +19,7 @@ require_once __DIR__.'/../inc/global.inc.php';
$debug = false; $debug = false;
$origin = api_get_origin(); $origin = api_get_origin();
$currentUserId = api_get_user_id(); $currentUserId = api_get_user_id();
$printHeaders = $origin == 'learnpath'; $printHeaders = $origin === 'learnpath';
$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; //exe id $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; //exe id
if (empty($id)) { if (empty($id)) {
@ -107,7 +107,7 @@ if (!empty($sessionId) && !$is_allowedToEdit) {
} }
$allowCoachFeedbackExercises = api_get_setting('allow_coach_feedback_exercises') === 'true'; $allowCoachFeedbackExercises = api_get_setting('allow_coach_feedback_exercises') === 'true';
$maxEditors = intval(api_get_setting('exercise_max_ckeditors_in_page')); $maxEditors = (int) api_get_setting('exercise_max_ckeditors_in_page');
$isCoachAllowedToEdit = api_is_allowed_to_edit(false, true); $isCoachAllowedToEdit = api_is_allowed_to_edit(false, true);
$isFeedbackAllowed = false; $isFeedbackAllowed = false;
@ -140,11 +140,11 @@ if (api_is_in_gradebook()) {
} }
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "exercise.php?".api_get_cidreq(), 'url' => 'exercise.php?'.api_get_cidreq(),
'name' => get_lang('Exercises'), 'name' => get_lang('Exercises'),
]; ];
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), 'url' => 'overview.php?exerciseId='.$exercise_id.'&'.api_get_cidreq(),
'name' => $objExercise->selectTitle(true), 'name' => $objExercise->selectTitle(true),
]; ];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Result')]; $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Result')];
@ -168,11 +168,7 @@ if ($action != 'export') {
if ($origin != 'learnpath') { if ($origin != 'learnpath') {
Display::display_header(''); Display::display_header('');
} else { } else {
$htmlHeadXtra[] = " $htmlHeadXtra[] = "<style>body { background: none; } </style>";
<style>
body { background: none;}
</style>
";
Display::display_reduced_header(); Display::display_reduced_header();
} }
@ -184,8 +180,8 @@ if ($action != 'export') {
]); ?> ]); ?>
<script> <script>
<?php echo $scoreJsCode; ?> <?php echo $scoreJsCode; ?>
var maxEditors = <?php echo $maxEditors; ?>;
var maxEditors = <?php echo intval($maxEditors); ?>;
function showfck(sid, marksid) { function showfck(sid, marksid) {
$('#' + sid).toggleClass('hidden'); $('#' + sid).toggleClass('hidden');
$('#' + marksid).toggleClass('hidden'); $('#' + marksid).toggleClass('hidden');
@ -198,7 +194,6 @@ if ($action != 'export') {
function getFCK(vals, marksid) { function getFCK(vals, marksid) {
var f = document.getElementById('myform'); var f = document.getElementById('myform');
var m_id = marksid.split(','); var m_id = marksid.split(',');
for (var i = 0; i < m_id.length; i++) { for (var i = 0; i < m_id.length; i++) {
var oHidn = document.createElement("input"); var oHidn = document.createElement("input");
@ -235,7 +230,6 @@ if (!empty($track_exercise_info)) {
// if the results_disabled of the Quiz is 1 when block the script // if the results_disabled of the Quiz is 1 when block the script
$result_disabled = $track_exercise_info['results_disabled']; $result_disabled = $track_exercise_info['results_disabled'];
if (true) {
if ($result_disabled == RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS) { if ($result_disabled == RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS) {
$show_results = false; $show_results = false;
} elseif ($result_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY) { } elseif ($result_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY) {
@ -273,7 +267,6 @@ if (!empty($track_exercise_info)) {
$showTotalScoreAndUserChoicesInLastAttempt = false; $showTotalScoreAndUserChoicesInLastAttempt = false;
} }
} }
}
} else { } else {
echo Display::return_message(get_lang('CantViewResults'), 'warning'); echo Display::return_message(get_lang('CantViewResults'), 'warning');
$show_results = false; $show_results = false;
@ -328,7 +321,6 @@ $sql = "SELECT attempts.question_id, answer
$result = Database::query($sql); $result = Database::query($sql);
$question_list_from_database = []; $question_list_from_database = [];
$exerciseResult = []; $exerciseResult = [];
while ($row = Database::fetch_array($result)) { while ($row = Database::fetch_array($result)) {
$question_list_from_database[] = $row['question_id']; $question_list_from_database[] = $row['question_id'];
$exerciseResult[$row['question_id']] = $row['answer']; $exerciseResult[$row['question_id']] = $row['answer'];
@ -352,7 +344,7 @@ if (!empty($track_exercise_info['data_tracking'])) {
// Display the text when finished message if we are on a LP #4227 // Display the text when finished message if we are on a LP #4227
$end_of_message = $objExercise->selectTextWhenFinished(); $end_of_message = $objExercise->selectTextWhenFinished();
if (!empty($end_of_message) && ($origin == 'learnpath')) { if (!empty($end_of_message) && ($origin === 'learnpath')) {
echo Display::return_message($end_of_message, 'normal', false); echo Display::return_message($end_of_message, 'normal', false);
echo "<div class='clear'>&nbsp;</div>"; echo "<div class='clear'>&nbsp;</div>";
} }
@ -436,8 +428,8 @@ foreach ($questionList as $questionId) {
break; break;
case MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY: case MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY:
$choiceTmp = []; $choiceTmp = [];
$choiceTmp["choice"] = $choice; $choiceTmp['choice'] = $choice;
$choiceTmp["choiceDegreeCertainty"] = $choiceDegreeCertainty; $choiceTmp['choiceDegreeCertainty'] = $choiceDegreeCertainty;
$questionResult = $objExercise->manage_answer( $questionResult = $objExercise->manage_answer(
$id, $id,
@ -723,8 +715,8 @@ foreach ($questionList as $questionId) {
$marksname = ''; $marksname = '';
if ($isFeedbackAllowed && $action != 'export') { if ($isFeedbackAllowed && $action != 'export') {
$name = "fckdiv".$questionId; $name = 'fckdiv'.$questionId;
$marksname = "marksName".$questionId; $marksname = 'marksName'.$questionId;
if (in_array($answerType, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) { if (in_array($answerType, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) {
$url_name = get_lang('EditCommentsAndMarks'); $url_name = get_lang('EditCommentsAndMarks');
} else { } else {
@ -790,7 +782,6 @@ foreach ($questionList as $questionId) {
echo ExerciseLib::getOralFeedbackForm($id, $questionId, $student_id); echo ExerciseLib::getOralFeedbackForm($id, $questionId, $student_id);
echo '</div>'; echo '</div>';
} }
echo '</div>'; echo '</div>';
} else { } else {
$comnt = Event::get_comments($id, $questionId); $comnt = Event::get_comments($id, $questionId);

Loading…
Cancel
Save