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 qbank_columnsortorder\output;
|
|
|
18 |
|
|
|
19 |
use moodle_url;
|
|
|
20 |
use templatable;
|
|
|
21 |
use renderable;
|
|
|
22 |
use qbank_columnsortorder\column_manager;
|
|
|
23 |
|
|
|
24 |
/**
|
|
|
25 |
* Renderable for the question bank preview.
|
|
|
26 |
*
|
|
|
27 |
* This takes the HTML for a question bank preview, and displays in a page with a link to return to the admin screen.
|
|
|
28 |
*
|
|
|
29 |
* @package qbank_columnsortorder
|
|
|
30 |
* @copyright 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
|
|
|
31 |
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
|
|
32 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
33 |
*/
|
|
|
34 |
class column_sort_preview implements renderable, templatable {
|
|
|
35 |
/** @var string Rendered preview HTML. */
|
|
|
36 |
protected string $preview;
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* Store rendered preview for template context.
|
|
|
40 |
*
|
|
|
41 |
* @param string $preview
|
|
|
42 |
*/
|
|
|
43 |
public function __construct(string $preview) {
|
|
|
44 |
$this->preview = $preview;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
public function export_for_template(\renderer_base $output): array {
|
|
|
48 |
$context = [
|
|
|
49 |
'backurl' => new moodle_url('/question/bank/columnsortorder/sortcolumns.php'),
|
|
|
50 |
'preview' => $this->preview,
|
|
|
51 |
];
|
|
|
52 |
return $context;
|
|
|
53 |
}
|
|
|
54 |
}
|