. /** * Badge overview page * * @package core * @subpackage badges * @copyright 2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Yuliya Bozhko */ require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $badgeid = required_param('id', PARAM_INT); $awards = optional_param('awards', '', PARAM_ALPHANUM); require_login(); if (empty($CFG->enablebadges)) { print_error('badgesdisabled', 'badges'); } $badge = new badge($badgeid); $context = $badge->get_context(); $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type)); if ($badge->type == BADGE_TYPE_COURSE) { if (empty($CFG->badges_allowcoursebadges)) { print_error('coursebadgesdisabled', 'badges'); } require_login($badge->courseid); $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid)); $PAGE->set_pagelayout('standard'); navigation_node::override_active_url($navurl); } else { $PAGE->set_pagelayout('admin'); navigation_node::override_active_url($navurl, true); } $currenturl = new moodle_url('/badges/overview.php', array('id' => $badge->id)); $PAGE->set_context($context); $PAGE->set_url($currenturl); $PAGE->set_heading($badge->name); $PAGE->set_title($badge->name); $PAGE->navbar->add($badge->name); require_capability('moodle/badges:viewbadges', $context); echo $OUTPUT->header(); echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name); if ($awards == 'cron') { echo $OUTPUT->notification(get_string('awardoncron', 'badges'), 'notifysuccess'); } else if ($awards != 0) { echo $OUTPUT->notification(get_string('numawardstat', 'badges', $awards), 'notifysuccess'); } $output = $PAGE->get_renderer('core', 'badges'); echo $output->print_badge_status_box($badge); $output->print_badge_tabs($badgeid, $context, 'overview'); echo $output->print_badge_overview($badge, $context); echo $OUTPUT->footer();