Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
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 * Group details page. 19 * 20 * @package core_group 21 * @copyright 2017 Adrian Greeve <adrian@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace core_group\output; 25 defined('MOODLE_INTERNAL') || die(); 26 27 use renderable; 28 use renderer_base; 29 use stdClass; 30 use templatable; 31 use context_course; 32 use moodle_url; 33 34 /** 35 * Group details page class. 36 * 37 * @package core_group 38 * @copyright 2017 Adrian Greeve <adrian@moodle.com> 39 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 40 */ 41 class group_details implements renderable, templatable { 42 43 /** @var stdClass $group An object with the group information. */ 44 protected $group; 45 46 /** 47 * group_details constructor. 48 * 49 * @param int $groupid Group ID to show details of. 50 */ 51 public function __construct($groupid) { 52 $this->group = groups_get_group($groupid, '*', MUST_EXIST); 53 } 54 55 /** 56 * Export the data. 57 * 58 * @param renderer_base $output 59 * @return stdClass 60 */ 61 public function export_for_template(renderer_base $output) { 62 63 if (!empty($this->group->description) || (!empty($this->group->picture) && empty($this->group->hidepicture))) { 64 $context = context_course::instance($this->group->courseid); 65 $description = file_rewrite_pluginfile_urls($this->group->description, 66 'pluginfile.php', 67 $context->id, 68 'group', 69 'description', 70 $this->group->id); 71 72 $descriptionformat = $this->group->descriptionformat ?? FORMAT_MOODLE; 73 $options = [ 74 'overflowdiv' => true, 75 'context' => $context 76 ]; 77 78 $data = new stdClass(); 79 $data->name = format_string($this->group->name, true, ['context' => $context]); 80 $data->pictureurl = get_group_picture_url($this->group, $this->group->courseid, true); 81 $data->description = format_text($description, $descriptionformat, $options); 82 83 if (has_capability('moodle/course:managegroups', $context)) { 84 $url = new moodle_url('/group/group.php', ['id' => $this->group->id, 'courseid' => $this->group->courseid]); 85 $data->editurl = $url->out(false); 86 } 87 88 return $data; 89 } else { 90 return; 91 } 92 } 93 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body