Added edit_button_cell()
[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, $center=false)
107 {
108         if ($center)
109                 echo "<br><center>";
110         echo "<a target='_blank' href='$target?$params" . SID . "'>$label</a>\n";
111         if ($center)
112                 echo "</center>";
113 }
114
115 function hyperlink_params_separate_td($target, $label, $params)
116 {
117         echo "<td>";
118         hyperlink_params_separate($target, $label, $params);
119         echo "</td>\n";
120 }
121
122 //--------------------------------------------------------------------------------------------------
123
124 function alt_table_row_color(&$k)
125 {
126         if ($k == 1)
127         {
128                 echo "<tr class='oddrow'>\n";
129                 $k = 0;
130         } 
131         else 
132         {
133                 echo "<tr class='evenrow'>\n";
134                 $k++;
135         }
136 }
137
138 function table_section_title($msg) 
139 {
140         echo "<tr><td colspan=2 class='tableheader'>$msg</td><tr>\n";
141 }
142
143 function table_header($labels) 
144 {
145         start_row();
146         foreach ($labels as $label)
147                 labelheader_cell($label);
148         end_row();      
149 }
150
151 function edit_link_cell($param) 
152 {
153         label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'>" . _("Edit") . "</a>", "nowrap");
154 }
155
156 function delete_link_cell($param)
157 {
158         label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'>" . _("Delete") . "</a>", "nowrap");
159 }
160
161 function edit_button_cell($name, $value)
162 {
163     label_cell("<input type=\"submit\" class=\"editbutton\" name=\"$name\" value=\"$value\" />\n");
164 }
165
166 //-----------------------------------------------------------------------------------
167
168 function start_row($param="") 
169 {
170         if ($param != "")
171                 echo "<tr $param>\n";
172         else    
173                 echo "<tr>\n";
174 }
175
176 function end_row() 
177 {
178         echo "</tr>\n";
179 }       
180
181 function br($num=1)
182 {
183         for ($i = 0; $i < $num; $i++)
184                 echo "<br>";
185 }               
186 ?>