]> git.llucax.com Git - z.facultad/75.43/tp1.git/blob - src/lib/info.forms.php
Cambio mi listador.
[z.facultad/75.43/tp1.git] / src / lib / info.forms.php
1 <?php\r
2 // Grupo 10\r
3 //\r
4 // Lucarella, Schein, Arena\r
5 //\r
6 // Creado: Sebastian Arena 01/05/2005\r
7 //\r
8 require_once 'lib/info.functions.php';\r
9 require_once 'Tema.php';\r
10 \r
11 function info_form_ingresar_tema( $__hidID, $nombre, $icono, $descripcion ) {\r
12 ?>\r
13         <form name="info_ingresar_tema" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" onSubmit="return info_validar_ingresar_tema(this);" enctype="multipart/form-data">\r
14                         <input type="hidden" name="__hidID" value="<? echo $__hidID; ?>">\r
15             <script type="text/javascript" language="JavaScript">\r
16                 <!--\r
17                 function info_validar_ingresar_tema(f)\r
18                 {\r
19                     if ( (!check_vacio(f.txtNombre, 'Nombre')) || (!check_min_max_cant(f.txtURL, 'URL', 5, 20)) ) return false;\r
20                                         if ( (!check_vacio(f.txtIcono, 'Icono')) ) return false;\r
21                                         if ( (!check_vacio(f.txtDescripcion, 'Descripcion')) || (!check_min_max_cant(f.txtURL, 'URL', 5, 200)) ) return false;\r
22                     return true;\r
23                 }\r
24 \r
25                                 function info_blankActual(f) {\r
26                                         if (confirm("Seguro desea perder la posibilidad de modificar?")) {\r
27                                                 location.href = "<?php echo $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; ?>";\r
28                                         }\r
29                                 }\r
30                 -->\r
31             </script>\r
32                         <table>\r
33                                 <tr>\r
34                                         <td>Tema:</td>\r
35                                         <td><input type="text" name="txtNombre" value="<?php echo $nombre ?>"/></td>\r
36                                 </tr>\r
37                                 <tr>\r
38                                         <td>Icono:</td>\r
39                                         <td><input type="file" name="txtIcono" value="<?php echo $icono ?>" accept="image/png;image/jpeg;image/gif"/></td>\r
40                                 </tr>\r
41                                 <tr>\r
42                                         <td>Descripción:</td>\r
43                                         <td><textarea name="txtDescripcion" rows="3" cols="50"><?php echo $descripcion ?></textarea></td>\r
44                                 </tr>\r
45                                 <tr>\r
46                      <? if ( $__hidID == -1 ) { ?>\r
47                                                 <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar Tema"/></td>\r
48                                         <? } else { ?>\r
49                                                 <td colspan="2">\r
50                                                         <input type="submit" name="btnSubmit" value="Modificar Tema"/>&nbsp;\r
51                                                         <input type="button" name="btnNew" value="Nuevo Tema" onclick="info_blankActual(this.form);"/>&nbsp;\r
52                                                 </td>\r
53                                         <? } ?>\r
54                                 </tr>\r
55                         </table>\r
56         </form>\r
57 <?php\r
58 }\r
59 \r
60 function info_form_printTemaCombo( $tema , $onchangeTema) {\r
61 \r
62         ?>\r
63         <select name="txtTema"<? if ($onchangeTema != '') { echo ' onchange="' . $onchangeTema . '"'; } ?>\r
64                 <option value="">Seleccione un Tema...</option>\r
65         <?php\r
66                 $arrTemas = info_obtener_temas();\r
67                 foreach( $arrTemas as $objTema ) {\r
68                 ?><option value="<?php echo $objTema->id; ?>"<?php if ($tema == $objTema->id) { echo " selected"; } ?>><? echo $objTema->nombre; ?></option><?php\r
69                 }\r
70         ?>\r
71         </select>\r
72         <?php\r
73 }\r
74 \r
75 \r
76 function info_form_ingresar_info( $__hidID, $tema, $url, $comentario ) {\r
77 ?>\r
78         <form name="info_ingresar_info" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" onSubmit="return info_validar_ingresar_info(this);">\r
79                         <input type="hidden" name="__hidID" value="<? echo $__hidID; ?>">\r
80             <script type="text/javascript" language="JavaScript">\r
81                 <!--\r
82                 function info_validar_ingresar_info(f)\r
83                 {\r
84                                         if ( (!check_vacio(f.txtTema, 'Tema')) ) return false;\r
85                     if ( (!check_vacio(f.txtURL, 'URL')) || (!check_min_max_cant(f.txtURL, 'URL', 5, 200)) ) return false;\r
86                     if ( (!check_vacio(f.txtComentario, 'Comentario')) || (!check_min_max_cant(f.txtComentario, 'Comentario', 10, 500)) ) return false;\r
87                     return true;\r
88                 }\r
89 \r
90                                 function info_blankActual(f) {\r
91                                         if (confirm("Seguro desea perder la posibilidad de modificar?")) {\r
92                                                 location.href = "<?php echo $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; ?>";\r
93                                         }\r
94                                 }\r
95                 -->\r
96             </script>\r
97                         <table>\r
98                                 <tr>\r
99                                         <td>Tema:</td>\r
100                                         <td><?info_form_printTemaCombo($tema,'');?></td>\r
101                                 </tr>\r
102                                 <tr>\r
103                                         <td>URL:</td>\r
104                                         <td><input type="text" name="txtURL" value="<?php echo $url ?>"/></td>\r
105                                 </tr>\r
106                                 <tr>\r
107                                         <td>Comentario:</td>\r
108                                         <td><textarea name="txtComentario" rows="3" cols="50"><?php echo $comentario ?></textarea></td>\r
109                                 </tr>\r
110                                 <tr>\r
111                     <? if ( $__hidID == -1 ) { ?>\r
112                                                 <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar Información"/></td>\r
113                                         <? } else { ?>\r
114                                                 <td colspan="2">\r
115                                                         <input type="submit" name="btnSubmit" value="Modificar Información"/>&nbsp;\r
116                                                         <input type="button" name="btnNew" value="Nueva Información" onclick="info_blankActual(this.form);"/>&nbsp;\r
117                                                 </td>\r
118                                         <? } ?>\r
119                                 </tr>\r
120                         </table>\r
121         </form>\r
122 <?php\r
123 }\r
124 \r
125 \r
126 \r
127 \r
128 function info_form_ingresar_comentario( $__hidID, $info_id, $comentario ) {\r
129 ?>\r
130         <form name="info_ingresar_comentario" action="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?echo $info_id;?>" method="post" onSubmit="return info_validar_ingresar_comentario(this);">\r
131             <input type="hidden" name="hidSaving" value="1">\r
132                         <input type="hidden" name="__hidID" value="<? echo $__hidID; ?>">\r
133             <script type="text/javascript" language="JavaScript">\r
134                 <!--\r
135                 function info_validar_ingresar_comentario(f)\r
136                 {\r
137                                         if ( (!check_vacio(f.txtComentario, 'Comentario') || (!check_min_max_cant(f.txtComentario, 'Comentario', 10, 500)) ) ) return false;\r
138                     return true;\r
139                 }\r
140 \r
141                                 function info_blankActual(f) {\r
142                                         if (confirm("Seguro desea perder la posibilidad de modificar?")) {\r
143                                                 location.href = "<?php echo $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; ?>";\r
144                                         }\r
145                                 }\r
146                 -->\r
147             </script>\r
148                         <table>\r
149                                 <tr>\r
150                                         <td>Comentario:</td>\r
151                                         <td><textarea name="txtComentario" rows="3" cols="50"><?php echo $comentario ?></textarea></td>\r
152                                 </tr>\r
153                                 <tr>\r
154                                         <? if ( $__hidID == -1 ) { ?>\r
155                                                 <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar Comentario"/></td>\r
156                                         <? } else { ?>\r
157                                                 <td colspan="2">\r
158                                                         <input type="submit" name="btnSubmit" value="Modificar Comentario"/>&nbsp;\r
159                                                         <input type="button" name="btnNew" value="Nuevo Comentario" onclick="info_blankActual(this.form);"/>&nbsp;\r
160                                                 </td>\r
161                                         <? } ?>\r
162                                 </tr>\r
163                         </table>\r
164         </form>\r
165 <?php\r
166 }\r
167 ?>\r