Minor format code.

1.9.x
Julio Montoya 12 years ago
parent 83db859690
commit 0b33a18966
  1. 21
      main/exercice/exercise.class.php
  2. 24
      main/exercice/fill_blanks.class.php

@ -2283,7 +2283,8 @@ class Exercise
break; break;
case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
if ($from_database) { if ($from_database) {
$queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." where exe_id = ".$exeId." AND question_id= ".$questionId; $queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
WHERE exe_id = ".$exeId." AND question_id= ".$questionId;
$resultans = Database::query($queryans); $resultans = Database::query($queryans);
while ($row = Database::fetch_array($resultans)) { while ($row = Database::fetch_array($resultans)) {
$ind = $row['answer']; $ind = $row['answer'];
@ -2315,7 +2316,8 @@ class Exercise
break; break;
case MULTIPLE_ANSWER_COMBINATION: case MULTIPLE_ANSWER_COMBINATION:
if ($from_database) { if ($from_database) {
$queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." where exe_id = '".$exeId."' and question_id= '".$questionId."'"; $queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
WHERE exe_id = '".$exeId."' and question_id= '".$questionId."'";
$resultans = Database::query($queryans); $resultans = Database::query($queryans);
while ($row = Database::fetch_array($resultans)) { while ($row = Database::fetch_array($resultans)) {
$ind = $row['answer']; $ind = $row['answer'];
@ -3798,23 +3800,29 @@ class Exercise
} }
} }
//Checking visibility in the item_property table // Checking visibility in the item_property table.
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_QUIZ, $this->id, api_get_session_id()); $visibility = api_get_item_visibility(api_get_course_info(), TOOL_QUIZ, $this->id, api_get_session_id());
if ($visibility == 0) { if ($visibility == 0) {
$this->active = 0; $this->active = 0;
} }
//2. If the exercise is not active // 2. If the exercise is not active.
if (empty($lp_id)) { if (empty($lp_id)) {
//2.1 LP is OFF //2.1 LP is OFF
if ($this->active == 0) { if ($this->active == 0) {
return array('value' => false, 'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false)); return array(
'value' => false,
'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false)
);
} }
} else { } else {
//2.1 LP is loaded //2.1 LP is loaded
if ($this->active == 0 AND !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) { if ($this->active == 0 AND !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
return array('value' => false, 'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false)); return array(
'value' => false,
'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false)
);
} }
} }
@ -3851,6 +3859,7 @@ class Exercise
// 4. We check if the student have attempts // 4. We check if the student have attempts
$exerciseAttempts = $this->selectAttempts(); $exerciseAttempts = $this->selectAttempts();
if ($is_visible) { if ($is_visible) {
if ($exerciseAttempts > 0) { if ($exerciseAttempts > 0) {

@ -1,21 +1,8 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/**
* File containing the FillBlanks class.
* @package chamilo.exercise
* @author Eric Marguin
* @author Julio Montoya Armas switchable fill in blank option added
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
*/
/** /**
* *
* This class allows to instantiate an object of type MULTIPLE_ANSWER * Class FillBlanks
* (MULTIPLE CHOICE, MULTIPLE ANSWER),
* extending the class question
* *
* @author Eric Marguin * @author Eric Marguin
* @author Julio Montoya multiple fill in blank option added * @author Julio Montoya multiple fill in blank option added
@ -37,7 +24,7 @@ class FillBlanks extends Question
} }
/** /**
* function which redifines Question::createAnswersForm * function which redefines Question::createAnswersForm
* @param the formvalidator instance * @param the formvalidator instance
*/ */
function createAnswersForm($form) function createAnswersForm($form)
@ -187,7 +174,6 @@ class FillBlanks extends Question
} }
$is_multiple = $form->getSubmitValue('multiple_answer'); $is_multiple = $form->getSubmitValue('multiple_answer');
$answer.= '@'.$is_multiple; $answer.= '@'.$is_multiple;
$this->save(); $this->save();
@ -196,6 +182,12 @@ class FillBlanks extends Question
$objAnswer->save(); $objAnswer->save();
} }
/**
* @param null $feedback_type
* @param null $counter
* @param null $score
* @return null|string
*/
function return_header($feedback_type = null, $counter = null, $score = null) function return_header($feedback_type = null, $counter = null, $score = null)
{ {
$header = parent::return_header($feedback_type, $counter, $score); $header = parent::return_header($feedback_type, $counter, $score);

Loading…
Cancel
Save