Minor - format code.

pull/2487/head
jmontoyaa 9 years ago
parent 902ebd24ad
commit f50451223b
  1. 19
      main/exercise/exercise.class.php
  2. 28
      main/inc/ajax/exercise.ajax.php

@ -6662,7 +6662,12 @@ class Exercise
return $new_array;
}
public function edit_question_to_remind($exe_id, $question_id, $action = 'add')
/**
* @param int $exe_id
* @param int $question_id
* @param string $action
*/
public function editQuestionToRemind($exe_id, $question_id, $action = 'add')
{
$exercise_info = self::get_stat_track_exercise_info_by_exe_id($exe_id);
$question_id = intval($question_id);
@ -6714,6 +6719,10 @@ class Exercise
}
}
/**
* @param string $answer
* @return mixed
*/
public function fill_in_blank_answer_to_array($answer)
{
api_preg_match_all('/\[[^]]+\]/', $answer, $teacher_answer_list);
@ -6743,6 +6752,9 @@ class Exercise
return $result;
}
/**
* @return string
*/
public function return_time_left_div()
{
$html = '<div id="clock_warning" style="display:none">';
@ -6760,7 +6772,7 @@ class Exercise
return $html;
}
function get_count_question_list()
public function get_count_question_list()
{
//Real question count
$question_count = 0;
@ -7079,7 +7091,8 @@ class Exercise
}
}
// The $questionList contains the media id we check if this questionId is a media question type
// The $questionList contains the media id we check
// if this questionId is a media question type
if (isset($mediaQuestions[$questionId]) &&
$mediaQuestions[$questionId] != 999
) {

@ -183,8 +183,9 @@ switch ($action) {
$table = Database::get_course_table(TABLE_QUIZ_ORDER);
$counter = 1;
//Drop all
Database::query("DELETE FROM $table WHERE session_id = $session_id AND c_id = $course_id");
//Insert all
$sql = "DELETE FROM $table WHERE session_id = $session_id AND c_id = $course_id";
Database::query($sql);
// Insert all
foreach ($new_list as $new_order_id) {
Database::insert(
$table,
@ -216,7 +217,16 @@ switch ($action) {
Database::update(
$TBL_QUESTIONS,
array('question_order' => $counter),
array('question_id = ? AND c_id = ? AND exercice_id = ? ' => array(intval($new_order_id), $course_id, $exercise_id)))
array(
'question_id = ? AND c_id = ? AND exercice_id = ? ' => array(
intval(
$new_order_id
),
$course_id,
$exercise_id
)
)
)
;
$counter++;
}
@ -230,7 +240,7 @@ switch ($action) {
echo 0;
exit;
} else {
$objExercise->edit_question_to_remind(
$objExercise->editQuestionToRemind(
$_REQUEST['exe_id'],
$_REQUEST['question_id'],
$_REQUEST['action']
@ -373,9 +383,8 @@ switch ($action) {
$objQuestionTmp = Question::read($my_question_id, $course_id);
// Getting free choice data.
if (
($objQuestionTmp->type == FREE_ANSWER || $objQuestionTmp->type == ORAL_EXPRESSION)
&& $type == 'all'
if (($objQuestionTmp->type == FREE_ANSWER || $objQuestionTmp->type == ORAL_EXPRESSION) &&
$type == 'all'
) {
$my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id])
? $_REQUEST['free_choice'][$my_question_id]
@ -388,7 +397,9 @@ switch ($action) {
// This variable came from exercise_submit_modal.php.
$hotspot_delineation_result = null;
if (isset($_SESSION['hotspot_delineation_result']) && isset($_SESSION['hotspot_delineation_result'][$objExercise->selectId()])) {
if (isset($_SESSION['hotspot_delineation_result']) &&
isset($_SESSION['hotspot_delineation_result'][$objExercise->selectId()])
) {
$hotspot_delineation_result = $_SESSION['hotspot_delineation_result'][$objExercise->selectId()][$my_question_id];
}
@ -543,7 +554,6 @@ switch ($action) {
$objQuestion->get_question_type_name();
echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
//echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
ExerciseLib::showQuestion(
$questionId,
false,

Loading…
Cancel
Save