本文整理汇总了PHP中hour_min_format函数的典型用法代码示例。如果您正苦于以下问题:PHP hour_min_format函数的具体用法?PHP hour_min_format怎么用?PHP hour_min_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hour_min_format函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: genslotselector
function genslotselector($area, $prefix, $first, $last, $time, $display = "block")
{
global $periods;
$html = '';
// Get the settings for this area. Note that the variables below are
// local variables, not globals.
$enable_periods = $area['enable_periods'];
$resolution = $enable_periods ? 60 : $area['resolution'];
// Check that $resolution is positive to avoid an infinite loop below.
// (Shouldn't be possible, but just in case ...)
if (empty($resolution) || $resolution < 0) {
fatal_error(FALSE, "Internal error - resolution is NULL or <= 0");
}
// If they've asked for "display: none" then we'll also disable the select so
// that there is only one select passing through the variable to the handler
$disabled = strtolower($display) == "none" ? " disabled=\"disabled\"" : "";
$date = getdate($time);
$time_zero = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']);
if ($enable_periods) {
$base = 12 * 60 * 60;
// The start of the first period of the day
} else {
$format = hour_min_format();
}
$html .= "<select style=\"display: {$display}\" id = \"{$prefix}seconds{$area['id']}\" name=\"{$prefix}seconds\" onChange=\"adjustSlotSelectors(this.form)\"{$disabled}>\n";
for ($t = $first; $t <= $last; $t = $t + $resolution) {
$timestamp = $t + $time_zero;
$slot_string = $enable_periods ? $periods[intval(($t - $base) / 60)] : utf8_strftime($format, $timestamp);
$html .= "<option value=\"{$t}\"";
$html .= $timestamp == $time ? " selected=\"selected\"" : "";
$html .= ">{$slot_string}</option>\n";
}
$html .= "</select>\n";
echo $html;
}
示例2: start_to_end
function start_to_end($starts, $ends)
{
global $twentyfourhour_format, $strftime_format;
$start_date = utf8_strftime($strftime_format['date'], $starts);
$start_time = utf8_strftime(hour_min_format(), $starts);
$end_date = utf8_strftime($strftime_format['date'], $ends);
$end_time = utf8_strftime(hour_min_format(), $ends);
return $start_date . " " . $start_time . " - " . $end_date . " " . $end_time;
}
示例3: elseif
echo "<script type=\"text/javascript\">\n<!--\n";
echo "EndActiveCell();\n";
echo "// -->\n</script>";
}
} else {
echo ' ';
}
} elseif ($descr != "") {
#if it is booked then show
echo " <a href=\"view_entry.php?id={$id}" . "&area={$area}&day={$wday}&month={$wmonth}&year={$wyear}\" " . "title=\"{$long_descr}\">{$descr}</a>";
} else {
echo " \" ";
}
echo "</td>\n";
}
# next lines to display times on right side
if (FALSE != $times_right_side) {
if ($enable_periods) {
tdcell("red");
$time_t_stripped = preg_replace("/^0/", "", $time_t);
echo "<a href=\"{$hilite_url}={$time_t}\" title=\"" . get_vocab("highlight_line") . "\">" . $periods[$time_t_stripped] . "</a></td>";
} else {
tdcell("red");
echo "<a href=\"{$hilite_url}={$time_t}\" title=\"" . get_vocab("highlight_line") . "\">" . utf8_strftime(hour_min_format(), $t) . "</a></td>";
}
}
echo "</tr>\n";
}
echo "</table>";
show_colour_key();
include "trailer.inc";
示例4: date
$d[$day_num]['data'][] = date(hour_min_format(), $row[0]) . get_vocab('to') . date(hour_min_format(), $row[1]);
break;
case '> = ':
$d[$day_num]['data'][] = date(hour_min_format(), $row[0]) . get_vocab('to') . '24:00';
break;
case '> > ':
$d[$day_num]['data'][] = date(hour_min_format(), $row[0]) . get_vocab('to') . '>';
break;
case '= = ':
$d[$day_num]['data'][] = $all_day;
break;
case '= > ':
$d[$day_num]['data'][] = $all_day . '>';
break;
case '< < ':
$d[$day_num]['data'][] = '<' . get_vocab('to') . date(hour_min_format(), $row[1]);
break;
case '< = ':
$d[$day_num]['data'][] = '<' . $all_day;
break;
case '< > ':
$d[$day_num]['data'][] = '<' . $all_day . '>';
break;
}
}
if ($row[1] <= $midnight_tonight) {
break;
}
$t = $midnight = $midnight_tonight;
$day_num = date('j', $t);
}
示例5: date
$d[$day_num][$month_num][$year_num]["data"][] = date(hour_min_format(), $row[0]) . "~" . date(hour_min_format(), $row[1]) . " - " . $row[3] . $temp;
break;
case "> = ":
$d[$day_num][$month_num][$year_num]["data"][] = date(hour_min_format(), $row[0]) . "~24:00" . " - " . $row[3] . $temp;
break;
case "> > ":
$d[$day_num][$month_num][$year_num]["data"][] = date(hour_min_format(), $row[0]) . "~====>" . " - " . $row[3] . $temp;
break;
case "= = ":
$d[$day_num][$month_num][$year_num]["data"][] = $all_day2 . $temp;
break;
case "= > ":
$d[$day_num][$month_num][$year_num]["data"][] = $all_day2 . "====>" . " - " . $row[3] . $temp;
break;
case "< < ":
$d[$day_num][$month_num][$year_num]["data"][] = "<====~" . date(hour_min_format(), $row[1]) . " - " . $row[3] . $temp;
break;
case "< = ":
$d[$day_num][$month_num][$year_num]["data"][] = "<====" . $all_day2 . " - " . $row[3] . $temp;
break;
case "< > ":
$d[$day_num][$month_num][$year_num]["data"][] = "<====" . $all_day2 . "====>" . " - " . $row[3] . $temp;
break;
}
}
//Only if end time > midnight does the loop continue for the next day.
if ($row[1] <= $midnight_tonight) {
break;
}
//$day_num++;
$t = $midnight = $midnight_tonight;
示例6: get_vocab
// minutes
$start_difference = ($start_last_slot - $start_first_slot) * 60;
// seconds
$n_slots = $start_difference / $resolution + 1;
$column_width = (int) (95 / $n_slots);
$header .= "<th class=\"first_last\">" . get_vocab("date") . ":</th>";
for ($t = mktime($morningstarts, $morningstarts_minutes, 0, $month, $day_start_week + $j, $year); $t <= mktime($eveningends, $eveningends_minutes, 0, $month, $day_start_week + $j, $year); $t += $resolution) {
$header .= "<th style=\"width: {$column_width}%\">";
if ($enable_periods) {
// convert timestamps to HHMM format without leading zeros
$time_t = date($format, $t);
// and get a stripped version of the time for use with periods
$time_t_stripped = preg_replace("/^0/", "", $time_t);
$header .= $periods[$time_t_stripped];
} else {
$header .= utf8_strftime(hour_min_format(), $t);
}
$header .= "</th>\n";
}
// next: line to display times on right side
if (FALSE != $row_labels_both_sides) {
$header .= "<th class=\"first_last\">" . get_vocab("date") . ":</th>";
}
} else {
// the standard view, with days along the top and times down the side
$header .= "<th class=\"first_last\">" . ($enable_periods ? get_vocab("period") : get_vocab("time")) . ":</th>";
for ($j = 0; $j <= $num_of_days - 1; $j++) {
$t = mktime(12, 0, 0, $month, $day_start_week + $j, $year);
if (is_hidden_day(($j + $weekstarts) % 7)) {
// These days are to be hidden in the display (as they are hidden, just give the
// day of the week in the header row
示例7: htmlspecialchars
break;
case "> > ":
// Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = htmlspecialchars(utf8_strftime(hour_min_format(), $row['start_time'])) . "~====>";
break;
case "= = ":
// Starts at midnight, ends at midnight
$d[$day_num]["data"][] = $all_day;
break;
case "= > ":
// Starts at midnight, continues tomorrow
$d[$day_num]["data"][] = $all_day . "====>";
break;
case "< < ":
// Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row['end_time']));
break;
case "< = ":
// Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
// Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = period_time_string($row['start_time']);
$end_str = period_time_string($row['end_time'], -1);
switch (cmp3($row['start_time'], $midnight[$day_num]) . cmp3($row['end_time'], $midnight_tonight[$day_num] + 1)) {
case "> < ":
示例8: utf8_strftime
break;
case "> > ":
# Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = utf8_strftime(hour_min_format(), $row[0]) . "~====>";
break;
case "= = ":
# Starts at midnight, ends at midnight
$d[$day_num]["data"][] = $all_day;
break;
case "= > ":
# Starts at midnight, continues tomorrow
$d[$day_num]["data"][] = $all_day . "====>";
break;
case "< < ":
# Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . utf8_strftime(hour_min_format(), $row[1]);
break;
case "< = ":
# Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
# Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = preg_replace("/ /", " ", period_time_string($row[0]));
$end_str = preg_replace("/ /", " ", period_time_string($row[1], -1));
switch (cmp3($row[0], $midnight[$day_num]) . cmp3($row[1], $midnight_tonight[$day_num] + 1)) {
case "> < ":
示例9: get_vocab
// minutes
$start_difference = ($start_last_slot - $start_first_slot) * 60;
// seconds
$n_slots = $start_difference / $resolution + 1;
$column_width = (int) (95 / $n_slots);
echo "<th class=\"first_last\">" . get_vocab("room") . ":</th>";
for ($t = mktime($morningstarts, $morningstarts_minutes, 0, $month, $day + $j, $year); $t <= mktime($eveningends, $eveningends_minutes, 0, $month, $day + $j, $year); $t += $resolution) {
echo "<th style=\"width: {$column_width}%\">";
if ($enable_periods) {
// convert timestamps to HHMM format without leading zeros
$time_t = date($format, $t);
// and get a stripped version of the time for use with periods
$time_t_stripped = preg_replace("/^0/", "", $time_t);
echo $periods[$time_t_stripped];
} else {
echo utf8_strftime(hour_min_format(), $t);
}
echo "</th>\n";
}
// next: line to display times on right side
if (FALSE != $row_labels_both_sides) {
echo "<th class=\"first_last\">" . get_vocab("room") . ":</th>";
}
} else {
// the standard view, with rooms along the top and times down the side
echo "<th class=\"first_last\">" . ($enable_periods ? get_vocab("period") : get_vocab("time")) . ":</th>";
$column_width = (int) (95 / sql_count($res));
for ($i = 0; $row = sql_row_keyed($res, $i); $i++) {
echo "<th style=\"width: {$column_width}%\">\n <a href=\"week.php?year={$year}&month={$month}&day={$day}&area={$area}&room=" . $row['id'] . "\"\n title=\"" . get_vocab("viewweek") . " " . $row['description'] . "\">" . htmlspecialchars($row['room_name']) . ($row['capacity'] > 0 ? "(" . $row['capacity'] . ")" : "") . "</a></th>";
$rooms[] = $row['id'];
}
示例10: strftime
echo "<th width=\"14%\">" . strftime($dformat, $t) . "</th>\n";
}
echo "</tr>\n";
# This is the main bit of the display. Outer loop is for the time slots,
# inner loop is for days of the week.
# URL for highlighting a time. Don't use REQUEST_URI or you will get
# the timetohighlight parameter duplicated each time you click.
$hilite_url = "week.php?year={$year}&month={$month}&day={$day}&area={$area}&room={$room}&timetohighlight";
# $t is the date/time for the first day of the week (Sunday, if $weekstarts=0).
# $wt is for the weekday in the inner loop.
$t = $am7;
for ($slot = $first_slot; $slot <= $last_slot; $slot++) {
# Show the time linked to the URL for highlighting that time:
echo "<tr>";
tdcell("red");
echo "<a href=\"{$hilite_url}={$t}\">" . date(hour_min_format(), $t) . "</a></td>";
$wt = $t;
# Color to use for empty cells: white, unless highlighting this row:
if (isset($timetohighlight) && $timetohighlight == $t) {
$empty_color = "red";
} else {
$empty_color = "white";
}
# See note above: weekday==0 is day $weekstarts, not necessarily Sunday.
for ($weekday = 0; $weekday < 7; $weekday++) {
# Three cases:
# color: id: Slot is: Color: Link to:
# ----- ----- -------- --------- -----------------------
# unset - empty white,red add new entry
# set unset used by type none (unlabelled slot)
# set set used by type view entry
示例11: get_booking_summary
function get_booking_summary($start, $end, $day_start, $day_end)
{
global $enable_periods;
// Use ~ (not -) to separate the start and stop times, because MSIE
// will incorrectly line break after a -.
$separator = '~';
$after_today = "====>";
$before_today = "<====";
$midnight = "24:00";
// need to fix this so it works with AM/PM configurations (and for that matter 24h)
// Localized "all day" text but with non-breaking spaces:
$all_day = preg_replace("/ /", " ", get_vocab("all_day"));
if ($enable_periods) {
$start_str = period_time_string($start);
$end_str = period_time_string($end, -1);
} else {
$start_str = htmlspecialchars(utf8_strftime(hour_min_format(), $start));
$end_str = htmlspecialchars(utf8_strftime(hour_min_format(), $end));
}
switch (cmp3($start, $day_start) . cmp3($end, $day_end + 1)) {
case "> < ":
// Starts after midnight, ends before midnight
// Starts after midnight, ends before midnight
case "= < ":
// Starts at midnight, ends before midnight
$result = $start_str;
// Don't bother showing the end if it's the same as the start period
if ($end_str !== $start_str) {
$result .= $separator . $end_str;
}
break;
case "> = ":
// Starts after midnight, ends at midnight
$result = $start_str . $separator . $midnight;
break;
case "> > ":
// Starts after midnight, continues tomorrow
$result = $start_str . $separator . $after_today;
break;
case "= = ":
// Starts at midnight, ends at midnight
$result = $all_day;
break;
case "= > ":
// Starts at midnight, continues tomorrow
$result = $all_day . $after_today;
break;
case "< < ":
// Starts before today, ends before midnight
$result = $before_today . $separator . $end_str;
break;
case "< = ":
// Starts before today, ends at midnight
$result = $before_today . $all_day;
break;
case "< > ":
// Starts before today, continues tomorrow
$result = $before_today . $all_day . $after_today;
break;
}
return $result;
}
示例12: unset
#if it is booked then show
echo " <a href=\"view_entry.php?id={$ids[$i]}&area={$area}&day={$day}&month={$month}&year={$year}\" title=\"{$long_descrs[$i]}\">{$descrs[$i]}</a><br>";
} else {
echo "<a href=\"view_entry.php?id={$ids[$i]}&area={$area}&day={$day}&month={$month}&year={$year}\" title=\"{$long_descrs[$i]}\"> \" </a><br>";
}
}
unset($descrs);
unset($long_descrs);
unset($ids);
echo "</td>\n";
}
# next lines to display times on right side
if (FALSE != $times_right_side) {
if ($enable_periods) {
tdcell("red");
$time_t_stripped = preg_replace("/^0/", "", $time_t);
echo "<a href=\"{$hilite_url}={$time_t}\" title=\"" . get_string('highlight_line', 'block_mrbs') . "\">" . $periods[$time_t_stripped] . "</a></td>\n";
} else {
tdcell("red");
echo "<a href=\"{$hilite_url}={$time_t}\" title=\"" . get_string('highlight_line', 'block_mrbs') . "\">" . userdate($t, hour_min_format()) . "</a></td>\n";
}
}
echo "</tr>\n";
reset($rooms);
}
}
echo "</table>\n";
isset($output) ? print $output : '';
show_colour_key();
}
include "trailer.php";
示例13: date
break;
case "> > ":
# Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = date(hour_min_format(), $row[0]) . "~====>";
break;
case "= = ":
# Starts at midnight, ends at midnight
$d[$day_num]["data"][] = $all_day;
break;
case "= > ":
# Starts at midnight, continues tomorrow
$d[$day_num]["data"][] = $all_day . "====>";
break;
case "< < ":
# Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . date(hour_min_format(), $row[1]);
break;
case "< = ":
# Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
# Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
# Only if end time > midnight does the loop continue for the next day.
if ($row[1] <= $midnight_tonight) {
break;
}
$day_num++;
示例14: genSlotSelector
function genSlotSelector($area, $id, $name, $current_s, $display_none = FALSE, $disabled = FALSE, $is_start = FALSE)
{
global $periods;
$html = '';
// Check that $resolution is positive to avoid an infinite loop below.
// (Shouldn't be possible, but just in case ...)
if (empty($area['resolution']) || $area['resolution'] < 0) {
fatal_error(FALSE, "Internal error - resolution is NULL or <= 0");
}
if ($area['enable_periods']) {
$base = 12 * SECONDS_PER_HOUR;
// The start of the first period of the day
} else {
$format = hour_min_format();
}
// Build the attributes
$attributes = array();
if ($disabled) {
// If $disabled is set, give the element a class so that the JavaScript
// knows to keep it disabled
$attributes[] = 'class="keep_disabled"';
}
if ($display_none) {
$attributes[] = 'style="display: none"';
}
// Build the options
$options = array();
// If we're using periods then the last slot is actually the start of the last period,
// or if we're using times and this is the start selector, then we don't show the last
// time
if ($area['enable_periods'] || $is_start) {
$last = $area['last'] - $area['resolution'];
} else {
$last = $area['last'];
}
for ($s = $area['first']; $s <= $last; $s += $area['resolution']) {
$slot_string = $area['enable_periods'] ? $periods[intval(($s - $base) / 60)] : hour_min($s);
$options[$s] = $slot_string;
}
// If $display_none or $disabled are set then we'll also disable the select so
// that there is only one select passing through the variable to the handler
$params = array('name' => $name, 'id' => $id, 'disabled' => $disabled || $display_none, 'create_hidden' => $disabled && !$display_none, 'attributes' => $attributes, 'value' => $current_s, 'options' => $options, 'force_assoc' => TRUE);
generate_select($params);
}
示例15: userdate
break;
case "> > ":
# Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = userdate($row[0], hour_min_format()) . "~====>";
break;
case "= = ":
# Starts at midnight, ends at midnight
$d[$day_num]["data"][] = $all_day;
break;
case "= > ":
# Starts at midnight, continues tomorrow
$d[$day_num]["data"][] = $all_day . "====>";
break;
case "< < ":
# Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . userdate($row[1], hour_min_format());
break;
case "< = ":
# Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
# Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = ereg_replace(" ", " ", period_time_string($row[0]));
$end_str = ereg_replace(" ", " ", period_time_string($row[1], -1));
switch (cmp3($row[0], $midnight[$day_num]) . cmp3($row[1], $midnight_tonight[$day_num] + 1)) {
case "> < ":