Add score to annotation question - refs BT#10892

pull/2487/head
Angel Fernando Quiroz Campos 8 years ago
parent f041d62f1c
commit 42f046aca3
  1. 15
      main/exercise/Annotation.php
  2. 1
      main/exercise/freeanswer.class.php

@ -19,6 +19,7 @@ class Annotation extends Question
{
parent::__construct();
$this->type = ANNOTATION;
$this->isContent = $this->getIsContent();
}
public function display()
@ -33,6 +34,16 @@ class Annotation extends Question
{
parent::createForm($form, $fck_config);
$form->addElement('number', 'weighting', get_lang('Weighting'), ['step' => '0.1']);
if (!empty($this->id)) {
$form->setDefaults(array('weighting' => float_format($this->weighting, 1)));
} else {
if ($this->isContent == 1) {
$form->setDefaults(array('weighting' => '10'));
}
}
if (isset($_GET['editQuestion'])) {
$form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
@ -79,6 +90,7 @@ class Annotation extends Question
}
$this->resizePicture('width', 800);
$this->weighting = $form->getSubmitValue('weighting');
$this->save();
return true;
@ -98,6 +110,7 @@ class Annotation extends Question
*/
function processAnswersCreation($form)
{
// nothing
$this->weighting = $form->getSubmitValue('weighting');
$this->save();
}
}

@ -1,3 +1,4 @@
<?php
/* For licensing terms, see /license.txt */

Loading…
Cancel
Save