2001-11-22 06:23:56 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
|
|
// Display profile for a particular user
|
|
|
|
|
|
|
|
require("../config.php");
|
2002-06-05 05:37:55 +00:00
|
|
|
require("../lib/countries.php");
|
2002-07-31 14:19:35 +00:00
|
|
|
require("../mod/forum/lib.php");
|
2001-11-22 06:23:56 +00:00
|
|
|
require("lib.php");
|
|
|
|
|
|
|
|
require_variable($id);
|
|
|
|
require_variable($course);
|
|
|
|
|
|
|
|
|
|
|
|
if (! $user = get_record("user", "id", $id) ) {
|
|
|
|
error("No such user in this course");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $course) ) {
|
|
|
|
error("No such course id");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($course->category) {
|
|
|
|
require_login($course->id);
|
|
|
|
}
|
|
|
|
|
2002-05-31 09:15:36 +00:00
|
|
|
add_to_log($course->id, "user", "view", "view.php?id=$user->id&course=$course->id", "$user->id");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-07-04 07:52:06 +00:00
|
|
|
$fullname = "$user->firstname $user->lastname";
|
|
|
|
$personalprofile = get_string("personalprofile");
|
|
|
|
$participants = get_string("participants");
|
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
if ($course->category) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_header("$personalprofile: $fullname", "$personalprofile: $fullname",
|
2001-11-22 06:23:56 +00:00
|
|
|
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> ->
|
2002-07-04 07:52:06 +00:00
|
|
|
<A HREF=\"index.php?id=$course->id\">$participants</A> -> $fullname", "");
|
2001-11-22 06:23:56 +00:00
|
|
|
} else {
|
2002-08-08 16:02:39 +00:00
|
|
|
print_header("$course->fullname: $personalprofile: $fullname", "$course->fullname", "$fullname", "");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2002-06-10 04:33:46 +00:00
|
|
|
if ($course->category and ! isguest() ) {
|
2002-06-10 03:49:28 +00:00
|
|
|
if (!isstudent($course->id, $user->id) && !isteacher($course->id, $user->id)) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_heading(get_string("notenrolled", "", $fullname));
|
2002-06-10 03:49:28 +00:00
|
|
|
print_footer($course);
|
|
|
|
die;
|
|
|
|
}
|
2002-06-04 06:49:52 +00:00
|
|
|
}
|
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
echo "<TABLE WIDTH=80% ALIGN=CENTER BORDER=0 CELLPADDING=1 CELLSPACING=1><TR><TD BGCOLOR=#888888>";
|
|
|
|
echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=3 CELLSPACING=0><TR>";
|
|
|
|
echo "<TD WIDTH=100 BGCOLOR=\"$THEME->body\" VALIGN=top>";
|
2002-08-09 09:25:17 +00:00
|
|
|
print_user_picture($user->id, $course->id, $user->picture, true);
|
2001-11-22 06:23:56 +00:00
|
|
|
echo "</TD><TD WIDTH=100% BGCOLOR=#FFFFFF>";
|
|
|
|
|
|
|
|
|
|
|
|
// Print name and edit button across top
|
|
|
|
|
|
|
|
echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD NOWRAP>";
|
2002-07-04 07:52:06 +00:00
|
|
|
echo "<H3>$fullname</H3>";
|
2001-11-22 06:23:56 +00:00
|
|
|
echo "</TD><TD align=right>";
|
2002-08-08 17:30:50 +00:00
|
|
|
if (($id == $USER->id and !isguest()) or isadmin()) {
|
2001-11-22 06:23:56 +00:00
|
|
|
echo "<P><FORM ACTION=edit.php METHOD=GET>";
|
|
|
|
echo "<INPUT type=hidden name=id value=\"$id\">";
|
|
|
|
echo "<INPUT type=hidden name=course value=\"$course->id\">";
|
2002-07-04 07:52:06 +00:00
|
|
|
echo "<INPUT type=submit value=\"".get_string("editmyprofile")."\">";
|
2001-11-22 06:23:56 +00:00
|
|
|
echo "</FORM></P>";
|
|
|
|
}
|
|
|
|
echo "</TD></TR></TABLE>";
|
|
|
|
|
|
|
|
|
|
|
|
// Print the description
|
|
|
|
|
|
|
|
if ($user->description) {
|
|
|
|
echo "<P>".text_to_html($user->description)."</P><HR>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Print all the little details in a list
|
|
|
|
|
|
|
|
echo "<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=2";
|
|
|
|
|
2002-06-10 04:33:46 +00:00
|
|
|
if ($user->city or $user->country) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_row(get_string("location").":", "$user->city, ".$COUNTRIES["$user->country"]);
|
2002-06-10 04:33:46 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
if (isteacher($course->id)) {
|
|
|
|
if ($user->address) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_row(get_string("address").":", "$user->address");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
if ($user->phone1) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_row(get_string("phone").":", "$user->phone1");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
if ($user->phone2) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_row(get_string("phone").":", "$user->phone2");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-21 13:29:25 +00:00
|
|
|
if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
|
|
|
|
print_row(get_string("email").":", "<A HREF=\"mailto:$user->email\">$user->email</A>");
|
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
if ($user->url) {
|
2002-07-04 07:52:06 +00:00
|
|
|
print_row(get_string("webpage").":", "<A HREF=\"$user->url\">$user->url</A>");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($user->icq) {
|
|
|
|
print_row("ICQ:","<A HREF=\"http://wwp.icq.com/$user->icq\">$user->icq <IMG SRC=\"http://online.mirabilis.com/scripts/online.dll?icq=$user->icq&img=5\" WIDTH=18 HEIGHT=18 BORDER=0></A>");
|
|
|
|
}
|
|
|
|
|
2002-09-06 15:10:36 +00:00
|
|
|
if ($user->lastaccess) {
|
|
|
|
$datestring = userdate($user->lastaccess)."  (".format_time(time() - $user->lastaccess).")";
|
|
|
|
} else {
|
|
|
|
$datestring = "-";
|
|
|
|
}
|
2002-07-04 07:52:06 +00:00
|
|
|
print_row(get_string("lastaccess").":", $datestring);
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
echo "</TABLE>";
|
|
|
|
|
|
|
|
echo "</TD></TR></TABLE></TABLE>";
|
|
|
|
|
2002-06-04 06:29:36 +00:00
|
|
|
// Print other functions
|
2002-07-27 10:23:45 +00:00
|
|
|
echo "<CENTER><TABLE ALIGN=CENTER><TR>";
|
2002-08-10 15:16:00 +00:00
|
|
|
if ((isstudent($course->id) and ($user->id == $USER->id)) or
|
|
|
|
(isteacher($course->id) and isstudent($course->id, $user->id)) ) {
|
2002-06-04 06:35:36 +00:00
|
|
|
echo "<TD NOWRAP><P><FORM ACTION=\"../course/unenrol.php\" METHOD=GET>";
|
|
|
|
echo "<INPUT type=hidden name=id value=\"$course->id\">";
|
2002-07-27 10:23:45 +00:00
|
|
|
echo "<INPUT type=hidden name=user value=\"$user->id\">";
|
2002-07-04 07:52:06 +00:00
|
|
|
echo "<INPUT type=submit value=\"".get_string("unenrolme", "", $course->shortname)."\">";
|
2002-06-04 06:35:36 +00:00
|
|
|
echo "</FORM></P></TD>";
|
|
|
|
}
|
2002-07-27 10:23:45 +00:00
|
|
|
if (isteacher($course->id)) {
|
|
|
|
echo "<TD NOWRAP><P><FORM ACTION=\"../course/user.php\" METHOD=GET>";
|
|
|
|
echo "<INPUT type=hidden name=id value=\"$course->id\">";
|
|
|
|
echo "<INPUT type=hidden name=user value=\"$user->id\">";
|
|
|
|
echo "<INPUT type=submit value=\"".get_string("activityreport")."\">";
|
|
|
|
echo "</FORM></P></TD>";
|
2002-08-15 05:43:38 +00:00
|
|
|
if ($user->id != $USER->id) {
|
|
|
|
echo "<TD NOWRAP><P><FORM ACTION=\"../course/loginas.php\" METHOD=GET>";
|
|
|
|
echo "<INPUT type=hidden name=id value=\"$course->id\">";
|
|
|
|
echo "<INPUT type=hidden name=user value=\"$user->id\">";
|
|
|
|
echo "<INPUT type=submit value=\"".get_string("loginas")."\">";
|
|
|
|
echo "</FORM></P></TD>";
|
|
|
|
}
|
2002-07-27 10:23:45 +00:00
|
|
|
}
|
|
|
|
echo "</TR></TABLE></CENTER>\n";
|
2002-06-04 06:29:36 +00:00
|
|
|
|
2002-08-01 03:50:27 +00:00
|
|
|
forum_print_user_discussions($course->id, $user->id);
|
2002-06-25 16:42:00 +00:00
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
print_footer($course);
|
|
|
|
|
|
|
|
/// Functions ///////
|
|
|
|
|
|
|
|
function print_row($left, $right) {
|
|
|
|
echo "<TR><TD NOWRAP ALIGN=right><P>$left</TD><TD align=left><P>$right</P></TD></TR>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|