Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | 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
 * Renderers for outputting parts of the question bank.
19
 *
20
 * @package    core_question
21
 * @copyright  2011 The Open University
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
 
26
defined('MOODLE_INTERNAL') || die();
27
 
28
 
29
/**
30
 * This renderer outputs parts of the question bank.
31
 *
32
 * @copyright  2011 The Open University
33
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 */
35
class core_question_bank_renderer extends plugin_renderer_base {
36
 
37
    /**
38
     * Display additional navigation if needed.
39
     *
40
     * @param string $active
41
     * @return string
42
     */
43
    public function extra_horizontal_navigation($active = null) {
44
        // Horizontal navigation for question bank.
45
        if ($questionnode = $this->page->settingsnav->find("questionbank", \navigation_node::TYPE_CONTAINER)) {
46
            if ($children = $questionnode->children) {
47
                $tabs = [];
48
                foreach ($children as $key => $node) {
49
                    $tabs[] = new \tabobject($node->key, $node->action, $node->text);
50
                }
51
                if (empty($active) && $questionnode->find_active_node()) {
52
                    $active = $questionnode->find_active_node()->key;
53
                }
54
                return \html_writer::div(print_tabs([$tabs], $active, null, null, true),
55
                        'questionbank-navigation');
56
            }
57
        }
58
        return '';
59
    }
60
 
61
    /**
62
     * Output the icon for a question type.
63
     *
64
     * @param string $qtype the question type.
65
     * @return string HTML fragment.
66
     */
67
    public function qtype_icon($qtype) {
68
        $qtype = question_bank::get_qtype($qtype, false);
69
        $namestr = $qtype->local_name();
70
 
71
        return $this->image_icon('icon', $namestr, $qtype->plugin_name(), array('title' => $namestr));
72
    }
73
 
74
    /**
75
     * Render the column headers.
76
     *
77
     * @param array $qbankheaderdata
78
     * @return bool|string
79
     */
80
    public function render_column_header($qbankheaderdata) {
81
        return $this->render_from_template('core_question/column_header', $qbankheaderdata);
82
    }
83
 
84
    /**
85
     * Render the column sort elements.
86
     *
87
     * @param array $sortdata
88
     * @return bool|string
89
     */
90
    public function render_column_sort($sortdata) {
91
        return $this->render_from_template('core_question/column_sort', $sortdata);
92
    }
93
 
94
    /**
95
     * @deprecated since Moodle 4.3
96
     */
1441 ariadna 97
    #[\core\attribute\deprecated(
98
        'qbank_managecategories\output\renderer::render_category_condition()',
99
        since: '4.3',
100
        mdl: 'MDL-72321',
101
        final: true
102
    )]
1 efrain 103
    public function render_category_condition($displaydata) {
1441 ariadna 104
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
1 efrain 105
    }
106
 
107
    /**
108
     * @deprecated since Moodle 4.3
109
     */
1441 ariadna 110
    #[\core\attribute\deprecated(null, since: '4.3', mdl: 'MDL-72321', final: true)]
1 efrain 111
    public function render_category_condition_advanced($displaydata) {
1441 ariadna 112
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
1 efrain 113
    }
114
 
115
    /**
116
     * @deprecated since Moodle 4.3
117
     */
1441 ariadna 118
    #[\core\attribute\deprecated(
119
        'qbank_deletequestion\output\renderer::render_hidden_condition_advanced()',
120
        since: '4.3',
121
        mdl: 'MDL-72321',
122
        final: true
123
    )]
1 efrain 124
    public function render_hidden_condition_advanced($displaydata) {
1441 ariadna 125
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
1 efrain 126
    }
127
 
128
    /**
129
     * Render question pagination.
130
     *
131
     * @param array $displaydata
132
     * @return bool|string
133
     */
134
    public function render_question_pagination($displaydata) {
135
        return $this->render_from_template('core_question/question_pagination', $displaydata);
136
    }
137
 
138
    /**
139
     * Render the showtext option.
140
     *
141
     * It's not a checkbox any more! [Name your API after the purpose, not the implementation!]
142
     *
143
     * @param array $displaydata
144
     * @return string
145
     */
146
    public function render_showtext_checkbox($displaydata) {
147
        return $this->render_from_template('core_question/showtext_option',
148
                ['selected' . $displaydata['checked'] => true]);
149
    }
150
 
151
    /**
152
     * Render bulk actions ui.
153
     *
154
     * @param array $displaydata
155
     * @return bool|string
156
     */
157
    public function render_bulk_actions_ui($displaydata) {
158
        return $this->render_from_template('core_question/bulk_actions_ui', $displaydata);
159
    }
160
}