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 |
* Renderer for adding/editing a question.
|
|
|
19 |
*
|
|
|
20 |
* This code is based on question/renderer.php by The Open University.
|
|
|
21 |
*
|
|
|
22 |
* @package qbank_editquestion
|
|
|
23 |
* @copyright 2021 Catalyst IT Australia Pty Ltd
|
|
|
24 |
* @author Safat Shahin <safatshahin@catalyst-au.net>
|
|
|
25 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
26 |
*/
|
|
|
27 |
|
|
|
28 |
namespace qbank_editquestion\output;
|
|
|
29 |
|
|
|
30 |
/**
|
|
|
31 |
* Renderer for add/edit/copy
|
|
|
32 |
*
|
|
|
33 |
* @package qbank_editquestion
|
|
|
34 |
* @copyright 2021 Catalyst IT Australia Pty Ltd
|
|
|
35 |
* @author Safat Shahin <safatshahin@catalyst-au.net>
|
|
|
36 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
37 |
*/
|
|
|
38 |
class renderer extends \plugin_renderer_base {
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Render a qbank_chooser.
|
|
|
42 |
*
|
|
|
43 |
* @param \renderable $qbankchooser The chooser.
|
|
|
44 |
* @return string
|
|
|
45 |
*/
|
|
|
46 |
public function render_qbank_chooser(\renderable $qbankchooser) {
|
|
|
47 |
return $this->render_from_template('qbank_editquestion/qbank_chooser', $qbankchooser->export_for_template($this));
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* Render add question button.
|
|
|
52 |
*
|
|
|
53 |
* @param array $addquestiondata
|
|
|
54 |
* @return bool|string
|
|
|
55 |
* @deprecated since Moodle 4.3. Use {@see add_new_question} renderable instead
|
|
|
56 |
* @todo Final deprecation in Moodle 4.7
|
|
|
57 |
*/
|
|
|
58 |
public function render_create_new_question_button($addquestiondata) {
|
|
|
59 |
debugging('render_create_new_question_button() is deprecated. '
|
|
|
60 |
. 'Pass the add_new_question renderable to render() instead.');
|
|
|
61 |
return $this->render_from_template('qbank_editquestion/add_new_question', $addquestiondata);
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* Render question information for edit form.
|
|
|
66 |
*
|
|
|
67 |
* @param array $questiondata
|
|
|
68 |
* @return bool|string
|
|
|
69 |
*/
|
|
|
70 |
public function render_question_info($questiondata) {
|
|
|
71 |
return $this->render_from_template('qbank_editquestion/question_info', $questiondata);
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
* Render status dropdown.
|
|
|
76 |
*
|
|
|
77 |
* @param array $dropdownoptions
|
|
|
78 |
* @return bool|string
|
|
|
79 |
*/
|
|
|
80 |
public function render_status_dropdown($dropdownoptions) {
|
|
|
81 |
return $this->render_from_template('qbank_editquestion/question_status_dropdown', $dropdownoptions);
|
|
|
82 |
}
|
|
|
83 |
}
|