Functions for options pages. Must be used if you want to display an
[squirrelmail.git] / functions / options.php
1 <?php
2 /**
3 ** options.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Functions needed to display the options pages.
9 **
10 ** $Id$
11 **/
12
13 function OptionSelect( $title, $name, $data, $default, $show = '', $store = '' ) {
14
15 echo "<tr><td align=right valign=middle nowrap>$title</td><td>" .
16 "<select name=\"$name\">";
17 foreach( $data as $key => $opt ) {
18 if ( $store == '' ) {
19 $vl = $key;
20 } else{
21 $vl = $opt[$store];
22 }
23 if ( $show == '' ) {
24 $nm = $opt;
25 } else{
26 $nm = $opt[$show];
27 }
28 if ( $nm <> '') {
29 echo "<option value=\"$vl\"";
30 if( $vl == $default ) {
31 echo ' selected';
32 }
33 echo ">$nm</option>\n";
34 }
35 }
36 echo "</select></td></tr>\n";
37
38 }
39
40 function OptionRadio( $title, $name, $data, $default, $show = '', $store = '', $sep = '&nbsp; &nbsp;' ) {
41
42 echo "<tr><td align=right valign=middle nowrap>$title</td><td>";
43 foreach( $data as $key => $opt ) {
44 if ( $store == '' ) {
45 $vl = $key;
46 } else{
47 $vl = $opt[$store];
48 }
49 if ( $show == '' ) {
50 $nm = $opt;
51 } else{
52 $nm = $opt[$show];
53 }
54 if ( $nm <> '') {
55 echo "<input type=\"radio\" name=\"$name\" value=\"$vl\"";
56 if( $vl == $default ) {
57 echo ' checked';
58 }
59 echo ">$nm $sep\n";
60 }
61 }
62 echo "</td></tr>\n";
63
64 }
65
66 function OptionText( $title, $name, $value, $size ) {
67
68 echo "<tr><td align=right valign=middle nowrap>$title</td><td>" .
69 "<input name=\"$name\" value=\"$value\" size=\"$size\">" .
70 "</td></tr>\n";
71
72 }
73
74 function OptionCheck( $title, $name, $value, $comment ) {
75
76 if ( $value )
77 $chk = 'checked';
78 echo "<tr><td align=right valign=middle nowrap>$title</td><td>" .
79 "<input type=\"checkbox\" name=\"$name\" $chk> $comment" .
80 "</td></tr>\n";
81
82 }
83
84 ?>