]> git.mjollnir.org Git - moodle.git/commitdiff
Changes to user settings, now it matches the stored data better
authormartin <martin>
Wed, 5 Jun 2002 05:37:55 +0000 (05:37 +0000)
committermartin <martin>
Wed, 5 Jun 2002 05:37:55 +0000 (05:37 +0000)
lib/db/mysql.sql
lib/weblib.php
user/edit.html
user/edit.php
user/index.php
user/view.php

index b9e023138a42c26b14c858edd68f9057dd9d36a1..195d9fbc9b2dfd075ae20184190fd8f2b94c10fc 100644 (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),
index b21dc31e66052d2b9e8766ed754426c56b364d60..0a695c865210c94f413fb8e31d9ade1d9204d26f 100644 (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) {
index 982e3023181b22bc79761bbe77c137bdc1adf214..0d883d82b431ff033309c246039fc431b7b47935 100644 (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>
index fc48b756a73f9ddc86a00f2dd4baaecd50591333..f35f68948be89e172944f41ce387782b914c3a25 100644 (file)
@@ -1,6 +1,7 @@
 <?PHP // $Id$
 
        require("../config.php");
+       require("../lib/countries.php");
        require("lib.php");
 
     require_variable($id);       // user id
                       -> 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";
 
index b9636f2ae37443ba624b3c52ce86d3de3a151eaa..26df7feb13b81247a647ba043f57ae37ed601bf8 100644 (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>";
index 63903d2edaec7a9d507392c9ab02037dfa824b7f..3735a39c1c238274d98b590ed7805aa481c4abc7 100644 (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) {