MDL-84805 badges: Titles must be unique
This commit is contained in:
@@ -37,6 +37,7 @@ if (empty($CFG->enablebadges)) {
|
||||
}
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$title = [get_string('alignment', 'badges'), $badge->name];
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
require_capability('moodle/badges:configuredetails', $context);
|
||||
|
||||
@@ -47,6 +48,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
@@ -60,7 +62,7 @@ $currenturl = new moodle_url('/badges/alignment.php', array('id' => $badge->id))
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
|
||||
+3
-1
@@ -38,6 +38,7 @@ if (empty($CFG->enablebadges)) {
|
||||
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$title = [get_string('bcriteria', 'badges'), $badge->name];
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
|
||||
require_capability('moodle/badges:configurecriteria', $context);
|
||||
@@ -49,6 +50,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
@@ -63,7 +65,7 @@ $currenturl = new moodle_url('/badges/criteria.php', array('id' => $badge->id));
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->navbar->add($badge->name, $currenturl);
|
||||
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
|
||||
@@ -41,6 +41,7 @@ require_login();
|
||||
|
||||
$return = new moodle_url('/badges/criteria.php', array('id' => $badgeid));
|
||||
$badge = new badge($badgeid);
|
||||
$title = [get_string('addcriterion', 'badges'), $badge->name];
|
||||
$context = $badge->get_context();
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
|
||||
@@ -65,6 +66,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
@@ -78,7 +80,7 @@ $urlparams = array('badgeid' => $badgeid, 'edit' => $edit, 'type' => $type, 'cri
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url('/badges/criteria_settings.php', $urlparams);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->navbar->add($badge->name, new moodle_url('overview.php', array('id' => $badge->id)))
|
||||
->add(get_string('bcriteria', 'badges'), new moodle_url('criteria.php', ['id' => $badge->id]))
|
||||
->add(get_string('criteria_' . $type, 'badges'));
|
||||
@@ -119,4 +121,4 @@ if (!empty($addcourse)) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$mform->display();
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
+5
-1
@@ -56,8 +56,10 @@ if (!empty($badgeid)) {
|
||||
// Check capabilities.
|
||||
$context = $badge->get_context();
|
||||
if ($action == 'message') {
|
||||
$title = [get_string('configuremessage', 'badges'), $badge->name];
|
||||
require_capability('moodle/badges:configuremessages', $context);
|
||||
} else {
|
||||
$title = [get_string('badgedetails', 'badges'), $badge->name];
|
||||
require_capability('moodle/badges:configuredetails', $context);
|
||||
}
|
||||
|
||||
@@ -78,6 +80,7 @@ if (!empty($badgeid)) {
|
||||
|
||||
$params = ['courseid' => $courseid];
|
||||
$badgename = get_string('create', 'badges');
|
||||
$title = [$badgename];
|
||||
|
||||
// Check capabilities.
|
||||
require_capability('moodle/badges:createbadge', $context);
|
||||
@@ -94,6 +97,7 @@ $navurl = new moodle_url('/badges/index.php', ['type' => $badge->type]);
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type, 'id' => $badge->courseid]);
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
navigation_node::override_active_url($navurl);
|
||||
@@ -108,7 +112,7 @@ $currenturl = new moodle_url('/badges/edit.php', $params);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badgename);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->add_body_class('limitedwidth');
|
||||
$PAGE->navbar->add($badgename);
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ if (empty($CFG->enablebadges)) {
|
||||
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$title = [get_string('bendorsement', 'badges'), $badge->name];
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
require_capability('moodle/badges:configuredetails', $context);
|
||||
|
||||
@@ -46,6 +47,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
@@ -59,7 +61,7 @@ $currenturl = new moodle_url('/badges/endorsement.php', array('id' => $badgeid))
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
|
||||
+3
-1
@@ -39,6 +39,7 @@ if (empty($CFG->enablebadges)) {
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
$title = [$badge->name];
|
||||
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
if (empty($CFG->badges_allowcoursebadges)) {
|
||||
@@ -47,6 +48,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
@@ -62,7 +64,7 @@ $currenturl = new moodle_url('/badges/overview.php', array('id' => $badge->id));
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
require_capability('moodle/badges:viewbadges', $context);
|
||||
|
||||
@@ -40,6 +40,7 @@ if (empty($CFG->enablebadges)) {
|
||||
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$title = [get_string('awards', 'badges'), $badge->name];
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
|
||||
require_capability('moodle/badges:viewawarded', $context);
|
||||
@@ -51,6 +52,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
@@ -63,7 +65,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url('/badges/recipients.php', ['id' => $badgeid]);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
/** @var core_badges_renderer $output */
|
||||
|
||||
+3
-1
@@ -40,6 +40,7 @@ if (empty($CFG->enablebadges)) {
|
||||
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$title = [get_string('relatedbages', 'badges'), $badge->name];
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
require_capability('moodle/badges:configuredetails', $context);
|
||||
|
||||
@@ -50,6 +51,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$title[] = $heading;
|
||||
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
@@ -64,7 +66,7 @@ $currenturl = new moodle_url('/badges/related.php', array('id' => $badge->id));
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
|
||||
$PAGE->navbar->add($badge->name);
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
$msg = optional_param('msg', '', PARAM_TEXT);
|
||||
|
||||
+2
-1
@@ -39,6 +39,7 @@ $string['addcohort'] = 'Add cohort';
|
||||
$string['addcohort_help'] = 'Select all cohorts that should be added to this badge requirement. Hold CTRL key to select multiple items.';
|
||||
$string['addcourse'] = 'Add courses';
|
||||
$string['addcourse_help'] = 'Select all courses that should be added to this badge requirement. Hold CTRL key to select multiple items.';
|
||||
$string['addcriterion'] = 'Add criterion';
|
||||
$string['addrelated'] = 'Add related badge';
|
||||
$string['addtobackpack'] = 'Add to backpack';
|
||||
$string['addedtobackpack'] = 'Added badge to backpack';
|
||||
@@ -169,6 +170,7 @@ $string['badgestoearn'] = 'Number of badges available: {$a}';
|
||||
$string['badgesview'] = 'Course badges';
|
||||
$string['badgetags'] = 'Badge tags';
|
||||
$string['badgeurl'] = 'Issued badge link';
|
||||
$string['balignment'] = 'Alignments ({$a})';
|
||||
$string['bawards'] = 'Recipients ({$a})';
|
||||
$string['bcriteria'] = 'Criteria';
|
||||
$string['bdetails'] = 'Edit details';
|
||||
@@ -176,7 +178,6 @@ $string['bendorsement'] = 'Endorsement';
|
||||
$string['bmessage'] = 'Message';
|
||||
$string['boverview'] = 'Overview';
|
||||
$string['brelated'] = 'Related badges ({$a})';
|
||||
$string['balignment'] = 'Alignments ({$a})';
|
||||
$string['bydate'] = ' complete by';
|
||||
$string['imagecaption'] = 'Image caption';
|
||||
$string['imagecaption_help'] = 'If specified, an image caption is displayed on the badge page.';
|
||||
|
||||
Reference in New Issue
Block a user