mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-49460 tool_lp: Adding user learning plans
Basic CRUD skeleton with external functions.
This commit is contained in:
parent
d9a39950b2
commit
4db373d5cb
21 changed files with 1653 additions and 27 deletions
|
@ -45,3 +45,31 @@ function tool_lp_extend_navigation_course($navigation, $course, $coursecontext)
|
|||
$navigation->add_node($settingsnode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 tool_lp_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
|
||||
global $USER;
|
||||
|
||||
$context = context_user::instance($USER->id);
|
||||
if (!$iscurrentuser && !has_capability('tool/lp:planviewall', $context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!has_capability('tool/lp:planviewown', $context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$url = new moodle_url('/admin/tool/lp/plans.php');
|
||||
$node = new core_user\output\myprofile\node('miscellaneous', 'learningplans',
|
||||
get_string('learningplans', 'tool_lp'), null, $url);
|
||||
$tree->add_node($node);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue