Fix parameter exercise in question->save().

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 3a07aff3dd
commit 203e45d074
  1. 10
      main/exercise/Annotation.php
  2. 5
      main/exercise/export/aiken/aiken_import.inc.php
  3. 4
      main/exercise/export/exercise_import.inc.php
  4. 17
      main/exercise/hotspot.class.php
  5. 5
      main/exercise/hotspot_admin.inc.php
  6. 3
      main/inc/lib/add_course.lib.inc.php

@ -83,20 +83,18 @@ class Annotation extends Question
}
/**
* @param FormValidator $form
* @param null $objExercise
* @return bool
* @inheritdoc
*/
public function processCreation($form, $objExercise = null)
public function processCreation($form, $exercise)
{
$fileInfo = $form->getSubmitValue('imageUpload');
parent::processCreation($form, $objExercise);
parent::processCreation($form, $exercise);
if (!empty($fileInfo['tmp_name'])) {
$result = $this->uploadPicture($fileInfo['tmp_name']);
if ($result) {
$this->weighting = $form->getSubmitValue('weighting');
$this->save();
$this->save($exercise);
return true;
}

@ -170,7 +170,6 @@ function aiken_import_exercise($file)
// 1. Create exercise
$exercise = new Exercise();
$exercise->exercise = $exercise_info['name'];
$exercise->save();
$last_exercise_id = $exercise->selectId();
if (!empty($last_exercise_id)) {
@ -187,7 +186,7 @@ function aiken_import_exercise($file)
}
$type = $question->selectType();
$question->type = constant($type);
$question->save($last_exercise_id);
$question->save($exercise);
$last_question_id = $question->selectId();
//3. Create answer
$answer = new Answer($last_question_id);
@ -217,7 +216,7 @@ function aiken_import_exercise($file)
$answer->save();
// Now that we know the question score, set it!
$question->updateWeighting($max_score);
$question->save();
$question->save($exercise);
}
// Delete the temp dir where the exercise was unzipped

@ -223,7 +223,7 @@ function import_exercise($file)
$description .= $question_array['description'];
}
$question->updateDescription($description);
$question->save($last_exercise_id);
$question->save($exercise);
$last_question_id = $question->selectId();
//3. Create answer
@ -261,7 +261,7 @@ function import_exercise($file)
}
}
$question->updateWeighting($totalCorrectWeight);
$question->save($last_exercise_id);
$question->save($exercise);
$answer->save();
}

@ -73,19 +73,17 @@ class HotSpot extends Question
}
/**
* @param FormValidator $form
* @param null $objExercise
* @return bool
* @inheritdoc
*/
public function processCreation($form, $objExercise = null)
public function processCreation($form, $exercise)
{
$file_info = $form->getSubmitValue('imageUpload');
parent::processCreation($form, $objExercise);
parent::processCreation($form, $exercise);
if (!empty($file_info['tmp_name'])) {
$result = $this->uploadPicture($file_info['tmp_name']);
if ($result) {
$this->save();
$this->save($exercise);
return true;
} else {
return false;
@ -133,10 +131,13 @@ class HotSpotDelineation extends HotSpot
parent::createForm($form);
}
public function processCreation($form, $objExercise = null)
/**
* @inheritdoc
*/
public function processCreation($form, $exercise)
{
$file_info = $form->getSubmitValue('imageUpload');
parent::processCreation($form, $objExercise);
parent::processCreation($form, $exercise);
}
public function createAnswersForm($form)

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
use \ChamiloSession as Session;
use ChamiloSession as Session;
/**
* This script allows to manage answers. It is included from the
@ -24,7 +24,6 @@ $debug = 0; // debug variable to get where we are
$okPicture = empty($pictureName) ? false : true;
// if we come from the warning box "this question is used in several exercises"
if ($modifyIn) {
if ($debug > 0) {
echo '$modifyIn was set'."<br />\n";
@ -143,7 +142,7 @@ if ($submitAnswers || $buttonBack) {
// sets the total weighting of the question
$objQuestion->updateWeighting($questionWeighting);
$objQuestion->save($exerciseId);
$objQuestion->save($objExercise);
$editQuestion = $questionId;
unset($modifyAnswers);

@ -1019,7 +1019,7 @@ class AddCourse
$question->weighting = 10;
$question->position = 1;
$question->course = $courseInfo;
$question->save($exercise_id);
$question->save($exercise);
$questionId = $question->id;
$answer = new Answer($questionId, $courseInfo['real_id']);
@ -1028,7 +1028,6 @@ class AddCourse
$answer->createAnswer(get_lang('AdmitError'), 0, get_lang('NoSeduction'), -5, 2);
$answer->createAnswer(get_lang('Force'), 1, get_lang('Indeed'), 5, 3);
$answer->createAnswer(get_lang('Contradiction'), 1, get_lang('NotFalse'), 5, 4);
$answer->save();
/* Forum tool */

Loading…
Cancel
Save