Improved interface for course/teachers.php ... instead of typing numbers

into a box there is now a menu for each user.   Much better!
This commit is contained in:
martin 2002-09-19 14:51:49 +00:00
parent ae7aafeb53
commit 08056730fa
4 changed files with 30 additions and 17 deletions

View File

@ -61,17 +61,23 @@
$table->align = array ("RIGHT", "LEFT", "CENTER", "CENTER");
$table->size = array ("35", "", "", "");
$option[0] = get_string("hide");
for ($i=1; $i<=8; $i++) {
$option[$i] = $i;
}
echo "<FORM ACTION=teachers.php METHOD=post>";
foreach ($teachers as $teacher) {
$picture = print_user_picture($teacher->id, $course->id, $teacher->picture, false, true);
$authority = choose_from_menu ($option, "a$teacher->id", $teacher->authority, "", "", "", true);
if (!$teacher->role) {
$teacher->role = $course->teacher;
}
$table->data[] = array ($picture, "$teacher->firstname $teacher->lastname",
"<INPUT TYPE=text NAME=\"a$teacher->id\" VALUE=\"$teacher->authority\" SIZE=2>",
$table->data[] = array ($picture, "$teacher->firstname $teacher->lastname", $authority,
"<INPUT TYPE=text NAME=\"r$teacher->id\" VALUE=\"$teacher->role\" SIZE=30>");
}
print_table($table);

View File

@ -11,12 +11,12 @@
(the one you set in the Course Settings page).
<P>You can also order this list (to put the main teacher at the
top, for example). Simply put a numbers in each box such
as 1, 2, 3 etc. After pressing "Save changes" you will
top, for example). Simply select numbers from the menus
in the "Order" column. After pressing "Save changes" you will
see the new order.
<P><B>NOTE:</B> A special case occurs if you use the number
0 (zero) for a teacher. In this case, the teacher will
<P><B>NOTE:</B> A special case occurs if you use select "Hide"
for a teacher. In this case, the teacher will
NOT BE SHOWN on the course listings or the list of
participants. They will be "invisible" to students
participants. They will be "hidden" from students
(unless they post messages to the forums etc)

View File

@ -189,6 +189,7 @@ $string[helphtml] = "How to write html";
$string[helppicture] = "How to upload a picture";
$string[helptext] = "How to write text";
$string[helpquestions] = "How to ask questions";
$string[hide] = "Hide";
$string[home] = "Home";
$string[htmlformat] = "Pretty HTML format";
$string[icqnumber] = "ICQ number";

View File

@ -145,7 +145,7 @@ function close_window_button() {
}
function choose_from_menu ($options, $name, $selected="", $nothing="choose", $script="", $nothingvalue="0") {
function choose_from_menu ($options, $name, $selected="", $nothing="choose", $script="", $nothingvalue="0", $return=false) {
// $options["value"]["label"]
if ($nothing == "choose") {
@ -155,26 +155,32 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc
if ($script) {
$javascript = "onChange=\"$script\"";
}
echo "<SELECT NAME=$name $javascript>\n";
$output = "<SELECT NAME=$name $javascript>\n";
if ($nothing) {
echo " <OPTION VALUE=\"$nothingvalue\"\n";
$output .= " <OPTION VALUE=\"$nothingvalue\"\n";
if ($nothingvalue == $selected) {
echo " SELECTED";
$output .= " SELECTED";
}
echo ">$nothing</OPTION>\n";
$output .= ">$nothing</OPTION>\n";
}
foreach ($options as $value => $label) {
echo " <OPTION VALUE=\"$value\"";
$output .= " <OPTION VALUE=\"$value\"";
if ($value == $selected) {
echo " SELECTED";
$output .= " SELECTED";
}
if ($label) {
echo ">$label</OPTION>\n";
$output .= ">$label</OPTION>\n";
} else {
echo ">$value</OPTION>\n";
$output .= ">$value</OPTION>\n";
}
}
echo "</SELECT>\n";
$output .= "</SELECT>\n";
if ($return) {
return $output;
} else {
echo $output;
}
}
function popup_form ($common, $options, $formname, $selected="", $nothing="choose") {