MDL-45898 myprofile: Redesign my profile page

Part of MDL-45774.

Contributions by John Okely, Jetha Chan and Damyon Wiese (squashed branch).

AMOS BEGIN
CPY [coursebadges,core_badges], [badges,core_badges]
AMOS END
This commit is contained in:
Ankit Agarwal
2015-04-10 17:17:32 +08:00
committed by Adrian Greeve
parent 479fa47d0b
commit b19cc4ef25
26 changed files with 1039 additions and 469 deletions
+35 -2
View File
@@ -17,8 +17,9 @@
/**
* Library of functions and constants for notes
*
* @package core_notes
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_notes
* @copyright 2007 onwards Yu Zhang
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
@@ -366,3 +367,35 @@ function note_view($context, $userid) {
));
$event->trigger();
}
/**
* Add nodes to myprofile page.
*
* @param \core_user\output\myprofile\tree $tree Tree object
* @param stdClass $user user object
* @param bool $iscurrentuser
* @param stdClass $course Course object
*
* @return bool
*/
function core_notes_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
$url = new moodle_url("/notes/index.php", array('user' => $user->id));
$title = $iscurrentuser ? get_string('myprofileownnotes', 'core_notes') :
get_string('myprofileothernotes', 'core_notes', fullname($user));;
if (empty($course)) {
// Site level profile.
if (!has_capability('moodle/notes:view', context_system::instance())) {
// No cap, nothing to do.
return false;
}
$url->param('course', 0);
} else {
if (!has_capability('moodle/notes:view', context_course::instance($course->id))) {
// No cap, nothing to do.
return false;
}
$url->param('course', $course->id);
}
$notesnode = new core_user\output\myprofile\node('miscellaneous', 'notes', $title, null, $url);
$tree->add_node($notesnode);
}