Autoría | Ultima modificación | Ver Log |
<?php// This file is part of Moodle - http://moodle.org///// Moodle is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Moodle is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Moodle. If not, see <http://www.gnu.org/licenses/>./*** myprofile renderer.** @package theme_universe* @copyright Copyright © 2021 onwards Marcin Czaja* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later**/namespace theme_universe\output\core_user\myprofile;defined('MOODLE_INTERNAL') || die;use core_user\output\myprofile\category;use core_user\output\myprofile\node;use core_user\output\myprofile\tree;use html_writer;require_once($CFG->dirroot . '/user/lib.php');/*** myprofile renderer.* @copyright Copyright (c) 2017 Manoj Solanki (Coventry University)* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later*/class renderer extends \core_user\output\myprofile\renderer {/*** Render a category.** @param category $category** @return string*/public function render_category(category $category) {$classes = $category->classes;if (empty($classes)) {$return = \html_writer::start_tag('section',array('class' => 'node_category card d-inline-block w-100 mb-5'));$return .= \html_writer::start_tag('div', array('class' => 'card-body'));} else {$return = \html_writer::start_tag('section',array('class' => 'node_category card d-inline-block w-100 mb-3' . $classes));$return .= \html_writer::start_tag('div', array('class' => 'card-body'));}$return .= \html_writer::tag('h5', $category->title, array('class' => 'card-title'));$nodes = $category->nodes;if (empty($nodes)) {// No nodes, nothing to render.return '';}$return .= \html_writer::start_tag('ul');foreach ($nodes as $node) {$return .= $this->render($node);}$return .= \html_writer::end_tag('ul');$return .= \html_writer::end_tag('div');$return .= \html_writer::end_tag('section');return $return;}}