← Back
Editing: sistemazioni_ed.php
<?php ###___###___###___###___###___###___###___###___###___###___###___###___### ### SmaDIB: Smart Database Interface Builder 1.0.b1 ### ### by Smartmedia 2000 http://www.smartmedia2000.it/ ### ### info email: smadib@smartmedia2000.it ### ### released under GPLv2 license http://www.gnu.org/licenses/gpl.txt ### ###___###___###___###___###___###___###___###___###___###___###___###___### require_once ("../funct.php"); require_once ("sess.php"); require_once ("conn.php"); $table = "sistemazioni"; $ptitolo = "Sistemazioni ".$tipoAr[$_REQUEST[$tp]]; $html = ""; # htmlarea type require_once ("testacoda.php"); $perpg = 50; $pgb = 19; $noEmpty = array ('nome'); $dateFlds = array (); $fumoAr = array ('no', 'sì'); $urlParam = "?tp=".$tp; $st = $dbi->real_escape_string ($_GET['st']); $query = new doQuery (); if ($az=="canc") { $query->delete (); header("Location: ".$_SERVER['PHP_SELF'].$urlParam."&pg=$pg"); } if ($op == "ds") { $query->insert ($_POST, $noEmpty); } else if ($op == "up") { $query->update ($_POST, $noEmpty); } if ($id && $st) { $sql = "UPDATE `sistemazioni` SET `stato` = ".$st." WHERE `id` = ".$id." LIMIT 1"; $query->freeQuery ($sql, 0); } if ($az=="ed") { $row = $query->selectById (0); $valop = "up"; $id = $row->id; $tipo = $row->tipo; $nome = $row->nome; $indirizzo = $row->indirizzo; $colore = $row->colore; $posti = $row->posti; $tipo_letti = $row->tipo_letti; $fumatori = $row->fumatori; $stato = $row->stato; } else $valop = "ds"; if (ID_UTENTE > 100) $sql = "SELECT * FROM `sistemazioni` WHERE `id_utente` = ".$id_utente." ORDER BY `tipo` ASC, `nome` ASC"; else $sql = "SELECT * FROM `sistemazioni` WHERE `tipo`= ".$tp." AND `id_utente` = ".$id_utente." ORDER BY `nome` ASC"; $rows = $query->freeQuery ($sql, 0); foreach ($rows as $i=>$row) { $bgcolor = rowCol ($i); $elenco.= " <tr bgcolor=\"#".$bgcolor."\"><td width=\"70\" nowrap>\n"; if ($az!="ed") $elenco.= "<a href=\"".$_SERVER['PHP_SELF'].$urlParam."&id=$row->id&az=ed&pg=$pg\" title=\"modifica riga\"><img src=\"images/edit.gif\" border=\"0\" hspace=\"3\" alt=\"modifica riga\" align=\"absmiddle\" /></a> <a href=\"#\" onClick=\"javascript:confDel($row->id)\" title=\"cancella riga\"><img src=\"images/delete.gif\" border=\"0\" alt=\"cancella riga\" align=\"absmiddle\" /></a>"; $elenco.= " </td>\n"; if (ID_UTENTE > 100) { $elenco.= "<td>".$tipoAr[$row->tipo]."</td>"; $stChange = ""; if ($row->stato == 1) $stChange = "<a href=\"".$_SERVER['PHP_SELF']."?id=".$row->id."&st=-2\" title=\"clicca per metterla in stato da pulire\"><img src=\"images/maid.png\" alt=\"da pulire\" align=\"absmiddle\" /></a>"; else if ($row->stato == -2) $stChange = " <a href=\"".$_SERVER['PHP_SELF']."?id=".$row->id."&st=1\" title=\"clicca per metterla in stato disponibile\"><img src=\"images/apply.gif\" alt=\"pulita\" align=\"absmiddle\" /></a>"; } $elenco.= "<td>".$row->nome."</td> <td>".$row->indirizzo."</td> <td>".$row->colore."</td> <td>".$row->posti."</td> <td>".$lettiAr[$row->tipo_letti]."</td> <td>".$fumoAr[$row->fumatori]."</td> <td>".$statoStrutt[$row->stato]." ".$stChange."</td></tr>\n"; } $elenco.= " <tr><td colspan=\"10\" align=\"center\">" .pager ($pg). " </td></tr>"; ?> <?=$testa;?> <script type="text/javascript" language="javascript"> function confDel(id) { if (confirm('Vuoi cancellare veramente questa riga? Premi OK per confermare.')) document.location='<?=$_SERVER['PHP_SELF'].$urlParam;?>&id='+ id +'&az=canc&pg=$pg'; } </script> <h2 align="center"><?php if (ID_UTENTE > 100) echo $ptitolo; else echo $ptitolo." ".$tipoAr[$tp]; ?></h2></h2> <form name="form1" method="post" action="<?=$_SERVER['PHP_SELF'];?>" > <table align="center"> <tr bgcolor="#FFFFF"><td valign="top">funzioni</td> <?php if (ID_UTENTE > 100) { ?> <td><b>Tipo</b></td> <?php } ?> <td><b>Nome</b></td> <td><b>Indirizzo</b></td> <td><b>Colore</b></td> <td><b>Posti</b></td> <td><b>Tipo letti</b></td> <td><b>Fumo</b></td> <td><b>Stato</b></td> </tr> <tr bgcolor="#EEEEEE"> <td><input type="submit" name="invio" value="<?=$intesta;?>" /> <input type="hidden" name="op" value="<?=$valop;?>" /> <input type="hidden" name="id" value="<?=$id;?>" /> <input type="hidden" name="pg" value="<?=$pg;?>" /> <input type="hidden" name="tp" value="<?=$tp;?>" /> <input type="hidden" name="tipo" value="<?=$tp;?>" /></td> <?php if (ID_UTENTE > 100) { ?> <td><?=selList ('tipo', $tipoAr, '', $tipo, '', '');?></td> <?php } ?> <td><input name="nome" type="text" size="8" maxlenght="20" value="<?=$nome;?>" /></td> <td><input name="indirizzo" type="text" size="16" maxlenght="100" value="<?=$indirizzo;?>" /></td> <td><input name="colore" type="text" size="6" maxlenght="6" value="<?=$colore;?>" /></td> <td><input name="posti" type="text" size="3" maxlenght="6" value="<?=$posti;?>" /></td> <td><?=selList ('tipo_letti', $lettiAr, '', $tipo_letti, '', '');?></td> <td><?=selList ('fumatori', $fumoAr, '', $fumatori, '', '');?></td> <td><?=selList ('stato', $statoStrutt, '', $stato, '', '');?></td> </tr> <tr><td colspan="10" height="1"><hr width="80%" /></td></tr> <?=$elenco;?> </table></form> <?=$coda;?>
Save File
Cancel