本文整理汇总了PHP中is_dst函数的典型用法代码示例。如果您正苦于以下问题:PHP is_dst函数的具体用法?PHP is_dst怎么用?PHP is_dst使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_dst函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_dst
}
# ensure that $morningstarts_minutes defaults to zero if not set
if (empty($morningstarts_minutes)) {
$morningstarts_minutes = 0;
}
# Define the start and end of each day of the week in a way which is not
# affected by daylight saving...
for ($j = 0; $j <= $num_of_days - 1; $j++) {
# are we entering or leaving daylight saving
# dst_change:
# -1 => no change
# 0 => entering DST
# 1 => leaving DST
$dst_change[$j] = is_dst($month, $day + $j, $year);
$am7[$j] = mktime($morningstarts, $morningstarts_minutes, 0, $month, $day + $j, $year, is_dst($month, $day + $j, $year, $morningstarts));
$pm7[$j] = mktime($eveningends, $eveningends_minutes, 0, $month, $day + $j, $year, is_dst($month, $day + $j, $year, $eveningends));
}
if ($pview != 1) {
# Table with areas, rooms, minicals.
echo "<table width=\"100%\"><tr>";
$this_area_name = "";
$this_room_name = "";
# Show all areas
echo "<td width=\"30%\"><u>" . get_vocab("areas") . "</u><br>";
}
# show either a select box or the normal html list
if ($area_list_format == "select") {
echo make_area_select_html('week.php', $area, $year, $month, $day);
# from functions.inc
$this_area_name = sql_query1("select area_name from {$tbl_area} where id={$area}");
$this_room_name = sql_query1("select room_name from {$tbl_room} where id={$room}");
示例2: is_dst
}
# Define the start and end of each day of the month in a way which is not
# affected by daylight saving...
for ($j = 1; $j <= $days_in_month; $j++) {
# are we entering or leaving daylight saving
# dst_change:
# -1 => no change
# 0 => entering DST
# 1 => leaving DST
$dst_change[$j] = is_dst($month, $j, $year);
if (empty($enable_periods)) {
$midnight[$j] = mktime(0, 0, 0, $month, $j, $year, is_dst($month, $j, $year, 0));
$midnight_tonight[$j] = mktime(23, 59, 59, $month, $j, $year, is_dst($month, $j, $year, 23));
} else {
$midnight[$j] = mktime(12, 0, 0, $month, $j, $year, is_dst($month, $j, $year, 0));
$midnight_tonight[$j] = mktime(12, count($periods), 59, $month, $j, $year, is_dst($month, $j, $year, 23));
}
}
if ($pview != 1) {
# Table with areas, rooms, minicals.
echo "<table width=\"100%\"><tr>";
$this_area_name = "";
$this_room_name = "";
# Show all areas
echo "<td width=\"30%\"><u>" . get_string('areas', 'block_mrbs') . "</u><br>";
}
# show either a select box or the normal html list
if ($area_list_format == "select") {
echo make_area_select_html('month.php', $area, $year, $month, $day);
# from functions.php
$this_area_name = sql_query1("select area_name from {$tbl_area} where id={$area}");
示例3: mktime
$starttime = mktime($morningstarts, 0, 0, $month, $day, $year, is_dst($month, $day, $year));
$end_minutes = $eveningends_minutes + $morningstarts_minutes;
$eveningends_minutes > 59 ? $end_minutes += 60 : '';
$endtime = mktime($eveningends, $end_minutes, 0, $month, $day, $year, is_dst($month, $day, $year));
}
} else {
if (!$twentyfourhour_format) {
if (isset($ampm) && $ampm == "pm" && $hour < 12) {
$hour += 12;
}
if (isset($ampm) && $ampm == "am" && $hour > 11) {
$hour -= 12;
}
}
$starttime = mktime($hour, $minute, 0, $month, $day, $year, is_dst($month, $day, $year, $hour));
$endtime = mktime($hour, $minute, 0, $month, $day, $year, is_dst($month, $day, $year, $hour)) + $units * $duration;
# Round up the duration to the next whole resolution unit.
# If they asked for 0 minutes, push that up to 1 resolution unit.
$diff = $endtime - $starttime;
if (($tmp = $diff % $resolution) != 0 || $diff == 0) {
$endtime += $resolution - $tmp;
}
$endtime += cross_dst($starttime, $endtime);
}
if (isset($rep_type) && $rep_type > 0 && isset($rep_end_month) && isset($rep_end_day) && isset($rep_end_year)) {
// Get the repeat entry settings
$rep_enddate = mktime($hour, $minute, 0, $rep_end_month, $rep_end_day, $rep_end_year);
} else {
$rep_type = 0;
}
if (!isset($rep_day)) {
示例4: mktime
// We want the end of the last slot, not the beginning
}
}
// Now work out the start and times
$starttime = mktime(0, 0, 0, $month, $day, $year, is_dst($month, $day, $year, intval($start_seconds / 3600))) + $start_seconds;
$endtime = mktime(0, 0, 0, $end_month, $end_day, $end_year, is_dst($end_month, $end_day, $end_year, intval($end_seconds / 3600))) + $end_seconds;
// If we're using periods then the endtime we've been returned by the form is actually
// the beginning of the last period in the booking (it's more intuitive for users this way)
// so we need to add on 60 seconds (1 period)
if ($enable_periods) {
$endtime = $endtime + 60;
}
// Round down the starttime and round up the endtime to the nearest slot boundaries
// (This step is probably unnecesary now that MRBS always returns times aligned
// on slot boundaries, but is left in for good measure).
$am7 = mktime($morningstarts, $morningstarts_minutes, 0, $month, $day, $year, is_dst($month, $day, $year, $morningstarts));
$starttime = round_t_down($starttime, $resolution, $am7);
$endtime = round_t_up($endtime, $resolution, $am7);
// If they asked for 0 minutes, and even after the rounding the slot length is still
// 0 minutes, push that up to 1 resolution unit.
if ($endtime == $starttime) {
$endtime += $resolution;
}
// Now get the duration, which will be needed for email notifications
// (We do this before we adjust for DST so that the user sees what they expect to see)
$duration = $endtime - $starttime;
$date = getdate($starttime);
if ($enable_periods) {
$period = ($date['hours'] - 12) * 60 + $date['minutes'];
toPeriodString($period, $duration, $dur_units, FALSE);
} else {
示例5: count
if ($enable_periods) {
$resolution = 60;
$morningstarts = 12;
$morningstarts_minutes = 0;
$eveningends = 12;
$eveningends_minutes = count($periods) - 1;
}
// Define the start and end of each day of the month in a way which is not
// affected by daylight saving...
for ($j = 1; $j <= $days_in_month; $j++) {
// are we entering or leaving daylight saving
// dst_change:
// -1 => no change
// 0 => entering DST
// 1 => leaving DST
$dst_change[$j] = is_dst($month, $j, $year);
$am7[$j] = get_start_first_slot($month, $j, $year);
$pm7[$j] = get_start_last_slot($month, $j, $year);
}
// Section with areas, rooms, minicals.
echo "<div id=\"dwm_header\" class=\"screenonly\">\n";
// Get the area and room names (we will need them later for the heading)
$this_area_name = sql_query1("SELECT area_name FROM {$tbl_area} WHERE id={$area} AND disabled=0 LIMIT 1");
$this_room_name = sql_query1("SELECT room_name FROM {$tbl_room} WHERE id={$room} AND disabled=0 LIMIT 1");
// The room is invalid if it doesn't exist, or else it has been disabled, either explicitly
// or implicitly because the area has been disabled
$room_invalid = $this_area_name === -1 || $this_room_name === -1;
// Show all available areas
echo make_area_select_html('month.php', $area, $year, $month, $day);
// Show all available rooms in the current area:
echo make_room_select_html('month.php', $area, $room, $year, $month, $day);
示例6: mktime
$month_start = mktime(0, 0, 0, $month, 1, $year);
# What column the month starts in: 0 means $weekstarts weekday.
$weekday_start = (date("w", $month_start) - $weekstarts + 7) % 7;
$days_in_month = date("t", $month_start);
$month_end = mktime(23, 59, 59, $month, $days_in_month, $year);
# Define the start and end of each day of the month in a way which is not
# affected by daylight saving...
for ($j = 1; $j <= $days_in_month; $j++) {
# are we entering or leaving daylight saving
# dst_change:
# -1 => no change
# 0 => entering DST
# 1 => leaving DST
$dst_change[$j] = is_dst($month, $j, $year);
$midnight[$j] = mktime(0, 0, 0, $month, $j, $year, is_dst($month, $j, $year, 0));
$midnight_tonight[$j] = mktime(23, 59, 59, $month, $j, $year, is_dst($month, $j, $year, 23));
}
if ($pview != 1) {
# Table with areas, rooms, minicals.
echo "<table width=\"100%\"><tr>";
$this_area_name = "";
$this_room_name = "";
# Show all areas
echo "<td width=\"30%\"><u>" . get_vocab("areas") . "</u><br>";
}
# show either a select box or the normal html list
if ($area_list_format == "select") {
echo make_area_select_html('month.php', $area, $year, $month, $day);
# from functions.inc
$this_area_name = sql_query1("select area_name from mrbs_area where id={$area}");
$this_room_name = sql_query1("select room_name from mrbs_room where id={$room}");
示例7: process_event
//.........这里部分代码省略.........
$booking[$key] = $value;
}
}
break;
case 'CLASS':
if (in_array($details['value'], array('PRIVATE', 'CONFIDENTIAL'))) {
$booking['status'] |= STATUS_PRIVATE;
}
break;
case 'STATUS':
if ($details['value'] == 'TENTATIVE') {
$booking['status'] |= STATUS_TENTATIVE;
}
break;
case 'UID':
$booking['ical_uid'] = $details['value'];
break;
case 'SEQUENCE':
$booking['ical_sequence'] = $details['value'];
break;
case 'LAST-MODIFIED':
// We probably ought to do something with LAST-MODIFIED and use it
// for the timestamp field
break;
default:
break;
}
}
// If we didn't manage to work out a username then just put the booking
// under the name of the current user
if (!isset($booking['create_by'])) {
$booking['create_by'] = getUserName();
}
// A SUMMARY is optional in RFC 5545, however a brief description is mandatory
// in MRBS. So if the VEVENT didn't include a name, we'll give it one
if (!isset($booking['name'])) {
$booking['name'] = "Imported event - no SUMMARY name";
}
// On the other hand a UID is mandatory in RFC 5545. We'll be lenient and
// provide one if it is missing
if (!isset($booking['ical_uid'])) {
$booking['ical_uid'] = generate_global_uid($booking['name']);
$booking['sequence'] = 0;
// and we'll start the sequence from 0
}
// LOCATION is optional in RFC 5545 but is obviously mandatory in MRBS.
// We could maybe have a default room on the form and use that
if (!isset($booking['room_id'])) {
$problems[] = get_vocab("no_LOCATION");
}
if (empty($problems)) {
// Get the area settings for this room, if we haven't got them already
if (!isset($room_settings[$booking['room_id']])) {
get_area_settings(get_area($booking['room_id']));
$room_settings[$booking['room_id']]['morningstarts'] = $morningstarts;
$room_settings[$booking['room_id']]['morningstarts_minutes'] = $morningstarts_minutes;
$room_settings[$booking['room_id']]['resolution'] = $resolution;
}
// Round the start and end times to slot boundaries
$date = getdate($booking['start_time']);
$m = $date['mon'];
$d = $date['mday'];
$y = $date['year'];
$am7 = mktime($room_settings[$booking['room_id']]['morningstarts'], $room_settings[$booking['room_id']]['morningstarts_minutes'], 0, $m, $d, $y, is_dst($m, $d, $y, $room_settings[$booking['room_id']]['morningstarts']));
$booking['start_time'] = round_t_down($booking['start_time'], $room_settings[$booking['room_id']]['resolution'], $am7);
$booking['end_time'] = round_t_up($booking['end_time'], $room_settings[$booking['room_id']]['resolution'], $am7);
// Make the bookings
$bookings = array($booking);
$result = mrbsMakeBookings($bookings, NULL, FALSE, $skip);
if ($result['valid_booking']) {
return TRUE;
}
}
// There were problems - list them
echo "<div class=\"problem_report\">\n";
echo get_vocab("could_not_import") . " UID:" . htmlspecialchars($booking['ical_uid']);
echo "<ul>\n";
foreach ($problems as $problem) {
echo "<li>" . htmlspecialchars($problem) . "</li>\n";
}
if (!empty($result['rules_broken'])) {
echo "<li>" . get_vocab("rules_broken") . "\n";
echo "<ul>\n";
foreach ($result['rules_broken'] as $rule) {
echo "<li>{$rule}</li>\n";
}
echo "</ul></li>\n";
}
if (!empty($result['conflicts'])) {
echo "<li>" . get_vocab("conflict") . "\n";
echo "<ul>\n";
foreach ($result['conflicts'] as $conflict) {
echo "<li>{$conflict}</li>\n";
}
echo "</ul></li>\n";
}
echo "</ul>\n";
echo "</div>\n";
return FALSE;
}