Paul Holden f47e89a9bd MDL-70795 reportbuilder: editor elements to set column aggregation.
Aggregation of report columns allows the report editor to perform
common types of data aggregation (concatenation, sum, count, etc)
on given columns.
2021-10-19 13:56:05 +01:00

74 lines
2.2 KiB
PHP

<?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/>.
/**
* Callback methods for reportbuilder component
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
declare(strict_types=1);
use core_reportbuilder\form\filter;
/**
* Return the filters form fragment
*
* @param array $params
* @return string
*/
function core_reportbuilder_output_fragment_filters_form(array $params): string {
$filtersform = new filter(null, null, 'post', '', [], true, [
'reportid' => $params['reportid'],
'parameters' => $params['parameters'],
]);
$filtersform->set_data_for_dynamic_submission();
return $filtersform->render();
}
/**
* Plugin inplace editable implementation
*
* @param string $itemtype
* @param int $itemid
* @param string $newvalue
* @return \core\output\inplace_editable|bool
*/
function core_reportbuilder_inplace_editable($itemtype, $itemid, $newvalue) {
$itemid = (int) $itemid;
switch ($itemtype) {
case 'reportname':
return \core_reportbuilder\output\report_name_editable::update($itemid, $newvalue);
case 'columnheading':
return \core_reportbuilder\output\column_heading_editable::update($itemid, $newvalue);
case 'columnaggregation':
return \core_reportbuilder\output\column_aggregation_editable::update($itemid, $newvalue);
case 'filterheading':
return \core_reportbuilder\output\filter_heading_editable::update($itemid, $newvalue);
default:
return false;
}
}