本文整理汇总了PHP中dateOfWeek函数的典型用法代码示例。如果您正苦于以下问题:PHP dateOfWeek函数的具体用法?PHP dateOfWeek怎么用?PHP dateOfWeek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dateOfWeek函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_weeks
function list_weeks()
{
global $getdate, $this_year, $cal, $dateFormat_week_jump, $phpiCal_config;
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$check_week = strtotime($getdate);
$start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("{$this_year}-01-01")), $phpiCal_config->week_start_day));
$end_week_time = $start_week_time + 6 * 25 * 60 * 60;
$return = '';
do {
$weekdate = date("Ymd", $start_week_time);
$select_week1 = localizeDate($dateFormat_week_jump, $start_week_time);
$select_week2 = localizeDate($dateFormat_week_jump, $end_week_time);
if ($check_week >= $start_week_time && $check_week <= $end_week_time) {
$return .= "<option value=\"week.php?cal={$cal}&getdate={$weekdate}\" selected=\"selected\">{$select_week1} - {$select_week2}</option>\n";
} else {
$return .= "<option value=\"week.php?cal={$cal}&getdate={$weekdate}\">{$select_week1} - {$select_week2}</option>\n";
}
$start_week_time = strtotime("+1 week", $start_week_time);
$end_week_time = $start_week_time + 6 * 25 * 60 * 60;
} while (date("Y", $start_week_time) <= $this_year);
return $return;
}
示例2: weekCompare
function weekCompare($now, $then)
{
global $week_start_day;
$sun_now = dateOfWeek($now, "Sunday");
$sun_then = dateOfWeek($then, "Sunday");
$seconds_now = strtotime($sun_now);
$seconds_then = strtotime($sun_then);
$diff_weeks = round(($seconds_now - $seconds_then) / (60 * 60 * 24 * 7));
return $diff_weeks;
}
示例3: weekCompare
function weekCompare($now, $then)
{
global $week_start_day;
$sun_now = dateOfWeek($now, $week_start_day);
$sun_then = dateOfWeek($then, $week_start_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;
}
示例4: date
$todate = $getdate;
$fromdate = date("Ymd", strtotime($getdate) - $_GET['days'] * 60 * 60 * 24);
$theview = $_GET['days'] . " days before " . date('n/d/Y', strtotime($todate));
break;
case 'range':
if (isset($_GET['from'])) {
$fromdate = $_GET['from'];
} else {
$fromdate = $getdate;
}
$todate = $_GET['to'];
$theview = date('n/d/Y', strtotime($fromdate)) . '-' . date('n/d/Y', strtotime($todate));
break;
default:
#default to week
$fromdate = dateOfWeek($getdate, 'Sunday');
$todate = $fromdate + 6;
$theview = "";
}
#need to give ical_parser the most distant date to correctly set up master_array.
$getdate = $todate;
#echo "from:$fromdate to:$todate";
#Note that ical_parser supplies cal_displayname.
include BASE . 'functions/ical_parser.php';
$events_count = 0;
// calculate a value for Last Modified and ETag
$cal = implode(",", $cals);
//get filemtime from master array
$filemod = 0;
#default to start of unix era, overwrite with most recent mtime from master array
foreach ($master_array['-4'] as $calinfo) {
示例5: draw_month
function draw_month($template_p, $offset = '+0', $type)
{
global $template, $getdate, $master_array, $this_year, $this_month, $unique_colors, $dateFormat_month, $week_start_day, $cal, $minical_view, $month_event_lines, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat;
preg_match("!<\\!-- loop weekday on -->(.*)<\\!-- loop weekday off -->!is", $template_p, $match1);
preg_match("!<\\!-- loop monthdays on -->(.*)<\\!-- loop monthdays off -->!is", $template_p, $match2);
preg_match("!<\\!-- switch notthismonth on -->(.*)<\\!-- switch notthismonth off -->!is", $template_p, $match3);
preg_match("!<\\!-- switch istoday on -->(.*)<\\!-- switch istoday off -->!is", $template_p, $match4);
preg_match("!<\\!-- switch ismonth on -->(.*)<\\!-- switch ismonth off -->!is", $template_p, $match5);
preg_match("!<\\!-- loop monthweeks on -->(.*)<\\!-- loop monthdays on -->!is", $template_p, $match6);
preg_match("!<\\!-- loop monthdays off -->(.*)<\\!-- loop monthweeks off -->!is", $template_p, $match7);
$loop_wd = trim($match1[1]);
$loop_md = trim($match2[1]);
$t_month[0] = trim($match3[1]);
$t_month[1] = trim($match4[1]);
$t_month[2] = trim($match5[1]);
$startweek = trim($match6[1]);
$endweek = trim($match7[1]);
if ($type != 'medium') {
$fake_getdate_time = strtotime($this_year . '-' . $this_month . '-15');
$fake_getdate_time = strtotime("{$offset} month", $fake_getdate_time);
} else {
$fake_getdate_time = strtotime($this_year . '-' . $offset . '-15');
}
$minical_month = date("m", $fake_getdate_time);
$minical_year = date("Y", $fake_getdate_time);
$first_of_month = $minical_year . $minical_month . "01";
$first_of_year = $minical_year . "0101";
// Add links in to the month/year views.
$dateFormat_month_local = str_replace("%B", "<a class=\"ps3\" href=\"month.php?cal={$cal}&getdate={$first_of_month}\">%B</a>", $dateFormat_month);
$dateFormat_month_local = str_replace("%Y", "<a class=\"ps3\" href=\"year.php?cal={$cal}&getdate={$first_of_year}\">%Y</a>", $dateFormat_month_local);
//$start_day = strtotime($week_start_day);
$start_day = strtotime(dateOfWeek($getdate, $week_start_day));
$month_title = localizeDate($dateFormat_month_local, $fake_getdate_time);
$month_date = date('Ymd', $fake_getdate_time);
if ($type == 'small') {
$langtype = $daysofweekreallyshort_lang;
} elseif ($type == 'medium') {
$langtype = $daysofweekshort_lang;
} elseif ($type == 'large') {
$langtype = $daysofweek_lang;
}
for ($i = 0; $i < 7; $i++) {
$day_num = date("w", $start_day);
$weekday = $langtype[$day_num];
$start_day = strtotime("+1 day", $start_day);
$loop_tmp = str_replace('{LOOP_WEEKDAY}', $weekday, $loop_wd);
$weekday_loop .= $loop_tmp;
}
$start_day = strtotime(dateOfWeek($first_of_month, $week_start_day));
$i = 0;
$whole_month = TRUE;
do {
if ($i == 0) {
$middle .= $startweek;
}
$i++;
#$temp_middle = $loop_md;
$switch = array('ALLDAY' => '', 'CAL' => $cal, 'MINICAL_VIEW' => $minical_view);
$check_month = date("m", $start_day);
$daylink = date("Ymd", $start_day);
$switch['DAY'] = date("j", $start_day);
$switch['DAYLINK'] = date("Ymd", $start_day);
if ($check_month != $minical_month) {
$temp = $t_month[0];
} elseif ($daylink == $getdate) {
$temp = $t_month[1];
} else {
$temp = $t_month[2];
}
if (isset($master_array[$daylink])) {
if ($type != 'small') {
foreach ($master_array[$daylink] as $cal_time => $event_times) {
foreach ($event_times as $uid => $val) {
$event_calno = $val['calnumber'];
$event_calno = ($event_calno - 1) % $unique_colors + 1;
if (!isset($val['event_start'])) {
if ($type == 'large') {
$switch['ALLDAY'] .= '<div class="V10"><img src="templates/' . $template . '/images/monthdot_' . $event_calno . '.gif" alt="" width="9" height="9" border="0" />';
$switch['ALLDAY'] .= openevent($daylink, $cal_time, $uid, $val, $month_event_lines, 15, 'psf');
$switch['ALLDAY'] .= '</div>';
} else {
$switch['ALLDAY'] .= '<img src="templates/' . $template . '/images/allday_dot.gif" alt=" " width="11" height="10" border="0" />';
}
} else {
$start2 = date($timeFormat_small, $val['start_unixtime']);
if ($type == 'large') {
$switch['EVENT'] .= '<div class="V9"><img src="templates/' . $template . '/images/monthdot_' . $event_calno . '.gif" alt="" width="9" height="9" border="0" />';
$switch['EVENT'] .= openevent($daylink, $cal_time, $uid, $val, $month_event_lines, 10, 'ps3', "{$start2} ") . '<br />';
$switch['EVENT'] .= '</div>';
} else {
$switch['EVENT'] = '<img src="templates/' . $template . '/images/event_dot.gif" alt=" " width="11" height="10" border="0" />';
}
}
}
}
}
}
$switch['EVENT'] = isset($switch['EVENT']) ? $switch['EVENT'] : '';
$switch['ALLDAY'] = isset($switch['ALLDAY']) ? $switch['ALLDAY'] : '';
#print_r($switch);
//.........这里部分代码省略.........
示例6: draw_month
function draw_month($template_p, $offset = '+0', $type)
{
global $phpiCal_config, $getdate, $master_array, $this_year, $this_month, $dateFormat_month, $cal, $minical_view, $month_event_lines, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat;
$unique_colors = $phpiCal_config->unique_colors;
preg_match('!<\\!-- loop weekday on -->(.*)<\\!-- loop weekday off -->!Uis', $template_p, $match1);
preg_match('!<\\!-- loop monthdays on -->(.*)<\\!-- loop monthdays off -->!Uis', $template_p, $match2);
preg_match('!<\\!-- switch notthismonth on -->(.*)<\\!-- switch notthismonth off -->!Uis', $template_p, $match3);
preg_match('!<\\!-- switch istoday on -->(.*)<\\!-- switch istoday off -->!Uis', $template_p, $match4);
preg_match('!<\\!-- switch ismonth on -->(.*)<\\!-- switch ismonth off -->!Uis', $template_p, $match5);
preg_match('!<\\!-- loop monthweeks on -->(.*)<\\!-- loop monthdays on -->!Uis', $template_p, $match6);
preg_match('!<\\!-- loop monthdays off -->(.*)<\\!-- loop monthweeks off -->!Uis', $template_p, $match7);
$loop_wd = trim($match1[1]);
$loop_md = trim($match2[1]);
$t_month[0] = trim($match3[1]);
$t_month[1] = trim($match4[1]);
$t_month[2] = trim($match5[1]);
$startweek = trim($match6[1]);
$endweek = trim($match7[1]);
if ($type != 'medium') {
$fake_getdate_time = strtotime($this_year . '-' . $this_month . '-15');
$fake_getdate_time = strtotime($offset . ' month', $fake_getdate_time);
} else {
$fake_getdate_time = strtotime($this_year . '-' . $offset . '-15');
}
$minical_month = date('m', $fake_getdate_time);
$minical_year = date('Y', $fake_getdate_time);
$first_of_month = $minical_year . $minical_month . '01';
$first_of_year = $minical_year . '0101';
// Add links in to the month/year views.
$dateFormat_month_local = str_replace('%B', '<a class="ps3" href="month.php?cal=' . $cal . '&getdate=' . $first_of_month . '&{P_LINK}">%B</a>', $dateFormat_month);
$dateFormat_month_local = str_replace('%Y', '<a class="ps3" href="year.php?cal=' . $cal . '&getdate=' . $first_of_year . '&{P_LINK}">%Y</a>', $dateFormat_month_local);
//$start_day = strtotime($phpiCal_config->week_start_day);
$start_day = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
$month_title = localizeDate($dateFormat_month_local, $fake_getdate_time);
$month_date = date('Ymd', $fake_getdate_time);
if ($type == 'small') {
$langtype = $daysofweekreallyshort_lang;
} elseif ($type == 'medium') {
$langtype = $daysofweekshort_lang;
} elseif ($type == 'large') {
$langtype = $daysofweek_lang;
}
$weekday_loop = '';
$middle = '';
for ($i = 0; $i < $phpiCal_config->week_length; $i++) {
$day_num = date('w', $start_day);
$weekday = $langtype[$day_num];
$start_day = strtotime('+1 day', $start_day);
$loop_tmp = str_replace('{LOOP_WEEKDAY}', $weekday, $loop_wd);
$weekday_loop .= $loop_tmp;
}
$start_day = strtotime(dateOfWeek($first_of_month, $phpiCal_config->week_start_day));
$i = 0;
$whole_month = TRUE;
do {
if ($i == 0) {
$middle .= $startweek;
}
$i++;
#$temp_middle = $loop_md;
$switch = array('ALLDAY' => '', 'CAL' => $cal, 'MINICAL_VIEW' => $minical_view);
$check_month = date('m', $start_day);
$daylink = date('Ymd', $start_day);
$switch['DAY'] = date('j', $start_day);
$switch['DAYLINK'] = date('Ymd', $start_day);
if ($check_month != $minical_month) {
$temp = $t_month[0];
} elseif ($daylink == $getdate) {
$temp = $t_month[1];
} else {
$temp = $t_month[2];
}
$switch['ALLDAY'] = $switch['EVENT'] = '';
if (isset($master_array[$daylink]) && $i <= $phpiCal_config->week_length) {
if ($type != 'small') {
foreach ($master_array[$daylink] as $cal_time => $event_times) {
foreach ($event_times as $uid => $val) {
if (!isset($val['calnumber'])) {
continue;
}
if ($phpiCal_config->month_locations == 'yes' && isset($val['location']) && !empty($val['location'])) {
$location = '<br /><span style="font-size: 95%">' . sanitizeForWeb(stripslashes(urldecode($val['location']))) . '</span>';
} else {
$location = '';
}
$event_calno = $val['calnumber'];
$event_calno = ($event_calno - 1) % $unique_colors + 1;
if ($cal_time == -1) {
if ($type == 'large') {
$switch['ALLDAY'] .= '<div class="V10"><img src="templates/' . $phpiCal_config->template . '/images/monthdot_' . $event_calno . '.gif" alt="" width="9" height="9" border="0" />';
$switch['ALLDAY'] .= openevent($daylink, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 15, 'psf');
$switch['ALLDAY'] .= $location . '</div>';
} else {
$switch['ALLDAY'] = '<img src="templates/' . $phpiCal_config->template . '/images/allday_dot.gif" alt=" " width="11" height="10" border="0" />';
}
} else {
$start2 = date($timeFormat_small, $val['start_unixtime']);
if ($type == 'large') {
$switch['EVENT'] .= '<div class="V9"><img src="templates/' . $phpiCal_config->template . '/images/monthdot_' . $event_calno . '.gif" alt="" width="9" height="9" border="0" />';
$switch['EVENT'] .= openevent($daylink, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 10, 'ps3', '<span style="font-weight: bold;">' . $start2 . '</span> ');
//.........这里部分代码省略.........
示例7: strtotime
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<?php
$start_day = strtotime($week_start_day);
echo '<tr>';
for ($i = 0; $i < 7; $i++) {
$day_num = date("w", $start_day);
$day = $daysofweekreallyshort_lang[$day_num];
echo '<td align="center" class="G10BOLD">' . $day . '</td>';
$start_day = strtotime("+1 day", $start_day);
}
echo '</tr>';
$minical_time = strtotime("+1 month", $fake_getdate_time);
$minical_month = date("m", $minical_time);
$minical_year = date("Y", $minical_time);
$first_of_month = $minical_year . $minical_month . "01";
$start_day = strtotime(dateOfWeek($first_of_month, $week_start_day));
$i = 0;
$whole_month = TRUE;
$num_of_events = 0;
do {
$day = date("j", $start_day);
$daylink = date("Ymd", $start_day);
$check_month = date("m", $start_day);
if ($check_month != $minical_month) {
$day = '<font class="G10G">' . $day . '</font>';
}
if ($i == 0) {
echo "<tr>\n";
}
if (isset($master_array["{$daylink}"]) && $check_month == $minical_month) {
echo '<td width="22" align="center" class="G10B">';
示例8: ereg
<?php
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$check_week = strtotime($getdate);
$start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("{$this_year}-01-01")), $week_start_day));
$end_week_time = $start_week_time + 6 * 25 * 60 * 60;
print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">\n";
// build the <option> tags
do {
$weekdate = date("Ymd", $start_week_time);
$select_week1 = localizeDate($dateFormat_week_jump, $start_week_time);
$select_week2 = localizeDate($dateFormat_week_jump, $end_week_time);
if ($check_week >= $start_week_time && $check_week <= $end_week_time) {
print "<option value=\"week.php?cal={$cal}&getdate={$weekdate}\" selected>{$select_week1} - {$select_week2}</option>\n";
} else {
print "<option value=\"week.php?cal={$cal}&getdate={$weekdate}\">{$select_week1} - {$select_week2}</option>\n";
}
$start_week_time = strtotime("+1 week", $start_week_time);
$end_week_time = $start_week_time + 6 * 25 * 60 * 60;
} while (date("Y", $start_week_time) <= $this_year);
// finish <select>
print "</select>";
示例9: switch
switch ($phpiCal_config->minical_view) {
case 'day':
case 'week':
case 'month':
$minical_view = $phpiCal_config->minical_view;
break;
}
$starttime = "0500";
$weekstart = 1;
$unix_time = strtotime($getdate);
$today_today = date('Ymd', time() + $phpiCal_config->second_offset);
$next_week = date("Ymd", strtotime("+1 week", $unix_time));
$prev_week = date("Ymd", strtotime("-1 week", $unix_time));
$next_day = date('Ymd', strtotime("+1 day", $unix_time));
$prev_day = date('Ymd', strtotime("-1 day", $unix_time));
$start_week_time = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
$end_week_time = $start_week_time + ($phpiCal_config->week_length - 1) * 25 * 60 * 60;
$start_week = localizeDate($dateFormat_week, $start_week_time);
$end_week = localizeDate($dateFormat_week, $end_week_time);
$display_date = "{$start_week} - {$end_week}";
$sidebar_date = localizeDate($dateFormat_week_list, $unix_time);
// For the side months
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
// select for calendars
$available = availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED);
$list_icals = display_ical_list($available);
$list_years = list_years();
$list_months = list_months();
示例10: strtoupper
$recur_data[] = $next_date_time;
break;
case 'WEEKLY':
// Populate $byday with the default day if it's not set.
if (!isset($byday)) {
$byday[] = strtoupper(substr(date('D', $start_date_time), 0, 2));
}
if (is_array($byday)) {
foreach ($byday as $day) {
$day = two2threeCharDays($day);
#need to find the first day of the appropriate week.
#dateOfweek uses weekstartday as a global variable. This has to be changed to $wkst,
#but then needs to be reset for other functions
$week_start_day_tmp = $week_start_day;
$week_start_day = $wkst3char;
$the_sunday = dateOfWeek(date("Ymd", $next_range_time), $wkst3char);
$next_date_time = strtotime($day, strtotime($the_sunday)) + 12 * 60 * 60;
$week_start_day = $week_start_day_tmp;
#see above reset to global value
#reset $next_range_time to first instance in this week.
if ($next_date_time < $next_range_time) {
$next_range_time = $next_date_time;
}
// Since this renders events from $next_range_time to $next_range_time + 1 week, I need to handle intervals
// as well. This checks to see if $next_date_time is after $day_start (i.e., "next week"), and thus
// if we need to add $interval weeks to $next_date_time.
if ($next_date_time > strtotime($week_start_day, $next_range_time) && $interval > 1) {
# $next_date_time = strtotime('+'.($interval - 1).' '.$freq_type, $next_date_time);
}
$recur_data[] = $next_date_time;
}
示例11: icalToArray
//.........这里部分代码省略.........
if ($count > 1 && $number > 1) {
$count = 1 + ($count - 1) * $number;
}
$count_to = 0;
// start at the $start_range and go until we hit the end of our range.
if (!isset($wkst)) {
$wkst = 'SU';
}
$wkst3char = two2threeCharDays($wkst);
while ($next_range_time >= $start_range_time_tmp && $next_range_time <= $end_range_time_tmp && $count_to != $count) {
$func = $freq_type . 'Compare';
$diff = $func(date('Ymd', $next_range_time), $start_date);
if ($diff < $count) {
if ($diff % $number == 0) {
$interval = $number;
switch ($rrule_array['FREQ']) {
case 'DAILY':
$next_date_time = $next_range_time;
$recur_data[] = $next_date_time;
break;
case 'WEEKLY':
// Populate $byday with the default day if it's not set.
if (!isset($byday)) {
$byday[] = strtoupper(substr(date('D', $start_date_time), 0, 2));
}
if (is_array($byday)) {
foreach ($byday as $day) {
$day = two2threeCharDays($day);
#need to find the first day of the appropriate week.
#dateOfweek uses weekstartday as a global variable. This has to be changed to $wkst,
#but then needs to be reset for other functions
$week_start_day_tmp = $week_start_day;
$week_start_day = $wkst3char;
$the_sunday = dateOfWeek(date("Ymd", $next_range_time), $wkst3char);
$next_date_time = strtotime($day, strtotime($the_sunday)) + 12 * 60 * 60;
$week_start_day = $week_start_day_tmp;
#see above reset to global value
#reset $next_range_time to first instance in this week.
if ($next_date_time < $next_range_time) {
$next_range_time = $next_date_time;
}
// Since this renders events from $next_range_time to $next_range_time + 1 week, I need to handle intervals
// as well. This checks to see if $next_date_time is after $day_start (i.e., "next week"), and thus
// if we need to add $interval weeks to $next_date_time.
if ($next_date_time > strtotime($week_start_day, $next_range_time) && $interval > 1) {
# $next_date_time = strtotime('+'.($interval - 1).' '.$freq_type, $next_date_time);
}
$recur_data[] = $next_date_time;
}
}
break;
case 'MONTHLY':
if (empty($bymonth)) {
$bymonth = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
}
$next_range_time = strtotime(date('Y-m-01', $next_range_time));
$next_date_time = $next_date_time;
if (isset($bysetpos)) {
/* bysetpos code from dustinbutler
start on day 1 or last day.
if day matches any BYDAY the count is incremented.
SETPOS = 4, need 4th match
SETPOS = -1, need 1st match
*/
$year = date('Y', $next_range_time);
$month = date('m', $next_range_time);
示例12: switch
if ($diff % $number == 0) {
$interval = $number;
switch ($rrule_array['FREQ']) {
case 'DAILY':
$next_date_time = $next_range_time;
$recur_data[] = $next_date_time;
break;
case 'WEEKLY':
if (!isset($byday)) {
$next_date = dateOfWeek(date('Ymd', $next_range_time), $bd);
$next_date_time = strtotime($next_date);
$recur_data[] = $next_date_time;
} elseif (is_array($byday)) {
foreach ($byday as $day) {
$day = two2threeCharDays($day);
$next_date = dateOfWeek(date('Ymd', $next_range_time), $day);
$next_date_time = strtotime($next_date);
$recur_data[] = $next_date_time;
}
}
break;
case 'MONTHLY':
if (!isset($bymonth)) {
$bymonth = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
}
$next_range_time = strtotime(date('Y-m-01', $next_range_time));
if (isset($bymonthday) && !isset($byday)) {
foreach ($bymonthday as $day) {
$year = date('Y', $next_range_time);
$month = date('m', $next_range_time);
if (checkdate($month, $day, $year)) {
示例13: mktime
}
$next_month_time = mktime(0, 0, 0, $next_month_month, $next_month_day, $next_month_year);
// find out last month
$prev_month_month = $this_month - 1 == '0' ? '12' : $this_month - 1;
$prev_month_day = $this_day;
$prev_month_year = $prev_month_month == '12' ? $this_year - 1 : $this_year;
while (!checkdate($prev_month_month, $prev_month_day, $prev_month_year)) {
$prev_month_day--;
}
$prev_month_time = mktime(0, 0, 0, $prev_month_month, $prev_month_day, $prev_month_year);
$next_month = date("Ymd", $next_month_time);
$prev_month = date("Ymd", $prev_month_time);
$display_date = localizeDate($dateFormat_month, $unix_time);
$parse_month = date("Ym", $unix_time);
$first_of_month = $this_year . $this_month . "01";
$start_month_day = dateOfWeek($first_of_month, $phpiCal_config->week_start_day);
$thisday2 = localizeDate($dateFormat_week_list, $unix_time);
$num_of_events2 = 0;
// select for calendars
$available = availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED);
$list_icals = display_ical_list($available);
$list_years = list_years();
$list_months = list_months();
$list_weeks = list_weeks();
$list_jumps = list_jumps();
$list_calcolors = list_calcolors();
$list_icals_pick = display_ical_list($available, TRUE);
// login/logout
$is_logged_in = $username != '' && !$invalid_login ? true : false;
$show_user_login = !$is_logged_in && $phpiCal_config->allow_login == 'yes';
$login_querys = login_querys();
示例14: expand_byday
function expand_byday($time)
{
global $freq_type, $byday, $bymonth, $byweekno, $wkst3char, $year, $month, $start_unixtime, $summary;
if (empty($byday)) {
return array($time);
}
$times = array();
$the_sunday = dateOfWeek(date('Ymd', $time), $wkst3char);
foreach ($byday as $key => $day) {
/* set $byday_arr
[0] => byday string, e.g. 4TH
[1] => sign/modifier
[2] => 4 number
[3] => TH day abbr
*/
ereg('([-\\+]{0,1})?([0-9]+)?([A-Z]{2})', $day, $byday_arr);
$on_day = two2threeCharDays($byday_arr[3]);
switch ($freq_type) {
case 'week':
#need to find the first day of the appropriate week.
$next_date_time = strtotime('this ' . $on_day, strtotime($the_sunday)) + 12 * 60 * 60;
$times[] = $next_date_time;
break;
case 'month':
$time = mktime(12, 0, 0, $month, 1, $year);
// FIXME: Is this supposed to fall through?
// FIXME: Is this supposed to fall through?
case 'year':
if (empty($byweekno)) {
$week_arr = array(1, 2, 3, 4, 5);
if (isset($byday_arr[2]) && $byday_arr[2] != '') {
$week_arr = array($byday_arr[2]);
}
$month_start = strtotime(date('Ym01', $time)) - 24 * 60 * 60;
$month_end = strtotime(date('Ymt', $time)) + 36 * 60 * 60;
if ($freq_type == 'year' && empty($bymonth)) {
$month_start = mktime(12, 0, 0, 1, 0, $year);
$month_end = mktime(12, 0, 0, 1, 1, $year + 1);
}
$month_start_day = strtolower(date('D', $month_start));
foreach ($week_arr as $week) {
if ($byday_arr[1] == '-') {
$next_date_time = strtotime($byday_arr[1] . $week . $on_day, $month_end);
} else {
# we need this special offset in case the event day coincides with the month start day
# eg: month starts on a Sunday, our event is the Nth Sunday of the month... without this
# special offset, the event will be added to the (N+1)th Sunday of the month
$special_offset = $month_start_day == $on_day ? 24 * 60 * 60 : 0;
$next_date_time = strtotime($byday_arr[1] . $week . $on_day, $month_start + $special_offset);
}
# check that we're still in the same month
if (date('m', $next_date_time) == date('m', $time)) {
$times[] = $next_date_time;
}
}
} else {
# byweekno should act like freq_type = week
$next_date_time = strtotime('this ' . $on_day, strtotime($the_sunday)) + 12 * 60 * 60;
$times[] = $next_date_time;
}
break;
default:
$month_start = strtotime(date('Ym01', $time));
$next_date_time = strtotime($byday_arr[1] . $byday_arr[2] . $on_day, $month_start);
break;
}
}
return $times;
}
示例15: mktime
}
$next_month_time = mktime(0, 0, 0, $next_month_month, $next_month_day, $next_month_year);
// find out last month
$prev_month_month = $this_month - 1 == '0' ? '12' : $this_month - 1;
$prev_month_day = $this_day;
$prev_month_year = $prev_month_month == '12' ? $this_year - 1 : $this_year;
while (!checkdate($prev_month_month, $prev_month_day, $prev_month_year)) {
$prev_month_day--;
}
$prev_month_time = mktime(0, 0, 0, $prev_month_month, $prev_month_day, $prev_month_year);
$next_month = date("Ymd", $next_month_time);
$prev_month = date("Ymd", $prev_month_time);
$display_date = localizeDate($dateFormat_month, $unix_time);
$parse_month = date("Ym", $unix_time);
$first_of_month = $this_year . $this_month . "01";
$start_month_day = dateOfWeek($first_of_month, $week_start_day);
$thisday2 = localizeDate($dateFormat_week_list, $unix_time);
$num_of_events2 = 0;
function outputSingleDayEvents($daysEvents, $dayOfWeek, $daylink)
{
echo '<div class="single-day" id="day-' . $daylink . '">';
usort($daysEvents, cmpEventLength);
foreach ($daysEvents as $event) {
if ($event != null) {
displayEvent($event);
}
}
echo '</div>';
}
function cmpEventLength($a, $b)
{