Codice PHP:
<FORM name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table>
<tr>
<td>
<table border='0' cellspacing='0' style='border-collapse: collapse' width='100' >
<tr bgcolor='#ffffff'>
<td width='25%' style="background-color:orange;" onclick="toggleCells(this, 'red', 'orange')">[b]SUB'[/b]
</td>
<td width='25%'><input type=checkbox name=box[] value='SUBNZ'></td>
<td width='25%'>SUBNZ</td>
<td width='25%'><input type=checkbox name=box[] value='SUBNX'></td>
<td width='25%'>SUBNX</td>
<td width='25%'><input type=checkbox name=box[] value='SUBNX_MUS'></td>
<td width='25%'>SUBNX_MUS</td>
<td width='25%'><input type=checkbox name=box[] value='SUBNX_CONS'></td>
<td width='25%'>SUBNX_CONS</td>
</tr>
<tr bgcolor='#f1f1f1'>
<td width='25%' style="background-color:orange;" onclick="toggleCells(this, 'red', 'orange')">[b]CV[/b]
<td width='25%'><input type=checkbox name=box[] value='CV_B'></td>
<td width='25%'>CV B</td>
<td width='25%'><input type=checkbox name=box[] value='CV_B_DVD'></td>
<td width='25%'>CV DVD</td>
<td width='25%'><input type=checkbox name=box[] value='ASB'></td>
<td width='25%'>ASB</td>
<td width='25%'><input type=checkbox name=box[] value='Museo'></td>
<td width='25%'>Museo</td>
</tr>
<tr bgcolor='#f1f1f1'>
<td width='25%' style="background-color:orange;" onclick="toggleCells(this, 'red', 'orange')">[b]PR[/b]
<td width='25%'><input type=checkbox name=box[] value='Rip1'></td>
<td width='25%'>Rip1</td>
<td width='25%'><input type=checkbox name=box[] value='Ac'></td>
<td width='25%'>Ac</td>
</tr>
</TABLE>
<tr><td colspan =6 align=center></form></td></tr>
</table>
<?php
$box=$_POST['box'];
$gruppo=$_POST['gruppo'];
?>
</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
<p class="largetxt">[b]Selezione periodo[/b]</p>
<div style="float: left;">
<div style="float: left; padding-right: 3px; line-height: 18px;">da :</div>
<div style="float: left;">
<?php
$thisweek = date('W');
$thisyear = date('Y');
$dayTimes = getDaysInWeek($thisweek, $thisyear);
//----------------------------------------
$date1 = date('Y-m-d', $dayTimes[0]);
$date2 = date('Y-m-d', $dayTimes[(sizeof($dayTimes)-1)]);
function getDaysInWeek ($weekNumber, $year, $dayStart = 1) {
// Count from '0104' because January 4th is always in week 1
// (according to ISO 8601).
$time = strtotime($year . '0104 +' . ($weekNumber - 1).' weeks');
// Get the time of the first day of the week
$dayTime = strtotime('-' . (date('w', $time) - $dayStart) . ' days', $time);
// Get the times of days 0 -> 6
$dayTimes = array ();
for ($i = 0; $i < 7; ++$i) {
$dayTimes[] = strtotime('+' . $i . ' days', $dayTime);
}
// Return timestamps for mon-sun.
return $dayTimes;
}
$myCalendar = new tc_calendar("date3", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d', strtotime($date1)), date('m', strtotime($date1)), date('Y', strtotime($date1)));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1970, 2020);
//$myCalendar->dateAllow('2009-02-20', "", false);
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->setDatePair('date3', 'date4', $date2);
//$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year');
$myCalendar->writeScript();
?>
</div>
</div>
<div style="float: left;">
<div style="float: left; padding-left: 3px; padding-right: 3px; line-height: 18px;">a :</div>
<div style="float: left;">
<?php
$myCalendar = new tc_calendar("date4", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d', strtotime($date2)), date('m', strtotime($date2)), date('Y', strtotime($date2)));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1970, 2020);
//$myCalendar->dateAllow("", '2009-11-03', false);
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->setDatePair('date3', 'date4', $date1);
//$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year');
$myCalendar->writeScript();
?>
</div>
</div>
</tr>
</table>
</td>
<td>
<INPUT type="submit" name="submit" value="Invia">
</td>
</tr>
</table>
</FORM>