MDL-19124 Continued misc user profile cleanups
- fixed user styles in base theme - added new divs for better control on user profile and user index pages - reduced data on course user profiles down to minimum - removed user/tabs.php completely and all uses of it - changed default user icon pix to something very bland (bye bye smiley cake)
|
@ -231,7 +231,7 @@ switch ($context->contextlevel) {
|
||||||
admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid));
|
admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid));
|
||||||
break;
|
break;
|
||||||
case CONTEXT_USER:
|
case CONTEXT_USER:
|
||||||
$tabfile = $CFG->dirroot.'/user/tabs.php';
|
$tabfile = null;
|
||||||
if ($isfrontpage) {
|
if ($isfrontpage) {
|
||||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||||
$PAGE->set_heading($fullname);
|
$PAGE->set_heading($fullname);
|
||||||
|
@ -259,9 +259,11 @@ switch ($context->contextlevel) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currenttab = 'assign';
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
include($tabfile);
|
if ($tabfile) {
|
||||||
|
$currenttab = 'assign';
|
||||||
|
include($tabfile);
|
||||||
|
}
|
||||||
|
|
||||||
// Print heading.
|
// Print heading.
|
||||||
echo $OUTPUT->heading_with_help($title, 'assignroles', 'role');
|
echo $OUTPUT->heading_with_help($title, 'assignroles', 'role');
|
||||||
|
|
|
@ -80,7 +80,7 @@ switch ($context->contextlevel) {
|
||||||
admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid));
|
admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid));
|
||||||
break;
|
break;
|
||||||
case CONTEXT_USER:
|
case CONTEXT_USER:
|
||||||
$tabfile = $CFG->dirroot.'/user/tabs.php';
|
$tabfile = null;
|
||||||
if ($isfrontpage) {
|
if ($isfrontpage) {
|
||||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||||
$PAGE->set_heading($fullname);
|
$PAGE->set_heading($fullname);
|
||||||
|
@ -108,12 +108,14 @@ switch ($context->contextlevel) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currenttab = 'check';
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
// These are needed early because of tabs.php
|
// These are needed early because of tabs.php
|
||||||
$assignableroles = get_assignable_roles($context, ROLENAME_BOTH);
|
$assignableroles = get_assignable_roles($context, ROLENAME_BOTH);
|
||||||
$overridableroles = get_overridable_roles($context, ROLENAME_BOTH);
|
$overridableroles = get_overridable_roles($context, ROLENAME_BOTH);
|
||||||
include($tabfile);
|
if ($tabfile) {
|
||||||
|
$currenttab = 'check';
|
||||||
|
include($tabfile);
|
||||||
|
}
|
||||||
|
|
||||||
// Print heading.
|
// Print heading.
|
||||||
echo $OUTPUT->heading_with_help($title, 'checkpermissions', 'role');
|
echo $OUTPUT->heading_with_help($title, 'checkpermissions', 'role');
|
||||||
|
|
|
@ -65,7 +65,7 @@ if (optional_param('cancel', false, PARAM_BOOL)) {
|
||||||
|
|
||||||
$role = $DB->get_record('role', array('id'=>$roleid), '*', MUST_EXIST);
|
$role = $DB->get_record('role', array('id'=>$roleid), '*', MUST_EXIST);
|
||||||
|
|
||||||
// These are needed early because of tabs.php
|
// These are needed early
|
||||||
$assignableroles = get_assignable_roles($context, ROLENAME_BOTH);
|
$assignableroles = get_assignable_roles($context, ROLENAME_BOTH);
|
||||||
list($overridableroles, $overridecounts, $nameswithcounts) = get_overridable_roles($context, ROLENAME_BOTH, true);
|
list($overridableroles, $overridecounts, $nameswithcounts) = get_overridable_roles($context, ROLENAME_BOTH, true);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ switch ($context->contextlevel) {
|
||||||
print_error('cannotoverridebaserole', 'error');
|
print_error('cannotoverridebaserole', 'error');
|
||||||
break;
|
break;
|
||||||
case CONTEXT_USER:
|
case CONTEXT_USER:
|
||||||
$tabfile = $CFG->dirroot.'/user/tabs.php';
|
$tabfile = null;
|
||||||
if ($isfrontpage) {
|
if ($isfrontpage) {
|
||||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||||
$PAGE->set_heading($fullname);
|
$PAGE->set_heading($fullname);
|
||||||
|
@ -135,7 +135,9 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
|
||||||
|
|
||||||
// Finally start page output
|
// Finally start page output
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
include($tabfile);
|
if ($tabfile) {
|
||||||
|
include($tabfile);
|
||||||
|
}
|
||||||
echo $OUTPUT->heading_with_help($title, 'overrides', 'role');
|
echo $OUTPUT->heading_with_help($title, 'overrides', 'role');
|
||||||
|
|
||||||
// Show UI for overriding roles.
|
// Show UI for overriding roles.
|
||||||
|
|
|
@ -85,7 +85,7 @@ switch ($context->contextlevel) {
|
||||||
print_error('cannotoverridebaserole', 'error');
|
print_error('cannotoverridebaserole', 'error');
|
||||||
break;
|
break;
|
||||||
case CONTEXT_USER:
|
case CONTEXT_USER:
|
||||||
$tabfile = $CFG->dirroot.'/user/tabs.php';
|
$tabfile = null;
|
||||||
if ($isfrontpage) {
|
if ($isfrontpage) {
|
||||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||||
$PAGE->set_heading($fullname);
|
$PAGE->set_heading($fullname);
|
||||||
|
@ -143,7 +143,9 @@ if ($capability && ($allowoverrides || ($allowsafeoverrides && is_safe_capabilit
|
||||||
}
|
}
|
||||||
// Display and print
|
// Display and print
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
include($tabfile);
|
if ($tabfile) {
|
||||||
|
include($tabfile);
|
||||||
|
}
|
||||||
echo $OUTPUT->heading($title);
|
echo $OUTPUT->heading($title);
|
||||||
echo $OUTPUT->confirm($message, $continueurl, $PAGE->url);
|
echo $OUTPUT->confirm($message, $continueurl, $PAGE->url);
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
|
@ -182,7 +184,9 @@ if ($capability && ($allowoverrides || ($allowsafeoverrides && is_safe_capabilit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
include($tabfile);
|
if ($tabfile) {
|
||||||
|
include($tabfile);
|
||||||
|
}
|
||||||
echo $OUTPUT->heading($title);
|
echo $OUTPUT->heading($title);
|
||||||
echo $OUTPUT->box($message);
|
echo $OUTPUT->box($message);
|
||||||
$mform->display();
|
$mform->display();
|
||||||
|
@ -192,7 +196,9 @@ if ($capability && ($allowoverrides || ($allowsafeoverrides && is_safe_capabilit
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
include($tabfile);
|
if ($tabfile) {
|
||||||
|
include($tabfile);
|
||||||
|
}
|
||||||
echo $OUTPUT->heading($title);
|
echo $OUTPUT->heading($title);
|
||||||
|
|
||||||
$table = new permissions_table($context, $contextname, $allowoverrides, $allowsafeoverrides, $overridableroles);
|
$table = new permissions_table($context, $contextname, $allowoverrides, $allowsafeoverrides, $overridableroles);
|
||||||
|
|
|
@ -106,11 +106,10 @@ foreach ($roleassignments as $ra) {
|
||||||
$contexts[$ra->contextid]->roleassignments[$ra->roleid] = $ra;
|
$contexts[$ra->contextid]->roleassignments[$ra->roleid] = $ra;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// These are needed to determine which tabs tabs.php should show.
|
|
||||||
$assignableroles = get_assignable_roles($usercontext, ROLENAME_BOTH);
|
$assignableroles = get_assignable_roles($usercontext, ROLENAME_BOTH);
|
||||||
$overridableroles = get_overridable_roles($usercontext, ROLENAME_BOTH);
|
$overridableroles = get_overridable_roles($usercontext, ROLENAME_BOTH);
|
||||||
|
|
||||||
/// Print the header and tabs
|
/// Print the header
|
||||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $coursecontext));
|
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $coursecontext));
|
||||||
$straction = get_string('thisusersroles', 'role');
|
$straction = get_string('thisusersroles', 'role');
|
||||||
$title = get_string('xroleassignments', 'role', $fullname);
|
$title = get_string('xroleassignments', 'role', $fullname);
|
||||||
|
@ -128,11 +127,6 @@ if ($courseid != SITEID) {
|
||||||
$PAGE->navbar->add($fullname, new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
|
$PAGE->navbar->add($fullname, new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
|
||||||
$PAGE->navbar->add($straction);
|
$PAGE->navbar->add($straction);
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
||||||
$showroles = 1;
|
|
||||||
$currenttab = 'usersroles';
|
|
||||||
include($CFG->dirroot.'/user/tabs.php');
|
|
||||||
|
|
||||||
echo $OUTPUT->heading($title, 3);
|
echo $OUTPUT->heading($title, 3);
|
||||||
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');
|
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ if (empty($CFG->bloglevel)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||||
$tabsfile = null;
|
|
||||||
|
|
||||||
if (!$userid && has_capability('moodle/blog:view', $sitecontext) && $CFG->bloglevel > BLOG_USER_LEVEL) {
|
if (!$userid && has_capability('moodle/blog:view', $sitecontext) && $CFG->bloglevel > BLOG_USER_LEVEL) {
|
||||||
if ($entryid) {
|
if ($entryid) {
|
||||||
|
@ -173,7 +172,6 @@ if (!empty($user)) {
|
||||||
print_error('cannotviewcourseblog', 'blog');
|
print_error('cannotviewcourseblog', 'blog');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tabsfile = $CFG->dirroot . '/user/tabs.php';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$courseid = (empty($courseid)) ? SITEID : $courseid;
|
$courseid = (empty($courseid)) ? SITEID : $courseid;
|
||||||
|
@ -195,10 +193,6 @@ if (empty($entryid) && empty($modid) && empty($groupid)) {
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
||||||
if (!empty($tabsfile)) {
|
|
||||||
require_once($tabsfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $OUTPUT->heading($blogheaders['heading'], 2);
|
echo $OUTPUT->heading($blogheaders['heading'], 2);
|
||||||
|
|
||||||
$bloglisting = new blog_listing($blogheaders['filters']);
|
$bloglisting = new blog_listing($blogheaders['filters']);
|
||||||
|
|
|
@ -154,15 +154,6 @@ $PAGE->set_title("$course->shortname: $stractivityreport ($mode)");
|
||||||
$PAGE->set_heading($course->fullname);
|
$PAGE->set_heading($course->fullname);
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
||||||
/// Print tabs at top
|
|
||||||
/// This same call is made in:
|
|
||||||
/// /user/view.php
|
|
||||||
/// /user/edit.php
|
|
||||||
/// /course/user.php
|
|
||||||
$currenttab = $mode;
|
|
||||||
$showroles = 1;
|
|
||||||
include($CFG->dirroot.'/user/tabs.php');
|
|
||||||
|
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case "grade":
|
case "grade":
|
||||||
if (empty($CFG->grade_profilereport) or !file_exists($CFG->dirroot.'/grade/report/'.$CFG->grade_profilereport.'/lib.php')) {
|
if (empty($CFG->grade_profilereport) or !file_exists($CFG->dirroot.'/grade/report/'.$CFG->grade_profilereport.'/lib.php')) {
|
||||||
|
|
|
@ -185,11 +185,6 @@ if ($course->id != SITEID) {
|
||||||
}
|
}
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
||||||
/// Print tabs at the top
|
|
||||||
$showroles = 1;
|
|
||||||
$currenttab = 'editmessage';
|
|
||||||
require('../user/tabs.php');
|
|
||||||
|
|
||||||
/// Start the form. We're not using mform here because of our special formatting needs ...
|
/// Start the form. We're not using mform here because of our special formatting needs ...
|
||||||
echo '<form class="mform" method="post" action="'.$CFG->wwwroot.'/message/edit.php">';
|
echo '<form class="mform" method="post" action="'.$CFG->wwwroot.'/message/edit.php">';
|
||||||
|
|
||||||
|
|
BIN
pix/u/f1.png
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
pix/u/f2.png
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
pix/u/user35.png
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.5 KiB |
|
@ -137,8 +137,6 @@ if ($context->contextlevel == CONTEXT_USER) {
|
||||||
if ( !$course = $DB->get_record('course', array('id'=>$usercourseid))) {
|
if ( !$course = $DB->get_record('course', array('id'=>$usercourseid))) {
|
||||||
print_error('invalidcourseid');
|
print_error('invalidcourseid');
|
||||||
}
|
}
|
||||||
$currenttab = 'repositories';
|
|
||||||
include($CFG->dirroot.'/user/tabs.php');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $OUTPUT->heading($pagename);
|
echo $OUTPUT->heading($pagename);
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
/*$$$$$$$$$$$$$$$$$ User $$$$$$$$$$$$$$$$$$$$*/
|
/*$$$$$$$$$$$$$$$$$ User $$$$$$$$$$$$$$$$$$$$*/
|
||||||
|
|
||||||
|
.userprofile .fullprofilelink {text-align:center; margin:10px;}
|
||||||
|
.userprofile .profilepicture {float:left; margin-right:20px;}
|
||||||
|
.userprofile .description {margin-bottom:20px;}
|
||||||
|
|
||||||
.user-box {margin:8px;width:115px;height:160px;text-align:center;float:left;clear: none;}
|
.user-box {margin:8px;width:115px;height:160px;text-align:center;float:left;clear: none;}
|
||||||
|
|
||||||
|
.userlist #showall {margin: 10px 0px;}
|
||||||
|
.userlist .buttons {text-align: center;}
|
||||||
|
.userlist table#participants {text-align:center;}
|
||||||
|
.userlist table#participants td,
|
||||||
|
.userlist table#participants th {vertical-align: middle;text-align: left;padding: 4px;}
|
||||||
|
.userlist table.controls {width: 100%;}
|
||||||
|
.userlist table.controls tr {vertical-align: top;}
|
||||||
|
.userlist table.controls td.right,
|
||||||
|
.userlist table.controls td.left {padding: 4px;}
|
||||||
|
.userlist table.controls .right {text-align: right;}
|
||||||
|
|
||||||
.userinfobox {width:100%;border:1px solid;border-collapse: separate;padding:10px;}
|
.userinfobox {width:100%;border:1px solid;border-collapse: separate;padding:10px;}
|
||||||
.userinfobox .left,
|
.userinfobox .left,
|
||||||
.userinfobox .side {width: 100px;vertical-align: top;}
|
.userinfobox .side {width: 100px;vertical-align: top;}
|
||||||
|
@ -14,24 +30,7 @@
|
||||||
.groupinfobox {border:1px solid;}
|
.groupinfobox {border:1px solid;}
|
||||||
.groupinfobox .left {padding: 10px;width: 100px;vertical-align: top;}
|
.groupinfobox .left {padding: 10px;width: 100px;vertical-align: top;}
|
||||||
|
|
||||||
.iplookup #note,
|
.course-participation #showall {text-align:center;margin: 10px 0px;}
|
||||||
#course-participation h2,
|
|
||||||
#user-index .rolesform,
|
|
||||||
#user-view .buttons,
|
|
||||||
#user-index .buttons {text-align: center;}
|
|
||||||
#user-view .buttons form,
|
|
||||||
#user-view .buttons form div {display:inline;}
|
|
||||||
|
|
||||||
#user-index #showall {margin: 10px 0px;}
|
|
||||||
#user-index table#participants,
|
|
||||||
#user-index table#participants td,
|
|
||||||
#user-index table#participants th {vertical-align: middle;text-align: left;padding: 4px;}
|
|
||||||
#user-index table.controls {width: 100%;}
|
|
||||||
#user-index table.controls tr {vertical-align: top;}
|
|
||||||
#user-index table.controls td.right,
|
|
||||||
#user-index table.controls td.left {padding: 4px;}
|
|
||||||
#user-index table.controls .right {text-align: right;}
|
|
||||||
#course-participation #showall {text-align:center;margin: 10px 0px;}
|
|
||||||
#user-policy .noticebox {text-align:center;margin-left:auto;margin-right:auto;margin-bottom:10px;width:80%;height:250px;}
|
#user-policy .noticebox {text-align:center;margin-left:auto;margin-right:auto;margin-bottom:10px;width:80%;height:250px;}
|
||||||
#user-policy #policyframe {width:100%;height:100%;}
|
#user-policy #policyframe {width:100%;height:100%;}
|
||||||
.iplookup #map {margin:auto;}
|
.iplookup #map {margin:auto;}
|
||||||
|
|
|
@ -8,6 +8,7 @@ $THEME->sheets = array(
|
||||||
'blocks',
|
'blocks',
|
||||||
'calendar',
|
'calendar',
|
||||||
'course',
|
'course',
|
||||||
|
'user',
|
||||||
'dock',
|
'dock',
|
||||||
'grade',
|
'grade',
|
||||||
'message',
|
'message',
|
||||||
|
|
|
@ -143,10 +143,13 @@
|
||||||
$PAGE->set_title("$course->shortname: ".get_string('participants'));
|
$PAGE->set_title("$course->shortname: ".get_string('participants'));
|
||||||
$PAGE->set_heading($course->fullname);
|
$PAGE->set_heading($course->fullname);
|
||||||
$PAGE->set_pagetype('course-view-' . $course->format);
|
$PAGE->set_pagetype('course-view-' . $course->format);
|
||||||
|
$PAGE->add_body_class('path-user'); // So we can style it independently
|
||||||
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
|
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
||||||
|
echo '<div class="userlist">';
|
||||||
|
|
||||||
if ($isseparategroups and (!$currentgroup) ) {
|
if ($isseparategroups and (!$currentgroup) ) {
|
||||||
// The user is not in the group so show message and exit
|
// The user is not in the group so show message and exit
|
||||||
echo $OUTPUT->heading(get_string("notingroup"));
|
echo $OUTPUT->heading(get_string("notingroup"));
|
||||||
|
@ -884,6 +887,8 @@
|
||||||
echo $OUTPUT->container(html_writer::link($perpageurl, get_string('showall', '', $matchcount)), array(), 'showall');
|
echo $OUTPUT->container(html_writer::link($perpageurl, get_string('showall', '', $matchcount)), array(), 'showall');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '</div>'; // userlist
|
||||||
|
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
|
|
||||||
if ($userlist) {
|
if ($userlist) {
|
||||||
|
|
|
@ -169,7 +169,9 @@ if ($currentpage->userid == 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO WORK OUT WHERE THE NAV BAR IS!
|
// TODO WORK OUT WHERE THE NAV BAR IS!
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
echo '<div class="userprofile">';
|
||||||
|
|
||||||
|
|
||||||
// Print the standard content of this page, the basic profile info
|
// Print the standard content of this page, the basic profile info
|
||||||
|
@ -370,6 +372,13 @@ echo "</table>";
|
||||||
|
|
||||||
echo $OUTPUT->blocks_for_region('content');
|
echo $OUTPUT->blocks_for_region('content');
|
||||||
|
|
||||||
|
if ($CFG->debugdisplay && debugging('', DEBUG_DEVELOPER) && $currentuser) { // Show user object
|
||||||
|
echo '<br /><br /><hr />';
|
||||||
|
echo $OUTPUT->heading('DEBUG MODE: User session variables');
|
||||||
|
print_object($USER);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</div>'; // userprofile class
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
|
|
||||||
|
|
||||||
|
|
309
user/tabs.php
|
@ -1,309 +0,0 @@
|
||||||
<?php
|
|
||||||
/// This file to be included so we can assume config.php has already been included.
|
|
||||||
/// We also assume that $user, $course, $currenttab have been set
|
|
||||||
|
|
||||||
require_once($CFG->libdir . '/portfoliolib.php');
|
|
||||||
|
|
||||||
if (!isset($filtertype)) {
|
|
||||||
$filtertype = '';
|
|
||||||
}
|
|
||||||
if (!isset($filterselect)) {
|
|
||||||
$filterselect = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
//make sure everything is cleaned properly
|
|
||||||
$filtertype = clean_param($filtertype, PARAM_ALPHA);
|
|
||||||
$filterselect = clean_param($filterselect, PARAM_INT);
|
|
||||||
|
|
||||||
if (empty($currenttab) or empty($user) or empty($course)) {
|
|
||||||
//print_error('cannotcallscript');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($filtertype == 'site' && $filterselect) || ($filtertype=='user' && $filterselect)) {
|
|
||||||
$user = $DB->get_record('user', array('id'=>$filterselect));
|
|
||||||
}
|
|
||||||
|
|
||||||
$inactive = NULL;
|
|
||||||
$activetwo = NULL;
|
|
||||||
$toprow = array();
|
|
||||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
|
||||||
|
|
||||||
/****************************
|
|
||||||
* Site Level participation *
|
|
||||||
****************************/
|
|
||||||
if ($filtertype == 'site') {
|
|
||||||
|
|
||||||
$site = get_site();
|
|
||||||
echo $OUTPUT->heading(format_string($site->fullname));
|
|
||||||
|
|
||||||
/******************************
|
|
||||||
* Course Level participation *
|
|
||||||
******************************/
|
|
||||||
} else if ($filtertype == 'course' && $filterselect) {
|
|
||||||
|
|
||||||
$course = $DB->get_record('course', array('id'=>$filterselect));
|
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
|
||||||
echo $OUTPUT->heading(format_string($course->fullname));
|
|
||||||
|
|
||||||
$toprow[] = new tabobject('participants', $CFG->wwwroot.'/user/index.php?id='.$filterselect,
|
|
||||||
get_string('participants'));
|
|
||||||
|
|
||||||
if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext))) {
|
|
||||||
$toprow[] = new tabobject('notes', $CFG->wwwroot.'/notes/index.php?filtertype=course&filterselect=' . $filterselect, get_string('notes', 'notes'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************
|
|
||||||
* Group Level participation *
|
|
||||||
*****************************/
|
|
||||||
} else if ($filtertype == 'group' && $filterselect) {
|
|
||||||
|
|
||||||
$group_name = groups_get_group_name($filterselect);
|
|
||||||
echo $OUTPUT->heading($group_name);
|
|
||||||
|
|
||||||
|
|
||||||
/****************************
|
|
||||||
* User Level participation *
|
|
||||||
****************************/
|
|
||||||
} else {
|
|
||||||
if (isset($userid)) {
|
|
||||||
$user = $DB->get_record('user', array('id'=>$userid));
|
|
||||||
}
|
|
||||||
echo $OUTPUT->heading(fullname($user, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id))));
|
|
||||||
|
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
|
||||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
|
||||||
|
|
||||||
if ($user->id == $USER->id || has_capability('moodle/user:viewdetails', $coursecontext) || has_capability('moodle/user:viewdetails', $personalcontext) ) {
|
|
||||||
$toprow[] = new tabobject('profile', $CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id, get_string('viewprofile'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Can only edit profile if it belongs to user or current user is admin and not editing primary admin
|
|
||||||
|
|
||||||
if(empty($CFG->loginhttps)) {
|
|
||||||
$wwwroot = $CFG->wwwroot;
|
|
||||||
} else {
|
|
||||||
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Everyone can see posts for this user
|
|
||||||
|
|
||||||
$edittype = 'none';
|
|
||||||
if (isguestuser($user)) {
|
|
||||||
// guest account can not be edited
|
|
||||||
|
|
||||||
} else if (is_mnet_remote_user($user)) {
|
|
||||||
// cannot edit remote users
|
|
||||||
|
|
||||||
} else if (isguestuser() or !isloggedin()) {
|
|
||||||
// guests and not logged in can not edit own profile
|
|
||||||
|
|
||||||
} else if ($USER->id == $user->id) {
|
|
||||||
if (has_capability('moodle/user:update', $systemcontext)) {
|
|
||||||
$edittype = 'advanced';
|
|
||||||
} else if (has_capability('moodle/user:editownprofile', $systemcontext)) {
|
|
||||||
$edittype = 'normal';
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (has_capability('moodle/user:update', $systemcontext) and !is_primary_admin($user->id)){
|
|
||||||
$edittype = 'advanced';
|
|
||||||
} else if (has_capability('moodle/user:editprofile', $personalcontext) and !is_primary_admin($user->id)){
|
|
||||||
//teachers, parents, etc.
|
|
||||||
$edittype = 'normal';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($edittype == 'advanced') {
|
|
||||||
$toprow[] = new tabobject('editprofile', $wwwroot.'/user/editadvanced.php?id='.$user->id.'&course='.$course->id, get_string('editmyprofile'));
|
|
||||||
} else if ($edittype == 'normal') {
|
|
||||||
$toprow[] = new tabobject('editprofile', $wwwroot.'/user/edit.php?id='.$user->id.'&course='.$course->id, get_string('editmyprofile'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// add logic to see course read posts permission
|
|
||||||
if (has_capability('moodle/user:readuserposts', $personalcontext) || has_capability('mod/forum:viewdiscussion', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
|
||||||
$toprow[] = new tabobject('forumposts', $CFG->wwwroot.'/mod/forum/user.php?id='.$user->id.'&course='.$course->id,
|
|
||||||
get_string('forumposts', 'forum'));
|
|
||||||
|
|
||||||
if (in_array($currenttab, array('posts', 'discussions'))) {
|
|
||||||
$inactive = array('forumposts');
|
|
||||||
$activetwo = array('forumposts');
|
|
||||||
|
|
||||||
$secondrow = array();
|
|
||||||
$secondrow[] = new tabobject('posts', $CFG->wwwroot.'/mod/forum/user.php?course='.$course->id.
|
|
||||||
'&id='.$user->id.'&mode=posts', get_string('posts', 'forum'));
|
|
||||||
$secondrow[] = new tabobject('discussions', $CFG->wwwroot.'/mod/forum/user.php?course='.$course->id.
|
|
||||||
'&id='.$user->id.'&mode=discussions', get_string('discussions', 'forum'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext))) {
|
|
||||||
$toprow[] = new tabobject('notes', $CFG->wwwroot.'/notes/index.php?course='.$course->id . '&user=' . $user->id, get_string('notes', 'notes'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Find out if user allowed to see all reports of this user (usually parent) or individual course reports
|
|
||||||
|
|
||||||
$myreports = ($course->showreports and $USER->id == $user->id);
|
|
||||||
$anyreport = has_capability('moodle/user:viewuseractivitiesreport', $personalcontext);
|
|
||||||
|
|
||||||
$reportsecondrow = array();
|
|
||||||
|
|
||||||
if ($myreports or $anyreport or has_capability('coursereport/outline:view', $coursecontext)) {
|
|
||||||
$reportsecondrow[] = new tabobject('outline', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
|
||||||
'&user='.$user->id.'&mode=outline', get_string('outlinereport'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($myreports or $anyreport or has_capability('coursereport/outline:view', $coursecontext)) {
|
|
||||||
$reportsecondrow[] = new tabobject('complete', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
|
||||||
'&user='.$user->id.'&mode=complete', get_string('completereport'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($myreports or $anyreport or has_capability('coursereport/log:viewtoday', $coursecontext)) {
|
|
||||||
$reportsecondrow[] = new tabobject('todaylogs', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
|
||||||
'&user='.$user->id.'&mode=todaylogs', get_string('todaylogs'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($myreports or $anyreport or has_capability('coursereport/log:view', $coursecontext)) {
|
|
||||||
$reportsecondrow[] = new tabobject('alllogs', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
|
||||||
'&user='.$user->id.'&mode=alllogs', get_string('alllogs'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($CFG->enablestats)) {
|
|
||||||
if ($myreports or $anyreport or has_capability('coursereport/stats:view', $coursecontext)) {
|
|
||||||
$reportsecondrow[] = new tabobject('stats',$CFG->wwwroot.'/course/user.php?id='.$course->id.
|
|
||||||
'&user='.$user->id.'&mode=stats',get_string('stats'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_capability('moodle/grade:viewall', $coursecontext)) {
|
|
||||||
//ok - can view all course grades
|
|
||||||
$gradeaccess = true;
|
|
||||||
|
|
||||||
} else if ($course->showgrades and $user->id == $USER->id and has_capability('moodle/grade:view', $coursecontext)) {
|
|
||||||
//ok - can view own grades
|
|
||||||
$gradeaccess = true;
|
|
||||||
|
|
||||||
} else if ($course->showgrades and has_capability('moodle/grade:viewall', $personalcontext)) {
|
|
||||||
// ok - can view grades of this user - parent most probably
|
|
||||||
$gradeaccess = true;
|
|
||||||
|
|
||||||
} else if ($course->showgrades and $anyreport) {
|
|
||||||
// ok - can view grades of this user - parent most probably
|
|
||||||
$gradeaccess = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$gradeaccess = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($gradeaccess) {
|
|
||||||
$reportsecondrow[] = new tabobject('grade', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
|
||||||
'&user='.$user->id.'&mode=grade', get_string('grade'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($reportsecondrow) {
|
|
||||||
$toprow[] = new tabobject('reports', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
|
||||||
'&user='.$user->id.'&mode=outline', get_string('activityreports'));
|
|
||||||
if (in_array($currenttab, array('outline', 'complete', 'todaylogs', 'alllogs', 'stats', 'grade'))) {
|
|
||||||
$inactive = array('reports');
|
|
||||||
$activetwo = array('reports');
|
|
||||||
$secondrow = $reportsecondrow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} //close last bracket (individual tags)
|
|
||||||
|
|
||||||
/// this needs permission checkings
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($showroles) and !empty($user)) { // this variable controls whether this roles is showed, or not, so only user/view page should set this flag
|
|
||||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
|
||||||
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride',
|
|
||||||
'moodle/role:override', 'moodle/role:manage', 'moodle/role:review'), $usercontext)) {
|
|
||||||
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/usersroles.php?userid='.$user->id.'&courseid='.$course->id
|
|
||||||
,get_string('roles'));
|
|
||||||
|
|
||||||
if (in_array($currenttab, array('usersroles', 'assign', 'permissions', 'check'))) {
|
|
||||||
$inactive = array('roles');
|
|
||||||
$activetwo = array('roles');
|
|
||||||
|
|
||||||
$secondrow = array();
|
|
||||||
$secondrow[] = new tabobject('usersroles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/usersroles.php?userid='.$user->id.'&courseid='.$course->id
|
|
||||||
,get_string('thisusersroles', 'role'));
|
|
||||||
if (!empty($assignableroles) || $currenttab=='assign') {
|
|
||||||
$secondrow[] = new tabobject('assign', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$usercontext->id.'&userid='.$user->id.'&courseid='.$course->id
|
|
||||||
,get_string('assignrolesrelativetothisuser', 'role'), '', true);
|
|
||||||
}
|
|
||||||
if (!empty($overridableroles) || $currenttab=='permissions' || has_capability('moodle/role:review', $usercontext)) {
|
|
||||||
$secondrow[] = new tabobject('permissions', $CFG->wwwroot.'/'.$CFG->admin.'/roles/permissions.php?contextid='.$usercontext->id.'&userid='.$user->id.'&courseid='.$course->id
|
|
||||||
,get_string('permissions', 'role'), '', true);
|
|
||||||
}
|
|
||||||
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride',
|
|
||||||
'moodle/role:override', 'moodle/role:assign', 'moodle/role:review'), $usercontext)) {
|
|
||||||
$secondrow[] = new tabobject('check',
|
|
||||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/check.php?contextid='.$usercontext->id.'&userid='.$user->id.'&courseid='.$course->id,
|
|
||||||
get_string('checkpermissions', 'role'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($user) and empty($userindexpage) && $user->id == $USER->id && !empty($CFG->enableportfolios) && has_capability('moodle/portfolio:export', get_system_context())) {
|
|
||||||
|
|
||||||
/// Portfolio tab
|
|
||||||
if (portfolio_instances(true, false)) {
|
|
||||||
$toprow[] = new tabobject('portfolios', $CFG->wwwroot .'/user/portfolio.php', get_string('portfolios', 'portfolio'));
|
|
||||||
if (in_array($currenttab, array('portfolioconf', 'portfoliologs'))) {
|
|
||||||
$inactive = array('portfolios');
|
|
||||||
$activetwo = array('portfolios');
|
|
||||||
$secondrow = array();
|
|
||||||
$secondrow[] = new tabobject('portfolioconf', $CFG->wwwroot . '/user/portfolio.php', get_string('configure', 'portfolio'));
|
|
||||||
$secondrow[] = new tabobject('portfoliologs', $CFG->wwwroot . '/user/portfoliologs.php', get_string('logs', 'portfolio'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Repository Tab
|
|
||||||
if (!empty($user) and $user->id == $USER->id) {
|
|
||||||
require_once($CFG->dirroot . '/repository/lib.php');
|
|
||||||
$usercontext = get_context_instance(CONTEXT_USER,$user->id);
|
|
||||||
$editabletypes = repository::get_editable_types($usercontext);
|
|
||||||
if (!empty($usercontext) && $usercontext->contextlevel == CONTEXT_USER && !empty($editabletypes)) {
|
|
||||||
$toprow[] = new tabobject('repositories', $CFG->wwwroot .'/repository/manage_instances.php?contextid='.$usercontext->id, get_string('repositories', 'repository'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Course completion tab
|
|
||||||
if (!empty($CFG->enablecompletion) && ($course->id == SITEID || !empty($course->enablecompletion)) && // completion enabled
|
|
||||||
($myreports || $anyreport || ($course->id == SITEID || has_capability('coursereport/completion:view', $coursecontext)))) { // permissions to view the report
|
|
||||||
|
|
||||||
// Decide if singular or plural
|
|
||||||
$coursecompletion = $course->id == SITEID ? 'coursecompletions' : 'coursecompletion';
|
|
||||||
|
|
||||||
// Add tab
|
|
||||||
$reportsecondrow[] = new tabobject(
|
|
||||||
'completion',
|
|
||||||
$CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode='.$coursecompletion,
|
|
||||||
get_string($coursecompletion)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Add second row to display if there is one
|
|
||||||
|
|
||||||
if (!empty($secondrow)) {
|
|
||||||
$tabs = array($toprow, $secondrow);
|
|
||||||
} else {
|
|
||||||
$tabs = array($toprow);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($currenttab == 'editprofile' && ($user->id == $USER->id) && user_not_fully_set_up($USER)) {
|
|
||||||
/// We're being forced here to fix profile
|
|
||||||
echo $OUTPUT->notification(get_string('moreprofileinfoneeded'));
|
|
||||||
} else {
|
|
||||||
/// Print out the tabs and continue!
|
|
||||||
print_tabs($tabs, $currenttab, $inactive, $activetwo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
215
user/view.php
|
@ -59,7 +59,8 @@ if (isguestuser($user)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$PAGE->set_context($coursecontext);
|
$PAGE->set_context($coursecontext);
|
||||||
$PAGE->set_pagetype('course-view-' . $course->format);
|
$PAGE->set_pagetype('course-view-' . $course->format); // To get the blocks exactly like the course
|
||||||
|
$PAGE->add_body_class('path-user'); // So we can style it independently
|
||||||
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
|
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
|
||||||
|
|
||||||
$isparent = false;
|
$isparent = false;
|
||||||
|
@ -153,7 +154,10 @@ $PAGE->set_title("$course->fullname: $strpersonalprofile: $fullname");
|
||||||
$PAGE->set_heading($course->fullname);
|
$PAGE->set_heading($course->fullname);
|
||||||
$PAGE->set_pagelayout('standard');
|
$PAGE->set_pagelayout('standard');
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
echo $OUTPUT->heading(fullname($user));
|
|
||||||
|
echo '<div class="userprofile">';
|
||||||
|
|
||||||
|
echo $OUTPUT->heading(fullname($user).' ('.$course->shortname.')');
|
||||||
|
|
||||||
if ($user->deleted) {
|
if ($user->deleted) {
|
||||||
echo $OUTPUT->heading(get_string('userdeleted'));
|
echo $OUTPUT->heading(get_string('userdeleted'));
|
||||||
|
@ -167,12 +171,6 @@ if ($user->deleted) {
|
||||||
|
|
||||||
add_to_log($course->id, "user", "view", "view.php?id=$user->id&course=$course->id", "$user->id");
|
add_to_log($course->id, "user", "view", "view.php?id=$user->id&course=$course->id", "$user->id");
|
||||||
|
|
||||||
$user->lastaccess = false;
|
|
||||||
if ($lastaccess = $DB->get_record('user_lastaccess', array('userid'=>$user->id, 'courseid'=>$course->id))) {
|
|
||||||
$user->lastaccess = $lastaccess->timeaccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Get the hidden field list
|
/// Get the hidden field list
|
||||||
if (has_capability('moodle/user:viewhiddendetails', $coursecontext)) {
|
if (has_capability('moodle/user:viewhiddendetails', $coursecontext)) {
|
||||||
$hiddenfields = array();
|
$hiddenfields = array();
|
||||||
|
@ -202,10 +200,6 @@ if (is_mnet_remote_user($user)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="fullprofilelink">';
|
|
||||||
echo html_writer::link($CFG->wwwroot.'/user/profile.php?id='.$id, get_string('fullprofile'));
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '<div class="profilepicture">';
|
echo '<div class="profilepicture">';
|
||||||
echo $OUTPUT->user_picture($user, array('size'=>100));
|
echo $OUTPUT->user_picture($user, array('size'=>100));
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
@ -214,10 +208,10 @@ echo '</div>';
|
||||||
echo '<div class="description">';
|
echo '<div class="description">';
|
||||||
if ($user->description && !isset($hiddenfields['description'])) {
|
if ($user->description && !isset($hiddenfields['description'])) {
|
||||||
if (!empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid'=>$id))) {
|
if (!empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid'=>$id))) {
|
||||||
echo get_string('profilenotshown', 'moodle').'<hr />';
|
echo get_string('profilenotshown', 'moodle');
|
||||||
} else {
|
} else {
|
||||||
$user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $usercontext->id, 'user_profile', $id);
|
$user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $usercontext->id, 'user_profile', $id);
|
||||||
echo format_text($user->description, $user->descriptionformat)."<hr />";
|
echo format_text($user->description, $user->descriptionformat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
@ -227,107 +221,38 @@ echo '</div>';
|
||||||
|
|
||||||
echo '<table class="list" summary="">';
|
echo '<table class="list" summary="">';
|
||||||
|
|
||||||
if (! isset($hiddenfields['country']) && $user->country) {
|
// Show last time this user accessed this course
|
||||||
print_row(get_string('country') . ':', get_string($user->country, 'countries'));
|
if (!isset($hiddenfields['lastaccess'])) {
|
||||||
|
if ($lastaccess = $DB->get_record('user_lastaccess', array('userid'=>$user->id, 'courseid'=>$course->id))) {
|
||||||
|
$datestring = userdate($lastaccess->timeaccess)." (".format_time(time() - $lastaccess->timeaccess).")";
|
||||||
|
} else {
|
||||||
|
$datestring = get_string("never");
|
||||||
|
}
|
||||||
|
print_row(get_string("lastaccess").":", $datestring);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($hiddenfields['city']) && $user->city) {
|
// Show roles in this course
|
||||||
print_row(get_string('city') . ':', $user->city);
|
if ($rolestring = get_user_roles_in_course($id, $course->id)) {
|
||||||
|
print_row(get_string('roles').':', $rolestring);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('moodle/user:viewhiddendetails', $coursecontext)) {
|
// Show groups this user is in
|
||||||
if ($user->address) {
|
if (!isset($hiddenfields['groups'])) {
|
||||||
print_row(get_string("address").":", "$user->address");
|
if ($course->groupmode != SEPARATEGROUPS or has_capability('moodle/site:accessallgroups', $coursecontext)) {
|
||||||
}
|
if ($usergroups = groups_get_all_groups($course->id, $user->id)) {
|
||||||
if ($user->phone1) {
|
$groupstr = '';
|
||||||
print_row(get_string("phone").":", "$user->phone1");
|
foreach ($usergroups as $group){
|
||||||
}
|
$groupstr .= ' <a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$group->id.'">'.format_string($group->name).'</a>,';
|
||||||
if ($user->phone2) {
|
}
|
||||||
print_row(get_string("phone2").":", "$user->phone2");
|
print_row(get_string("group").":", rtrim($groupstr, ', '));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->maildisplay == 1
|
|
||||||
or ($user->maildisplay == 2 && !isguestuser())
|
|
||||||
or has_capability('moodle/course:useremail', $coursecontext)) {
|
|
||||||
|
|
||||||
$emailswitch = '';
|
|
||||||
|
|
||||||
if ($currentuser or has_capability('moodle/course:useremail', $coursecontext)) { /// Can use the enable/disable email stuff
|
|
||||||
if (!empty($enable) and confirm_sesskey()) { /// Recieved a parameter to enable the email address
|
|
||||||
$DB->set_field('user', 'emailstop', 0, array('id'=>$user->id));
|
|
||||||
$user->emailstop = 0;
|
|
||||||
}
|
|
||||||
if (!empty($disable) and confirm_sesskey()) { /// Recieved a parameter to disable the email address
|
|
||||||
$DB->set_field('user', 'emailstop', 1, array('id'=>$user->id));
|
|
||||||
$user->emailstop = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('moodle/course:useremail', $coursecontext)) { /// Can use the enable/disable email stuff
|
|
||||||
if ($user->emailstop) {
|
|
||||||
$switchparam = 'enable';
|
|
||||||
$switchtitle = get_string('emaildisable');
|
|
||||||
$switchclick = get_string('emailenableclick');
|
|
||||||
$switchpix = 't/emailno';
|
|
||||||
} else {
|
|
||||||
$switchparam = 'disable';
|
|
||||||
$switchtitle = get_string('emailenable');
|
|
||||||
$switchclick = get_string('emaildisableclick');
|
|
||||||
$switchpix = 't/email';
|
|
||||||
}
|
|
||||||
$emailswitch = " <a title=\"$switchclick\" ".
|
|
||||||
"href=\"view.php?id=$user->id&course=$course->id&$switchparam=1&sesskey=".sesskey()."\">".
|
|
||||||
"<img src=\"" . $OUTPUT->pix_url("$switchpix") . "\" alt=\"$switchclick\" /></a>";
|
|
||||||
|
|
||||||
} else if ($currentuser) { /// Can only re-enable an email this way
|
|
||||||
if ($user->emailstop) { // Include link that tells how to re-enable their email
|
|
||||||
$switchparam = 'enable';
|
|
||||||
$switchtitle = get_string('emaildisable');
|
|
||||||
$switchclick = get_string('emailenableclick');
|
|
||||||
|
|
||||||
$emailswitch = " (<a title=\"$switchclick\" ".
|
|
||||||
"href=\"view.php?id=$user->id&course=$course->id&enable=1&sesskey=".sesskey()."\">$switchtitle</a>)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print_row(get_string("email").":", obfuscate_mailto($user->email, '', $user->emailstop)."$emailswitch");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->url && !isset($hiddenfields['webpage'])) {
|
// Show other courses they may be in
|
||||||
$url = $user->url;
|
|
||||||
if (strpos($user->url, '://') === false) {
|
|
||||||
$url = 'http://'. $url;
|
|
||||||
}
|
|
||||||
print_row(get_string('webpage') .':', '<a href="'.s($url).'">'.s($user->url).'</a>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->icq && !isset($hiddenfields['icqnumber'])) {
|
|
||||||
print_row(get_string('icqnumber').':',"<a href=\"http://web.icq.com/wwp?uin=".urlencode($user->icq)."\">".s($user->icq)." <img src=\"http://web.icq.com/whitepages/online?icq=".urlencode($user->icq)."&img=5\" alt=\"\" /></a>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->skype && !isset($hiddenfields['skypeid'])) {
|
|
||||||
print_row(get_string('skypeid').':','<a href="callto:'.urlencode($user->skype).'">'.s($user->skype).
|
|
||||||
' <img src="http://mystatus.skype.com/smallicon/'.urlencode($user->skype).'" alt="'.get_string('status').'" '.
|
|
||||||
' /></a>');
|
|
||||||
}
|
|
||||||
if ($user->yahoo && !isset($hiddenfields['yahooid'])) {
|
|
||||||
print_row(get_string('yahooid').':', '<a href="http://edit.yahoo.com/config/send_webmesg?.target='.urlencode($user->yahoo).'&.src=pg">'.s($user->yahoo)." <img src=\"http://opi.yahoo.com/online?u=".urlencode($user->yahoo)."&m=g&t=0\" alt=\"\"></a>");
|
|
||||||
}
|
|
||||||
if ($user->aim && !isset($hiddenfields['aimid'])) {
|
|
||||||
print_row(get_string('aimid').':', '<a href="aim:goim?screenname='.urlencode($user->aim).'">'.s($user->aim).'</a>');
|
|
||||||
}
|
|
||||||
if ($user->msn && !isset($hiddenfields['msnid'])) {
|
|
||||||
print_row(get_string('msnid').':', s($user->msn));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Print the Custom User Fields
|
|
||||||
profile_display_fields($user->id);
|
|
||||||
|
|
||||||
|
|
||||||
if (!isset($hiddenfields['mycourses'])) {
|
if (!isset($hiddenfields['mycourses'])) {
|
||||||
if ($mycourses = get_my_courses($user->id, 'visible DESC,sortorder ASC', null, false, 21)) {
|
if ($mycourses = get_my_courses($user->id, 'visible DESC,sortorder ASC', null, false, 21)) {
|
||||||
$shown=0;
|
$shown = 0;
|
||||||
$courselisting = '';
|
$courselisting = '';
|
||||||
foreach ($mycourses as $mycourse) {
|
foreach ($mycourses as $mycourse) {
|
||||||
if ($mycourse->category) {
|
if ($mycourse->category) {
|
||||||
|
@ -341,86 +266,38 @@ if (!isset($hiddenfields['mycourses'])) {
|
||||||
}
|
}
|
||||||
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}\" $class >"
|
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}\" $class >"
|
||||||
. format_string($mycourse->fullname) . "</a>, ";
|
. format_string($mycourse->fullname) . "</a>, ";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$courselisting .= format_string($mycourse->fullname) . ", ";
|
$courselisting .= format_string($mycourse->fullname) . ", ";
|
||||||
|
$PAGE->navbar->add($mycourse->fullname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$shown++;
|
$shown++;
|
||||||
if($shown==20) {
|
if ($shown >= 20) {
|
||||||
$courselisting.= "...";
|
$courselisting .= "...";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print_row(get_string('courseprofiles').':', rtrim($courselisting,', '));
|
print_row(get_string('courseprofiles').':', rtrim($courselisting,', '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isset($hiddenfields['firstaccess'])) {
|
|
||||||
if ($user->firstaccess) {
|
|
||||||
$datestring = userdate($user->firstaccess)." (".format_time(time() - $user->firstaccess).")";
|
|
||||||
} else {
|
|
||||||
$datestring = get_string("never");
|
|
||||||
}
|
|
||||||
print_row(get_string("firstaccess").":", $datestring);
|
|
||||||
}
|
|
||||||
if (!isset($hiddenfields['lastaccess'])) {
|
|
||||||
if ($user->lastaccess) {
|
|
||||||
$datestring = userdate($user->lastaccess)." (".format_time(time() - $user->lastaccess).")";
|
|
||||||
} else {
|
|
||||||
$datestring = get_string("never");
|
|
||||||
}
|
|
||||||
print_row(get_string("lastaccess").":", $datestring);
|
|
||||||
}
|
|
||||||
/// printing roles
|
|
||||||
|
|
||||||
if ($rolestring = get_user_roles_in_course($id, $course->id)) {
|
|
||||||
print_row(get_string('roles').':', $rolestring);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Printing groups
|
|
||||||
if (!isset($hiddenfields['groups'])) {
|
|
||||||
if ($course->groupmode != SEPARATEGROUPS or has_capability('moodle/site:accessallgroups', $coursecontext)) {
|
|
||||||
if ($usergroups = groups_get_all_groups($course->id, $user->id)) {
|
|
||||||
$groupstr = '';
|
|
||||||
foreach ($usergroups as $group){
|
|
||||||
$groupstr .= ' <a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$group->id.'">'.format_string($group->name).'</a>,';
|
|
||||||
}
|
|
||||||
print_row(get_string("group").":", rtrim($groupstr, ', '));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// End of printing groups
|
|
||||||
|
|
||||||
/// Printing Interests
|
|
||||||
if( !empty($CFG->usetags)) {
|
|
||||||
if ( $interests = tag_get_tags_csv('user', $user->id) ) {
|
|
||||||
print_row(get_string('interests') .": ", $interests);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// End of Printing Interests
|
|
||||||
|
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
|
||||||
$userauth = get_auth_plugin($user->auth);
|
echo '<div class="fullprofilelink">';
|
||||||
|
echo html_writer::link($CFG->wwwroot.'/user/profile.php?id='.$id, get_string('fullprofile'));
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
$passwordchangeurl = false;
|
/// TODO Add more useful overview info for teachers here, see below
|
||||||
if ($currentuser and $userauth->can_change_password() and !isguestuser() and has_capability('moodle/user:changeownpassword', $systemcontext)) {
|
|
||||||
if (!$passwordchangeurl = $userauth->change_password_url()) {
|
|
||||||
if (empty($CFG->loginhttps)) {
|
|
||||||
$passwordchangeurl = "$CFG->wwwroot/login/change_password.php";
|
|
||||||
} else {
|
|
||||||
$passwordchangeurl = str_replace('http:', 'https:', $CFG->wwwroot.'/login/change_password.php');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Buttons gone! TODO: Make sure there's a good way to message someone from the profile pages
|
/// Show links to notes made about this student (must click to display, for privacy)
|
||||||
|
|
||||||
if ($CFG->debugdisplay && debugging('', DEBUG_DEVELOPER) && $currentuser) { // Show user object
|
/// Recent comments made in this course
|
||||||
echo '<br /><br /><hr />';
|
|
||||||
echo $OUTPUT->heading('DEBUG MODE: User session variables');
|
/// Recent blogs associated with this course and items in it
|
||||||
print_object($USER);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
echo '</div>'; // userprofile class
|
||||||
|
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
|
|
||||||
|
|