Beispiel #1
0
function display_small_month($thismonth, $thisyear, $showyear)
{
    global $WEEK_START, $user, $login;
    if ($user != $login && !empty($user)) {
        $u_url = "&user={$user}";
    } else {
        $u_url = "";
    }
    echo "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"2\">";
    if ($WEEK_START == "1") {
        $wkstart = get_monday_before($thisyear, $thismonth, 1);
    } else {
        $wkstart = get_sunday_before($thisyear, $thismonth, 1);
    }
    $monthstart = mktime(2, 0, 0, $thismonth, 1, $thisyear);
    $monthend = mktime(2, 0, 0, $thismonth + 1, 0, $thisyear);
    echo "<TR><TD COLSPAN=\"7\" ALIGN=\"center\">" . "<A HREF=\"month.php?year={$thisyear}&month={$thismonth}" . $u_url . "\" CLASS=\"monthlink\">";
    echo month_name($thismonth - 1) . "</A></TD></TR>";
    echo "<TR>";
    if ($WEEK_START == 0) {
        echo "<TD><FONT SIZE=\"-3\">" . weekday_short_name(0) . "</TD>";
    }
    for ($i = 1; $i < 7; $i++) {
        echo "<TD><FONT SIZE=\"-3\">" . weekday_short_name($i) . "</TD>";
    }
    if ($WEEK_START == 1) {
        echo "<TD><FONT SIZE=\"-3\">" . weekday_short_name(0) . "</TD>";
    }
    for ($i = $wkstart; date("Ymd", $i) <= date("Ymd", $monthend); $i += 24 * 3600 * 7) {
        echo "<TR>";
        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 ALIGN=\"right\"><A HREF=\"day.php?date=" . date("Ymd", $date) . $u_url . "\" CLASS=\"dayofmonthyearview\">";
                echo "<FONT SIZE=\"-1\">" . date("j", $date) . "</A></FONT></TD>";
            } else {
                echo "<TD></TD>";
            }
        }
        // end for $j
        echo "</TR>";
    }
    // end for $i
    echo "</TABLE>";
}
Beispiel #2
0
    $events = read_events($viewusers[$i], $startdate, $enddate);
    $e_save[$i] = $events;
}
for ($j = 0; $j < 7; $j += $DAYS_PER_TABLE) {
    // since print_date_entries is rather stupid, we can swap the event data
    // around for users by changing what $events points to.
    $tdw = 12;
    // column width percent
    ?>

<table class="main" cellspacing="0" cellpadding="0">
<tr><th class="empty">&nbsp;</th>
<?php 
    for ($date = $wkstart, $h = 0; date("Ymd", $date) <= date("Ymd", $wkend); $date += 24 * 3600, $h++) {
        $wday = strftime("%w", $date);
        $weekday = weekday_short_name($wday);
        if (date("Ymd", $date) == date("Ymd", $today)) {
            echo "<th class=\"today\" style=\"width:{$tdw}%;\">";
        } else {
            echo "<th style=\"width:{$tdw}%;\">";
        }
        echo $weekday . " " . round(date("d", $date)) . "</th>\n";
    }
    echo "</tr>\n";
    for ($i = 0; $i < count($viewusers); $i++) {
        echo "\n<tr>\n";
        $user = $viewusers[$i];
        user_load_variables($user, "temp");
        echo "<th class=\"row\" style=\"width:{$tdw}%;\">{$tempfullname}</th>";
        for ($date = $wkstart, $h = 0; date("Ymd", $date) <= date("Ymd", $wkend); $date += 24 * 3600, $h++) {
            $wday = strftime("%w", $date);
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;
    }
}
?>
"><IMG SRC="rightarrowsmall.gif" WIDTH="18" HEIGHT="18" BORDER="0" ALT="<?php 
etranslate("Next");
?>
"></A></TD>
</TR>
<?php 
echo "<TR>";
if ($WEEK_START == 0) {
    echo "<TD><FONT SIZE=\"-1\">" . weekday_short_name(0) . "</TD>";
}
for ($i = 1; $i < 7; $i++) {
    echo "<TD><FONT SIZE=\"-1\">" . weekday_short_name($i) . "</TD>";
}
if ($WEEK_START == 1) {
    echo "<TD><FONT SIZE=\"-1\">" . weekday_short_name(0) . "</TD>";
}
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>";
}
$HeadX = '';
if ($auto_refresh == "Y" && !empty($auto_refresh_time)) {
    $refresh = $auto_refresh_time * 60;
    // convert to seconds
    $HeadX = "<meta http-equiv=\"refresh\" content=\"{$refresh}; url=week_details.php?{$u_url}" . "date={$startdate}{$caturl}\" />\n";
}
$INC = array('js/popups.php');
print_header($INC, $HeadX);
/* Pre-Load the repeated events for quckier access */
$repeated_events = read_repeated_events(strlen($user) ? $user : $login, $cat_id, $startdate);
/* Pre-load the non-repeating events for quicker access */
$events = read_events(strlen($user) ? $user : $login, $startdate, $enddate, $cat_id);
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] . " " . date_to_str(date("Ymd", $days[$i]), $DATE_FORMAT_MD, false);
}
?>

<div class="title">
<a title="Previous" class="prev" href="week_details.php?<?php 
echo $u_url;
?>
date=<?php 
echo date("Ymd", $prev) . $caturl;
?>
"><img src="leftarrow.gif" alt="Previous" /></a>
<a title="Next" class="next" href="week_details.php?<?php 
echo $u_url;
?>
Beispiel #6
0
</b></td>
<?php 
}
?>
</tr>
  <!-- rows -->
<?php 
$count = 0;
for ($row = 1; $row < 7; $row++) {
    ?>
  <tr>
<?php 
    reset($wdays_ind);
    foreach ($wdays_ind as $wday_ind) {
        $selected = SELECTED_DATE_DAY == $count + 1 ? 1 : 0;
        $count = $count > 0 || weekday_short_name($wday_ind) == $month_begin_wday ? $count + 1 : 0;
        if ($count && $count <= $days_in_the_month) {
            if ($selected) {
                ?>
				<td align="center" valign="middle" class="BgcolorDull"><span class="FontSoftSmall"><b><?php 
                echo $count;
                ?>
</b></span></td>
<?php 
            } else {
                $date = sprintf("%04d-%02d-%02d", SELECTED_DATE_YEAR, SELECTED_DATE_MONTH, $count);
                ?>
			<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');
                ?>
             }
         default:
             $rep_str .= $cal_frequency;
             break;
     }
 }
 $rep_str .= ' ';
 switch ($cal_type) {
     case "daily":
         $rep_str .= translate("Day");
         break;
     case "weekly":
         $rep_str .= translate("Week");
         for ($i = 0; $i <= 7; $i++) {
             if (substr($cal_days, $i, 1) == "y") {
                 $rep_str .= ", " . weekday_short_name($i);
             }
         }
         break;
     case "monthlyByDay":
     case "monthlyByDayR":
         if ($cal_frequency == 12) {
             $rep_str .= month_name($thismonth - 1) . " / ";
         } else {
             $rep_str .= translate("Month") . " / ";
         }
         $days_this_month = $thisyear % 4 == 0 ? $ldays_per_month[$thismonth] : $days_per_month[$thismonth];
         if ($cal_type == 'monthlyByDay') {
             $dow1 = date("w", mktime(3, 0, 0, $thismonth, 1, $thisyear));
             $days_in_first_week = 7 - $dow1;
             $whichWeek = ceil($thisday / 7);
?>
"><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";
Beispiel #9
0
    ?>
" CLASS="monthlink"><img src="rightarrowsmall.gif" width="18" height="18" border="0" alt="<?php 
    etranslate("Next");
    ?>
"></A></TD>
</TR>
<?php 
    echo "<TR>";
    if ($WEEK_START == 0) {
        echo "<TD BGCOLOR=\"{$CELLBG}\"><FONT SIZE=\"-3\">" . weekday_short_name(0) . "</TD>";
    }
    for ($i = 1; $i < 7; $i++) {
        echo "<TD BGCOLOR=\"{$CELLBG}\"><FONT SIZE=\"-3\">" . weekday_short_name($i) . "</TD>";
    }
    if ($WEEK_START == 1) {
        echo "<TD BGCOLOR=\"{$CELLBG}\"><FONT SIZE=\"-3\">" . weekday_short_name(0) . "</TD>";
    }
    echo "</TR>\n";
    // generate values for first day and last day of month
    $monthstart = mktime(3, 0, 0, $thismonth, 1, $thisyear);
    $monthend = mktime(3, 0, 0, $thismonth + 1, 0, $thisyear);
    if ($WEEK_START == "1") {
        $wkstart = get_monday_before($thisyear, $thismonth, 1);
    } else {
        $wkstart = get_sunday_before($thisyear, $thismonth, 1);
    }
    $wkend = $wkstart + 3600 * 24 * 7;
    for ($i = $wkstart; date("Ymd", $i) <= date("Ymd", $monthend); $i += 24 * 3600 * 7) {
        for ($i = $wkstart; date("Ymd", $i) <= date("Ymd", $monthend); $i += 24 * 3600 * 7) {
            echo "<TR ALIGN=\"center\">\n";
            for ($j = 0; $j < 7; $j++) {