1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
<?php
// month and year are being overwritten so we will copy vars to fix.
// this will make datesel.php still work where ever it is called from.
$fday = $_REQUEST["day"];$fmonth = $_REQUEST["month"];$fyear = $_REQUEST["year"];
include_once 'includes/init.php';
$INC = array('js/datesel.php');
print_header($INC,'','',true);
if ( strlen ( $date ) > 0 ) {
$thisyear = substr ( $date, 0, 4 );
$thismonth = substr ( $date, 4, 2 );
} else {
$thismonth = date("m");
$thisyear = date("Y");
}
$next = mktime ( 3, 0, 0, $thismonth + 1, 1, $thisyear );
$nextyear = date ( "Y", $next );
$nextmonth = date ( "m", $next );
$nextdate = date ( "Ym", $next ) . "01";
$prev = mktime ( 3, 0, 0, $thismonth - 1, 1, $thisyear );
$prevyear = date ( "Y", $prev );
$prevmonth = date ( "m", $prev );
$prevdate = date ( "Ym", $prev ) . "01";
// Sanitize get variables
$fday = clean_word($fday);
$fmonth = clean_word($fmonth);
$fyear = clean_word($fyear);
?>
<div style="text-align:center;">
<table class="minical">
<tr>
<td><a title="<?php etranslate("Previous")?>" href="datesel.php?form=<?php echo $form?>&fday=<?php echo $fday?>&fmonth=<?php echo $fmonth?>&fyear=<?php echo $fyear?>&date=<?php echo $prevdate?>"><img src="leftarrowsmall.gif" class="prevnextsmall" alt="<?php etranslate("Previous")?>" /></a></td>
<th colspan="5"><?php echo month_name ( $thismonth - 1 ) . " " . $thisyear;?></th>
<td><a title="<?php etranslate("Next")?>" href="datesel.php?form=<?php echo $form?>&fday=<?php echo $fday?>&fmonth=<?php echo $fmonth?>&fyear=<?php echo $fyear?>&date=<?php echo $nextdate?>"><img src="rightarrowsmall.gif" class="prevnextsmall" alt="<?php etranslate("Next")?>" /></a></td>
</tr>
<?php
echo "<tr class=\"day\">\n";
if ( $WEEK_START == 0 ) echo "<td>" .
weekday_short_name ( 0 ) . "</td>\n";
for ( $i = 1; $i < 7; $i++ ) {
echo "<td>" .
weekday_short_name ( $i ) . "</td>\n";
}
if ( $WEEK_START == 1 ) echo "<td>" .
weekday_short_name ( 0 ) . "</td>\n";
echo "</tr>\n";
if ( $WEEK_START == "1" )
$wkstart = get_monday_before ( $thisyear, $thismonth, 1 );
else
$wkstart = get_sunday_before ( $thisyear, $thismonth, 1 );
$monthstart = mktime ( 3, 0, 0, $thismonth, 1, $thisyear );
$monthend = mktime ( 3, 0, 0, $thismonth + 1, 0, $thisyear );
for ( $i = $wkstart; date ( "Ymd", $i ) <= date ( "Ymd", $monthend );
$i += ( 24 * 3600 * 7 ) ) {
echo "<tr>\n";
for ( $j = 0; $j < 7; $j++ ) {
$date = $i + ( $j * 24 * 3600 );
if ( date ( "Ymd", $date ) >= date ( "Ymd", $monthstart ) &&
date ( "Ymd", $date ) <= date ( "Ymd", $monthend ) ) {
echo "<td><a href=\"javascript:sendDate('" .
date ( "Ymd", $date ) . "')\">" .
date ( "d", $date ) . "</a></td>\n";
} else {
echo "<td></td>\n";
}
}
echo "</tr>\n";
}
?>
</table>
</div>
<?php print_trailer ( false, true, true ); ?>
</body>
</html>
|