Now the global multiple answer can be saved see #5012

skala
Julio Montoya 13 years ago
parent 7417a5b0a5
commit 06bcc3ab20
  1. 8
      main/exercice/exercise.class.php
  2. 4
      main/exercice/global_multiple_answer.class.php
  3. 18
      main/inc/ajax/exercise.ajax.php
  4. 1
      main/inc/lib/autoload.class.php
  5. 16
      main/inc/lib/events.lib.inc.php

@ -1809,7 +1809,7 @@ class Exercise {
* @return string html code
*/
public function manage_answer($exeId, $questionId, $choice, $from = 'exercise_show', $exerciseResultCoordinates = array(), $saved_results = true, $from_database = false, $show_result = true, $propagate_neg = 0, $hotspot_delineation_result = array()) {
global $_configuration, $feedback_type, $debug;
global $feedback_type, $debug;
require_once api_get_path(LIBRARY_PATH).'geometry.lib.php';
if ($debug) error_log("<------ manage_answer ------> ");
@ -1987,7 +1987,7 @@ class Exercise {
}
$totalScore = $questionScore;
break;
case MULTIPLE_ANSWER : //2
case MULTIPLE_ANSWER : //2
if ($from_database) {
$choice = array();
$queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'";
@ -2018,7 +2018,7 @@ class Exercise {
case GLOBAL_MULTIPLE_ANSWER :
if ($from_database) {
$choice = array();
$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);
while ($row = Database::fetch_array($resultans)) {
$ind = $row['answer'];
@ -3098,7 +3098,7 @@ class Exercise {
} else {
exercise_attempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
}
} elseif ($answerType == MULTIPLE_ANSWER) {
} elseif ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
if ($choice != 0) {
$reply = array_keys($choice);

@ -136,11 +136,11 @@ if (!class_exists('GlobalMultipleAnswer')):
global $pts;
//--------- Creation coche pour ne pas prendre en compte les n<EFBFBD>gatifs
$form->addElement('checkbox', 'pts', '', get_lang('NoNegative'));
$form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore'));
$form->addElement('html', '<br />');
// Affiche un message si le score n'est pas renseign<EFBFBD>
$form->addRule('weighting[1]', get_lang('EmptyScore'), 'required');
$form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required');
$navigator_info = api_get_navigator();
global $text, $class, $show_quiz_edition;

@ -148,13 +148,13 @@ switch ($action) {
//Use have permissions?
if (api_is_allowed_to_session_edit()) {
//"all" or "simple" strings means that there's one or all questions
//"all" or "simple" strings means that there's one or all questions exercise type
$type = $_REQUEST['type'];
//Normal questions choices
//Questions choices
$choice = $_REQUEST['choice'];
//All Hotspot coordinates from all questions
//Hotspot coordinates from all questions
$hot_spot_coordinates = $_REQUEST['hotspot'];
//There is a reminder?
@ -170,12 +170,15 @@ switch ($action) {
if ($debug) error_log("remind_list = $remind_list ");
//Exercise information
$objExercise = $_SESSION['objExercise'];
//Question info
$question_id = intval($_REQUEST['question_id']);
$question_list = $_SESSION['questionList'];
$objExercise = $_SESSION['objExercise'];
//If exercise or question is not set then exit
if (empty($question_list) || empty($objExercise)) {
echo 0;
echo 'error';
exit;
}
@ -233,7 +236,7 @@ switch ($action) {
}
//No exe id? Can't save answer
//No exe id? Can't save answer.
if (empty($exe_id)) {
//Fires an error
echo 'error';
@ -288,7 +291,6 @@ switch ($action) {
//Removing old score
$total_score = $total_score - $old_result['score'];
} else {
}
// Deleting old attempt
@ -326,7 +328,7 @@ switch ($action) {
if (!empty($exercise_stat_info['exe_duration'])) {
$duration += $exercise_stat_info['exe_duration'];
}
$duration = intval($duration);
$duration = intval($duration);
} else {
if (!empty($exercise_stat_info['exe_duration'])) {
$duration = $exercise_stat_info['exe_duration'];

@ -707,6 +707,7 @@ class Autoload
$result['MultipleAnswerCombination'] = '/main/exercice/multiple_answer_combination.class.php';
$result['MultipleAnswerCombinationTrueFalse'] = '/main/exercice/multiple_answer_combination_true_false.class.php';
$result['MultipleAnswerTrueFalse'] = '/main/exercice/multiple_answer_true_false.class.php';
$result['GlobalMultipleAnswer'] = '/main/exercice/global_multiple_answer.class.php';
$result['MyHorBar'] = '/main/inc/lib/pchart/MyHorBar.class.php';
$result['MySpace'] = '/main/mySpace/myspace.lib.php';
$result['Nanogong'] = '/main/inc/lib/nanogong.lib.php';

@ -322,25 +322,17 @@ function event_link($link_id) {
* @desc Record result of user when an exercice was done
*/
function update_event_exercice($exeid, $exo_id, $score, $weighting, $session_id, $learnpath_id = 0, $learnpath_item_id = 0, $learnpath_item_view_id = 0, $duration = 0, $question_list = array(), $status = '', $remind_list = array() , $end_date = null) {
//error_log('Called to update_event_exercice');
//error_log('duration:' . $duration);
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
global $debug;
if ($debug) error_log('Called to update_event_exercice');
if ($debug) error_log('duration:' . $duration);
if ($exeid != '') {
// Validation in case of fraud with actived control time
if (!exercise_time_control_is_valid($exo_id)) {
$score = 0;
}
/* start_date wouldn't be updated
$start_date_condition = '';
//Validation in case of wrong start_date
if (isset($_SESSION['exercice_start_date'])) {
$start_date = $_SESSION['exercice_start_date'];
$diff = abs($start_date - $now);
if ($diff > 14400) { // 14400 = 4h*60*60 more than 4h of diff
$start_date = $now - 1800; // Now - 30min
}
}*/
if (!isset($status) || empty($status)) {
$status = '';

Loading…
Cancel
Save