Changes to user settings, now it matches the stored data better

This commit is contained in:
martin
2002-06-05 05:37:55 +00:00
parent 02ccf26f34
commit bda8d43a78
6 changed files with 64 additions and 23 deletions
+1
View File
@@ -153,6 +153,7 @@ CREATE TABLE user (
picture tinyint(1) default NULL,
url varchar(255) default NULL,
description text,
mailformat tinyint(1) unsigned NOT NULL default '1',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY username (username),
+6 -4
View File
@@ -170,11 +170,13 @@ function choose_from_menu ($options, $name, $selected="", $nothing="Choose...",
$javascript = "onChange=\"$script\"";
}
echo "<SELECT NAME=$name $javascript>\n";
echo " <OPTION VALUE=\"$nothingvalue\"\n";
if ($nothingvalue == $selected) {
echo " SELECTED";
if ($nothing) {
echo " <OPTION VALUE=\"$nothingvalue\"\n";
if ($nothingvalue == $selected) {
echo " SELECTED";
}
echo ">$nothing</OPTION>\n";
}
echo ">$nothing</OPTION>\n";
foreach ($options as $value => $label) {
echo " <OPTION VALUE=\"$value\"";
if ($value == $selected) {
+42 -17
View File
@@ -1,54 +1,79 @@
<P ALIGN=center>Items marked <B>private</B> will not be made visible to other students</P>
<FORM METHOD="post" ENCTYPE="multipart/form-data" action="edit.php">
<table cellpadding=9 cellspacing=0 >
<tr valign=top>
<td><P>New picture:</td>
<td>
<INPUT type="hidden" name="MAX_FILE_SIZE" value="4000000">
<input type="file" name="imagefile"> ( .jpg or .png ) <? helpbutton("picture") ?>
<input type="file" name="imagefile" size=40> ( .jpg or .png ) <? helpbutton("picture") ?>
<? formerr($err["imagefile"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>Email:</td>
<td><input type="text" name="email" size=25 value="<?=$user->email ?>">
<td><P>Description:</td>
<td><TEXTAREA NAME=description COLS=50 ROWS=10 WRAP=virtual><?=$user->description ?></TEXTAREA>
<? helpbutton("text") ?>
</td>
</tr>
<tr valign=top>
<td><P>Email address:</td>
<td><input type="text" name="email" size=30 value="<?=$user->email ?>">
<? formerr($err["email"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>ICQ Number:</td>
<td><P>Email format:</td>
<td><?
$choices["0"] = "Plain text format";
$choices["1"] = "Pretty HTML format";
choose_from_menu ($choices, "mailformat", $user->mailformat, "") ?>
</td>
</tr>
<tr valign=top>
<td><P>Web address (URL):</td>
<td><input type="text" name="url" size=30 value="<?=$user->url ?>">
<? formerr($err["url"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>ICQ number:</td>
<td><input type="text" name="icq" size=25 value="<?=$user->icq ?>">
<? formerr($err["icq"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>Phone Number 1:</td>
<td><input type="text" name="phone1" size=25 value="<?=$user->phone1 ?>"> (private)
<td><P>ID Number:</td>
<td><input type="text" name="idnumber" size=25 value="<?=$user->idnumber ?>"> (for the <?=$teacher ?> only)
<? formerr($err["idnumber"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>Phone number 1:</td>
<td><input type="text" name="phone1" size=25 value="<?=$user->phone1 ?>"> (for the <?=$teacher ?> only)
<? formerr($err["phone1"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>Phone Number 2:</td>
<td><input type="text" name="phone2" size=25 value="<?=$user->phone2 ?>"> (private)
<td><P>Phone number 2:</td>
<td><input type="text" name="phone2" size=25 value="<?=$user->phone2 ?>"> (for the <?=$teacher ?> only)
<? formerr($err["phone2"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>Address:</td>
<td><input type="text" name="address" size=25 value="<?=$user->address ?>"> (private)
<td><P>Street Address:</td>
<td><input type="text" name="address" size=25 value="<?=$user->address ?>"> (for the <?=$teacher ?> only)
<? formerr($err["address"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>Web Address:</td>
<td><input type="text" name="url" size=25 value="<?=$user->url ?>">
<? formerr($err["url"]) ?>
<td><P>City/town:</td>
<td><input type="text" name="city" size=25 value="<?=$user->city ?>">
<? formerr($err["city"]) ?>
</td>
</tr>
<tr valign=top>
<td><P>Description:</td>
<td><TEXTAREA NAME=description COLS=50 ROWS=10 WRAP=virtual><?=$user->description ?></TEXTAREA>
<td><P>Country:</td>
<td><? choose_from_menu ($COUNTRIES, "country", $user->country, "Select a country...", "", "") ?>
<? formerr($err["country"]) ?>
</td>
</tr>
<tr valign=top>
+9
View File
@@ -1,6 +1,7 @@
<?PHP // $Id$
require("../config.php");
require("../lib/countries.php");
require("lib.php");
require_variable($id); // user id
@@ -130,6 +131,8 @@
-> Edit profile", "");
}
$teacher = strtolower($course->teacher);
print_simple_box_start("center", "", "$THEME->cellheading");
echo "<H2>User profile for $user->firstname $user->lastname</H2>";
include("edit.html");
@@ -147,6 +150,12 @@ function find_form_errors(&$user, &$usernew, &$err) {
if (empty($usernew->email))
$err["email"] = "Missing email address";
if (empty($usernew->city))
$err["city"] = "Missing city or town";
if (empty($usernew->country))
$err["country"] = "Missing country";
else if (! validate_email($usernew->email))
$err["email"] = "Invalid email address, check carefully";
+4 -1
View File
@@ -3,6 +3,7 @@
// Lists all the users within a given course
require("../config.php");
require("../lib/countries.php");
require("lib.php");
require_variable($id); //course
@@ -54,6 +55,8 @@
/// FUNCTIONS //////////////////
function print_user($user, $course, $teacherlinks) {
global $COUNTRIES;
echo "<TABLE WIDTH=80% ALIGN=CENTER BORDER=0 CELLPADDING=1 CELLSPACING=1><TR><TD BGCOLOR=#888888>";
echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR>";
@@ -69,7 +72,7 @@ function print_user($user, $course, $teacherlinks) {
echo "<FONT SIZE=-1>";
echo "<FONT SIZE=3><B>$user->firstname $user->lastname</B></FONT>";
echo "<P>Email: <A HREF=\"mailto:$user->email\">$user->email</A><BR>";
echo "Location: $user->city, $user->country<BR>";
echo "Location: $user->city, ".$COUNTRIES["$user->country"]."<BR>";
echo "Last access: ".userdate($user->lastaccess);
echo "&nbsp (".format_time(time() - $user->lastaccess).")";
echo "</TD><TD VALIGN=bottom BGCOLOR=#FFFFFF NOWRAP>";
+2 -1
View File
@@ -3,6 +3,7 @@
// Display profile for a particular user
require("../config.php");
require("../lib/countries.php");
require("lib.php");
require_variable($id);
@@ -78,7 +79,7 @@
echo "<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=2";
print_row("Location:", "$user->city, $user->country");
print_row("Location:", "$user->city, ".$COUNTRIES["$user->country"]);
if (isteacher($course->id)) {
if ($user->address) {