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
namespace mod_quiz\question\bank;
18
 
19
/**
20
 * A column type for the name followed by the start of the question text.
21
 *
22
 * @package    mod_quiz
23
 * @category   question
24
 * @copyright  2009 Tim Hunt
25
 * @author     2021 Safat Shahin <safatshahin@catalyst-au.net>
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
class question_name_text_column extends question_name_column {
29
 
30
    #[\Override]
31
    public function get_name(): string {
32
        return 'questionnametext';
33
    }
34
 
35
    #[\Override]
36
    public function get_default_width(): int {
37
        // In the places this is used, this seems to make it use all the available space, without overflowing.
38
        return 800;
39
    }
40
 
41
    #[\Override]
42
    protected function display_content($question, $rowclasses): void {
43
        echo \html_writer::start_tag('div');
44
        $labelfor = $this->label_for($question);
45
        if ($labelfor) {
46
            echo \html_writer::start_tag('label', ['for' => $labelfor]);
47
        }
48
        echo quiz_question_tostring($question, false, true, true, $question->tags);
49
        if ($labelfor) {
50
            echo \html_writer::end_tag('label');
51
        }
52
        echo \html_writer::end_tag('div');
53
    }
54
 
55
    #[\Override]
56
    public function get_required_fields(): array {
57
        $fields = parent::get_required_fields();
58
        $fields[] = 'q.questiontext';
59
        $fields[] = 'q.questiontextformat';
60
        $fields[] = 'qbe.idnumber';
61
        return $fields;
62
    }
63
 
64
    #[\Override]
65
    public function load_additional_data(array $questions) {
66
        parent::load_additional_data($questions);
67
        parent::load_question_tags($questions);
68
    }
69
}