Minor - format code

pull/2926/head
Julio Montoya 7 years ago
parent 9363d32d19
commit 294f94caa2
  1. 3
      main/admin/user_import.php
  2. 32
      main/exercise/exercise_reminder.php
  3. 22
      main/exercise/exercise_submit.php

@ -2,7 +2,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\ExtraFieldOptions;
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
use ChamiloSession as Session;
/**
@ -773,4 +772,4 @@ if ($count_fields > 0) {
</pre>
</blockquote>
<?php
Display :: display_footer();
Display::display_footer();

@ -15,28 +15,26 @@ require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
/* ACCESS RIGHTS */
// notice for unauthorized people.
api_protect_course_script(true);
$origin = api_get_origin();
if (empty($learnpath_id)) {
if (!empty($_REQUEST['learnpath_id'])) {
$learnpath_id = intval($_REQUEST['learnpath_id']);
$learnpath_id = (int) $_REQUEST['learnpath_id'];
} else {
$learnpath_id = 0;
}
}
if (empty($learnpath_item_id)) {
if (!empty($_REQUEST['learnpath_item_id'])) {
$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
$learnpath_item_id = (int) $_REQUEST['learnpath_item_id'];
} else {
$learnpath_item_id = 0;
}
}
if (empty($learnpath_item_view_id)) {
if (!empty($_REQUEST['learnpath_item_view_id'])) {
$learnpath_item_view_id = intval($_REQUEST['learnpath_item_view_id']);
$learnpath_item_view_id = (int) $_REQUEST['learnpath_item_view_id'];
} else {
$learnpath_item_view_id = 0;
}
@ -44,7 +42,7 @@ if (empty($learnpath_item_view_id)) {
if (empty($exerciseId)) {
if (!empty($_REQUEST['exerciseId'])) {
$exerciseId = intval($_REQUEST['exerciseId']);
$exerciseId = (int) $_REQUEST['exerciseId'];
} else {
$exerciseId = 0;
}
@ -60,9 +58,9 @@ if (empty($objExercise)) {
}
if (!$objExercise) {
//Redirect to the exercise overview
//Check if the exe_id exists
header("Location: overview.php?exerciseId=".$exerciseId.'&'.api_get_cidreq());
// Redirect to the exercise overview
// Check if the exe_id exists
header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$exerciseId.'&'.api_get_cidreq());
exit;
}
@ -106,7 +104,7 @@ if (empty($exercise_stat_info) || empty($question_list)) {
}
$nameTools = get_lang('Exercises');
$interbreadcrumb[] = ["url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')];
$interbreadcrumb[] = ['url' => 'exercise.php?'.api_get_cidreq(), 'name' => get_lang('Exercises')];
$hideHeaderAndFooter = in_array($origin, ['learnpath', 'embeddable']);
@ -140,7 +138,7 @@ echo '<script>
function final_submit() {
//Normal inputs
window.location = "exercise_result.php?'.api_get_cidreq().'&exe_id='.$exe_id.'&" + lp_data;
window.location = "'.api_get_path(WEB_CODE_PATH).'exercise/exercise_result.php?'.api_get_cidreq().'&exe_id='.$exe_id.'&" + lp_data;
}
function changeOptionStatus(status)
@ -222,8 +220,8 @@ echo '<div class="clear"></div><br />';
$table = '';
$counter = 0;
// Loop over all question to show results for each of them, one by one
// Loop over all question to show results for each of them, one by one
foreach ($question_list as $questionId) {
// destruction of the Question object
unset($objQuestionTmp);
@ -242,13 +240,13 @@ foreach ($question_list as $questionId) {
$url = 'exercise_submit.php?exerciseId='.$objExercise->id.'&num='.$counter.'&reminder=1&'.api_get_cidreq();
$counter++;
$question_title = $counter.'. '.strip_tags($objQuestionTmp->selectTitle());
//Check if the question doesn't have an answer
$questionTitle = $counter.'. '.strip_tags($objQuestionTmp->selectTitle());
// Check if the question doesn't have an answer
if (!in_array($questionId, $exercise_result)) {
$question_title = Display::label($question_title, 'warning');
$questionTitle = Display::label($questionTitle, 'warning');
}
$question_title = Display::tag('label', $checkbox.$question_title, $label_attributes);
$table .= Display::div($question_title, ['class' => 'exercise_reminder_item checkbox']);
$questionTitle = Display::tag('label', $checkbox.$questionTitle, $label_attributes);
$table .= Display::div($questionTitle, ['class' => 'exercise_reminder_item checkbox']);
} // end foreach() block that loops over all questions
echo Display::div($table, ['class' => 'question-check-test']);

@ -82,22 +82,22 @@ if (api_get_setting('enable_record_audio') === 'true') {
$template = new Template();
// General parameters passed via POST/GET
$learnpath_id = isset($_REQUEST['learnpath_id']) ? intval($_REQUEST['learnpath_id']) : 0;
$learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['learnpath_item_id']) : 0;
$learnpath_item_view_id = isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : 0;
$learnpath_id = isset($_REQUEST['learnpath_id']) ? (int) $_REQUEST['learnpath_id'] : 0;
$learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? (int) $_REQUEST['learnpath_item_id'] : 0;
$learnpath_item_view_id = isset($_REQUEST['learnpath_item_view_id']) ? (int) $_REQUEST['learnpath_item_view_id'] : 0;
$reminder = isset($_REQUEST['reminder']) ? intval($_REQUEST['reminder']) : 0;
$remind_question_id = isset($_REQUEST['remind_question_id']) ? intval($_REQUEST['remind_question_id']) : 0;
$exerciseId = isset($_REQUEST['exerciseId']) ? intval($_REQUEST['exerciseId']) : 0;
$reminder = isset($_REQUEST['reminder']) ? (int) $_REQUEST['reminder'] : 0;
$remind_question_id = isset($_REQUEST['remind_question_id']) ? (int) $_REQUEST['remind_question_id'] : 0;
$exerciseId = isset($_REQUEST['exerciseId']) ? (int) $_REQUEST['exerciseId'] : 0;
$formSent = isset($_REQUEST['formSent']) ? $_REQUEST['formSent'] : null;
$exerciseResult = isset($_REQUEST['exerciseResult']) ? $_REQUEST['exerciseResult'] : null;
$exerciseResultCoordinates = isset($_REQUEST['exerciseResultCoordinates']) ? $_REQUEST['exerciseResultCoordinates'] : null;
$choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null;
$choice = empty($choice) ? isset($_REQUEST['choice2']) ? $_REQUEST['choice2'] : null : null;
//From submit modal
$current_question = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : null;
$currentAnswer = isset($_REQUEST['num_answer']) ? intval($_REQUEST['num_answer']) : null;
// From submit modal
$current_question = isset($_REQUEST['num']) ? (int) $_REQUEST['num'] : null;
$currentAnswer = isset($_REQUEST['num_answer']) ? (int) $_REQUEST['num_answer'] : null;
$endExercise = isset($_REQUEST['end_exercise']) && $_REQUEST['end_exercise'] == 1 ? true : false;
$logInfo = [
@ -111,7 +111,6 @@ Event::registerLog($logInfo);
// Error message
$error = '';
$exercise_attempt_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
/* Teacher takes an exam and want to see a preview,
@ -178,7 +177,8 @@ $exercise_sound = $objExercise->selectSound();
// If reminder ends we jump to the exercise_reminder
if ($objExercise->review_answers) {
if ($remind_question_id == -1) {
header('Location: exercise_reminder.php?exerciseId='.$exerciseId.'&'.api_get_cidreq());
header('Location: '.api_get_path(WEB_CODE_PATH).
'exercise/exercise_reminder.php?exerciseId='.$exerciseId.'&'.api_get_cidreq());
exit;
}
}

Loading…
Cancel
Save