default cellpadding set to 2. Looks better in both IE and FireFox.
[fa-stable.git] / includes / ui / ui_controls.inc
1 <?php
2
3 //---------------------------------------------------------------------------------
4
5 function start_form($multi=false, $sid=false, $action="", $name="")
6 {
7         if ($name != "")
8                 $name = "name='$name'";
9         if ($action == "")
10                 $action = $_SERVER['PHP_SELF'];
11         if ($sid)
12         {
13                 if (strpos($action, "?"))
14                         $action .= "&" . SID;
15                 else    
16                         $action .= "?" . SID;
17         }               
18         if ($multi)
19                 echo "<form enctype='multipart/form-data' method='post' action='$action' $name>\n";     
20         else
21                 echo "<form method='post' action='$action' $name>\n";   
22 }
23
24 //---------------------------------------------------------------------------------
25
26 function end_form($breaks=0)
27 {
28         if ($breaks)
29                 br($breaks);
30         echo "</form>\n";
31 }
32
33 function start_table($extra="", $padding='2', $spacing='0')
34 {
35         echo "<center><table";
36         if ($extra != "")
37                 echo " $extra";
38         echo " cellpadding=$padding cellspacing=$spacing>\n";
39 }       
40
41 function end_table($breaks=0)
42 {
43         echo "</table></center>\n";
44         if ($breaks)
45                 br($breaks);
46 }
47
48 function meta_forward($forward_to, $params="")
49 {
50         echo "<meta http-equiv='Refresh' content='0; url=$forward_to?$params'>\n";
51         echo "<center><br>" . _("You should automatically be forwarded.");
52         echo " " . _("If this does not happen") . " " . "<a href='$forward_to'>" . _("click here") . "</a> " . _("to continue") . ".<br><br>\n";
53         exit;
54 }
55
56 //-----------------------------------------------------------------------------------
57
58 function hyperlink_back($center=true)
59 {
60         echo  get_js_go_back();
61
62         if ($center)
63                 echo "<center>";
64         echo "<a href='javascript:goBack();'>"._("Back")."</a>\n";
65         if ($center)
66                 echo "</center>";
67         echo "<br>";    
68 }
69
70 function hyperlink_no_params($target, $label, $center=true)
71 {
72         if ($center)
73                 echo "<br><center>";
74         echo "<a href='$target?=" . SID . "'>$label</a>\n";
75         if ($center)
76                 echo "</center>";
77 }
78
79 function hyperlink_no_params_td($target, $label)
80 {
81         echo "<td>";
82         hyperlink_no_params($target, $label);
83         echo "</td>\n";
84 }
85
86 //-----------------------------------------------------------------------------------
87
88 function hyperlink_params($target, $label, $params, $center=true)
89 {
90         if ($center)
91                 echo "<br><center>";
92         echo "<a href='$target?$params'>$label</a>\n";
93         if ($center)
94                 echo "</center>";
95 }
96
97 function hyperlink_params_td($target, $label, $params)
98 {
99         echo "<td>";
100         hyperlink_params($target, $label, $params);
101         echo "</td>\n";
102 }
103
104 //-----------------------------------------------------------------------------------
105
106 function hyperlink_params_separate($target, $label, $params)
107 {
108         echo "<a target='_blank' href='$target?$params" . SID . "'>$label</a>\n";
109 }
110
111 function hyperlink_params_separate_td($target, $label, $params)
112 {
113         echo "<td>";
114         hyperlink_params_separate($target, $label, $params);
115         echo "</td>\n";
116 }
117
118 //--------------------------------------------------------------------------------------------------
119
120 function alt_table_row_color(&$k)
121 {
122         if ($k == 1)
123         {
124                 echo "<tr class='oddrow'>\n";
125                 $k = 0;
126         } 
127         else 
128         {
129                 echo "<tr class='evenrow'>\n";
130                 $k++;
131         }
132 }
133
134 function table_section_title($msg) 
135 {
136         echo "<tr><td colspan=2 class='tableheader'>$msg</td><tr>\n";
137 }
138
139 function table_header($labels) 
140 {
141         start_row();
142         foreach ($labels as $label)
143                 labelheader_cell($label);
144         end_row();      
145 }
146
147 function edit_link_cell($param) 
148 {
149         label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'>" . _("Edit") . "</a>", "nowrap");
150 }
151
152 function delete_link_cell($param)
153 {
154         label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'>" . _("Delete") . "</a>", "nowrap");
155 }
156
157 //-----------------------------------------------------------------------------------
158
159 function start_row($param="") 
160 {
161         if ($param != "")
162                 echo "<tr $param>\n";
163         else    
164                 echo "<tr>\n";
165 }
166
167 function end_row() 
168 {
169         echo "</tr>\n";
170 }       
171
172 function br($num=1)
173 {
174         for ($i = 0; $i < $num; $i++)
175                 echo "<br>";
176 }               
177 ?>