From 45367bdf0cace1b0efb1a7430c570a39c347ab22 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Fri, 27 Mar 2015 16:17:30 +0800 Subject: [PATCH] MDL-49688 navigation: First review fixes and version bump. Part of MDL-45774. --- admin/roles/assign.php | 5 ++ blog/edit.php | 23 ++++--- blog/index.php | 6 ++ course/user.php | 2 +- lib/db/upgrade.php | 5 +- lib/myprofilelib.php | 6 +- lib/navigationlib.php | 67 ++++++++++--------- lib/outputrenderers.php | 12 ++-- message/index.php | 2 +- message/output/email/message_output_email.php | 5 +- mod/forum/lib.php | 4 +- mod/forum/user.php | 6 +- my/index.php | 3 - user/edit.php | 3 +- user/editadvanced.php | 2 +- user/editlib.php | 5 +- user/editor.php | 2 + user/forum.php | 2 + user/forum_form.php | 4 +- user/language.php | 4 +- user/tests/fixtures/myprofile_fixtures.php | 11 +++ user/view.php | 2 +- 22 files changed, 111 insertions(+), 70 deletions(-) diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 78b496ad04bc9..fee876b27ff02 100644 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -135,6 +135,11 @@ } } +if ($user->id != $USER->id) { + $PAGE->navigation->extend_for_user($user); + $PAGE->navbar->includesettingsbase = true; +} + $PAGE->set_pagelayout('admin'); $PAGE->set_title($title); diff --git a/blog/edit.php b/blog/edit.php index 1963c287b5dcc..24612dd7d1a7e 100644 --- a/blog/edit.php +++ b/blog/edit.php @@ -48,8 +48,20 @@ $id = null; } +$entry = new stdClass(); +$entry->id = null; + +if ($id) { + if (!$entry = new blog_entry($id)) { + print_error('wrongentryid', 'blog'); + } + $userid = $entry->userid; +} else { + $userid = $USER->id; +} + $sitecontext = context_system::instance(); -$usercontext = context_user::instance($USER->id); +$usercontext = context_user::instance($userid); $PAGE->set_context($usercontext); $blognode = $PAGE->settingsnav->find('blogadd', null); $blognode->make_active(); @@ -85,24 +97,15 @@ // Make sure that the person trying to edit has access right. if ($id) { - if (!$entry = new blog_entry($id)) { - print_error('wrongentryid', 'blog'); - } - if (!blog_user_can_edit_entry($entry)) { print_error('notallowedtoedit', 'blog'); } - $userid = $entry->userid; $entry->subject = clean_text($entry->subject); $entry->summary = clean_text($entry->summary, $entry->format); - } else { if (!has_capability('moodle/blog:create', $sitecontext)) { print_error('noentry', 'blog'); // The capability "manageentries" is not enough for adding. } - $entry = new stdClass(); - $entry->id = null; - $userid = $USER->id; } $returnurl->param('userid', $userid); diff --git a/blog/index.php b/blog/index.php index 0f43d24026490..35bab0c9897bb 100644 --- a/blog/index.php +++ b/blog/index.php @@ -57,6 +57,12 @@ } } +// Set the userid to the entry author if we have the entry ID. +if ($entryid and !isset($userid)) { + $entry = new blog_entry($entryid); + $userid = $entry->userid; +} + if (isset($userid)) { $context = context_user::instance($userid); } else { diff --git a/course/user.php b/course/user.php index 9aedcef1b817d..c1f0c6991ac48 100644 --- a/course/user.php +++ b/course/user.php @@ -154,7 +154,7 @@ // Add the user name. $PAGE->navbar->add(fullname($user), $userurl, navigation_node::TYPE_SETTING); } - $gradeurl = new moodle_url('/course/user.php', array('id'=>$id, 'user'=>$user->id, 'mode'=>$mode)); + $gradeurl = new moodle_url('/course/user.php', array('id' => $id, 'user' => $user->id, 'mode' => $mode)); // Add the 'grades' node to the navbar. $navbar = $PAGE->navbar->add(get_string('grades', 'grades'), $gradeurl, navigation_node::TYPE_SETTING); } diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 1873ce0639afd..782c84cd7a2d4 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -4270,6 +4270,7 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2015032000.00); } +<<<<<<< HEAD if ($oldversion < 2015040200.01) { // Force uninstall of deleted tool. if (!file_exists("$CFG->dirroot/$CFG->admin/tool/timezoneimport")) { @@ -4315,7 +4316,7 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2015040800.01); } - if ($oldversion < 2015030400.02) { + if ($oldversion < 2015040800.02) { // Update the default user menu (add preferences, remove my files and my badges). $oldconfig = get_config('core', 'customusermenuitems'); @@ -4334,7 +4335,7 @@ function xmldb_main_upgrade($oldversion) { $newconfig = preg_replace('/(\r\n)+/', "\n", $newconfig); set_config('customusermenuitems', $newconfig); - upgrade_main_savepoint(true, 2015030400.02); + upgrade_main_savepoint(true, 2015040800.02); } return true; diff --git a/lib/myprofilelib.php b/lib/myprofilelib.php index d436e704cbffc..8c12a467e2d05 100644 --- a/lib/myprofilelib.php +++ b/lib/myprofilelib.php @@ -83,7 +83,11 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, if ($userauthplugin && $userauthplugin->can_edit_profile()) { $url = $userauthplugin->edit_profile_url(); if (empty($url)) { - $url = new moodle_url('/user/edit.php', array('userid' => $user->id, 'course' => $id)); + if (empty($course)) { + $url = new moodle_url('/user/edit.php', array('userid' => $user->id)); + } else { + $url = new moodle_url('/user/edit.php', array('userid' => $user->id, 'course' => $course->id)); + } } $node = new core_user\output\myprofile\node('administration', 'editprofile', get_string('editmyprofile'), null, $url); diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 98eaff5cc58b4..2e1872369de2c 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2162,7 +2162,7 @@ protected function load_for_user($user=null, $forceforcontext=false) { // This is the site so add a users node to the root branch. $usersnode = $this->rootnodes['users']; if (has_capability('moodle/course:viewparticipants', $coursecontext)) { - $usersnode->action = new moodle_url('/user/index.php', array('id'=>$course->id)); + $usersnode->action = new moodle_url('/user/index.php', array('id' => $course->id)); } $userviewurl = new moodle_url('/user/profile.php', $baseargs); } @@ -2189,9 +2189,9 @@ protected function load_for_user($user=null, $forceforcontext=false) { if ($iscurrentuser || has_capability('moodle/user:viewdetails', $coursecontext) || has_capability('moodle/user:viewdetails', $usercontext)) { if ($issitecourse || ($iscurrentuser && !$forceforcontext)) { - $usernode->add(get_string('viewprofile'), new moodle_url('/user/profile.php',$baseargs)); + $usernode->add(get_string('viewprofile'), new moodle_url('/user/profile.php', $baseargs)); } else { - $usernode->add(get_string('viewprofile'), new moodle_url('/user/view.php',$baseargs)); + $usernode->add(get_string('viewprofile'), new moodle_url('/user/view.php', $baseargs)); } } @@ -2202,7 +2202,7 @@ protected function load_for_user($user=null, $forceforcontext=false) { $forumtab = $usernode->add(get_string('forumposts', 'forum')); $forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs)); $forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', - array_merge($baseargs, array('mode'=>'discussions')))); + array_merge($baseargs, array('mode' => 'discussions')))); } // Add blog nodes. @@ -2239,7 +2239,7 @@ protected function load_for_user($user=null, $forceforcontext=false) { if ($course->id != $SITE->id) { $messageargs['viewing'] = MESSAGE_VIEW_COURSE. $course->id; } - $url = new moodle_url('/message/index.php',$messageargs); + $url = new moodle_url('/message/index.php', $messageargs); $usernode->add(get_string('messages', 'message'), $url, self::TYPE_SETTING, null, 'messages'); } @@ -2259,7 +2259,7 @@ protected function load_for_user($user=null, $forceforcontext=false) { // Add a node to view the users notes if permitted. if (!empty($CFG->enablenotes) && has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $coursecontext)) { - $url = new moodle_url('/notes/index.php',array('user'=>$user->id)); + $url = new moodle_url('/notes/index.php', array('user' => $user->id)); if ($coursecontext->instanceid != SITEID) { $url->param('course', $coursecontext->instanceid); } @@ -2291,7 +2291,7 @@ protected function load_for_user($user=null, $forceforcontext=false) { // Add view grade report is permitted. $reports = core_component::get_plugin_list('gradereport'); - arsort($reports); // user is last, we want to test it first. + arsort($reports); // User is last, we want to test it first. $userscourses = enrol_get_users_courses($user->id); $userscoursesnode = $usernode->add(get_string('courses')); @@ -2307,13 +2307,13 @@ protected function load_for_user($user=null, $forceforcontext=false) { $usercoursecontext = context_course::instance($usercourse->id); $usercourseshortname = format_string($usercourse->shortname, true, array('context' => $usercoursecontext)); $usercoursenode = $userscoursesnode->add($usercourseshortname, new moodle_url('/user/view.php', - array('id'=>$user->id, 'course'=>$usercourse->id)), self::TYPE_CONTAINER); + array('id' => $user->id, 'course' => $usercourse->id)), self::TYPE_CONTAINER); $gradeavailable = has_capability('moodle/grade:viewall', $usercoursecontext); if (!$gradeavailable && !empty($usercourse->showgrades) && is_array($reports) && !empty($reports)) { foreach ($reports as $plugin => $plugindir) { if (has_capability('gradereport/'.$plugin.':view', $usercoursecontext)) { - //stop when the first visible plugin is found. + // Stop when the first visible plugin is found. $gradeavailable = true; break; } @@ -2321,7 +2321,7 @@ protected function load_for_user($user=null, $forceforcontext=false) { } if ($gradeavailable) { - $url = new moodle_url('/grade/report/index.php', array('id'=>$usercourse->id)); + $url = new moodle_url('/grade/report/index.php', array('id' => $usercourse->id)); $usercoursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/grades', '')); } @@ -2329,13 +2329,13 @@ protected function load_for_user($user=null, $forceforcontext=false) { // Add a node to view the users notes if permitted. if (!empty($CFG->enablenotes) && has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $usercoursecontext)) { - $url = new moodle_url('/notes/index.php',array('user'=>$user->id, 'course'=>$usercourse->id)); + $url = new moodle_url('/notes/index.php', array('user' => $user->id, 'course' => $usercourse->id)); $usercoursenode->add(get_string('notes', 'notes'), $url, self::TYPE_SETTING); } if (can_access_course($usercourse, $user->id)) { $usercoursenode->add(get_string('entercourse'), new moodle_url('/course/view.php', - array('id'=>$usercourse->id)), self::TYPE_SETTING, null, null, new pix_icon('i/course', '')); + array('id' => $usercourse->id)), self::TYPE_SETTING, null, null, new pix_icon('i/course', '')); } $reporttab = $usercoursenode->add(get_string('activityreports')); @@ -2623,7 +2623,7 @@ public function add_front_page_course_essentials(navigation_node $coursenode, st and ($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser()))) and has_capability('moodle/blog:view', context_system::instance())) { $blogsurls = new moodle_url('/blog/index.php', array('courseid' => $filterselect)); - $coursenode->add(get_string('blogssite','blog'), $blogsurls->out(), self::TYPE_SYSTEM, null, 'siteblog'); + $coursenode->add(get_string('blogssite', 'blog'), $blogsurls->out(), self::TYPE_SYSTEM, null, 'siteblog'); } //Badges @@ -2634,13 +2634,14 @@ public function add_front_page_course_essentials(navigation_node $coursenode, st // Notes if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) { - $coursenode->add(get_string('notes','notes'), new moodle_url('/notes/index.php', - array('filtertype'=>'course', 'filterselect'=>$filterselect)), self::TYPE_SETTING, null, 'notes'); + $coursenode->add(get_string('notes', 'notes'), new moodle_url('/notes/index.php', + array('filtertype' => 'course', 'filterselect' => $filterselect)), self::TYPE_SETTING, null, 'notes'); } // Tags if (!empty($CFG->usetags) && isloggedin()) { - $node = $coursenode->add(get_string('tags', 'tag'), new moodle_url('/tag/search.php'), self::TYPE_SETTING, null, 'tags'); + $node = $coursenode->add(get_string('tags', 'tag'), new moodle_url('/tag/search.php'), + self::TYPE_SETTING, null, 'tags'); } if (isloggedin()) { @@ -4198,7 +4199,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr $iscurrentuser = ($user->id == $USER->id); - $baseargs = array('id'=>$user->id); + $baseargs = array('id' => $user->id); if ($course->id != $SITE->id && !$iscurrentuser) { $baseargs['course'] = $course->id; $issitecourse = false; @@ -4218,7 +4219,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr $forumtab = $dashboard->add(get_string('forumposts', 'forum')); $forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs), null, 'myposts'); $forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', - array_merge($baseargs, array('mode'=>'discussions'))), null, 'mydiscussions'); + array_merge($baseargs, array('mode' => 'discussions'))), null, 'mydiscussions'); } // Add blog nodes. @@ -4236,7 +4237,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr $blogs = $dashboard->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER); foreach ($options as $type => $option) { if ($type == "rss") { - $blogs->add($option['string'], $option['link'], settings_navigation::TYPE_SETTING, null, null, + $blogs->add($option['string'], $option['link'], self::TYPE_SETTING, null, null, new pix_icon('i/rss', '')); } else { $blogs->add($option['string'], $option['link'], self::TYPE_SETTING, null, 'blog' . $type); @@ -4255,7 +4256,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr if ($course->id != $SITE->id) { $messageargs['viewing'] = MESSAGE_VIEW_COURSE. $course->id; } - $url = new moodle_url('/message/index.php',$messageargs); + $url = new moodle_url('/message/index.php', $messageargs); $dashboard->add(get_string('messages', 'message'), $url, self::TYPE_SETTING, null, 'messages'); } @@ -4275,7 +4276,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr // Add a node to view the users notes if permitted. if (!empty($CFG->enablenotes) && has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $coursecontext)) { - $url = new moodle_url('/notes/index.php',array('user'=>$user->id)); + $url = new moodle_url('/notes/index.php', array('user' => $user->id)); if ($coursecontext->instanceid != SITEID) { $url->param('course', $coursecontext->instanceid); } @@ -4360,8 +4361,8 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr if (isloggedin() && !isguestuser($user) && !is_mnet_remote_user($user)) { if ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) || has_capability('moodle/user:editprofile', $usercontext)) { - $url = new moodle_url('/user/language.php', array('id'=>$user->id, 'course'=>$course->id)); - $useraccount->add(get_string('preferredlanguage'), $url, self::TYPE_SETTING); + $url = new moodle_url('/user/language.php', array('id' => $user->id, 'course' => $course->id)); + $useraccount->add(get_string('preferredlanguage'), $url, self::TYPE_SETTING, null, 'preferredlanguage'); } } $pluginmanager = core_plugin_manager::instance(); @@ -4369,7 +4370,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr if (isset($enabled['forum']) && isloggedin() && !isguestuser($user) && !is_mnet_remote_user($user)) { if ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) || has_capability('moodle/user:editprofile', $usercontext)) { - $url = new moodle_url('/user/forum.php', array('id'=>$user->id, 'course'=>$course->id)); + $url = new moodle_url('/user/forum.php', array('id' => $user->id, 'course' => $course->id)); $useraccount->add(get_string('forumpreferences'), $url, self::TYPE_SETTING); } } @@ -4378,15 +4379,15 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr if (isloggedin() && !isguestuser($user) && !is_mnet_remote_user($user)) { if ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) || has_capability('moodle/user:editprofile', $usercontext)) { - $url = new moodle_url('/user/editor.php', array('id'=>$user->id, 'course'=>$course->id)); + $url = new moodle_url('/user/editor.php', array('id' => $user->id, 'course' => $course->id)); $useraccount->add(get_string('editorpreferences'), $url, self::TYPE_SETTING); } } } // View the roles settings. - if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride','moodle/role:override', 'moodle/role:manage'), - $usercontext)) { + if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', + 'moodle/role:manage'), $usercontext)) { $roles = $usersetting->add(get_string('roles'), null, self::TYPE_SETTING); $url = new moodle_url('/admin/roles/usersroles.php', array('userid'=>$user->id, 'courseid'=>$course->id)); @@ -4396,18 +4397,18 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr if (!empty($assignableroles)) { $url = new moodle_url('/admin/roles/assign.php', - array('contextid'=>$usercontext->id,'userid'=>$user->id, 'courseid'=>$course->id)); + array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id)); $roles->add(get_string('assignrolesrelativetothisuser', 'role'), $url, self::TYPE_SETTING); } if (has_capability('moodle/role:review', $usercontext) || count(get_overridable_roles($usercontext, ROLENAME_BOTH))>0) { $url = new moodle_url('/admin/roles/permissions.php', - array('contextid'=>$usercontext->id,'userid'=>$user->id, 'courseid'=>$course->id)); + array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id)); $roles->add(get_string('permissions', 'role'), $url, self::TYPE_SETTING); } $url = new moodle_url('/admin/roles/check.php', - array('contextid'=>$usercontext->id,'userid'=>$user->id, 'courseid'=>$course->id)); + array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id)); $roles->add(get_string('checkpermissions', 'role'), $url, self::TYPE_SETTING); } @@ -4466,7 +4467,8 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr if ($currentuser && !empty($CFG->enableblogs)) { $blog = $usersetting->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER, null, 'blogs'); if (has_capability('moodle/blog:view', $systemcontext)) { - $blog->add(get_string('preferences', 'blog'), new moodle_url('/blog/preferences.php'), navigation_node::TYPE_SETTING); + $blog->add(get_string('preferences', 'blog'), new moodle_url('/blog/preferences.php'), + navigation_node::TYPE_SETTING); } if (!empty($CFG->useexternalblogs) && $CFG->maxexternalblogsperuser > 0 && has_capability('moodle/blog:manageexternal', $systemcontext)) { @@ -4482,7 +4484,8 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr // Badges. if ($currentuser && !empty($CFG->enablebadges)) { $badges = $usersetting->add(get_string('badges'), null, navigation_node::TYPE_CONTAINER, null, 'badges'); - $badges->add(get_string('preferences', 'badges'), new moodle_url('/badges/preferences.php'), navigation_node::TYPE_SETTING); + $badges->add(get_string('preferences', 'badges'), new moodle_url('/badges/preferences.php'), + navigation_node::TYPE_SETTING); if (!empty($CFG->badges_allowexternalbackpack)) { $badges->add(get_string('backpackdetails', 'badges'), new moodle_url('/badges/mybackpack.php'), navigation_node::TYPE_SETTING); diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 059e27cf895c2..ca4e70a3490e4 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -3960,6 +3960,7 @@ public function favicon() { */ public function render_preferences_groups(preferences_groups $renderable) { $html = ''; + $html .= html_writer::start_div('row-fluid'); $html .= html_writer::start_tag('div', array('class' => 'span12 preferences-groups')); $i = 0; $open = false; @@ -3968,7 +3969,7 @@ public function render_preferences_groups(preferences_groups $renderable) { if ($open) { $html .= html_writer::end_tag('div'); } - $html .= html_writer::start_tag('div', array('class' => 'row')); + $html .= html_writer::start_tag('div', array('class' => 'row-fluid')); $open = true; } $html .= $this->render($group); @@ -3979,6 +3980,7 @@ public function render_preferences_groups(preferences_groups $renderable) { $html .= html_writer::end_tag('ul'); $html .= html_writer::end_tag('div'); + $html .= html_writer::end_div(); return $html; } @@ -4122,11 +4124,13 @@ protected function render_context_header(context_header $contextheader) { /** * Wrapper for header elements. + * + * @param string $heading Heading to be used for the main header. + * @return string HTML to display the main header. */ public function full_header($heading = null) { $html = html_writer::start_tag('header', array('id' => 'page-header', 'class' => 'clearfix')); - // This is to ensure that the logo completely overwrites the header. MDL-49536 has been created to investigate - // whether the logo should work this way or not. + // This is to ensure that the logo completely overwrites the header if set. if (isset($heading) && $heading == '') { $html .= $heading; } else { @@ -4136,7 +4140,7 @@ public function full_header($heading = null) { $html .= html_writer::tag('nav', $this->navbar(), array('class' => 'breadcrumb-nav')); $html .= html_writer::div($this->page_heading_button(), 'breadcrumb-button'); $html .= html_writer::end_div(); - $html .= html_writer::tag('div', $this->course_header(), array('class' => 'course-header')); + $html .= html_writer::tag('div', $this->course_header(), array('id' => 'course-header')); $html .= html_writer::end_tag('header'); return $html; } diff --git a/message/index.php b/message/index.php index 94234193f5e66..4c6514ccca79c 100644 --- a/message/index.php +++ b/message/index.php @@ -198,7 +198,7 @@ } else { $PAGE->set_title("{$SITE->shortname}: $strmessages"); } -$PAGE->set_heading(fullname($USER)); +$PAGE->set_heading(fullname($user1)); // Remove the user node from the main navigation for this page. $usernode = $PAGE->navigation->find('users', null); diff --git a/message/output/email/message_output_email.php b/message/output/email/message_output_email.php index dcc5b46f3bcf2..2f8195e109c98 100644 --- a/message/output/email/message_output_email.php +++ b/message/output/email/message_output_email.php @@ -134,8 +134,9 @@ function config_form($preferences){ } if (!empty($CFG->messagingallowemailoverride)) { - $inputattributes = array('size'=>'30', 'name'=>'email_email', 'value'=>$preferences->email_email, 'id'=>'email_email'); - $string .= html_writer::label(get_string('email','message_email'), 'email_email'); + $inputattributes = array('size' => '30', 'name' => 'email_email', 'value' => $preferences->email_email, + 'id' => 'email_email'); + $string .= html_writer::label(get_string('email', 'message_email'), 'email_email'); $string .= $OUTPUT->container(html_writer::empty_tag('input', $inputattributes)); if (empty($preferences->email_email) && !empty($preferences->userdefaultemail)) { diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 78f843d12aab6..d24030c705a31 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -7831,7 +7831,7 @@ function mod_forum_myprofile_navigation(core_user\output\myprofile\tree $tree, $ } $postsurl = new moodle_url('/mod/forum/user.php', array('id' => $user->id)); if (!empty($course)) { - $postsurl->param('coursre', $course->id); + $postsurl->param('course', $course->id); } $string = $iscurrentuser ? get_string('myprofileownpost', 'mod_forum') : get_string('myprofileotherpost', 'mod_forum', fullname($user)); @@ -7840,7 +7840,7 @@ function mod_forum_myprofile_navigation(core_user\output\myprofile\tree $tree, $ $discussionssurl = new moodle_url('/mod/forum/user.php', array('id' => $user->id, 'mode' => 'discussions')); if (!empty($course)) { - $postsurl->param('coursre', $course->id); + $postsurl->param('course', $course->id); } $string = $iscurrentuser ? get_string('myprofileowndis', 'mod_forum') : get_string('myprofileotherdis', 'mod_forum', fullname($user)); diff --git a/mod/forum/user.php b/mod/forum/user.php index de072813e4111..8ad6b9dba5ef2 100644 --- a/mod/forum/user.php +++ b/mod/forum/user.php @@ -193,7 +193,7 @@ array('id' => $user->id, 'course' => $courseid))); } else { $navbar = $PAGE->navbar->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', - array('id' => $user->id, 'course' => $courseid, 'mode'=>'discussions'))); + array('id' => $user->id, 'course' => $courseid, 'mode' => 'discussions'))); } } } else if ($canviewuser) { @@ -211,7 +211,7 @@ array('id' => $user->id, 'course' => $courseid))); } else { $navbar = $PAGE->navbar->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', - array('id' => $user->id, 'course' => $courseid, 'mode'=>'discussions'))); + array('id' => $user->id, 'course' => $courseid, 'mode' => 'discussions'))); } } @@ -384,7 +384,7 @@ array('id' => $user->id, 'course' => $courseid))); } else { $navbar = $PAGE->navbar->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', - array('id' => $user->id, 'course' => $courseid, 'mode'=>'discussions'))); + array('id' => $user->id, 'course' => $courseid, 'mode' => 'discussions'))); } } diff --git a/my/index.php b/my/index.php index ce73fd327226c..4b6e73098cfe1 100644 --- a/my/index.php +++ b/my/index.php @@ -93,9 +93,6 @@ } } } -$mycoursenode = $PAGE->navigation->get('mycourses'); -$mycoursenode->collapse = true; -$mycoursenode->make_inactive(); // Toggle the editing state and switches if ($PAGE->user_allowed_editing()) { diff --git a/user/edit.php b/user/edit.php index 49da9f27df548..bd3d5dbb40aaa 100644 --- a/user/edit.php +++ b/user/edit.php @@ -194,7 +194,8 @@ $a->oldemail = $usernew->email = $user->email; $emailchangedhtml = $OUTPUT->box(get_string('auth_changingemailaddress', 'auth', $a), 'generalbox', 'notice'); - $emailchangedhtml .= $OUTPUT->continue_button("$CFG->wwwroot/user/preferences.php?userid=$user->id&course=$course->id"); + $emailchangedhtml .= + $OUTPUT->continue_button("$CFG->wwwroot/user/preferences.php?userid=$user->id&course=$course->id"); $emailchanged = true; } } diff --git a/user/editadvanced.php b/user/editadvanced.php index 976ccd5a64b9d..024b9f55df56b 100644 --- a/user/editadvanced.php +++ b/user/editadvanced.php @@ -338,7 +338,7 @@ $PAGE->set_heading($userfullname); echo $OUTPUT->header(); - echo $OUTPUT->heading($userfullname); + echo $OUTPUT->heading($streditmyprofile); } // Finally display THE form. diff --git a/user/editlib.php b/user/editlib.php index 205f6df3043c1..0890d4cd75c4c 100644 --- a/user/editlib.php +++ b/user/editlib.php @@ -96,10 +96,7 @@ function useredit_setup_preference_page($userid, $courseid) { } else { // Teachers, parents, etc. require_capability('moodle/user:editprofile', $personalcontext); - // No editing of guest user account. - if (isguestuser($user->id)) { - print_error('guestnoeditprofileother'); - } + // No editing of primary admin! if (is_siteadmin($user) and !is_siteadmin($USER)) { // Only admins may edit other admins. print_error('useradmineditadmin'); diff --git a/user/editor.php b/user/editor.php index 57ebaafe1859b..7a3267d7cc3ba 100644 --- a/user/editor.php +++ b/user/editor.php @@ -56,6 +56,8 @@ $streditmyeditor = get_string('editorpreferences'); $userfullname = fullname($user, true); +$PAGE->navbar->includesettingsbase = true; + $PAGE->set_title("$course->shortname: $streditmyeditor"); $PAGE->set_heading($userfullname); diff --git a/user/forum.php b/user/forum.php index 4947d2ca333a4..88b8628866efe 100644 --- a/user/forum.php +++ b/user/forum.php @@ -57,6 +57,8 @@ $streditmyforum = get_string('forumpreferences'); $userfullname = fullname($user, true); +$PAGE->navbar->includesettingsbase = true; + $PAGE->set_title("$course->shortname: $streditmyforum"); $PAGE->set_heading($userfullname); diff --git a/user/forum_form.php b/user/forum_form.php index 2a037f1b347f9..3a4b04df1b116 100644 --- a/user/forum_form.php +++ b/user/forum_form.php @@ -15,7 +15,9 @@ // along with Moodle. If not, see . /** - * Form to edit a users forum preferences. These are stored as columns in the user table, which + * Form to edit a users forum preferences. + * + * These are stored as columns in the user table, which * is why they are in /user and not /mod/forum. * * @copyright 1999 Martin Dougiamas http://dougiamas.com diff --git a/user/language.php b/user/language.php index 2feb2c29ad1f4..b49f69b52cbd8 100644 --- a/user/language.php +++ b/user/language.php @@ -60,11 +60,13 @@ $streditmylanguage = get_string('preferredlanguage'); $userfullname = fullname($user, true); +$PAGE->navbar->includesettingsbase = true; + $PAGE->set_title("$course->shortname: $streditmylanguage"); $PAGE->set_heading($userfullname); echo $OUTPUT->header(); -echo $OUTPUT->heading($userfullname); +echo $OUTPUT->heading($streditmylanguage); // Finally display THE form. $languageform->display(); diff --git a/user/tests/fixtures/myprofile_fixtures.php b/user/tests/fixtures/myprofile_fixtures.php index 126932e156361..30ed596777525 100644 --- a/user/tests/fixtures/myprofile_fixtures.php +++ b/user/tests/fixtures/myprofile_fixtures.php @@ -36,6 +36,9 @@ class phpunit_fixture_myprofile_category extends \core_user\output\myprofile\category { /** * Make protected method public for testing. + * + * @param node $node + * @return node Nodes after the specified node. */ public function find_nodes_after($node) { return parent::find_nodes_after($node); @@ -51,10 +54,18 @@ public function validate_after_order() { /** * Class phpunit_fixture_myprofile_tree + * + * @package core_user + * @category test + * @copyright 2015 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class phpunit_fixture_myprofile_tree extends \core_user\output\myprofile\tree { /** * Make protected method public for testing. + * + * @param category $cat Category object + * @return array An array of category objects. */ public function find_categories_after($cat) { return parent::find_categories_after($cat); diff --git a/user/view.php b/user/view.php index b72a2f252b767..cbbb29d4988a1 100644 --- a/user/view.php +++ b/user/view.php @@ -190,7 +190,7 @@ echo $OUTPUT->header(); echo '
'; -$headerinfo = array('heading' => fullname($user) ,'user' => $user, 'usercontext' => $usercontext); +$headerinfo = array('heading' => fullname($user), 'user' => $user, 'usercontext' => $usercontext); echo $OUTPUT->context_header($headerinfo, 2); if ($user->deleted) {