2009-09-25 04:02:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display profile for a particular user
|
|
|
|
*
|
|
|
|
* @copyright 1999 Martin Dougiamas http://dougiamas.com
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
* @package user
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once("../config.php");
|
|
|
|
require_once($CFG->dirroot.'/user/profile/lib.php');
|
|
|
|
require_once($CFG->dirroot.'/tag/lib.php');
|
|
|
|
|
2010-03-31 07:41:31 +00:00
|
|
|
$id = optional_param('id', 0, PARAM_INT); // user id
|
|
|
|
$courseid = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site)
|
|
|
|
$enable = optional_param('enable', 0, PARAM_BOOL); // enable email
|
|
|
|
$disable = optional_param('disable', 0, PARAM_BOOL); // disable email
|
2009-09-25 04:02:46 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
if (empty($id)) { // See your own profile by default
|
2009-09-25 04:02:46 +00:00
|
|
|
require_login();
|
|
|
|
$id = $USER->id;
|
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
if ($courseid == SITEID) { // Since Moodle 2.0 all site-level profiles are shown by profile.php
|
|
|
|
redirect($CFG->wwwroot.'/user/profile.php?id='.$id); // Immediate redirect
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2010-05-04 13:04:35 +00:00
|
|
|
|
|
|
|
$url = new moodle_url('/user/view.php', array('id'=>$id,'course'=>$courseid));
|
2009-09-25 04:02:46 +00:00
|
|
|
$PAGE->set_url($url);
|
2004-09-25 12:53:35 +00:00
|
|
|
|
2010-03-31 07:41:31 +00:00
|
|
|
$user = $DB->get_record('user', array('id'=>$id), '*', MUST_EXIST);
|
|
|
|
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
2010-05-04 13:04:35 +00:00
|
|
|
$currentuser = ($user->id == $USER->id);
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
2010-05-04 13:04:35 +00:00
|
|
|
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
|
|
|
$usercontext = get_context_instance(CONTEXT_USER, $user->id, MUST_EXIST);
|
2009-05-25 21:46:28 +00:00
|
|
|
|
2010-03-31 07:41:31 +00:00
|
|
|
// Require login first
|
|
|
|
if (isguestuser($user)) {
|
|
|
|
// can not view profile of guest - thre is nothing to see there
|
|
|
|
print_error('invaliduserid');
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2006-10-01 05:26:38 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
$PAGE->set_context($coursecontext);
|
2010-08-27 01:44:25 +00:00
|
|
|
$PAGE->set_course($course);
|
2010-05-16 08:21:12 +00:00
|
|
|
$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
|
2010-05-04 13:04:35 +00:00
|
|
|
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
|
2009-07-20 06:09:27 +00:00
|
|
|
|
2010-03-31 07:41:31 +00:00
|
|
|
$isparent = false;
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
if (!$currentuser
|
2010-03-31 07:41:31 +00:00
|
|
|
and $DB->record_exists('role_assignments', array('userid'=>$USER->id, 'contextid'=>$usercontext->id))
|
|
|
|
and has_capability('moodle/user:viewdetails', $usercontext)) {
|
|
|
|
// TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in,
|
|
|
|
// this way they may access the profile where they get overview of grades and child activity in course,
|
|
|
|
// please note this is just a guess!
|
2009-09-25 04:02:46 +00:00
|
|
|
require_login();
|
2010-03-31 07:41:31 +00:00
|
|
|
$isparent = true;
|
|
|
|
} else {
|
|
|
|
// normal course
|
|
|
|
require_login($course);
|
|
|
|
// what to do with users temporary accessing this course? shoudl they see the details?
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
$strpersonalprofile = get_string('personalprofile');
|
|
|
|
$strparticipants = get_string("participants");
|
|
|
|
$struser = get_string("user");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $coursecontext));
|
2003-10-27 14:15:05 +00:00
|
|
|
|
2010-03-31 07:41:31 +00:00
|
|
|
/// Now test the actual capabilities and enrolment in course
|
|
|
|
if ($currentuser) {
|
|
|
|
// me
|
2010-05-04 13:04:35 +00:00
|
|
|
if (!is_enrolled($coursecontext) and !is_viewing($coursecontext)) { // Need to have full access to a course to see the rest of own info
|
2010-03-31 07:41:31 +00:00
|
|
|
echo $OUTPUT->header();
|
|
|
|
echo $OUTPUT->heading(get_string('notenrolled', '', $fullname));
|
|
|
|
if (!empty($_SERVER['HTTP_REFERER'])) {
|
|
|
|
echo $OUTPUT->continue_button($_SERVER['HTTP_REFERER']);
|
|
|
|
}
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
die;
|
|
|
|
}
|
2009-09-02 08:36:16 +00:00
|
|
|
|
2010-03-31 07:41:31 +00:00
|
|
|
} else {
|
|
|
|
// somebody else
|
2009-09-25 04:02:46 +00:00
|
|
|
$PAGE->set_title("$strpersonalprofile: ");
|
|
|
|
$PAGE->set_heading("$strpersonalprofile: ");
|
2009-09-02 08:36:16 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
// check course level capabilities
|
|
|
|
if (!has_capability('moodle/user:viewdetails', $coursecontext) && // normal enrolled user or mnager
|
|
|
|
!has_capability('moodle/user:viewdetails', $usercontext)) { // usually parent
|
|
|
|
print_error('cannotviewprofile');
|
|
|
|
}
|
2010-03-31 07:41:31 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
if (!is_enrolled($coursecontext, $user->id)) {
|
|
|
|
// TODO: the only potential problem is that managers and inspectors might post in forum, but the link
|
|
|
|
// to profile would not work - maybe a new capability - moodle/user:freely_acessile_profile_for_anybody
|
|
|
|
// or test for course:inspect capability
|
|
|
|
if (has_capability('moodle/role:assign', $coursecontext)) {
|
|
|
|
$PAGE->navbar->add($fullname);
|
|
|
|
echo $OUTPUT->header();
|
|
|
|
echo $OUTPUT->heading(get_string('notenrolled', '', $fullname));
|
|
|
|
} else {
|
|
|
|
echo $OUTPUT->header();
|
|
|
|
$PAGE->navbar->add($struser);
|
|
|
|
echo $OUTPUT->heading(get_string('notenrolledprofile'));
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2010-05-04 13:04:35 +00:00
|
|
|
if (!empty($_SERVER['HTTP_REFERER'])) {
|
|
|
|
echo $OUTPUT->continue_button($_SERVER['HTTP_REFERER']);
|
2005-11-08 07:19:27 +00:00
|
|
|
}
|
2010-05-04 13:04:35 +00:00
|
|
|
echo $OUTPUT->footer();
|
|
|
|
exit;
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2006-10-29 04:21:23 +00:00
|
|
|
|
2010-03-31 07:41:31 +00:00
|
|
|
// If groups are in use and enforced throughout the course, then make sure we can meet in at least one course level group
|
|
|
|
if (groups_get_course_groupmode($course) == SEPARATEGROUPS and $course->groupmodeforce
|
|
|
|
and !has_capability('moodle/site:accessallgroups', $coursecontext) and !has_capability('moodle/site:accessallgroups', $coursecontext, $user->id)) {
|
|
|
|
if (!isloggedin() or isguestuser()) {
|
|
|
|
// do not use require_login() here because we might have already used require_login($course)
|
|
|
|
redirect(get_login_url());
|
|
|
|
}
|
|
|
|
$mygroups = array_keys(groups_get_all_groups($course->id, $USER->id, $course->defaultgroupingid, 'g.id, g.name'));
|
|
|
|
$usergroups = array_keys(groups_get_all_groups($course->id, $user->id, $course->defaultgroupingid, 'g.id, g.name'));
|
|
|
|
if (!array_intersect($mygroups, $usergroups)) {
|
2009-09-25 04:02:46 +00:00
|
|
|
print_error("groupnotamember", '', "../course/view.php?id=$course->id");
|
2004-03-09 23:07:35 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2004-08-12 06:57:53 +00:00
|
|
|
|
2006-10-01 05:26:38 +00:00
|
|
|
/// We've established they can see the user's name at least, so what about the rest?
|
|
|
|
|
2010-05-17 05:38:59 +00:00
|
|
|
if (!$currentuser) {
|
|
|
|
$PAGE->navigation->extend_for_user($user);
|
2010-06-10 07:29:02 +00:00
|
|
|
if ($node = $PAGE->settingsnav->get('userviewingsettings'.$user->id)) {
|
2010-05-17 05:38:59 +00:00
|
|
|
$node->forceopen = true;
|
|
|
|
}
|
|
|
|
} else if ($node = $PAGE->settingsnav->get('usercurrentsettings', navigation_node::TYPE_CONTAINER)) {
|
|
|
|
$node->forceopen = true;
|
|
|
|
}
|
|
|
|
if ($node = $PAGE->settingsnav->get('courseadmin')) {
|
|
|
|
$node->forceopen = false;
|
|
|
|
}
|
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
$PAGE->set_title("$course->fullname: $strpersonalprofile: $fullname");
|
|
|
|
$PAGE->set_heading($course->fullname);
|
2010-01-18 05:00:17 +00:00
|
|
|
$PAGE->set_pagelayout('standard');
|
2009-09-25 04:02:46 +00:00
|
|
|
echo $OUTPUT->header();
|
2010-05-16 08:21:12 +00:00
|
|
|
|
|
|
|
echo '<div class="userprofile">';
|
|
|
|
|
|
|
|
echo $OUTPUT->heading(fullname($user).' ('.$course->shortname.')');
|
2004-03-13 15:22:33 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
if ($user->deleted) {
|
|
|
|
echo $OUTPUT->heading(get_string('userdeleted'));
|
|
|
|
if (!has_capability('moodle/user:update', $coursecontext)) {
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
die;
|
2002-09-22 03:01:17 +00:00
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2002-09-22 03:01:17 +00:00
|
|
|
|
2006-10-01 05:26:38 +00:00
|
|
|
/// OK, security out the way, now we are showing the user
|
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
add_to_log($course->id, "user", "view", "view.php?id=$user->id&course=$course->id", "$user->id");
|
2006-10-01 05:26:38 +00:00
|
|
|
|
2006-09-15 15:04:38 +00:00
|
|
|
/// Get the hidden field list
|
2009-09-25 04:02:46 +00:00
|
|
|
if (has_capability('moodle/user:viewhiddendetails', $coursecontext)) {
|
|
|
|
$hiddenfields = array();
|
|
|
|
} else {
|
|
|
|
$hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
|
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
if (is_mnet_remote_user($user)) {
|
2010-07-01 12:56:31 +00:00
|
|
|
$sql = "SELECT h.id, h.name, h.wwwroot,
|
|
|
|
a.name as application, a.display_name
|
|
|
|
FROM {mnet_host} h, {mnet_application} a
|
|
|
|
WHERE h.id = ? AND h.applicationid = a.id";
|
2008-05-31 11:13:21 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
$remotehost = $DB->get_record_sql($sql, array($user->mnethostid));
|
2010-07-01 12:56:31 +00:00
|
|
|
$a = new stdclass();
|
|
|
|
$a->remotetype = $remotehost->display_name;
|
|
|
|
$a->remotename = $remotehost->name;
|
|
|
|
$a->remoteurl = $remotehost->wwwroot;
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2010-07-01 12:56:31 +00:00
|
|
|
echo $OUTPUT->box(get_string('remoteuserinfo', 'mnet', $a), 'remoteuserinfo');
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2007-01-04 03:01:30 +00:00
|
|
|
|
2010-06-30 22:55:07 +00:00
|
|
|
echo '<div class="userprofilebox clearfix"><div class="profilepicture">';
|
2010-05-04 13:04:35 +00:00
|
|
|
echo $OUTPUT->user_picture($user, array('size'=>100));
|
|
|
|
echo '</div>';
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
// Print the description
|
2010-06-30 22:55:07 +00:00
|
|
|
echo '<div class="descriptionbox"><div class="description">';
|
2009-09-25 04:02:46 +00:00
|
|
|
if ($user->description && !isset($hiddenfields['description'])) {
|
2010-05-04 13:04:35 +00:00
|
|
|
if (!empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid'=>$id))) {
|
2010-05-16 08:21:12 +00:00
|
|
|
echo get_string('profilenotshown', 'moodle');
|
2009-09-25 04:02:46 +00:00
|
|
|
} else {
|
2010-07-03 13:37:13 +00:00
|
|
|
if ($courseid == SITEID) {
|
|
|
|
$user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $usercontext->id, 'user', 'profile', null);
|
|
|
|
} else {
|
|
|
|
// we have to make a little detour thought the course context to verify the access control for course profile
|
|
|
|
$user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $coursecontext->id, 'user', 'profile', $user->id);
|
|
|
|
}
|
2010-05-16 08:21:12 +00:00
|
|
|
echo format_text($user->description, $user->descriptionformat);
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2010-05-04 13:04:35 +00:00
|
|
|
echo '</div>';
|
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
// Print all the little details in a list
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-05-04 13:04:35 +00:00
|
|
|
echo '<table class="list" summary="">';
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
// Show last time this user accessed this course
|
|
|
|
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");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
2010-05-16 08:21:12 +00:00
|
|
|
print_row(get_string("lastaccess").":", $datestring);
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
// Show roles in this course
|
|
|
|
if ($rolestring = get_user_roles_in_course($id, $course->id)) {
|
|
|
|
print_row(get_string('roles').':', $rolestring);
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2005-03-05 05:57:10 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
// Show groups this user is in
|
|
|
|
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, ', '));
|
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
// Show other courses they may be in
|
2009-09-25 04:02:46 +00:00
|
|
|
if (!isset($hiddenfields['mycourses'])) {
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
if ($mycourses = enrol_get_users_courses($user->id, true, NULL, 'visible DESC,sortorder ASC')) {
|
2010-05-16 08:21:12 +00:00
|
|
|
$shown = 0;
|
2009-09-25 04:02:46 +00:00
|
|
|
$courselisting = '';
|
|
|
|
foreach ($mycourses as $mycourse) {
|
|
|
|
if ($mycourse->category) {
|
|
|
|
if ($mycourse->id != $course->id){
|
|
|
|
$class = '';
|
|
|
|
if ($mycourse->visible == 0) {
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
$ccontext = get_context_instance(CONTEXT_COURSE, $mycourse->id);
|
|
|
|
if (!has_capability('moodle/course:viewhiddencourses', $ccontext)) {
|
|
|
|
continue;
|
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
$class = 'class="dimmed"';
|
2007-09-19 07:21:47 +00:00
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}\" $class >"
|
|
|
|
. format_string($mycourse->fullname) . "</a>, ";
|
2010-05-16 08:21:12 +00:00
|
|
|
} else {
|
2009-09-25 04:02:46 +00:00
|
|
|
$courselisting .= format_string($mycourse->fullname) . ", ";
|
2010-05-16 08:21:12 +00:00
|
|
|
$PAGE->navbar->add($mycourse->fullname);
|
2003-11-19 07:55:00 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
$shown++;
|
2010-05-16 08:21:12 +00:00
|
|
|
if ($shown >= 20) {
|
|
|
|
$courselisting .= "...";
|
2009-09-25 04:02:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-11-19 07:55:00 +00:00
|
|
|
}
|
2010-05-04 13:04:35 +00:00
|
|
|
print_row(get_string('courseprofiles').':', rtrim($courselisting,', '));
|
2003-11-19 07:55:00 +00:00
|
|
|
}
|
2009-09-25 04:02:46 +00:00
|
|
|
}
|
2009-08-20 08:50:22 +00:00
|
|
|
|
2010-06-30 22:55:07 +00:00
|
|
|
echo "</table></div></div>";
|
2005-11-08 07:19:27 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
echo '<div class="fullprofilelink">';
|
|
|
|
echo html_writer::link($CFG->wwwroot.'/user/profile.php?id='.$id, get_string('fullprofile'));
|
|
|
|
echo '</div>';
|
2005-11-08 07:19:27 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
/// TODO Add more useful overview info for teachers here, see below
|
2007-07-31 08:09:46 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
/// Show links to notes made about this student (must click to display, for privacy)
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
/// Recent comments made in this course
|
2007-02-21 21:53:28 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
/// Recent blogs associated with this course and items in it
|
2002-11-28 12:31:46 +00:00
|
|
|
|
2007-01-23 02:14:29 +00:00
|
|
|
|
2010-05-16 08:21:12 +00:00
|
|
|
|
|
|
|
echo '</div>'; // userprofile class
|
2007-01-23 02:14:29 +00:00
|
|
|
|
2009-09-25 04:02:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
/// Functions ///////
|
|
|
|
|
|
|
|
function print_row($left, $right) {
|
2007-01-06 14:07:00 +00:00
|
|
|
echo "\n<tr><td class=\"label c0\">$left</td><td class=\"info c1\">$right</td></tr>\n";
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 08:11:02 +00:00
|
|
|
|