See Release Notes
Long Term Support Release
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 * Callback methods for reportbuilder component 19 * 20 * @package core_reportbuilder 21 * @copyright 2021 Paul Holden <paulh@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 declare(strict_types=1); 26 27 use core\output\inplace_editable; 28 use core_reportbuilder\form\audience; 29 use core_reportbuilder\form\filter; 30 31 /** 32 * Return the filters form fragment 33 * 34 * @param array $params 35 * @return string 36 */ 37 function core_reportbuilder_output_fragment_filters_form(array $params): string { 38 $filtersform = new filter(null, null, 'post', '', [], true, [ 39 'reportid' => $params['reportid'], 40 'parameters' => $params['parameters'], 41 ]); 42 43 $filtersform->set_data_for_dynamic_submission(); 44 45 return $filtersform->render(); 46 } 47 48 /** 49 * Return the audience form fragment 50 * 51 * @param array $params 52 * @return string 53 */ 54 function core_reportbuilder_output_fragment_audience_form(array $params): string { 55 global $PAGE; 56 57 $audienceform = new audience(null, null, 'post', '', [], true, [ 58 'reportid' => $params['reportid'], 59 'classname' => $params['classname'], 60 ]); 61 $audienceform->set_data_for_dynamic_submission(); 62 63 $context = [ 64 'instanceid' => 0, 65 'heading' => $params['title'], 66 'headingeditable' => $params['title'], 67 'form' => $audienceform->render(), 68 'canedit' => true, 69 'candelete' => true, 70 'showormessage' => $params['showormessage'], 71 ]; 72 73 $renderer = $PAGE->get_renderer('core_reportbuilder'); 74 return $renderer->render_from_template('core_reportbuilder/local/audience/form', $context); 75 } 76 77 /** 78 * Plugin inplace editable implementation 79 * 80 * @param string $itemtype 81 * @param int $itemid 82 * @param string $newvalue 83 * @return inplace_editable|null 84 */ 85 function core_reportbuilder_inplace_editable(string $itemtype, int $itemid, string $newvalue): ?inplace_editable { 86 switch ($itemtype) { 87 case 'reportname': 88 return \core_reportbuilder\output\report_name_editable::update($itemid, $newvalue); 89 90 case 'columnheading': 91 return \core_reportbuilder\output\column_heading_editable::update($itemid, $newvalue); 92 93 case 'columnaggregation': 94 return \core_reportbuilder\output\column_aggregation_editable::update($itemid, $newvalue); 95 96 case 'filterheading': 97 return \core_reportbuilder\output\filter_heading_editable::update($itemid, $newvalue); 98 99 case 'audienceheading': 100 return \core_reportbuilder\output\audience_heading_editable::update($itemid, $newvalue); 101 102 case 'schedulename': 103 return \core_reportbuilder\output\schedule_name_editable::update($itemid, $newvalue); 104 } 105 106 return null; 107 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body