MDL-35073 badges: Open badges integration

The badges feature allows to integrate Mozilla "Open Badges" to issue, assign,
manage and display digital badges in Moodle. This feature supports:
-- badge creation and issuing based on criteria
-- badge baking and verification service
-- direct pushing of internal badges to external backpack
-- interanl and external badge display in Moodle
-- Moodle block to display latest badges
This commit is contained in:
Yuliya Bozhko
2013-04-02 15:49:02 +08:00
committed by Damyon Wiese
parent ec6089f07b
commit 278065528a
75 changed files with 8760 additions and 3 deletions
+49
View File
@@ -2182,6 +2182,12 @@ class global_navigation extends navigation_node {
$usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
}
if ($CFG->enablebadges && $iscurrentuser &&
has_capability('moodle/badges:manageownbadges', context_user::instance($USER->id))) {
$url = new moodle_url('/badges/mybadges.php');
$usernode->add(get_string('mybadges', 'badges'), $url, self::TYPE_SETTING);
}
// Add a node to view the users notes if permitted
if (!empty($CFG->enablenotes) && has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $coursecontext)) {
$url = new moodle_url('/notes/index.php',array('user'=>$user->id));
@@ -2432,6 +2438,39 @@ class global_navigation extends navigation_node {
$participants = $coursenode->add(get_string('participants'), null, self::TYPE_CONTAINER, get_string('participants'), 'participants');
}
// View course reports
if (has_capability('moodle/site:viewreports', $this->page->context)) { // basic capability for listing of reports
$reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, null, new pix_icon('i/stats', ''));
$coursereports = get_plugin_list('coursereport'); // deprecated
foreach ($coursereports as $report=>$dir) {
$libfile = $CFG->dirroot.'/course/report/'.$report.'/lib.php';
if (file_exists($libfile)) {
require_once($libfile);
$reportfunction = $report.'_report_extend_navigation';
if (function_exists($report.'_report_extend_navigation')) {
$reportfunction($reportnav, $course, $this->page->context);
}
}
}
$reports = get_plugin_list_with_function('report', 'extend_navigation_course', 'lib.php');
foreach ($reports as $reportfunction) {
$reportfunction($reportnav, $course, $this->page->context);
}
}
// Badges.
if ($CFG->enablebadges && has_capability('moodle/badges:viewbadges', $this->page->context)) {
$url = new moodle_url($CFG->wwwroot . '/badges/view.php',
array('type' => 2, 'id' => $course->id));
$coursenode->add(get_string('coursebadges', 'badges'), null,
navigation_node::TYPE_CONTAINER, null, 'coursebadges');
$coursenode->get('coursebadges')->add(get_string('badgesview', 'badges'), $url,
navigation_node::TYPE_SETTING, null, 'badgesview',
new pix_icon('i/badge', get_string('badgesview', 'badges')));
}
return true;
}
/**
@@ -2471,6 +2510,12 @@ class global_navigation extends navigation_node {
$coursenode->add(get_string('blogssite','blog'), $blogsurls->out());
}
//Badges
if ($CFG->enablebadges && has_capability('moodle/badges:viewbadges', $this->page->context)) {
$url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1));
$coursenode->add(get_string('sitebadges', 'badges'), $url, navigation_node::TYPE_CUSTOM);
}
// Notes
if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) {
$coursenode->add(get_string('notes','notes'), new moodle_url('/notes/index.php', array('filtertype'=>'course', 'filterselect'=>$filterselect)));
@@ -3498,6 +3543,10 @@ class settings_navigation extends navigation_node {
$coursenode->add(get_string('outcomes', 'grades'), $url, self::TYPE_SETTING, null, 'outcomes', new pix_icon('i/outcomes', ''));
}
//Add badges navigation
require_once($CFG->libdir .'/badgeslib.php');
badges_add_course_navigation($coursenode, $course);
// Backup this course
if (has_capability('moodle/backup:backupcourse', $coursecontext)) {
$url = new moodle_url('/backup/backup.php', array('id'=>$course->id));