MDL-72287 report: Add back link and headings in user profile pages
This commit is contained in:
+4
-1
@@ -71,7 +71,7 @@ if (isset($userid) && empty($courseid) && empty($modid)) {
|
||||
}
|
||||
$PAGE->set_context($context);
|
||||
|
||||
if (isset($userid) && $USER->id == $userid) {
|
||||
if (isset($userid) && $USER->id == $userid && !$PAGE->has_secondary_navigation()) {
|
||||
$blognode = $PAGE->navigation->find('siteblog', null);
|
||||
if ($blognode) {
|
||||
$blognode->make_inactive();
|
||||
@@ -153,6 +153,9 @@ if ($usernode && $courseid != SITEID) {
|
||||
if ($courseid != SITEID) {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $userid, 'course' => $courseid]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
|
||||
if (!empty($user)) {
|
||||
$headerinfo = array('heading' => fullname($user), 'user' => $user);
|
||||
echo $OUTPUT->context_header($headerinfo, 2);
|
||||
|
||||
+21
-3
@@ -55,7 +55,14 @@ if ($mode === 'coursecompletions' or $mode === 'coursecompletion') {
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$personalcontext = context_user::instance($user->id);
|
||||
|
||||
$PAGE->set_context($personalcontext);
|
||||
if ($id == SITEID) {
|
||||
$PAGE->set_context($personalcontext);
|
||||
$PAGE->set_heading(fullname($user));
|
||||
} else {
|
||||
$PAGE->set_context($coursecontext);
|
||||
$PAGE->set_secondary_active_tab('participants');
|
||||
$PAGE->set_heading($course->fullname);
|
||||
}
|
||||
|
||||
$PAGE->set_url('/course/user.php', array('id'=>$id, 'user'=>$user->id, 'mode'=>$mode));
|
||||
|
||||
@@ -125,7 +132,6 @@ $stractivityreport = get_string("activityreport");
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
$PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for reasons and for full commit reference for reversal when fixed.
|
||||
$PAGE->set_title("$course->shortname: $stractivityreport ($mode)");
|
||||
$PAGE->set_heading(fullname($user));
|
||||
|
||||
switch ($mode) {
|
||||
case "grade":
|
||||
@@ -166,6 +172,19 @@ switch ($mode) {
|
||||
}
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($course->id !== SITEID) {
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $user->id, 'course' => $course->id]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
$userheading = array(
|
||||
'heading' => fullname($user, has_capability('moodle/site:viewfullnames', $PAGE->context)),
|
||||
'user' => $user,
|
||||
'usercontext' => $personalcontext,
|
||||
);
|
||||
echo $OUTPUT->context_header($userheading, 2);
|
||||
|
||||
echo $OUTPUT->heading(get_string('grades', 'moodle'), 2, 'main mt-4 mb-4');
|
||||
}
|
||||
|
||||
if (empty($CFG->grade_profilereport) or !file_exists($CFG->dirroot.'/grade/report/'.$CFG->grade_profilereport.'/lib.php')) {
|
||||
$CFG->grade_profilereport = 'user';
|
||||
}
|
||||
@@ -179,7 +198,6 @@ switch ($mode) {
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
// It's unlikely to reach this piece of code, as the mode is never empty and it sets mode as grade in most of the cases.
|
||||
// Display the page header to avoid breaking the navigation. A course/user.php review will be done in MDL-49939.
|
||||
|
||||
@@ -204,6 +204,7 @@ $string['discussionsstartedby'] = 'Discussions started by {$a}';
|
||||
$string['discussionstartedby'] = 'Discussion started by {$a}';
|
||||
$string['discussionsstartedbyrecent'] = 'Discussions recently started by {$a}';
|
||||
$string['discussionsstartedbyuserincourse'] = 'Discussions started by {$a->fullname} in {$a->coursename}';
|
||||
$string['discussionsstartedincourse'] = 'Discussions started in {$a}';
|
||||
$string['discussionunpin'] = 'Unpin';
|
||||
$string['discussionunsubscribed'] = 'You are now unsubscribed from this discussion.';
|
||||
$string['discussthistopic'] = 'Discuss this topic';
|
||||
@@ -525,6 +526,7 @@ $string['posts'] = 'Posts';
|
||||
$string['postsfrom'] = 'Posts from';
|
||||
$string['postsmadebyuser'] = 'Posts made by {$a}';
|
||||
$string['postsmadebyuserincourse'] = 'Posts made by {$a->fullname} in {$a->coursename}';
|
||||
$string['postsmadeincourse'] = 'Posts made in {$a}';
|
||||
$string['poststo'] = 'Posts to';
|
||||
$string['posttoforum'] = 'Post to forum';
|
||||
$string['postupdated'] = 'Your post was updated';
|
||||
|
||||
@@ -217,6 +217,7 @@ if (empty($result->posts)) {
|
||||
// Display a page letting the user know that there's nothing to display;
|
||||
$PAGE->set_title($pagetitle);
|
||||
if ($isspecificcourse) {
|
||||
$PAGE->set_secondary_active_tab('participants');
|
||||
$PAGE->set_heading($pageheading);
|
||||
} else if ($canviewuser) {
|
||||
$PAGE->set_heading(fullname($user));
|
||||
@@ -224,6 +225,10 @@ if (empty($result->posts)) {
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
}
|
||||
echo $OUTPUT->header();
|
||||
if (isset($courseid) && $courseid != SITEID) {
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $userid, 'course' => $courseid]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
}
|
||||
if (!$isspecificcourse) {
|
||||
echo $OUTPUT->heading($pagetitle);
|
||||
} else {
|
||||
@@ -309,9 +314,15 @@ if (isset($courseid) && $courseid != SITEID) {
|
||||
$navbar = $PAGE->navbar->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php',
|
||||
array('id' => $user->id, 'course' => $courseid, 'mode' => 'discussions')));
|
||||
}
|
||||
$PAGE->set_secondary_active_tab('participants');
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if (isset($courseid) && $courseid != SITEID) {
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $userid, 'course' => $courseid]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
}
|
||||
echo html_writer::start_tag('div', array('class' => 'user-content'));
|
||||
|
||||
if ($isspecificcourse) {
|
||||
@@ -321,6 +332,10 @@ if ($isspecificcourse) {
|
||||
'usercontext' => $usercontext
|
||||
);
|
||||
echo $OUTPUT->context_header($userheading, 2);
|
||||
$coursename = format_string($course->fullname, true, array('context' => $coursecontext));
|
||||
$heading = $mode === 'posts' ? get_string('postsmadeincourse', 'mod_forum', $coursename) :
|
||||
get_string('discussionsstartedincourse', 'mod_forum', $coursename);
|
||||
echo $OUTPUT->heading($heading, 2, 'main mt-4 mb-4');
|
||||
} else {
|
||||
echo $OUTPUT->heading($inpageheading);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,9 @@ if ($course->id == SITEID) {
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $userid, 'course' => $courseid]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
|
||||
$headerinfo = array('heading' => fullname($user), 'user' => $user);
|
||||
echo $OUTPUT->context_header($headerinfo, 2);
|
||||
}
|
||||
|
||||
@@ -104,12 +104,20 @@ $event->trigger();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if ($courseid != SITEID) {
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $userid, 'course' => $courseid]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
|
||||
$userheading = array(
|
||||
'heading' => fullname($user, has_capability('moodle/site:viewfullnames', $PAGE->context)),
|
||||
'user' => $user,
|
||||
'usercontext' => $personalcontext,
|
||||
);
|
||||
echo $OUTPUT->context_header($userheading, 2);
|
||||
if ($mode === 'today') {
|
||||
echo $OUTPUT->heading(get_string('todaylogs', 'moodle'), 2, 'main mt-4 mb-4');
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string('alllogs', 'moodle'), 2, 'main mt-4 mb-4');
|
||||
}
|
||||
}
|
||||
|
||||
// Time to filter records from.
|
||||
|
||||
@@ -91,12 +91,19 @@ $event->trigger();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if ($courseid != SITEID) {
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $userid, 'course' => $courseid]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
echo $OUTPUT->context_header(
|
||||
array(
|
||||
'heading' => fullname($user),
|
||||
'user' => $user,
|
||||
'usercontext' => $personalcontext
|
||||
), 2);
|
||||
if ($mode === 'outline') {
|
||||
echo $OUTPUT->heading(get_string('outlinereport', 'moodle'), 2, 'main mt-4 mb-4');
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string('completereport', 'moodle'), 2, 'main mt-4 mb-4');
|
||||
}
|
||||
}
|
||||
|
||||
$modinfo = get_fast_modinfo($course, $user->id);
|
||||
|
||||
@@ -73,12 +73,16 @@ $PAGE->set_title("$course->shortname: $stractivityreport");
|
||||
$PAGE->set_heading($pageheading);
|
||||
echo $OUTPUT->header();
|
||||
if ($courseid != SITEID) {
|
||||
$backurl = new moodle_url('/user/view.php', ['id' => $userid, 'course' => $courseid]);
|
||||
echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
|
||||
|
||||
echo $OUTPUT->context_header(
|
||||
array(
|
||||
'heading' => $userfullname,
|
||||
'user' => $user,
|
||||
'usercontext' => $personalcontext
|
||||
), 2);
|
||||
echo $OUTPUT->heading(get_string('statistics', 'moodle'), 2, 'main mt-4 mb-4');
|
||||
}
|
||||
|
||||
// Trigger a user report viewed event.
|
||||
|
||||
Reference in New Issue
Block a user