Skip to content

Commit

Permalink
Improvement: Switch between report contexts within report and fix req…
Browse files Browse the repository at this point in the history
…uire_login in system scope. #721
  • Loading branch information
ibernhardf committed Jan 27, 2025
1 parent ee06455 commit 78fc295
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
13 changes: 11 additions & 2 deletions classes/table/manageusers_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,25 @@ public function col_option(stdClass $values) {
]
);

$report2link = new moodle_url(
'/mod/booking/report2.php',
[
'cmid' => $values->cmid,
'optionid' => $values->optionid,
]
);

$instancelink = new moodle_url(
'/mod/booking/view.php',
['id' => $values->cmid]
'/mod/booking/report2.php',
['cmid' => $values->cmid]
);

$data = [
'id' => $values->id,
'titleprefix' => $values->titleprefix,
'title' => $values->text,
'optionlink' => $optionlink->out(false),
'report2link' => $report2link->out(false),
'instancename' => $values->instancename,
'instancelink' => $instancelink->out(false),
'teachers' => $teachers,
Expand Down
2 changes: 1 addition & 1 deletion report2.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
"</a>";
} else {
$scopes = ['system'];
require_login(0, false);
require_login(1, false);
$scope = 'system'; // The whole site.
$scopeid = 0;
$urlparams = []; // For PAGE url.
Expand Down
7 changes: 6 additions & 1 deletion templates/report/option.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
<div class="mod-booking-report-option ml-3">
<div>
<div class="h6 mb-1">
<a href="{{optionlink}}" target="_blank">{{#titleprefix}}{{.}} - {{/titleprefix}}{{title}}</a>
<a href="{{report2link}}" target="_blank">
<i class="fa fa-fw fa-ticket" aria-hidden="true"></i>&nbsp;{{#titleprefix}}{{.}} - {{/titleprefix}}{{title}}
</a>&nbsp;
<a href="{{optionlink}}" target="_blank">
<i class="fa fa-fw fa-external-link" aria-hidden="true"></i>
</a>
<span class="ml-1"><a class="btn btn-link btn-sm" data-toggle="collapse" href="#collapseoptionshortinfo-{{id}}"
role="button" aria-expanded="false" aria-controls="collapseoptionshortinfo-{{id}}">
<i class="fa fa-chevron-down" aria-hidden="true"></i>
Expand Down

0 comments on commit 78fc295

Please sign in to comment.