Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 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 * Contains renderers for the bulk activity completion stuff. 19 * 20 * @package core_course 21 * @copyright 2017 Adrian Greeve 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die; 26 27 require_once($CFG->dirroot.'/course/renderer.php'); 28 29 /** 30 * Main renderer for the bulk activity completion stuff. 31 * 32 * @package core_course 33 * @copyright 2017 Adrian Greeve 34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 35 */ 36 class core_course_bulk_activity_completion_renderer extends plugin_renderer_base { 37 38 /** 39 * Render the navigation tabs for the completion page. 40 * 41 * @deprecated since Moodle 4.0 42 * @param int|stdClass $courseorid the course object or id. 43 * @param String $page the tab to focus. 44 * @return string html 45 */ 46 public function navigation($courseorid, $page) { 47 debugging('navigation() has been deprecated as the tabs navigation structure in the completion page ' . 48 'has been replaced with tertiary navigation. Please use render_course_completion_action_bar() instead.', 49 DEBUG_DEVELOPER); 50 51 $tabs = core_completion\manager::get_available_completion_tabs($courseorid); 52 if (count($tabs) > 1) { 53 return $this->tabtree($tabs, $page); 54 } else { 55 return ''; 56 } 57 } 58 59 /** 60 * Render the bulk completion tab. 61 * 62 * @param Array|stdClass $data the context data to pass to the template. 63 * @return bool|string 64 */ 65 public function bulkcompletion($data) { 66 return parent::render_from_template('core_course/bulkactivitycompletion', $data); 67 } 68 69 /** 70 * Render the default completion tab. 71 * 72 * @param Array|stdClass $data the context data to pass to the template. 73 * @return bool|string 74 */ 75 public function defaultcompletion($data) { 76 return parent::render_from_template('core_course/defaultactivitycompletion', $data); 77 } 78 79 /** 80 * Renders the form for bulk editing activities completion 81 * 82 * @param moodleform $form 83 * @param array $activities 84 * @return string 85 */ 86 public function edit_bulk_completion($form, $activities) { 87 ob_start(); 88 $form->display(); 89 $formhtml = ob_get_contents(); 90 ob_end_clean(); 91 92 $data = (object)[ 93 'form' => $formhtml, 94 'activities' => array_values($activities), 95 'activitiescount' => count($activities), 96 ]; 97 return parent::render_from_template('core_course/editbulkactivitycompletion', $data); 98 } 99 100 /** 101 * Renders the form for editing default completion 102 * 103 * @param moodleform $form 104 * @param array $modules 105 * @return string 106 */ 107 public function edit_default_completion($form, $modules) { 108 ob_start(); 109 $form->display(); 110 $formhtml = ob_get_contents(); 111 ob_end_clean(); 112 113 $data = (object)[ 114 'form' => $formhtml, 115 'modules' => array_values($modules), 116 'modulescount' => count($modules), 117 ]; 118 return parent::render_from_template('core_course/editdefaultcompletion', $data); 119 } 120 121 /** 122 * Renders the course completion action bar. 123 * 124 * @param \core_course\output\completion_action_bar $actionbar 125 * @return string The HTML output 126 */ 127 public function render_course_completion_action_bar(\core_course\output\completion_action_bar $actionbar): string { 128 $data = $actionbar->export_for_template($this->output); 129 return $this->output->render_from_template('core_course/completion_action_bar', $data); 130 } 131 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body