if (isset($_POST['addnewMONTH'])) { //aggiungi mese $settimana = ['ZERO', 'LUNEDI', 'MARTEDI', 'MERCOLEDI', 'GIOVEDI', 'VENERDI', 'SABATO', 'DOMENICA']; //array nomi giorni //$nomeCampoPausa=['PausaRXL','PausaN1','PausaN2','PausaN3','PausaN4']; $nomeCampoPausa = generaCAMPIpausa($numeroTURNISTIotto); $numeroCAMPI = count($nomeCampoPausa); $mese = $_POST['meseNEW']; $anno = mysql_real_escape_string($_POST['annoNEW']); if (isset($_POST['bisestile'])) { //check su febbraio bisestile $bisesto = 1; } else { $bisesto = 0; } $giorni = ritorna_giorni($mese, $bisesto); //ritorno numero giorni in base al mese $primoG = $_POST['primoGiorno']; $tabella = $anno . $mese; if ($anno >= 2015 && $anno < 2100) { //creo tabella $sqlTABLE = "CREATE TABLE `{$tabella}` \n\t\t(numGiorno int(2) PRIMARY KEY,\n\t\tnomeGiorno varchar(20),\n\t\tTurno8 varchar(20),\n\t\tTurno6 varchar(20)\n\t\t)"; $queryTABLE = mysql_query($sqlTABLE) or die(mysql_error()); if ($queryTABLE) { if ($mese == 12) { openLoadingPage('loading/loadingPageNAT.php'); } else { openLoadingPage('loading/loadingPage.php'); } $indice = $primoG; $numGiornoAttuale = 1;
<?php echo "Seleziona i numeri dei giorni festivi di "; echo "<form id='ritornaGiorni' method='POST'>"; echo "<input id='meseScelto' type='text' name='meseOggetto' size='5' value='ND'>\n <input id='numeroMESE' type='text' name='numeroMESEoggetto' value='ND' hidden='true' >\n\t <input id='bisestoCBFESTIVI' name='bisestileFESTIVI' type='checkbox' hidden='true' ><br>\n <input id='calcola' type='submit' name='calcola' size='5' value='calcola'>\n<script>function retrieveMESE(){\n\tvar x=window.opener.mese.value;\n\tvar z=window.opener.bisestoCB.checked;\n\tvar y;\n\tif(x=='1'){\n\t\ty='GENNAIO';\n\t}\n\telse if(x=='2'){\n\t\ty='FEBBRAIO';\n\t}\n\telse if(x=='3'){\n\t\ty='MARZO';\n\t}\n\telse if(x=='4'){\n\t\ty='APRILE';\n\t}\n\telse if(x=='5'){\n\t\ty='MAGGIO';\n\t}\n\telse if(x=='6'){\n\t\ty='GIUGNO';\n\t}\n\telse if(x=='7'){\n\t\ty='LUGLIO';\n\t}\n\telse if(x=='8'){\n\t\ty='AGOSTO';\n\t}\n\telse if(x=='9'){\n\t\ty='SETTEMBRE';\n\t}\n\telse if(x=='10'){\n\t\ty='OTTOBRE';\n\t}\n\telse if(x=='11'){\n\t\ty='NOVEMBRE';\n\t}\n\telse if(x=='12'){\n\t\ty='DICEMBRE';\n\t}\n\tif(z==true){\n\t\tbisestoCBFESTIVI.checked=true;\n\t\t\n\t}\n\tnumeroMESE.value=x;\n\tmeseScelto.value=y;\n}</script>"; echo "</form>"; if (isset($_POST['calcola'])) { $giorno = 1; $vettoreFestivi = array(); echo "<form id='listaGiorni' method='POST'>"; $numeroMESE = $_POST['numeroMESEoggetto']; $bisestoFESTIVI = 0; if (isset($_POST['bisestileFESTIVI'])) { //check su febbraio bisestile $bisestoFESTIVI = 1; } $maxGiorni = ritorna_giorni($numeroMESE, $bisestoFESTIVI); while ($giorno <= $maxGiorni) { echo "<input id='check{$giorno}' name='checkPressed[]' type='checkbox' value='{$giorno}'>{$giorno} "; $giorno++; } echo "<br><input id='inviaFestivi' name='sceltaFestivi' value='scegli' type='submit'>"; echo "</form>"; } if (isset($_POST['checkPressed'])) { foreach ($_POST['checkPressed'] as $value) { $vettoreFestivi[] = $value; } $_SESSION['festivi'] = $vettoreFestivi; chiudiPagina(); } ?>