diff options
author | Chad Little <clittle@users.sourceforge.net> | 2002-09-24 19:03:20 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2002-09-24 19:03:20 +0000 |
commit | 27801f06818bac4a1c01fc0734ee0b63df9d6fdb (patch) | |
tree | f4aec937628802a7a6985e2c1db58531389c08ef /functions | |
parent | 71e3870fb7658565e6cf17fea3206bff9211d981 (diff) | |
download | phpicalendar-27801f06818bac4a1c01fc0734ee0b63df9d6fdb.tar.gz phpicalendar-27801f06818bac4a1c01fc0734ee0b63df9d6fdb.tar.bz2 phpicalendar-27801f06818bac4a1c01fc0734ee0b63df9d6fdb.zip |
Changed all files to reflect <?php when opening tags.
Diffstat (limited to 'functions')
-rw-r--r-- | functions/date_add.php | 2 | ||||
-rw-r--r-- | functions/date_functions.php | 2 | ||||
-rw-r--r-- | functions/overlapping_events.php | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/functions/date_add.php b/functions/date_add.php index 858bef3..6449943 100644 --- a/functions/date_add.php +++ b/functions/date_add.php @@ -1 +1 @@ -<?
/* From phpbuilder.net
http://www.phpbuilder.net/columns/akent20000610.php3?page=6
yyyy year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
n Minute
s Second
*/
function DateAdd ($interval, $number, $date) {
$date_time_array = getdate($date);
$hours = $date_time_array["hours"];
$minutes = $date_time_array["minutes"];
$seconds = $date_time_array["seconds"];
$month = $date_time_array["mon"];
$day = $date_time_array["mday"];
$year = $date_time_array["year"];
switch ($interval) {
case "yyyy":
$year +=$number;
break;
case "q":
$year +=($number*3);
break;
case "m":
$month +=$number;
break;
case "y":
case "d":
case "w":
$day+=$number;
break;
case "ww":
$day+=($number*7);
break;
case "h":
$hours+=$number;
break;
case "n":
$minutes+=$number;
break;
case "s":
$seconds+=$number;
break;
}
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
return $timestamp;
}
function sundayOfWeek($year,$month,$day) {
$linkDay = "$month/$day/$year";
$w = date("w", strtotime("$linkDay"));
$sow = date("Ymd", (strtotime("$linkDay")-$w*82800));
return $sow;
}
?>
\ No newline at end of file +<?php
/* From phpbuilder.net
http://www.phpbuilder.net/columns/akent20000610.php3?page=6
yyyy year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
n Minute
s Second
*/
function DateAdd ($interval, $number, $date) {
$date_time_array = getdate($date);
$hours = $date_time_array["hours"];
$minutes = $date_time_array["minutes"];
$seconds = $date_time_array["seconds"];
$month = $date_time_array["mon"];
$day = $date_time_array["mday"];
$year = $date_time_array["year"];
switch ($interval) {
case "yyyy":
$year +=$number;
break;
case "q":
$year +=($number*3);
break;
case "m":
$month +=$number;
break;
case "y":
case "d":
case "w":
$day+=$number;
break;
case "ww":
$day+=($number*7);
break;
case "h":
$hours+=$number;
break;
case "n":
$minutes+=$number;
break;
case "s":
$seconds+=$number;
break;
}
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
return $timestamp;
}
function sundayOfWeek($year,$month,$day) {
$linkDay = "$month/$day/$year";
$w = date("w", strtotime("$linkDay"));
$sow = date("Ymd", (strtotime("$linkDay")-$w*82800));
return $sow;
}
?>
\ No newline at end of file diff --git a/functions/date_functions.php b/functions/date_functions.php index 6fde3ad..a682afe 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -1 +1 @@ -<?
// date_functions.php
// functions for returning or comparing dates
// dateOfWeek() takes a date in Ymd and a day of week as iCal knows them
// (ie: SU, MO, TU, etc)and returns the date of that day.
// This function may be specific to WEEKLY recurring events.
function dateOfWeek($Ymd, $day) {
global $week_start_day;
if (!$week_start_day) $week_start_day = "Sunday";
$timestamp = strtotime($Ymd);
$sunday = strtotime((date("w",$timestamp)==0 ? "$week_start_day" : "last $week_start_day"), $timestamp);
if ($day == "SU") $day_longer = "sun";
elseif ($day == "MO") $day_longer = "mon";
elseif ($day == "TU") $day_longer = "tue";
elseif ($day == "WE") $day_longer = "wed";
elseif ($day == "TH") $day_longer = "thu";
elseif ($day == "FR") $day_longer = "fri";
elseif ($day == "SA") $day_longer = "sat";
return date("Ymd",strtotime($day_longer,$sunday));
}
// function to compare to dates in Ymd and return the number of weeks
// that differ between them. requires dateOfWeek()
function weekCompare($now, $then) {
global $week_start_day;
$day = substr($week_start_day, 0, 2);
$sun_now = dateOfWeek($now, $day);
$sun_then = dateOfWeek($then, $day);
$seconds_now = strtotime($sun_now);
$seconds_then = strtotime($sun_then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
$diff_weeks = $diff_days/7;
return $diff_weeks;
}
// function to compare to dates in Ymd and return the number of days
// that differ between them. requires dateOfWeek()
function dayCompare($now, $then) {
$seconds_now = strtotime($now);
$seconds_then = strtotime($then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
return $diff_days;
}
\ No newline at end of file +<?php
// date_functions.php
// functions for returning or comparing dates
// dateOfWeek() takes a date in Ymd and a day of week as iCal knows them
// (ie: SU, MO, TU, etc)and returns the date of that day.
// This function may be specific to WEEKLY recurring events.
function dateOfWeek($Ymd, $day) {
global $week_start_day;
if (!$week_start_day) $week_start_day = "Sunday";
$timestamp = strtotime($Ymd);
$sunday = strtotime((date("w",$timestamp)==0 ? "$week_start_day" : "last $week_start_day"), $timestamp);
if ($day == "SU") $day_longer = "sun";
elseif ($day == "MO") $day_longer = "mon";
elseif ($day == "TU") $day_longer = "tue";
elseif ($day == "WE") $day_longer = "wed";
elseif ($day == "TH") $day_longer = "thu";
elseif ($day == "FR") $day_longer = "fri";
elseif ($day == "SA") $day_longer = "sat";
return date("Ymd",strtotime($day_longer,$sunday));
}
// function to compare to dates in Ymd and return the number of weeks
// that differ between them. requires dateOfWeek()
function weekCompare($now, $then) {
global $week_start_day;
$day = substr($week_start_day, 0, 2);
$sun_now = dateOfWeek($now, $day);
$sun_then = dateOfWeek($then, $day);
$seconds_now = strtotime($sun_now);
$seconds_then = strtotime($sun_then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
$diff_weeks = $diff_days/7;
return $diff_weeks;
}
// function to compare to dates in Ymd and return the number of days
// that differ between them. requires dateOfWeek()
function dayCompare($now, $then) {
$seconds_now = strtotime($now);
$seconds_then = strtotime($then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
return $diff_days;
}
?>
\ No newline at end of file diff --git a/functions/overlapping_events.php b/functions/overlapping_events.php index be40031..3c311c4 100644 --- a/functions/overlapping_events.php +++ b/functions/overlapping_events.php @@ -1,4 +1,4 @@ -<? +<?php // function to determine the colspan for overlapping events // takes 2 parameters: index of event (in regards of column output) and number of overlapping events function eventWidth($ind, $overlaps) { |