← Back
Editing: tableau.php
<?php ###___###___###___###___###___###___###___###___###___###___###___###___### ### SmaDIB: Smart Database Interface Builder 0.6.0.1 ### ### 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 = "Tableau ".$tipoAr[$_REQUEST[$tp]]; require_once ("testacoda.php"); $query = new doQuery(); $id_sistemaz = $_REQUEST['id_sistemaz']; $nome_sist = $_REQUEST['nome_sist']; $fisso = $_REQUEST['fisso']; $anno = $_REQUEST['anno'] ? $_REQUEST['anno'] : date ("Y"); $colSovrap = "#CC0000"; $mesi = array ('', 'gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'noveembre', 'diceembre'); $gMesi = array(1=>31, 2=>28, 3=>31, 4=>30, 5=>31, 6=>30, 7=>31, 8=>31, 9=>30, 10=>31, 11=>30, 12=>31); $giorni = array ('Sun'=>'dom', 'Mon'=>'lun', 'Tue'=>'mar', 'Wed'=>'mer', 'Thu'=>'gio', 'Fri'=>'ven', 'Sat'=>'sab'); $coloriStStr = array (-1=>'#000000', 0=>'#FFFFFF', 1=>'#EECCEE'); # link piantine if ($id_utente == 12) { $piantina = "<a href=\"".$dominio."/images/".$tipoAr[$tp]."_piantina.jpg\" target=\"_new\">piantina $tipoAr[$tp]</a>"; } if ($op == "ds") { $sql = "SELECT `stato` FROM `contratti` WHERE `id`=$idC LIMIT 1"; $row = $query->freeQuery ($sql, 0); if ($row[0]->stato < 10 && $fisso != "") # da movibile a fisso $stato = $row[0]->stato+10; else if ($row[0]->stato > 10 && $fisso == "") # da fisso a movibile $stato = $row[0]->stato-10; else $stato = $row[0]->stato; $sql = "UPDATE `contratti` SET `id_sistemaz`='$id_sistemaz', `stato`='$stato' WHERE `id`=$idC LIMIT 1"; $query->freeQuery ($sql, 0); } if ($az == "ed") { # nuovo inserimento $sql = "SELECT `contratti`.`data_in`, `contratti`.`data_out` AS `data_fi`, `contratti`.`stato`, `id_sistemaz`, `cognome`, `nome` FROM `contratti`, `persone`, `presenze` WHERE `contratti`.`id_utente`=$id_utente $c2p AND `presenze`.`tipo_pers` < 3 AND `contratti`.`id`=$idC LIMIT 1"; $row = $query->freeQuery ($sql, 0); list ($aIn, $mIn, $gIn) = explode ('-', $row[0]->data_in); list ($aFi, $mFi, $gFi) = explode ('-', $row[0]->data_fi); $data_in = date ("Y-m-d", mktime(0,0,0,$mIn,$gIn,$aIn)-(3600*24*7) ); $data_in0 = mktime(0,0,0,$mIn,$gIn,$aIn); $data_fi = date ("Y-m-d", mktime(0,0,0,$mFi,$gFi,$aFi)+(3600*24*7) ); $data_fi0 = mktime(0,0,0,$mFi,$gFi,$aFi)-(3600*24); list ($aIn, $mIn, $gIn) = explode ('-', $data_in); list ($aFi, $mFi, $gFi) = explode ('-', $data_fi); if ($row[0]->stato > 10) $checkF = "checked=\"checked\""; # prende il nome della struttura $sqlNs = "SELECT `nome` AS `nome_sist` FROM `sistemazioni` WHERE `id`=".$row[0]->id_sistemaz." LIMIT 1"; $rowNs = $query->freeQuery ($sqlNs, 0); $insStrutt = "<b>".$row[0]->cognome." ".$row[0]->nome."</b> da ".date2data ($row[0]->data_in)." a ".date2data ($row[0]->data_fi)." sistemazione <input type=\"text\" readonly=\"readonly\" name=\"nome_sist\" size=\"6\" value=\"".$rowNs[0]->nome_sist."\" /> <input type=\"checkbox\" name=\"fisso\" $checkF /> posto fisso <input type=\"submit\" name=\"invio\" value=\"Inserisci\" /> <input type=\"button\" value=\"Canc.\" onclick=\"javascript:cancSist()\" /> $backPres <input type=\"hidden\" name=\"id_sistemaz\" value=\"".$row[0]->id_sistemaz."\" /> <input type=\"hidden\" name=\"nomeC\" value=\"$nomeC\" /> <input type=\"hidden\" name=\"az\" value=\"ed\" /> <input type=\"hidden\" name=\"op\" value=\"ds\" /> <input type=\"hidden\" name=\"st\" value=\"$st\" /> <input type=\"hidden\" name=\"tp\" value=\"$tp\" /> <input type=\"hidden\" name=\"idC\" value=\"$idC\" />\n"; } else { # lista degli anni per i tableau $insStrutt = "<table align=\"center\"><tr>"; $sqlA = "SELECT DISTINCT `anno` FROM `stagioni` WHERE `id_utente` = ".$id_utente." ORDER BY `anno` DESC"; $rowsA = $query->freeQuery ($sqlA, 0); foreach ($rowsA as $rowA) $insStrutt.= "<td><a href=\"".$_SERVER['PHP_SELF']."?tp=".$tp."&anno=".$rowA->anno."\">".$rowA->anno."</a></td>"; $insStrutt.= "</tr></table>"; } $sqlS = "SELECT `id`, `nome`, `posti`, `tipo_letti`, `fumatori`, `stato` FROM `sistemazioni` WHERE `id_utente`= $id_utente AND (`tipo`=$tp OR `tipo`=0) ORDER BY `nome`"; $rowsS = $query->freeQuery ($sqlS, 0); foreach ($rowsS as $nr=>$rowS) $tableauStr.= "<tr><td bgcolor=\"".$coloriStStr[$rowS->stato]."\" height=\"10\" style=\"font-size:10px\" nowrap> <b>".$rowS->nome."</b> ".$rowS->posti." ".$lettiAr[$rowS->tipo_letti]." ".$fumoAr[$rowS->fumatori+1]."</td></tr> <tr><td bgcolor=\"#AAAAFF\" height=\"1\"></td></tr>\n"; $hIfr = ceil (($nr+3)*17); # altezza dell'iframe $legenda = "<table align=\"center\" border><tr>"; foreach ($coloriSt AS $st=>$col) $legenda.= "<td bgcolor=\"$col\">".$statoAr[$st]."</td>"; $legenda.= "</tr></table>"; echo "$testa <script type=\"text/javascript\" language=\"javascript\"> //<!-- function cancSist() { document.form1.id_sistemaz.value = ''; document.form1.nome_sist.value = ''; document.form1.fisso.checked = false; document.forms['form1'].submit(); } function confDel2(id, stag) { if (confirm(\"Vuoi davvero cancellare la riga? Premi ok per confermare.\")) document.location='".$_SERVER['PHP_SELF']."?id='+ id +'&id_stagione='+ stag +'&az=canc'; } function changePer() { document.forms['form1'].periodo.value = ''; document.forms['form1'].op.value = ''; document.forms['form1'].submit(); } //--> </script> <h2 align=\"center\">".$ptitolo." ".$tipoAr[$tp]." ".$anno."</h2> $piantina <form name=\"form1\" method=\"post\" action=\"".$_SERVER['PHP_SELF']."\"> $insStrutt <table align=\"center\" cellspacing=\"0\" cellpadding=\"0\"> <tr><td valign=\"top\"><table align=\"center\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-collapse: separate; border-spacing: 0px 1px;\"> <tr><td align=\"right\" height=\"1\" style=\"font-size: 10px;\">mesi</td> <tr><td align=\"right\" height=\"1\" style=\"font-size: 10px;\">giorni</td></tr> $tableauStr <tr><td> </td></tr> </table></td> <td width=\"100%\" valign=\"top\"> <iframe src =\"tableau_if.php?tp=".$tp."&st=".$st."&idC=".$idC."&az=".$az."&anno=".$anno."\" width=\"100%\" height=\"$hIfr\" valign=\"top\" frameborder=\"0\" marginheight=\"0\"></iframe> </td></tr> </table></form> $legenda $coda"; ?>
Save File
Cancel