|
| 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_subcourse\courseformat; |
| 18 | + |
| 19 | +use core\output\action_link; |
| 20 | +use core\output\local\properties\button; |
| 21 | +use core\output\local\properties\text_align; |
| 22 | +use core\url; |
| 23 | +use core_courseformat\local\overview\overviewitem; |
| 24 | + |
| 25 | +/** |
| 26 | + * Subcourse overview integration (for Moodle 5.1+) |
| 27 | + * |
| 28 | + * @package mod_subcourse |
| 29 | + * @copyright 2026 Luca Bösch <[email protected]> |
| 30 | + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 31 | + */ |
| 32 | +class overview extends \core_courseformat\activityoverviewbase { |
| 33 | + /** |
| 34 | + * Constructor. |
| 35 | + * |
| 36 | + * @param \cm_info $cm the course module instance. |
| 37 | + * @param \core\output\renderer_helper $rendererhelper the renderer helper. |
| 38 | + */ |
| 39 | + public function __construct( |
| 40 | + \cm_info $cm, |
| 41 | + /** @var \core\output\renderer_helper $rendererhelper the renderer helper */ |
| 42 | + protected readonly \core\output\renderer_helper $rendererhelper, |
| 43 | + ) { |
| 44 | + parent::__construct($cm); |
| 45 | + } |
| 46 | + |
| 47 | + #[\Override] |
| 48 | + public function get_actions_overview(): ?overviewitem { |
| 49 | + $url = new url( |
| 50 | + '/mod/verbalfeedback/view.php', |
| 51 | + ['id' => $this->cm->id], |
| 52 | + ); |
| 53 | + |
| 54 | + if (defined('button::BODY_OUTLINE')) { |
| 55 | + $bodyoutline = button::BODY_OUTLINE; |
| 56 | + $buttonclass = $bodyoutline->classes(); |
| 57 | + } else { |
| 58 | + $buttonclass = "btn btn-outline-secondary"; |
| 59 | + } |
| 60 | + |
| 61 | + $text = get_string('view'); |
| 62 | + $content = new action_link( |
| 63 | + url: $url, |
| 64 | + text: $text, |
| 65 | + attributes: ['class' => $buttonclass], |
| 66 | + ); |
| 67 | + |
| 68 | + return new overviewitem( |
| 69 | + name: get_string('actions'), |
| 70 | + value: $text, |
| 71 | + content: $content, |
| 72 | + textalign: text_align::CENTER, |
| 73 | + ); |
| 74 | + } |
| 75 | +} |
0 commit comments