← Back
Editing: listini_ed.php
<?php #______________________________________________________________________# ### made with SmaDIB: Smart Database Interface Builder 0.4.0 ### ### by Smartmedia 2000 http://www.smartmedia2000.it/ ### ### info email: smadib@smartmedia2000.it ### ###___###___###___###___###____###____###____###___###___###___###___### require_once ("../funct.php"); require_once ("sess.php"); require_once ("conn.php"); $ptitolo = "Listini"; $table = "listini"; $html = "y"; require_once ("../lan_it.php"); require_once ("testacoda.php"); $query = new doQuery(); $id_stagione = $_REQUEST['id_stagione']; $tipo_pr = $_REQUEST['tipo_pr']; $tipo = $_REQUEST['tipo']; $id_stagione_id = array (); $id_stagione_anno = array (); $id_stagione_fine = array (); $id_stagione_numero = array (); $id_stagione_nome = array (); $novuoto = array(); $numeroar = array ('','Prezzo unico','2 Stagioni','3 Stagioni','4 Stagioni','5 Stagioni','6 Stagioni','7 Stagioni','8 Stagioni','9 Stagioni','10 Stagioni','Min - Max','Bassa/Alta','Bassa/Media/Alta','Bassa/Media/Alta/Altissima'); $rowsSt = $query->freeQuery ("SELECT `id`, `anno`, DATE_FORMAT(`fine`, '%d/%m/%y') AS `fine`, `numero`, `nome_it` AS `nome` FROM `stagioni` WHERE `id_utente`=".$id_utente." ORDER BY `anno` DESC", 0); foreach ($rowsSt as $i=>$rowSt) { array_push ($id_stagione_id, $rowSt->id); array_push ($id_stagione_anno, $rowSt->anno); array_push ($id_stagione_fine, $rowSt->fine); array_push ($id_stagione_numero, $numeroar[$rowSt->numero]); array_push ($id_stagione_nome, $rowSt->nome); } $arTipoPr = $PREZZO_B; $arTipo = $TIPO_LIST_B; if ($az=="canc") { $query->freeQuery ("DELETE FROM `prezzi` WHERE `id_listino` = '$id'", 0); $query->delete (); header("Location: ".$_SERVER['PHP_SELF']); } if ($op == "ds") { $row = $query->freeQuery ("SELECT `id` FROM `listini` WHERE `id_stagione`='$id_stagione' AND `tipo`='$tipo' AND `tipo_pr`='$tipo_pr' AND `id_utente`='$id_utente'", 0); if (!count ($row)) $query->insert ($_POST, $novuoto); } else if ($op == "up") $query->update ($_POST, $novuoto); if ($az=="ed") { $rowE = $query->selectById (1); $id = $rowE['id']; $valop = "up"; $id_stagione = array_search($rowE['id_stagione'],$id_stagione_id); $id_stagionesel[$id_stagione] = "selected"; $tipo = $rowE['tipo']; $tiposel[$tipo] = "selected"; $tipoPr = $rowE['tipo_pr']; $tipoPrsel[$tipoPr] = "selected"; } else $valop = "ds"; $elenco.= "<tr bgcolor=\"white\"><td rowspan=\"".(3+count($lingue)*3)."\" valign=\"bottom\">funzioni <td colspan=\"2\"><b>Stagione</b></td> <td><b>Tipo Prezzo</b></td> <td><b>Tipo Listino</b></td> </tr><tr bgcolor=\"#EEEEEE\"> <td colspan=\"2\"><select name=\"id_stagione\">\n"; for ($s=0; $s<count($id_stagione_id); $s++) $elenco.= "<option value=\"".$id_stagione_id[$s]."\" $id_stagionesel[$s]>".$id_stagione_anno[$s]." ".$id_stagione_fine[$s]." ".$id_stagione_nome[$s]." ".$id_stagione_numero[$s]."</option>\n"; $elenco.= "</select></td> <td><select name=\"tipo_pr\">\n"; foreach ($arTipoPr as $t=>$tipoPr) $elenco.= "<option value=\"$t\" $tipoPrsel[$t]>$tipoPr</option>\n"; $elenco.= "</select></td> <td><select name=\"tipo\">\n"; foreach ($arTipo as $t=>$tipo) $elenco.= "<option value=\"$t\" $tiposel[$t]>$tipo</option>\n"; $elenco.= "</select></td> </tr>\n"; foreach ($lingue as $l) { $elenco.= " <tr><td colspan=\"4\"><b>Nome ".$l."</b> <input type=\"text\" name=\"nome_".$l."\" value=\"".$rowE[$in+5]."\" /></td></tr> <tr><td colspan=\"4\"><b>Note ".$l."</b></td></tr> <tr><td colspan=\"4\"><textarea name=\"note_".$l."\" cols=\"80\" rows=\"5\">".$rowE[$in+6]."</textarea></td></tr>\n"; $in+=2; } $elenco.= "<tr bgcolor=\"#FFFFFF\"> <td align=\"center\" colspan=\"4\"><input type=\"submit\" name=\"invio\" value=\"$intesta\"> $noMod <input type=\"hidden\" name=\"op\" value=\"$valop\" /> <input type=\"hidden\" name=\"id\" value=\"$id\" /> </td></tr> $riga\n"; $rows = $query->selectAll ($table, array('id_stagione'=>'DESC', 'tipo'=>'ASC', 'tipo_pr'=>'ASC'), 0); foreach ($rows as $i=>$row) { $cc++; $bgcolor = rowCol ($cc); $id_stagione = array_search($row->id_stagione,$id_stagione_id); $id_stagionesel[$id_stagione] = "selected"; $tipo = $row->tipo; $tipoPr = $row->tipo_pr; $elenco.= "<tr bgcolor=\"#$bgcolor\"><td>\n"; if ($az!="ed") $elenco.= $row->id." <a href=\"".$_SERVER['PHP_SELF']."?id=$row->id&az=ed\" title=\"modifica riga\"><img src=\"images/edit.gif\" border=\"0\" hspace=\"5\" alt=\"modifica riga\"></a> <a href=\"#\" onclick=\"javascript:confDel($row->id)\" title=\"cancella riga\"><img src=\"images/delete.gif\" border=\"0\" alt=\"cancella riga\"></a>\n"; else $elenco.= " "; $elenco.= " </td><td>".$id_stagione_anno[$id_stagione]." ".$id_stagione_fine[$id_stagione]." ".$id_stagione_nome[$id_stagione]." ".$id_stagione_numero[$id_stagione]."</td> <td>".$row->nome_it."</td> <td>".$arTipoPr[$tipoPr]."</td> <td>".$arTipo[$tipo]."</td>\n"; } echo $testa; ?> <h2 align="center"><?php echo $ptitolo; ?></h2> <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table align="center"> <?php echo $elenco; ?> </table></form> <?php echo $coda; ?>
Save File
Cancel