Skip to content

Commit

Permalink
MDL-72968 reportbuilder: breadcrumb navigation for edit/view report.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Nov 1, 2021
1 parent b16fc54 commit d7e10c3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions lang/en/reportbuilder.php
Expand Up @@ -164,3 +164,4 @@
$string['userfullnamewithpicturelink'] = 'Full name with picture and link';
$string['usermodified'] = 'Modified by';
$string['userpicture'] = 'User picture';
$string['viewreport'] = 'View report';
2 changes: 1 addition & 1 deletion reportbuilder/classes/local/systemreports/reports_list.php
Expand Up @@ -249,7 +249,7 @@ protected function add_actions(): void {
// Preview action.
$this->add_action((new action(
new moodle_url('/reportbuilder/view.php', ['id' => ':id']),
new pix_icon('i/search', get_string('view', 'moodle')),
new pix_icon('i/search', get_string('viewreport', 'core_reportbuilder')),
[]
))
->add_callback(function(stdClass $row): bool {
Expand Down
3 changes: 2 additions & 1 deletion reportbuilder/edit.php
Expand Up @@ -34,17 +34,18 @@
$reportid = required_param('id', PARAM_INT);

admin_externalpage_setup('customreports', null, ['id' => $reportid], new moodle_url('/reportbuilder/edit.php'));
navigation_node::override_active_url(new moodle_url('/reportbuilder/index.php'));

$report = manager::get_report_from_id($reportid);
permission::require_can_edit_report($report->get_report_persistent());

$PAGE->set_context($report->get_context());
$PAGE->navbar->add(get_string('editreportcontent', 'core_reportbuilder'), $PAGE->url);

/** @var \core_reportbuilder\output\renderer $renderer */
$renderer = $PAGE->get_renderer('core_reportbuilder');

$reportname = $report->get_report_persistent()->get_formatted_name();
$PAGE->navbar->add($reportname);
$PAGE->set_title($reportname);
$PAGE->set_heading($reportname);

Expand Down
3 changes: 2 additions & 1 deletion reportbuilder/view.php
Expand Up @@ -34,17 +34,18 @@
$reportid = required_param('id', PARAM_INT);

admin_externalpage_setup('customreports', null, ['id' => $reportid], new moodle_url('/reportbuilder/view.php'));
navigation_node::override_active_url(new moodle_url('/reportbuilder/index.php'));

$report = manager::get_report_from_id($reportid);
permission::require_can_view_report($report->get_report_persistent());

$PAGE->set_context($report->get_context());
$PAGE->navbar->add(get_string('viewreport', 'core_reportbuilder'), $PAGE->url);

/** @var \core_reportbuilder\output\renderer $renderer */
$renderer = $PAGE->get_renderer('core_reportbuilder');

$reportname = $report->get_report_persistent()->get_formatted_name();
$PAGE->navbar->add($reportname);
$PAGE->set_title($reportname);
$PAGE->set_heading($reportname);

Expand Down

0 comments on commit d7e10c3

Please sign in to comment.