$mform->addElement('hidden', 'multiplier'."[$i]", optional_param('multiplier'."[$i]", '', PARAM_NUMBER));
$mform->setType('multiplier'."[$i]", PARAM_NUMBER);
}
+ $mform->addElement('hidden','unitgradingtype',optional_param('unitgradingtype', '', PARAM_INT)) ;
+ $mform->addElement('hidden','unitpenalty',optional_param('unitpenalty', '', PARAM_NUMBER)) ;
+ $mform->addElement('hidden','showunits',optional_param('showunits', '', PARAM_INT)) ;
+ $mform->addElement('hidden','unitsleft',optional_param('unitsleft', '', PARAM_INT)) ;
+ $mform->addElement('hidden','instructions',optional_param('instructions', '', PARAM_RAW)) ;
}else {
+ $QTYPES['numerical']->edit_numerical_options($mform,$this);
$repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));
$repeated[] =& $mform->createElement('text', 'unit', get_string('unit', 'quiz'));
$repeated[] =& $mform->createElement('text', 'multiplier', get_string('multiplier', 'quiz'));
function set_data($question) {
if (isset($this->editasmultichoice)){
- $default_values['multichoice']= 1 ; //$this->editasmultichoice ;
+ $default_values['multichoice']= $this->editasmultichoice ; //$this->editasmultichoice ;
}
if (isset($question->options)){
$answers = $question->options->answers;
$key++;
}
}
+ $default_values['unitgradingtype'] = $question->options->unitgradingtype ;
+ $default_values['unitpenalty'] = $question->options->unitpenalty ;
+ $default_values['showunits'] = $question->options->showunits ;
+ $default_values['unitsleft'] = $question->options->unitsleft ;
+ $default_values['instructions'] = $question->options->instructions ;
+
if (isset($question->options->units)){
$units = array_values($question->options->units);
// make sure the default unit is at index 0
global $QTYPES, $SESSION, $CFG, $DB;
$this->regenerate = true;
$this->question = $question;
+ echo "<p> question <pre>";print_r($question);echo "</pre></p>";
+
$this->qtypeobj =& $QTYPES[$this->question->qtype];
//get the dataset definitions for this question
//coming here everytime even when using a NoSubmitButton
if(trim($answer) != ''){ // just look for non-empty
$this->answer[$key]=new stdClass();
$this->answer[$key]->answer = $answer;
+ $this->answer[$key]->fraction = $fraction[$key];
$this->answer[$key]->tolerance = $tolerance[$key];
$this->answer[$key]->tolerancetype = $tolerancetype[$key];
$this->answer[$key]->correctanswerlength = $correctanswerlength[$key];
if ($olddef = optional_param('datasetdef', '', PARAM_RAW)){
$calcmin = optional_param('calcmin', '', PARAM_NUMBER);
$calclength = optional_param('calclength', '', PARAM_INT);
- $calcmax = optional_param('calcmax', '', PARAM_NUMBER);
+ $calcmax = optional_param('calcmax', '', PARAM_NUMBER);
+ $oldoptions = optional_param('defoptions', '', PARAM_RAW);
$newdatasetvalues = false ;
for($key = 1 ; $key <= sizeof($olddef) ; $key++) {
$def = $olddef[$key] ;
$this->datasetdefs[$def]->type = 1;
$this->datasetdefs[$def]->category = 0;
// $this->datasets[$key]->name = $datasetname;
- // $this->datasetdefs[$def]->options = $oldoptions[$key] ;
+ $this->datasetdefs[$def]->options = $oldoptions[$key] ;
$this->datasetdefs[$def]->calcmin = $calcmin[$key] ;
$this->datasetdefs[$def]->calcmax = $calcmax[$key] ;
$this->datasetdefs[$def]->calclength = $calclength[$key] ;
$this->qtypeobj =& $QTYPES[$this->qtype()];
$strquestionlabel = $this->qtypeobj->comment_header($this->nonemptyanswer);
$label = get_string("sharedwildcards", "qtype_datasetdependent");
+ $mform->addElement('hidden', 'multichoice', 0);
+ $mform->addElement('hidden', 'synchronize', 0);
$mform->addElement('hidden', 'initialcategory', 1);
$mform->setType('initialcategory', PARAM_INT);
$mform->addElement('hidden', 'reload', 1);
$this->add_per_answer_fields($mform, get_string('answerhdr', 'qtype_calculated', '{no}'),
$creategrades->gradeoptions, 1, 1);
+ $QTYPES['numerical']->edit_numerical_options($mform,$this);
+
$repeated = array();
$repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));
$firstunit->setValue('1.0');
$firstunit->setPersistantFreeze(true);
}
+
//hidden elements
// $mform->addElement('hidden', 'wizard', 'datasetdefinitions');
// $mform->setType('wizard', PARAM_ALPHA);
$this->qtypeobj->custom_generator_tools_part($mform, $idx, $j);
$mform->addElement('hidden', "datasetdef[$idx]");
$mform->setType("datasetdef[$idx]", PARAM_RAW);
+ $mform->addElement('hidden', "defoptions[$idx]");
+ $mform->setType("defoptions[$idx]", PARAM_RAW);
$idx++;
$mform->addElement('static', "divider[$j]", '', '<hr />');
$j++;
$mform->closeHeaderBefore('warningnowildcards');
}
+
//------------------------------------------------------------------------------------------------------------------------------
//non standard name for button element needed so not using add_action_buttons
//hidden elements
function set_data($question) {
$answer = $this->answer;
$default_values = array();
- /* if (count($answer)) {
+ if (count($answer)) {
$key = 0;
foreach ($answer as $answer){
$default_values['answer['.$key.']'] = $answer->answer;
+ // echo "<p> $answer->fraction </p>";
$default_values['fraction['.$key.']'] = $answer->fraction;
$default_values['tolerance['.$key.']'] = $answer->tolerance;
$default_values['tolerancetype['.$key.']'] = $answer->tolerancetype;
$default_values['feedback['.$key.']'] = $answer->feedback;
$key++;
}
- }*/
+ }
+ $default_values['multichoice'] = 0 ;
+ $default_values['synchronize'] = 0 ;
if (isset($question->options)){
+ $default_values['unitgradingtype'] = $question->options->unitgradingtype ;
+ $default_values['unitpenalty'] = $question->options->unitpenalty ;
+ $default_values['showunits'] = $question->options->showunits ;
+ $default_values['unitsleft'] = $question->options->unitsleft ;
+ $default_values['instructions'] = $question->options->instructions ;
+
$units = array_values($question->options->units);
// make sure the default unit is at index 0
usort($units, create_function('$a, $b',
}
/*Here we use the already done the error analysis so that
* we could force all wild cards values display if there is an error in values.
- * as using a , in a number */
+ * as using a , in a number *//*
$numbers = $data['number'];
foreach ($numbers as $key => $number){
if(! is_numeric($number)){
$errors['number['.$key.']'] = get_string('notvalidnumber', 'qtype_datasetdependent');
}
}
-
+ */
if ( $this->noofitems==0 ){
$errors['warning'] = get_string('warning', 'mnet');
}
function save_question_options($question) {
//$options = $question->subtypeoptions;
// Get old answers:
- global $CFG, $DB;
+ global $CFG, $DB , $QTYPES;
if (isset($question->answer) && !isset($question->answers)) {
$question->answers = $question->answer;
}
// Save the units.
- $virtualqtype = $this->get_virtual_qtype();
+ $virtualqtype = $this->get_virtual_qtype($question);
$result = $virtualqtype->save_numerical_units($question);
if (isset($result->error)) {
return $result;
if(!empty($question->makecopy) && !empty($question->convert)) {
$DB->set_field('question', 'qtype', 'calculated', array('id'=> $question->id));
}
+ $result = $QTYPES['numerical']->save_numerical_options($question);
+ if (isset($result->error)) {
+ return $result;
+ }
+
if (!empty($result->notice)) {
return $result;
}
}
function comment_on_datasetitems($questionid, $answers,$data, $number) {
- global $DB;
+ global $DB,$QTYPES;
$comment = new stdClass;
$comment->stranswers = array();
$comment->outsidelimit = false ;
$strmax = get_string('max', 'quiz');
$errors = '';
$delimiter = ': ';
- $virtualqtype = $this->get_virtual_qtype();
+ $virtualqtype = & $QTYPES['numerical'] ; //$this->get_virtual_qtype($question);
foreach ($answers as $key => $answer) {
$formula = $this->substitute_variables($answer->answer,$data);
$formattedanswer = qtype_calculated_calculate_answer(
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="question/type/numerical/db" VERSION="20060812" COMMENT="XMLDB file for Moodle question/type/numerical"
+<XMLDB PATH="question/type/numerical/db" VERSION="20091001" COMMENT="XMLDB file for Moodle question/type/numerical"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
- <TABLE NAME="question_numerical" COMMENT="Options for numerical questions." NEXT="question_numerical_units">
+ <TABLE NAME="question_numerical" COMMENT="Options for numerical questions." NEXT="question_numerical_options">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="question"/>
<FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Redundant, because of the answer field. Foreign key references question.id." PREVIOUS="id" NEXT="answer"/>
<INDEX NAME="answer" UNIQUE="false" FIELDS="answer"/>
</INDEXES>
</TABLE>
- <TABLE NAME="question_numerical_units" COMMENT="Optional unit options for numerical questions. This table is also used by the calculated question type." PREVIOUS="question_numerical">
+ <TABLE NAME="question_numerical_options" COMMENT="Options for questions of type numerical This table is also used by the calculated question type" PREVIOUS="question_numerical" NEXT="question_numerical_units">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="question"/>
+ <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="instructions"/>
+ <FIELD NAME="instructions" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="Feedback shown for any incorrect response." PREVIOUS="question" NEXT="showunits"/>
+ <FIELD NAME="showunits" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="display units as multichoice" PREVIOUS="instructions" NEXT="unitsleft"/>
+ <FIELD NAME="unitsleft" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="display the unit at left as in $1.00" PREVIOUS="showunits" NEXT="unitgradingtype"/>
+ <FIELD NAME="unitgradingtype" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 no penalty, 1 total grade, 2 response grade" PREVIOUS="unitsleft" NEXT="unitpenalty"/>
+ <FIELD NAME="unitpenalty" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="true" DEFAULT="0.1" SEQUENCE="false" DECIMALS="7" PREVIOUS="unitgradingtype"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="question"/>
+ <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id" PREVIOUS="primary"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="question_numerical_units" COMMENT="Optional unit options for numerical questions. This table is also used by the calculated question type." PREVIOUS="question_numerical_options">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="question"/>
<FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references question.id" PREVIOUS="id" NEXT="multiplier"/>
$result = true;
//===== 1.9.0 upgrade line ======//
+ if ($result && $oldversion < 2009100100 ) { //New version in version.php
+
+ /// Define table question_numerical_options to be created
+ $table = new xmldb_table('question_numerical_options');
+
+ /// Adding fields to table question_numerical_options
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('question', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
+ $table->add_field('instructions', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
+ $table->add_field('showunits', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
+ $table->add_field('unitsleft', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('unitgradingtype', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
+ $table->add_field('unitpenalty', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0.1');
+
+ /// Adding keys to table question_numerical_options
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->add_key('question', XMLDB_KEY_FOREIGN, array('question'), 'question', array('id'));
+ /// Conditionally launch create table for question_calculated_options
+ if (!$dbman->table_exists($table)) {
+ // $dbman->create_table doesnt return a result, we just have to trust it
+ $dbman->create_table($table);
+ }//else
+ upgrade_plugin_savepoint($result, 2009100100, 'qtype', 'numerical');
+ }
return $result;
}
--- /dev/null
+<?php
+// as the entry is controlled the question type here is numerical
+ $nameunit = "name=\"".$question->name_prefix."unit\"";
+ $nameanswer = "name=\"".$question->name_prefix."answer\"";
+//if left unit is placed before answer so we need to answer field text and a center pice for the show units options
+// split the respnse in 2 element numerical and units
+/*if (!empty($question->options->showunits)){
+ if(isset($question->options->units) && count($question->options->units)){
+ $length = 0;
+ $goodkey = 0 ;
+ foreach ($question->options->units as $key => $unit){
+ if (false === stripos($value, $unit->unit)){
+ }else{
+
+ if(strlen($unit->unit)> $length) {$length =strlen($unit->unit);
+ $goodkey = $key ;
+ }
+ }
+ }
+ if($length){
+ $value = str_replace($question->options->units[$goodkey]->unit, '' , $value);
+ }
+ $state->responses['unit']=$goodkey ;<div class="ablock clearfix">
+ }
+
+ }*/
+ if (isset($state->responses['answer']) && $state->responses['answer']!='') {
+ $valueanswer = ' value="'.s($state->responses['answer']).'" ';
+ } else {
+ $valueanswer = ' value="" ';
+ }
+ if (isset($state->responses['unit']) && $state->responses['unit']!='') {
+ $valueunit = ' value="'.s($state->responses['unit']).'" ';
+ } else {
+
+ $valueunit = ' value="" ';
+ if ($question->options->showunits == 2 ){
+ $valueunit = ' value="'.s($question->options->units[0]->unit).'" ';
+ }
+ }
+ // put a div to enclose the answer and unit elements<div class="clearfix"></div>
+ $textlength = 20 ;
+?>
+
+<?php
+ if ( $question->options->unitsleft == 0 ){ ?>
+
+ <div class="answer">
+ <fieldset class="answer" id="generalheader">
+ <legend class="ftoggler">
+ <?php echo get_string('number', 'quiz') ; ?>
+ </legend>
+ <input type="text" class="<?php echo $class; ?>" <?php echo "$readonly $nameanswer $valueanswer"; //
+ ?> size="<?php echo $textlength;?>" />
+ <?php echo $feedbackimg; ?>
+</fieldset>
+ </div>
+
+
+<?php }// display unit
+ $class = '';
+ $feedbackimgunit = '';
+ if ($options->feedback){
+ $classunit = question_get_feedback_class(1-$this->raw_unitpenalty);
+ $feedbackimgunit = question_get_feedback_image(1-$this->raw_unitpenalty, $options->feedback);
+ }
+ if ($question->options->showunits == 3 || (isset($question->options->units) && count($question->options->units) == 0 )) {// no unit display or tested
+
+?>
+ <div class="answer">
+ <input type="hidden"
+ <?php
+ echo $nameunit;
+ ?>
+ value ="" />
+ </div>
+<?php
+ } else if ($question->options->showunits == 0 ) {// display unit text input
+?>
+<div class="answer">
+ <fieldset class="clearfix" id="generalheader">
+ <legend class="ftoggler">
+ <?php echo get_string('unit', 'quiz'); ?>
+ </legend>
+ <input type="text" class="<?php echo $classunit; ?>" <?php echo "$readonly $nameunit $valueunit"; //
+ ?> size="<?php echo $textlength;?>"/>
+ <?php echo $feedbackimgunit; ?>
+</fieldset>
+ </div>
+<?php
+
+ } else if ($question->options->showunits == 2 ) {// display text
+
+?>
+ <div class="answer">
+ <fieldset class="clearfix" id="generalheader">
+ <legend class="ftoggler">
+ <?php echo get_string('unit', 'quiz');
+ //echo $question->options->units[0]->unit ;
+ ?>
+ </legend>
+ <input type="hidden"
+ <?php
+ echo $nameunit; echo $valueunit ;
+
+ ?>
+ />
+ <?php echo $question->options->units[0]->unit ;
+
+ echo ' ' ;
+ ?>
+ </fieldset>
+ </div>
+
+ <?php
+
+ //display the units as choice
+
+ } else if ($question->options->showunits == 1){?>
+
+
+
+<?php
+ //display the units as choice
+ if ($question->options->showunits == 1 && isset($question->options->units)){?>
+ <div class="answer">
+ <table class="answer">
+
+<?php foreach ($question->options->units as $key => $unit) {
+ $checked = '';
+ $chosen = false;
+
+ $type = 'type="radio"';
+ // $nameunit = "name=\"".$question->name_prefix;//."unit\"";
+ if (isset($state->responses['unit'])){
+ if ($state->responses['unit'] == $unit->unit) {
+ $checked = 'checked="checked"';
+ $chosen = true;
+ }
+ }else if ($key == 0) {
+ $checked = 'checked="checked"';
+ $chosen = true;
+ }
+
+ $aid = $question->id ;
+ $a = new stdClass;
+ $a->id = $question->name_prefix."unit" ;//. "2"
+ $a->class = '';
+ $a->feedbackimg = '';
+
+ // Print the control
+ $a->control = "<input $readonly $nameunit $checked $type value=\"$key\" />";
+
+ if ($options->correct_responses && $answer->fraction > 0) {
+ $a->class = question_get_feedback_class(1);
+ }
+ if (($options->feedback && $chosen) || $options->correct_responses) {
+ if ($type == ' type="checkbox" ') {
+ $a->feedbackimg = question_get_feedback_image($answer->fraction > 0 ? 1 : 0, $chosen && $options->feedback);
+ } else {
+ $a->feedbackimg = question_get_feedback_image($answer->fraction, $chosen && $options->feedback);
+ }
+ }
+
+ // Print the answer text
+ $a->text = format_text($unit->unit, FORMAT_MOODLE, $formatoptions, $cmoptions->course);
+ $row = 0 ;
+
+?>
+ <tr class="<?php echo 'r'.$row = $row ? 0 : 1; ?>">
+ <td class="c0 control">
+ <?php echo $a->control; ?>
+ </td>
+ <td class="c1 text <?php echo $a->class ?>">
+ <label for="<?php echo $a->id ?>">
+ <?php echo $a->text; ?>
+ <?php echo $a->feedbackimg; ?>
+ </label>
+ </td>
+ </tr>
+ <?php } ?>
+
+ </table>
+
+ </div>
+ <?php } // end unit choices
+ // display intructions
+ // general message first
+ }
+
+ if ($question->options->unitsleft == 1 ){?>
+
+ <div class="answer">
+ <fieldset class="clearfix" id="generalheader">
+ <legend class="ftoggler">
+ <?php echo get_string('number', 'quiz'); ?>
+ </legend>
+ <input type="text" class="<?php echo $class; ?>" <?php echo "$readonly $nameanswer $valueanswer"; //
+ ?> size="<?php echo $textlength;?>"/>
+ <?php echo $feedbackimg; ?>
+ </fieldset>
+ </div>
+<?php }
+ //</div> put a div to enclose the answer and unit elements
+?>
+
+
+
+ <div class="feedback">
+ <fieldset class="clearfix" id="generalheader">
+ <legend class="ftoggler">
+ <?php echo get_string('instructions', 'quiz'); ?>
+ </legend>
+ <div class="feedback">
+ <?php echo get_string('validnumber', 'numerical');?>
+ </div>
+ <?php if (!empty($question->options->instructions)){?>
+ <div>
+ <?php echo format_text($question->options->instructions, true, $formatoptions, $cmoptions->course);?>
+ </div>
+ <?php }?>
+ </fieldset>
+ </div>
+
+ <?php ?>
+
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform) {
+ global $QTYPES ;
//------------------------------------------------------------------------------------------
$creategrades = get_grade_options();
$this->add_per_answer_fields($mform, get_string('answerno', 'qtype_numerical', '{no}'),
$creategrades->gradeoptions);
//------------------------------------------------------------------------------------------
- $repeated = array();
+ $QTYPES['numerical']->edit_numerical_options($mform);
+ /*
+ $mform->addElement('header', 'unithandling', get_string("Units handling", 'qtype_numerical'));
+ $currentgrp1 = array();
+
+ $currentgrp1[] =& $mform->createElement('text', 'unitpenalty', get_string('Penalty for bad unit', 'qtype_numerical') ,
+ array('size' => 3));
+ $currentgrp1[] =& $mform->createElement('static', 'penalty1','hello', get_string('as decimal fraction (0-1) of', 'qtype_numerical'));
+ $mform->addGroup($currentgrp1, 'penaltygrp', get_string('Penalty for bad unit', 'qtype_numerical'), null, false);
+ $mform->setType('unitpenalty', PARAM_NUMBER);
+ //$mform->addRule('unitpenalty', null, 'required', null, 'client');
+ $mform->setDefault('unitpenalty', 0.1);
+ $currentgrp = array();
+ $currentgrp[] =& $mform->createElement('radio', 'unitgradingtype', 'or', get_string('question grade', 'qtype_numerical'),1);
+ $currentgrp[] =& $mform->createElement('radio', 'unitgradingtype', '', get_string(' response grade', 'qtype_numerical'),2);
+ $mform->setDefault('unitgradingtype', 1);
+ $mform->addGroup($currentgrp, 'penaltychoicegrp', '',' or ', false);
+ $mform->setHelpButton('penaltychoicegrp', array('penaltygrp', get_string('unitpenalty', 'qtype_numerical'), 'qtype_numerical'));
+ $mform->addElement('radio', 'showunits', 'Edit unit ', get_string('Editable text input element', 'qtype_numerical'),0);
+ $mform->addElement('radio', 'showunits', 'Select units ', get_string('Choice radio element', 'qtype_numerical'),1);
+ $mform->addElement('radio', 'showunits', 'Display unit ', get_string('NON editable text of Unit No1', 'qtype_numerical'),2);
+ $mform->addElement('radio', 'showunits', 'No unit display', get_string("Only numerical answer will be graded leave Unit No1 empty", 'qtype_numerical'),3);
+ $mform->setDefault('showunits', 0);
+ $currentgrp = array();
+ $leftgrp[] =& $mform->createElement('radio', 'unitsleft', '', get_string('left as $1.00', 'qtype_numerical'),1);
+ $leftgrp[] =& $mform->createElement('radio', 'unitsleft', '', get_string('rigth as 1.00cm', 'qtype_numerical'),0);
+ $mform->addGroup($leftgrp, 'unitsleft', 'Unit position',' or ', false);
+ $mform->setDefault('unitsleft', 0);
+ $repeated = array();*/
$repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));
$repeated[] =& $mform->createElement('text', 'unit', get_string('unit', 'quiz'));
function set_data($question) {
if (isset($question->options)){
+ $default_values['unitgradingtype'] = $question->options->unitgradingtype ;
+ $default_values['unitpenalty'] = $question->options->unitpenalty ;
+ $default_values['showunits'] = $question->options->showunits ;
+ $default_values['unitsleft'] = $question->options->unitsleft ;
+ $default_values['instructions'] = $question->options->instructions ;
+
$answers = $question->options->answers;
if (count($answers)) {
$key = 0;
<?PHP // $Id$
-$plugin->version = 2006121500;
+$plugin->version = 2009100100;
$plugin->requires = 2007101000;
?>
<div class="prompt">
<?php echo get_string("answer", "quiz").': '; ?>
</div>
-
+ <?php if ($question->qtype == 'numerical' || $question->qtype == 'calculated' || $question->qtype == 'calculatedsimple' ){
+ include("$CFG->dirroot/question/type/numerical/display.html");?>
+<?php }else {?>
<div class="answer">
<input type="text" class="<?php echo $class; ?>" <?php echo "$readonly $inputname $value"; ?> size="80"/>
<?php echo $feedbackimg; ?>
</div>
+<?php }?>
<?php if ($feedback) { ?>
<div class="feedback">
<?php echo $feedback ?>