File: editquestion.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (27 lines) | stat: -rw-r--r-- 1,262 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php // $Id: editquestion.php,v 1.1 2006/03/24 19:31:47 gustav_delius Exp $

    // Get all the extra information if we're editing
    if (!empty($question->id) && isset($question->qtype) &&
     $QTYPES[$question->qtype]->get_question_options($question)) {
        $answer = array_values($question->options->answers);
        usort($answer, create_function('$a, $b',
         'if ($a->fraction == $a->fraction) { return 0; }' .
         'else { return $a->fraction < $b->fraction ? -1 : 1; }'));
        $answer = $answer[0]; // Get the answer with the highest fraction (i.e. 1)
        $units  = array_values($question->options->units);
        usort($units, create_function('$a, $b', // make sure the default unit is at index 0
         'if (1.0 === (float)$a->multiplier) { return -1; } else '.
         'if (1.0 === (float)$b->multiplier) { return 1; } else { return 0; }'));
        $tolerance = $answer->tolerance;
    } else {
        $answer   = new stdClass;
        $answer->answer   = '';
        $answer->feedback = '';
        $units     = array();
        $tolerance = '';
    }

    print_heading_with_help(get_string("editingnumerical", "quiz"), "numerical", "quiz");
    require("$CFG->dirroot/question/type/numerical/editquestion.html");

?>