MDL-49854 core: User navigation refinements

Fixing some reported issues:
- Removing unnecessary conditional include
- Require login in grade/report/mygrades.php
- Remove unnecessary defined('MOODLE_INTERNAL') call
- Fixing context_header::__construct $imagedata param type
This commit is contained in:
Simey Lameze
2015-04-21 11:46:32 +08:00
committed by David Monllao
parent 9d745218e8
commit e35bac3e80
4 changed files with 12 additions and 15 deletions
+2 -2
View File
@@ -175,8 +175,8 @@ switch ($mode) {
break;
default:
// can not be reached ;-)
// But just incase let's not break the navigation.
// 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.
echo $OUTPUT->header();
}
+4 -2
View File
@@ -25,8 +25,10 @@
require_once('../../config.php');
require_once($CFG->dirroot . '/user/lib.php');
defined('MOODLE_INTERNAL') || die();
require_login(null, false);
if (isguestuser()) {
throw new require_login_exception('Guests are not allowed here.');
}
// Get the url to redirect to.
$url = user_mygrades_url();
// Redirect to that page.
+2 -2
View File
@@ -3095,7 +3095,7 @@ class context_header implements renderable {
*/
public $headinglevel;
/**
* @var string $imagedata HTML for the Image for the header.
* @var string|null $imagedata HTML code for the picture in the page header.
*/
public $imagedata;
/**
@@ -3113,7 +3113,7 @@ class context_header implements renderable {
*
* @param string $heading Main heading data.
* @param int $headinglevel Main heading 'h' tag level.
* @param object $imagedata Information needed to include a picture in the header.
* @param string|null $imagedata HTML code for the picture in the page header.
* @param string $additionalbuttons Buttons for the header e.g. Messaging button for the user header.
*/
public function __construct($heading = null, $headinglevel = 1, $imagedata = null, $additionalbuttons = null) {
+4 -9
View File
@@ -25,6 +25,9 @@
namespace core_user\output\myprofile;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir . "/myprofilelib.php");
/**
* Defines MAnager class for myprofile navigation tree.
*
@@ -44,18 +47,10 @@ class manager {
* @return tree Fully build tree to be rendered on my profile page.
*/
public static function build_tree($user, $iscurrentuser, $course = null) {
global $CFG;
$tree = new tree();
// Add core nodes.
$file = $CFG->libdir . "/myprofilelib.php";
if (is_readable($file)) {
require_once($file);
$function = "core_myprofile_navigation";
if (function_exists($function)) {
$function($tree, $user, $iscurrentuser, $course);
}
}
core_myprofile_navigation($tree, $user, $iscurrentuser, $course);
// Core components.
$components = \core_component::get_core_subsystems();