Agregado modulo de gestion de pantallas,
[ecomupi.git] / contenido / mupis+pantallas.php
blobfd322fbe9b018df8a58b28c903afec43e60228a2
1 <?php
2 function CONTENIDO_pantallas() {
3 global $session;
4 echo '<h1>Gestión de pantallas de ' . _NOMBRE_ . '</h1>';
5 if ( $session->isAdmin() && isset($_POST['registrar_mupi']) ) {
6 //Nos toca registrar un MUPI
7 Pantalla_REGISTRAR();
9 echo '<hr /><h2>Pantallas '._NOMBRE_." registradas para Ud.</h2>";
10 verPantallas();
11 if ( $session->isAdmin() ) {
12 echo '<hr /><h2>Registrar Pantallas</h2>';
13 verPantallasregistro();
16 function verPantallas(){
17 global $database;
18 $q = "SELECT codigo_cara_mupi 'Código Pantalla', codigo_mupi ' Código " . _NOMBRE_."', codigo 'Código propietario', alquilado_desde 'Alquilado desde', codigo_evento 'Evento', foto 'Foto' FROM ".TBL_MUPI_FACES.";";
19 $result = $database->query($q);
20 /* Error occurred, return given name by default */
21 $num_rows = mysql_numrows($result);
22 if(!$result || ($num_rows < 0)){
23 echo "Error mostrando la información";
24 return;
26 if($num_rows == 0){
27 echo "¡No hay Pantallas "._NOMBRE_." ingresadas!<BR />";
28 return;
30 echo Query2Table($result);
32 function verPantallasregistro() {
33 global $form;
34 echo '
35 <form action="./?'._ACC_.'=gestionar+pantallas" method="POST">
36 <table>
37 <tr><td>Código Pantalla '._NOMBRE_.':</td><td><input type="text" name="codigo" maxlength="100" style="width: 100%;" value="' . $form->value("codigo"). '"></td></tr>
38 <tr><td>Foto:</td><td><input type="text" name="foto" style="width: 100%;" maxlength="255" value="' . $form->value("foto"). '"></td></tr>
39 </table>
40 <input type="submit" value="Registrar">
41 <input type="hidden" name="registrar_mupi" value="1">
42 </form>';
45 function Pantalla_REGISTRAR() {
46 global $database,$form;
47 $form->setValue("codigo", $_POST['codigo']);
48 $form->setValue("foto", $_POST['foto']);
49 echo "Registrado ". $_POST['codigo'];
50 $q = "INSERT INTO ".TBL_MUPI_FACES." (codigo_cara_mupi, foto) VALUES ('".$_POST['codigo'] . "', '" . $_POST['foto'] ."');";
51 DEPURAR ($q);
52 $result = $database->query($q);