Skip to content

Commit

Permalink
MDL-71915 mod_url: Update for tertiary nav
Browse files Browse the repository at this point in the history
Remove the headings if the secondary nav
is present in this activity.
  • Loading branch information
sharidas committed Dec 6, 2021
1 parent 6dfb487 commit 45621b7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion mod/url/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strurls);
echo $OUTPUT->header();
echo $OUTPUT->heading($strurls);
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading($strurls);
}

if (!$urls = get_all_instances_in_course('url', $course)) {
notice(get_string('thereareno', 'moodle', $strurls), "$CFG->wwwroot/course/view.php?id=$course->id");
Expand Down
11 changes: 8 additions & 3 deletions mod/url/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,13 @@ function url_display_frame($url, $cm, $course) {
* @return does not return
*/
function url_print_workaround($url, $cm, $course) {
global $OUTPUT, $USER;
global $OUTPUT, $PAGE, $USER;

url_print_header($url, $cm, $course);
url_print_heading($url, $cm, $course, true);

if (!$PAGE->has_secondary_navigation()) {
url_print_heading($url, $cm, $course, true);
}

// Display any activity information (eg completion requirements / dates).
$cminfo = cm_info::create($cm);
Expand Down Expand Up @@ -344,7 +347,9 @@ function url_display_embed($url, $cm, $course) {
}

url_print_header($url, $cm, $course);
url_print_heading($url, $cm, $course);
if (!$PAGE->has_secondary_navigation()) {
url_print_heading($url, $cm, $course);
}

// Display any activity information (eg completion requirements / dates).
$cminfo = cm_info::create($cm);
Expand Down
4 changes: 3 additions & 1 deletion mod/url/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
$exturl = trim($url->externalurl);
if (empty($exturl) or $exturl === 'http://') {
url_print_header($url, $cm, $course);
url_print_heading($url, $cm, $course);
if (!$PAGE->has_secondary_navigation()) {
url_print_heading($url, $cm, $course);
}
url_print_intro($url, $cm, $course);
notice(get_string('invalidstoredurl', 'url'), new moodle_url('/course/view.php', array('id'=>$cm->course)));
die;
Expand Down

0 comments on commit 45621b7

Please sign in to comment.