| Línea 91... |
Línea 91... |
| 91 |
$this->define_columns([0]);
|
91 |
$this->define_columns([0]);
|
| 92 |
return;
|
92 |
return;
|
| 93 |
}
|
93 |
}
|
| Línea 94... |
Línea 94... |
| 94 |
|
94 |
|
| 95 |
// If we are aggregating any columns, we should group by the remaining ones.
|
95 |
// If we are aggregating any columns, we should group by the remaining ones.
|
| 96 |
$aggregatedcolumns = array_filter($columns, static function(column $column): bool {
|
96 |
$aggregatedcolumns = array_filter($columns, fn(column $column): bool => !empty($column->get_aggregation()));
|
| 97 |
return !empty($column->get_aggregation());
|
- |
|
| Línea 98... |
Línea 97... |
| 98 |
});
|
97 |
$hasaggregatedcolumns = !empty($aggregatedcolumns);
|
| 99 |
|
- |
|
| 100 |
// Also take account of the report setting to show unique rows (only if no columns are being aggregated).
|
98 |
|
| Línea 101... |
Línea 99... |
| 101 |
$hasaggregatedcolumns = !empty($aggregatedcolumns);
|
99 |
// Also take account of the report setting to show unique rows (only if no columns are being aggregated).
|
| 102 |
$showuniquerows = !$hasaggregatedcolumns && $this->persistent->get('uniquerows');
|
100 |
$showuniquerows = !$hasaggregatedcolumns && $this->persistent->get('uniquerows');
|
| 103 |
|
101 |
|
| 104 |
$columnheaders = $columnsattributes = [];
|
102 |
$columnheaders = $columnsattributes = [];
|
| Línea 105... |
Línea 103... |
| 105 |
foreach ($columns as $column) {
|
103 |
foreach ($columns as $column) {
|
| 106 |
$columnheading = $column->get_persistent()->get_formatted_heading($this->report->get_context());
|
104 |
$columnheading = $column->get_persistent()->get_formatted_heading($this->report->get_context());
|
| 107 |
$columnheaders[$column->get_column_alias()] = $columnheading !== '' ? $columnheading : $column->get_title();
|
105 |
$columnheaders[$column->get_column_alias()] = $columnheading !== '' ? $columnheading : $column->get_title();
|
| 108 |
|
106 |
|
| 109 |
// We need to determine for each column whether we should group by it's fields, to support aggregation.
|
107 |
// We need to determine for each column whether we should group by its fields, to support aggregation.
|
| Línea 110... |
Línea 108... |
| 110 |
$columnaggregation = $column->get_aggregation();
|
108 |
$columnaggregation = $column->get_aggregation();
|
| 111 |
if ($showuniquerows || ($hasaggregatedcolumns && empty($columnaggregation))) {
|
109 |
if ($showuniquerows || ($hasaggregatedcolumns && (empty($columnaggregation) || $columnaggregation::column_groupby()))) {
|
| Línea 261... |
Línea 259... |
| 261 |
'aggregationeditable' => $aggregationeditable->render($renderer),
|
259 |
'aggregationeditable' => $aggregationeditable->render($renderer),
|
| 262 |
'movetitle' => get_string('movecolumn', 'core_reportbuilder', $column->get_title()),
|
260 |
'movetitle' => get_string('movecolumn', 'core_reportbuilder', $column->get_title()),
|
| 263 |
]);
|
261 |
]);
|
| Línea 264... |
Línea 262... |
| 264 |
|
262 |
|
| 265 |
echo html_writer::tag('th', $headercell, [
|
263 |
echo html_writer::tag('th', $headercell, [
|
| 266 |
'class' => 'border-right border-left',
|
264 |
'class' => 'border-end border-start',
|
| 267 |
'scope' => 'col',
|
265 |
'scope' => 'col',
|
| 268 |
'data-region' => 'column-header',
|
266 |
'data-region' => 'column-header',
|
| 269 |
'data-column-id' => $column->get_persistent()->get('id'),
|
267 |
'data-column-id' => $column->get_persistent()->get('id'),
|
| 270 |
'data-column-name' => $column->get_title(),
|
268 |
'data-column-name' => $column->get_title(),
|
| Línea 348... |
Línea 346... |
| 348 |
|
346 |
|
| 349 |
$button = html_writer::tag('button', $buttonicon, [
|
347 |
$button = html_writer::tag('button', $buttonicon, [
|
| 350 |
'type' => 'button',
|
348 |
'type' => 'button',
|
| 351 |
'class' => 'btn collapsed',
|
349 |
'class' => 'btn collapsed',
|
| 352 |
'title' => $buttontitle,
|
350 |
'title' => $buttontitle,
|
| 353 |
'data-toggle' => 'collapse',
|
351 |
'data-bs-toggle' => 'collapse',
|
| 354 |
'data-action' => 'toggle-card'
|
352 |
'data-action' => 'toggle-card'
|
| 355 |
]);
|
353 |
]);
|
| 356 |
$html .= html_writer::tag('td', $button, ['class' => 'card-toggle d-none']);
|
354 |
$html .= html_writer::tag('td', $button, ['class' => 'card-toggle d-none']);
|
| 357 |
}
|
355 |
}
|
| Línea 387... |
Línea 385... |
| 387 |
private static function show_live_editing(): bool {
|
385 |
private static function show_live_editing(): bool {
|
| 388 |
global $CFG;
|
386 |
global $CFG;
|
| Línea 389... |
Línea 387... |
| 389 |
|
387 |
|
| 390 |
return !empty($CFG->customreportsliveediting);
|
388 |
return !empty($CFG->customreportsliveediting);
|
| - |
|
389 |
}
|
| - |
|
390 |
|
| - |
|
391 |
/**
|
| - |
|
392 |
* Check if the user has the capability to access this table.
|
| - |
|
393 |
*
|
| - |
|
394 |
* @return bool Return true if capability check passed.
|
| - |
|
395 |
*/
|
| - |
|
396 |
public function has_capability(): bool {
|
| - |
|
397 |
return \core_reportbuilder\permission::can_edit_report($this->persistent);
|
| 391 |
}
|
398 |
}
|