Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Upgrade library code for the essay question type.
19
 *
20
 * @package    qtype
21
 * @subpackage essay
22
 * @copyright  2010 The Open University
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
 
27
defined('MOODLE_INTERNAL') || die();
28
 
29
 
30
/**
31
 * Class for converting attempt data for essay questions when upgrading
32
 * attempts to the new question engine.
33
 *
34
 * This class is used by the code in question/engine/upgrade/upgradelib.php.
35
 *
36
 * @copyright  2010 The Open University
37
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 */
39
class qtype_essay_qe2_attempt_updater extends question_qtype_attempt_updater {
40
    public function right_answer() {
41
        return '';
42
    }
43
 
44
    public function response_summary($state) {
45
        if (!empty($state->answer)) {
46
            return $this->to_text($state->answer);
47
        } else {
48
            return null;
49
        }
50
    }
51
 
52
    public function was_answered($state) {
53
        return !empty($state->answer);
54
    }
55
 
56
    public function set_first_step_data_elements($state, &$data) {
57
    }
58
 
59
    public function supply_missing_first_step_data(&$data) {
60
    }
61
 
62
    public function set_data_elements_for_step($state, &$data) {
63
        if (!empty($state->answer)) {
64
            $data['answer'] = $state->answer;
65
            $data['answerformat'] = FORMAT_HTML;
66
        }
67
    }
68
}