mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-45774 navigation: Added general reports on a site level
These reports are located on the full user profile page.
This commit is contained in:
parent
08cb34a5a6
commit
7588cc6302
@ -160,23 +160,25 @@ function report_log_page_type_list($pagetype, $parentcontext, $currentcontext) {
|
||||
* @return bool
|
||||
*/
|
||||
function report_log_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
|
||||
if (!empty($course)) {
|
||||
list($all, $today) = report_log_can_access_user_report($user, $course);
|
||||
if ($today) {
|
||||
// Today's log.
|
||||
$url = new moodle_url('/report/log/user.php',
|
||||
array('id' => $user->id, 'course' => $course->id, 'mode' => 'today'));
|
||||
$node = new core_user\output\myprofile\node('reports', 'todayslogs', get_string('todaylogs'), null, $url);
|
||||
$tree->add_node($node);
|
||||
}
|
||||
if (empty($course)) {
|
||||
// We want to display these reports under the site context.
|
||||
$course = get_fast_modinfo(SITEID)->get_course();
|
||||
}
|
||||
list($all, $today) = report_log_can_access_user_report($user, $course);
|
||||
if ($today) {
|
||||
// Today's log.
|
||||
$url = new moodle_url('/report/log/user.php',
|
||||
array('id' => $user->id, 'course' => $course->id, 'mode' => 'today'));
|
||||
$node = new core_user\output\myprofile\node('reports', 'todayslogs', get_string('todaylogs'), null, $url);
|
||||
$tree->add_node($node);
|
||||
}
|
||||
|
||||
if ($all) {
|
||||
// All logs.
|
||||
$url = new moodle_url('/report/log/user.php',
|
||||
array('id' => $user->id, 'course' => $course->id, 'mode' => 'all'));
|
||||
$node = new core_user\output\myprofile\node('reports', 'alllogs', get_string('alllogs'), null, $url);
|
||||
$tree->add_node($node);
|
||||
}
|
||||
if ($all) {
|
||||
// All logs.
|
||||
$url = new moodle_url('/report/log/user.php',
|
||||
array('id' => $user->id, 'course' => $course->id, 'mode' => 'all'));
|
||||
$node = new core_user\output\myprofile\node('reports', 'alllogs', get_string('alllogs'), null, $url);
|
||||
$tree->add_node($node);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -131,7 +131,11 @@ function report_outline_supports_logstore($instance) {
|
||||
* @return bool
|
||||
*/
|
||||
function report_outline_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
|
||||
if (!empty($course) && report_outline_can_access_user_report($user, $course)) {
|
||||
if (empty($course)) {
|
||||
// We want to display these reports under the site context.
|
||||
$course = get_fast_modinfo(SITEID)->get_course();
|
||||
}
|
||||
if (report_outline_can_access_user_report($user, $course)) {
|
||||
$url = new moodle_url('/report/outline/user.php',
|
||||
array('id' => $user->id, 'course' => $course->id, 'mode' => 'outline'));
|
||||
$node = new core_user\output\myprofile\node('reports', 'outline', get_string('outlinereport'), null, $url);
|
||||
|
Loading…
x
Reference in New Issue
Block a user