← Back
Editing: tableau_ex.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"); require_once ("../lan_arr.php"); $ptitolo = "Tableau extra"; $noscr = "y"; require_once ("testacoda.php"); $query = new doQuery(); $anno = $_REQUEST['anno'] ? $_REQUEST['anno'] : date ("Y"); $colSovrap = "#CC0000"; $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'); $urlParam = "?tp=$tp&tpC=$tpC&st=$st&nomeC=$nomeC&idC=$idC"; # 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>"; echo $testa; ?> <style type="text/css"> td { font-size: 10px; border-collapse: separate; border-spacing: 0px 1px; } #cal { position: absolute; top: 120px; padding-bottom: 20px; padding-left: 120px; z-index: -2; } #str { position: fixed; top: 120px; left: 0px; z-index: -1; } #lnk { position: fixed; width: 100%; align: center; top: 90px; } #anno { position: absolute; width: 100%; align: center; top: 130px; z-index: -1; } .occ { background-color: #CCCCCC; } .occ a, .occ a:hover, .occ a:visited { color: #CCCCCC; ] </style> <?php echo "<h2 align=\"center\">".$ptitolo." ".$tablEx[$tp]."</h2><br />\n"; $id_sistemaz = $_REQUEST['id_sistemaz']; $nome_sist = $_REQUEST['nome_sist']; $dataScadl2 = $anno.substr ($dataScadl, 4); $colSovrap = "#CC0000"; $mesi = array ('', 'gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'); $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'); $fumo = array ('', 'ind', 'nf', 'f'); $c2mat = array ('', 'ind', '1mat', '2mat'); $sql = "SELECT MIN(`data_in`) AS `data_in`, MAX(`data_fi`) AS `data_fi` FROM `periodi`, `stagioni` WHERE `periodi`.`id_utente`=$id_utente AND `periodi`.`id_stagione` = `stagioni`.`id` AND `stagioni`.`fine` = '$dataScadl2' AND `data_in`>='".$anno."-01-01'"; # date per inizio e fine del tableau $row = $query->freeQuery ($sql, 0); list ($aIn, $mIn, $gIn) = explode ('-', $row[0]->data_in); list ($aFi, $mFi, $gFi) = explode ('-', $row[0]->data_fi); if ($az == "ed") { $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); } # prima riga mesi for ($i=$mIn+0; $i<=$mFi; $i++) { $bgcol = rowCol ($i); $colsp = ($i > $mIn && $i < $mFi) ? $gMesi[$i] : ($i == $mIn ? $gMesi[$i]-$gIn+1 : $gFi); $cal.= "<td colspan=\"$colsp\" align=\"center\" bgcolor=\"$bgcol\"><a name=\"".$mesi[$i]."\">"; for ($j=0; $j< ($colsp/5); $j++) $cal.= $mesi[$i]." - "; $cal.= "</a></td>"; $linkInt.= "<a href=\"#".$mesi[$i]."\">".$mesi[$i]."</a> "; $totGg+= $colsp; } $cal.= "<td rowspan=\"2\"></td> </tr><tr><td> </td>\n"; # seconda riga giorni colorati nei periodi $datainAr = array (); $datafiAr = array (); $coloriAr = array (); $sqlCol = "SELECT DISTINCT `periodo`, `data_in`, `data_fi` FROM `periodi`, `listini`, `stagioni` WHERE `periodi`.`id_utente` = ".ID_UTENTE." AND `periodi`.`id_stagione` = `stagioni`.`id` AND `listini`.`id_stagione`=`periodi`.`id_stagione` AND (`listini`.`tipo`= ".$tp." OR `listini`.`tipo`=0) AND `stagioni`.`fine` = '".$dataScadl2."' ORDER BY `data_in`"; $rowsCol = $query->freeQuery ($sqlCol, 0); foreach ($rowsCol AS $i=>$rowC) { list ($yy1, $mm1, $dd1) = explode ('-', $rowC->data_in); list ($yy2, $mm2, $dd2) = explode ('-', $rowC->data_fi); $datainAr[] = mktime (0,0,0,$mm1,$dd1,$yy1); $datafiAr[] = mktime (0,0,0,$mm2,$dd2,$yy2); $coloriPerAr[] = $coloriPer[$rowC->periodo]; } $t = mktime (0,0,0,$mIn,$gIn,$aIn); while ($t < mktime (0,0,0,$mFi+1,$gFi,$aFi)) { $bgcolor = ""; for ($g=0; $g<count($datainAr); $g++) if ($t >= $datainAr[$g] && $t <= $datafiAr[$g]) # colore di sfondo $bgcolor = "bgcolor=\"".$coloriPerAr[$g]."\""; $data = date ("d/n/Y", $t); list ($dd, $mm, $yy) = explode ('/', $data); $dd = (date ("N", $t) == 6) ? "<b>$dd</b>" : $dd; if ($data == date ("d/n/Y", time ()+3600*2)) # oggi $bgcolor = "class=\"oggi\""; $cal.= "<td $bgcolor>".$dd." </td>\n"; $t+= 3600*24; } $cal.= "</tr>\n"; $sqlTp = "SELECT DISTINCT `prezzi`.`tipologia` FROM `conti`, `listini`, `prezzi`, `stagioni` WHERE `stagioni`.`id_utente`= ".$id_utente." AND `prezzi`.`id`=`conti`.`id_prezzo` AND `prezzi`.`id_listino`=`listini`.`id` AND `stagioni`.`id` = `id_stagione` AND `listini`.`tipo` = ".$tp." AND `stagioni`.`anno` = '".$anno."' ORDER BY `prezzi`.`tipologia`"; $rowsTp = $query->freeQuery ($sqlTp, 0); foreach ($rowsTp as $rowTp) { $tplg = $rowTp->tipologia; $dayOccup = array (); $maxO = 0; $sqlE = "SELECT `contratti`.`data_in`, `contratti`.`data_out`, `prezzi`.`tipologia`, `quant`, `period`, `contratti`.`numero`, `cognome`, `conti`.`data_in` AS `data_in2`, `conti`.`period` FROM `conti`, `listini`, `prezzi`, `stagioni`, $wc2p AND `prezzi`.`id`=`conti`.`id_prezzo` AND `prezzi`.`id_listino`=`listini`.`id` AND `conti`.`id_contratto`=`contratti`.`id` AND `stagioni`.`id` = `id_stagione` AND `presenze`.`tipo_pers` = 1 AND `contratti`.`stato` > 0 AND `contratti`.`tipo_contr` != 9 AND `listini`.`tipo` = $tp AND `prezzi`.`tipologia` = ".$tplg." AND `stagioni`.`anno` = '".date("Y")."' GROUP BY `conti`.`id` ORDER BY `data_in`"; $rowsE = $query->freeQuery ($sqlE, 0); foreach ($rowsE as $i=>$rowE) { if ($rowS->periodo) { # extra durante $giorni = $rowE->periodo; } else { # extra prima $giorni = (date2time ($rowE->data_out)-date2time ($rowE->data_in))/(3600*24); } list ($yy1, $mm1, $dd1) = explode ('-', dateNoTime ($rowE->data_in)); $timeIn = mktime (0,0,0,$mm1,$dd1,$yy1); for ($i=0; $i<$giorni; $i++) { $dayOccup[$timeIn]++; $timeIn+= 3600*24; } foreach ($dayOccup as $n=>$v) if ($v > $maxO) $maxO = $v;; } //eco($dayOccup); for ($i=1; $i<=$maxO; $i++) { $tableauStr.= "<tr><td bgcolor=\"#EECCEE\" height=\"10\" style=\"font-size:10px\" nowrap> <b>".$NOMI_B_IT[$tp][$tplg]." ".$i."</b></td></tr> <tr><td bgcolor=\"#AAAAFF\" height=\"1\"></td></tr>\n"; $tableau.= "<tr><td height=\"10\" style=\"font-size:10px\"><b> |</b></td>\n"; $t = mktime (0,0,0,$mIn,$gIn,$aIn); while ($t < mktime (0,0,0,$mFi, $gFi,$aFi)) { $bgcolor = ""; $nom = ""; $data = date ("d/n/Y", $t); $oggiT = date ("d/n/Y", time()+3600*2); list ($dd, $mm, $yy) = explode ('/', $data); $ddSty = (date ("N", $t) == 6) ? "style=\"font-weight:bold; border-left-style:solid; border-left-color: #AAAAFF; border-left-width: 1px;\"" : ""; # se ÃÂÃÂàá sabato $dN = $giorni [date ("D", $t)]; # colorazione dell'oggi if ($data == $oggiT) $ddSty = "class=\"oggi\""; else if ($dayOccup[$t]) { # giorno di occupazione $ddSty = "class=\"occ\""; $nom = "<a title=\"".$rowE->numero." ".$rowE->cognome."\" href=\"void(0);\">__</a>"; $dayOccup[$t]--; } $tableau.= "<td ".$ddSty.">".$nom."</td>"; $t+= 3600*24; /* for ($g=0; $g<count($datainAr); $g++) { # primo giorno if (($t < $datafiAr[$g] && $t >= $datafiAr[$g]-47*1800) || ($t >= $datainAr[$g] && $t < $datainAr[$g]+47*1800)) { $flA++; $linkC = "contratti_ed.php?tp=$tp&st=".$statoAr[$g]."&id=".$idC."&az=ed"; } // if ($t < $dFi && $t >= $dIn) $fl2++; # cliccabili i giorni del periodo in modifica # altri giorni if ($t >= $datainAr[$g] && $t <= $datafiAr[$g]+3600*3) { $fl++; $bgcolor = rowCol ($k); $colsp = $dataggAr[$g]; } # giorno di partenza if ($t > $datafiAr[$g] && $t <= $datafiAr[$g]+3600 && $data != $oggiT) $flP = "<b>P</b>"; } # colorazione dell'oggi if ($data == $oggiT) $ddSty = "class=\"oggi\""; if ($flA && $fl == 1) { # primo giorno occupato $tableau.= "<td bgcolor=\"$bgcolor\" colspan=\"$colsp\" nowrap><a href=\"$linkC\" target=\"_parent\" style=\"font-size:9px;\"><b>A</b></a></td>\n"; $t+= 3600*24*$colsp; } else if ($fl || $flP) { # altri giorni occupati o partenza $tableau.= "<td bgcolor=\"$bgcolor\">$flP</td>\n"; $t+= 3600*24; } else { # giorni liberi $tableau.= "<td $ddSty> </td>"; $t+= 3600*24; } */ } //eco($dayOccup); $tableau.= "</tr> <tr><td colspan=\"".($totGg+1)."\" bgcolor=\"#AAAAFF\" height=\"1\"></td></tr>\n"; } $tableauStr.= "<tr><td bgcolor=\"#333333\" height=\"1\"></td></tr>\n"; $tableau.= "<tr><td colspan=\"".($totGg+1)."\" bgcolor=\"#333333\" height=\"1\"></td></tr>\n"; } ?> <div id="lnk"><?php echo $linkInt; ?></div> <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <div id="str"> <table cellspacing="0" cellpadding="0"> <tr><td align="right" height="1" style="width: 120pX; background: #ffffff; font-size: 10px;">mesi</td> <tr><td align="right" height="1" style="width: 120pX; background: #ffffff; font-size: 10px;">giorni</td></tr> <?php echo $tableauStr; ?> </table> </div> <div id="cal"> <table cellspacing="0" cellpadding="0"> <tr> <td width="100%" valign="top"> <?php echo $cal; ?> </tr> <?php echo $tableau; ?> </table> </div> </form> <script language="JavaScript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js" type="text/javascript"></script> <script language="JavaScript" src="scrollspy.js" type="text/javascript"></script> <script language="JavaScript" type="text/javascript"> <!-- function loadSpy(){ var demoThree= new ScrollSpy({ min: 0, mode: 'horizontal', onTick: function(position,state,enters,leaves) { $("str").style.top = -position.y+120+"px"; $("lnk").style.top = -position.y+90+"px"; }, container: window }); } var Page = { initialize: function() { loadSpy(); } } window.addEvent("domready", Page.initialize); //--> </script> </body> </html>
Save File
Cancel