Exemple #1
0
$prevdate = sprintf("%04d%02d%02d", $prevyear, $prevmonth, $prevday);
// We add 2 hours on to the time so that the switch to DST doesn't
// throw us off.  So, all our dates are 2AM for that day.
if ($WEEK_START == 1) {
    $wkstart = get_monday_before($thisyear, $thismonth, $thisday);
} else {
    $wkstart = get_sunday_before($thisyear, $thismonth, $thisday);
}
$wkend = $wkstart + 3600 * 24 * 6;
$startdate = date("Ymd", $wkstart);
$enddate = date("Ymd", $wkend);
$thisdate = $startdate;
for ($i = 0; $i < 7; $i++) {
    $days[$i] = $wkstart + 24 * 3600 * $i;
    $weekdays[$i] = weekday_short_name(($i + $WEEK_START) % 7);
    $header[$i] = $weekdays[$i] . "<br />" . month_short_name(date("m", $days[$i]) - 1) . " " . date("d", $days[$i]);
}
?>

<div style="border-width:0px; width:99%;">
<a title="<?php 
etranslate("Previous");
?>
" class="prev" 
  href="view_v.php?id=<?php 
echo $id;
?>
&amp;date=<?php 
echo $prevdate;
?>
">
Exemple #2
0
function short_date_format($date)
{
    list($year, $month, $day) = explode("-", $date);
    return month_short_name($month) . ' ' . sprintf("%d", $day) . ', ' . $year;
}
function date_to_str($indate, $format = "", $show_weekday = true, $short_months = false, $server_time = "")
{
    global $DATE_FORMAT, $TZ_OFFSET;
    if (strlen($indate) == 0) {
        $indate = date("Ymd");
    }
    $newdate = $indate;
    if (!empty($server_time)) {
        $y = substr($indate, 0, 4);
        $m = substr($indate, 4, 2);
        $d = substr($indate, 6, 2);
        if ($server_time + $TZ_OFFSET * 10000 > 240000) {
            $newdate = date("Ymd", mktime(3, 0, 0, $m, $d + 1, $y));
        } else {
            if ($server_time + $TZ_OFFSET * 10000 < 0) {
                $newdate = date("Ymd", mktime(3, 0, 0, $m, $d - 1, $y));
            }
        }
    }
    // if they have not set a preference yet...
    if ($DATE_FORMAT == "") {
        $DATE_FORMAT = "__month__ __dd__, __yyyy__";
    }
    if (empty($format)) {
        $format = $DATE_FORMAT;
    }
    $y = (int) ($newdate / 10000);
    $m = (int) ($newdate / 100) % 100;
    $d = $newdate % 100;
    $date = mktime(3, 0, 0, $m, $d, $y);
    $wday = strftime("%w", $date);
    if ($short_months) {
        $weekday = weekday_short_name($wday);
        $month = month_short_name($m - 1);
    } else {
        $weekday = weekday_name($wday);
        $month = month_name($m - 1);
    }
    $yyyy = $y;
    $yy = sprintf("%02d", $y %= 100);
    $ret = $format;
    $ret = str_replace("__yyyy__", $yyyy, $ret);
    $ret = str_replace("__yy__", $yy, $ret);
    $ret = str_replace("__month__", $month, $ret);
    $ret = str_replace("__mon__", $month, $ret);
    $ret = str_replace("__dd__", $d, $ret);
    $ret = str_replace("__mm__", $m, $ret);
    if ($show_weekday) {
        return "{$weekday}, {$ret}";
    } else {
        return $ret;
    }
}
Exemple #4
0
<?php

// year_nav_widget.php
// Displays the Year Navigation
$cols = 3;
// Number of Columns
?>


<table cellspacing="2" cellpadding="1" width="100%" border="0">
<?php 
for ($i = 1; $i <= 12; $i++) {
    $mon_str = month_short_name($i);
    if ($i - 1 == 0 || ($i - 1) % $cols == 0) {
        ?>
		<tr>
<?php 
    }
    if (SELECTED_DATE_MONTH == $i) {
        ?>
		<td align="center" valign="middle" class="BgcolorDull"><span class="FontSoftSmall"><b><?php 
        echo $mon_str;
        ?>
</b></span></td>
<?php 
    } else {
        $date = SELECTED_DATE_YEAR . '-' . sprintf("%02d", $i) . '-' . SELECTED_DATE_DAY;
        ?>
		<td align="center" valign="middle" class="BgcolorNormal"><span class="FontSoftSmall"><a 
			href="<?php 
        echo href_link(NAV_SCRIPT_NAME, 'date=' . $date . '&' . make_hidden_fields_workstring(array('view', 'loc')), 'NONSSL');
     echo "\n\t" . '<option value="' . $thisVal . '"';
     if ($_POST['dob_dd'] == $thisVal) {
         echo ' selected="selected"';
     }
     echo '>' . $thisVal . '</option>';
 }
 ?>
 </select>
 <select name="dob_mm"><?php 
 for ($i = 1; $i < 13; $i++) {
     $thisVal = str_pad($i, 2, '0', STR_PAD_LEFT);
     echo "\n\t" . '<option value="' . $thisVal . '"';
     if ($_POST['dob_mm'] == $thisVal) {
         echo ' selected="selected"';
     }
     echo '>' . month_short_name($i) . '</option>';
 }
 ?>
 </select>
 <select name="dob_yyyy"><?php 
 $thisYear = date('Y');
 $defaultVal = 1975;
 if (isset($_POST['dob_yyyy']) && $_POST['dob_yyyy'] != '') {
     $defaultVal = $_POST['dob_yyyy'];
 }
 for ($i = 1920; $i <= $thisYear; $i++) {
     echo "\n\t" . '<option value="' . $i . '"';
     if ($i == $defaultVal) {
         echo ' selected="selected"';
     }
     echo '>' . $i . '</option>';
:</label></td><td>
	<select name="modday">
		<?php 
$week_ago = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"));
$day = date("d", $week_ago);
for ($i = 1; $i <= 31; $i++) {
    echo "<option" . ($i == $day ? " selected=\"selected\"" : "") . ">{$i}</option>\n";
}
?>
	</select>
	<select name="modmonth">
		<?php 
$month = date("m", $week_ago);
$year = date("Y", $week_ago);
for ($i = 1; $i <= 12; $i++) {
    $m = month_short_name($i - 1);
    print "<option value=\"{$i}\"" . ($i == $month ? " selected=\"selected\"" : "") . ">{$m}</option>\n";
}
?>
	</select>
	<select name="modyear">
		<?php 
$year = date("Y", $week_ago);
for ($i = -1; $i < 5; $i++) {
    $y = date("Y") + $i;
    print "<option value=\"{$y}\"" . ($y == $year ? " selected=\"selected\"" : "") . ">{$y}</option>\n";
}
?>
	</select>
	<input type="button" onclick="selectDate('modday','modmonth','modyear')" value="<?php 
etranslate("Select");
<table cellspacing="1" cellpadding="1" width="100%" border="0">
  <tr>
	<td nowrap="nowrap" align="center" valign="middle" class="BgcolorNormal"><div class="FontSoftSmall">
	<select name="start_mon" class="FontSoftSmall">
<?php 
    for ($i = 1; $i <= 12; $i++) {
        // Defined 1-12
        ?>
	<option value="<?php 
        echo $i;
        ?>
"<?php 
        echo SELECTED_DATE_MONTH + 0 == $i ? ' selected="selected"' : '';
        ?>
><?php 
        echo month_short_name($i);
        ?>
</option>
<?php 
    }
    ?>
	</select>
	<select name="start_day" class="FontSoftSmall">
<?php 
    for ($i = 1; $i <= 31; $i++) {
        ?>
	<option value="<?php 
        echo $i;
        ?>
"<?php 
        echo SELECTED_DATE_DAY + 0 == $i ? ' selected="selected"' : '';
Exemple #8
0
    if ($i == 0) {
        // Previous Week Link
        ?>
			<a href="<?php 
        echo href_link(FILENAME_WEEK_VIEW, 'date=' . $previous_week_date . '&view=week&' . make_hidden_fields_workstring(array('loc')), 'NONSSL');
        ?>
"><img
			src="<?php 
        echo DIR_WS_IMAGES;
        ?>
/prev.gif" alt="Previous Week" align="top" /></a>
<?php 
    }
    ?>
			<?php 
    echo month_short_name($month);
    ?>
 <?php 
    echo occurence_name($day + 0);
    if ($i == 6) {
        // Next Week Link
        ?>
			<a href="<?php 
        echo href_link(FILENAME_WEEK_VIEW, 'date=' . $next_week_date . '&view=week&' . make_hidden_fields_workstring(array('loc')), 'NONSSL');
        ?>
"><img
			src="<?php 
        echo DIR_WS_IMAGES;
        ?>
/next.gif" alt="Next Week" align="top" /></a>
<?php