本文整理汇总了PHP中round_t_up函数的典型用法代码示例。如果您正苦于以下问题:PHP round_t_up函数的具体用法?PHP round_t_up怎么用?PHP round_t_up使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了round_t_up函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$ind++;
}
$ty = date("Y", $i);
$tm = date("m", $i);
$td = date("d", $i);
$am7 = mktime($morningstarts, 0, 0, $month, $day, $year);
$pm7 = mktime($eveningends, $eveningends_minutes, 0, $month, $day, $year);
$this_area_name = grr_sql_query1("SELECT area_name FROM " . TABLE_PREFIX . "_area WHERE id='" . protect_data_sql($area) . "'");
$sql = "SELECT " . TABLE_PREFIX . "_room.id, start_time, end_time, name, " . TABLE_PREFIX . "_entry.id, type, beneficiaire, statut_entry, " . TABLE_PREFIX . "_entry.description, " . TABLE_PREFIX . "_entry.option_reservation, " . TABLE_PREFIX . "_entry.moderate, beneficiaire_ext\nFROM " . TABLE_PREFIX . "_entry, " . TABLE_PREFIX . "_room\nWHERE " . TABLE_PREFIX . "_entry.room_id = " . TABLE_PREFIX . "_room.id\nAND area_id = '" . protect_data_sql($area) . "'\nAND start_time < " . ($pm7 + $resolution) . " AND end_time > {$am7} ORDER BY start_time";
$res = grr_sql_query($sql);
if (!$res) {
echo grr_sql_error();
} else {
for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
$start_t = max(round_t_down($row['1'], $resolution, $am7), $am7);
$end_t = min(round_t_up($row['2'], $resolution, $am7) - $resolution, $pm7);
$cellules[$row['4']] = ($end_t - $start_t) / $resolution + 1;
$compteur[$row['4']] = 0;
for ($t = $start_t; $t <= $end_t; $t += $resolution) {
$today[$row['0']][$t]["id"] = $row['4'];
$today[$row['0']][$t]["color"] = $row['5'];
$today[$row['0']][$t]["data"] = "";
$today[$row['0']][$t]["who"] = "";
$today[$row['0']][$t]["statut"] = $row['7'];
$today[$row['0']][$t]["moderation"] = $row['10'];
$today[$row['0']][$t]["option_reser"] = $row['9'];
$today[$row['0']][$t]["description"] = affichage_resa_planning($row['8'], $row['4']);
}
if ($row['1'] < $am7) {
$today[$row['0']][$am7]["data"] = affichage_lien_resa_planning($row['3'], $row['4']);
if ($settings->get("display_info_bulle") == 1) {
示例2: addValue
addValue('invoice_electronic', $entry['invoice_electronic']);
addValue('invoice_email', $entry['invoice_email']);
addValue('invoice_comment', $entry['invoice_comment']);
addValue('invoice_internal_comment', $entry['invoice_internal_comment']);
addValue('invoice_ref_your', $entry['invoice_ref_your']);
addValue('invoice_address_id', $entry['invoice_address_id']);
addValueArray('invoice_content', $entry['invoice_content']);
} else {
// Some default values
$time_end_after_start = 60 * 60 * 2;
addValueArray('invoice', '0');
// Invoice = no
addValue('num_person_count', '1');
// Count = yes
addValue('time_start', round_t_up(time(), $resolution));
addValue('time_end', round_t_up(time() + $time_end_after_start, $resolution));
addValue('area_id', $area);
addValueArray('room_id', array(0 => 0));
/* ### DATA SENDT VIA GET/POST ### */
/*
Data that can be sent:
area_id = ID
room_id = ;ID;;ID;;ID; (or just ;ID;)
time_start = unix timestamp
time_end = unix timestamp
user_assigned = array or ;ID;;ID;;ID; (or just ;ID;)
*/
if (isset($_GET['area_id']) && is_numeric($_GET['area_id'])) {
addValue('area_id', (int) $_GET['area_id']);
}
if (isset($_GET['room_id'])) {
示例3: map_add_booking
function map_add_booking($row, &$column, $am7, $pm7)
{
// Enters the contents of the booking found in $row into $column, which is
// a column of the map of the bookings being prepared ready for display.
//
// $column the column of the map that is being prepared (see below)
// $row a booking from the database
// $am7 the start of the first slot of the booking day (Unix timestamp)
// $pm7 the start of the last slot of the booking day (Unix timestamp)
// $row is expected to have the following field names, when present:
// room_id
// start_time
// end_time
// name
// repeat_id
// entry_id
// type
// entry_description
// entry_create_by
// status
// $column is a column of the map of the screen that will be displayed
// It looks like:
// $column[s][n][id]
// [is_repeat]
// [is_multiday_start] a boolean indicating if the booking stretches
// beyond the day start
// [is_multiday_end] a boolean indicating if the booking stretches
// beyond the day end
// [color]
// [data]
// [long_descr]
// [create_by]
// [room_id]
// [start_time]
// [slots]
// [status]
// s is the number of nominal seconds (ie ignoring DST changes] since the
// start of the calendar day which has the start of the booking day
// slots records the duration of the booking in number of time slots.
// Used to calculate how high to make the block used for clipping
// overflow descriptions.
// Fill in the map for this meeting. Start at the meeting start time,
// or the day start time, whichever is later. End one slot before the
// meeting end time (since the next slot is for meetings which start then),
// or at the last slot in the day, whichever is earlier.
// Time is of the format HHMM without leading zeros.
//
// [n] exists because it's possible that there may be multiple bookings
// in the same time slot. Normally this won't be the case. However it
// can arise legitimately if you increase the resolution, or shift the
// displayed day. For example if you previously had a resolution of 1800
// seconds you might have a booking (A) for 1000-1130 and another (B) for 1130-1230.
// If you then increase the resolution to 3600 seconds, these two bookings
// will both occupy the 1100-1200 time slot. [n] starts at 0. For
// the example above the map for the room would look like this
//
// 0 1
// 1000 A
// 1100 A B
// 1200 B
//
// Adjust the starting and ending times so that bookings which don't
// start or end at a recognized time still appear.
global $resolution;
global $is_private_field;
//$user = getUserName();
/*if (is_private_event($row['status'] & STATUS_PRIVATE) &&
!getWritable($row['entry_create_by'], $user, $row['room_id']))
{
$row['status'] |= STATUS_PRIVATE; // Set the private bit
if ($is_private_field['entry.name'])
{
$row['name']= "[".get_vocab('unavailable')."]";
}
if ($is_private_field['entry.description'])
{
$row['entry_description']= "[".get_vocab('unavailable')."]";
}
}
else
{
$row['status'] &= ~STATUS_PRIVATE; // Clear the private bit
}*/
$is_multiday_start = $row['start_time'] < $am7;
$is_multiday_end = $row['end_time'] > $pm7 + $resolution;
$start_t = max(round_t_down($row['start_time'], $resolution, $am7), $am7);
$end_t = min(round_t_up($row['end_time'], $resolution, $am7) - $resolution, $pm7);
// calculate the times used for indexing - we index by nominal seconds since the start
// of the calendar day which has the start of the booking day
$start_s = nominal_seconds($start_t);
$end_s = nominal_seconds($end_t);
for ($s = $start_s; $s <= $end_s; $s += $resolution) {
// find the first free index (in case there are multiple bookings in a timeslot)
$n = 0;
while (!empty($column[$s][$n]["id"])) {
$n++;
}
// fill in the id, type and start time
$column[$s][$n]["id"] = $row['entry_id'];
$column[$s][$n]["is_repeat"] = isset($row['repeat_id']);
//.........这里部分代码省略.........
示例4: time
}
# $d is a map of the screen that will be displayed
# It looks like:
# $d[Day][Time][id]
# [color]
# [data]
# where Day is in the range 0 to $num_of_days.
# Fill in the map for this meeting. Start at the meeting start time,
# or the day start time, whichever is later. End one slot before the
# meeting end time (since the next slot is for meetings which start then),
# or at the last slot in the day, whichever is earlier.
# Note: int casts on database rows for max may be needed for PHP3.
# Adjust the starting and ending times so that bookings which don't
# start or end at a recognized time still appear.
$start_t = max(round_t_down($row[0], $resolution, $am7[$j]), $am7[$j]);
$end_t = min(round_t_up($row[1], $resolution, $am7[$j]) - $resolution, $pm7[$j]);
for ($t = $start_t; $t <= $end_t; $t += $resolution) {
$d[$j][date($format, $t)]["id"] = $row[4];
$d[$j][date($format, $t)]["color"] = $row[2];
$d[$j][date($format, $t)]["data"] = "";
$d[$j][date($format, $t)]["long_descr"] = "";
}
# Show the name of the booker in the first segment that the booking
# happens in, or at the start of the day if it started before today.
if ($row[1] < $am7[$j]) {
$d[$j][date($format, $am7[$j])]["data"] = $row[3];
$d[$j][date($format, $am7[$j])]["long_descr"] = $row[5];
} else {
$d[$j][date($format, $start_t)]["data"] = $row[3];
$d[$j][date($format, $start_t)]["long_descr"] = $row[5];
}
示例5: mktime
}
// Now work out the start and times
$starttime = mktime(0, 0, $start_seconds, $start_month, $start_day, $start_year);
$endtime = mktime(0, 0, $end_seconds, $end_month, $end_day, $end_year);
// 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 = get_start_first_slot($start_month, $start_day, $start_year);
$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;
}
if (isset($rep_type) && $rep_type != REP_NONE && isset($rep_end_month) && isset($rep_end_day) && isset($rep_end_year)) {
// Get the repeat entry settings
$end_date = mktime(intval($start_seconds / SECONDS_PER_HOUR), intval($start_seconds % SECONDS_PER_HOUR / 60), 0, $rep_end_month, $rep_end_day, $rep_end_year);
} else {
$rep_type = REP_NONE;
$end_date = 0;
// to avoid an undefined variable notice
}
if (!isset($rep_day)) {
$rep_day = array();
示例6: grr_sql_query
echo "<br />DEBUG: query={$sql} <br />first_slot={$first_slot} - last_slot={$last_slot}\n";
}
$res = grr_sql_query($sql);
if (!$res) {
echo grr_sql_error();
} else {
for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
if ($debug_flag) {
echo "<br />DEBUG: result {$i}, id {$row['4']}, starts {$row['0']} (" . affiche_date($row[0]) . "), ends {$row['1']} (" . affiche_date($row[1]) . ")\n";
}
$month_current = date("m", $row[0]);
$day_current = date("d", $row[0]);
$year_current = date("Y", $row[0]);
$debut_jour = mktime($morningstarts, 0, 0, $month_current, $day_current, $year_current);
$t = max(round_t_down($row[0], $resolution, $debut_jour), $week_start);
$end_t = min((int) round_t_up((int) $row[1], (int) $resolution, $debut_jour), (int) $week_end + 1);
$weekday = (date("w", $t) + 7 - $weekstarts) % 7;
$prev_weekday = -1;
$slot = ($t - $week_midnight) % 86400 / $resolution;
$firstday = date("d", $t);
$lastday = date("d", $row[1]);
$heigthSlotHoure = 60 / ($this_area_resolution / 60);
do {
if ($debug_flag) {
echo "<br />DEBUG: t={$t} (" . affiche_date($t) . "), end_t={$end_t} (" . affiche_date($end_t) . "), weekday={$weekday}, slot={$slot}\n";
}
if ($slot < $first_slot) {
$slot = $first_slot;
$t = $weekday * 86400 + $am7;
continue;
}
示例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);
$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;
}
示例8: sql_query
echo "<br>DEBUG: query={$sql} <br>slots={$first_slot}:{$last_slot}\n";
}
$res = sql_query($sql);
if (!$res) {
echo sql_error();
} else {
for ($i = 0; $row = sql_row($res, $i); $i++) {
if ($debug_flag) {
echo "<br>DEBUG: result {$i}, id {$row['4']}, starts {$row['0']}, ends {$row['1']}\n";
}
# Fill in slots for the meeting. Start at the meeting start time or
# week start (which ever is later), and end one slot before the meeting
# end time or week end (which ever is earlier).
# Note: int casts on database rows for min and max is needed for PHP3.
$t = max(round_t_down($row[0], $resolution, $am7), $week_start);
$end_t = min((int) round_t_up((int) $row[1], (int) $resolution, $am7), (int) $week_end + 1);
$weekday = (date("w", $t) + 7 - $weekstarts) % 7;
$prev_weekday = -1;
# Invalid value to force initial label.
$slot = ($t - $week_midnight) % 86400 / $resolution;
do {
if ($debug_flag) {
echo "<br>DEBUG: t={$t}, weekday={$weekday}, slot={$slot}\n";
}
if ($slot < $first_slot) {
# This is before the start of the displayed day; skip to first slot.
$slot = $first_slot;
$t = $weekday * 86400 + $am7;
continue;
}
if ($slot <= $last_slot) {
示例9: _
// Saving originals
$event['time_start_real'] = $event['time_start'];
$event['time_end_real'] = $event['time_end'];
if ($event['time_start'] < $start) {
$event['time_start'] = $start;
$event['entry_name'] .= ' (' . _('started') . ' ' . date('H:i d-m-Y', $event['time_start_real']) . ')';
}
$event['time_start'] = round_t_down($event['time_start'], $resolution);
//echo date('H:i:s dmY',$event['time_start']).' start før diff<br>'.chr(10);
$diff = $event['time_end'] - $event['time_start'];
//echo $diff.' '.($diff/60).'<br>'.chr(10);
if ($diff < 60 * 30) {
$event['time_end'] = round_t_up($event['time_end'], 60 * 15);
}
//echo date('H:i:s dmY',$event['time_start']).' start last<br>'.chr(10);
$event['time_end'] = round_t_up($event['time_end'], $resolution);
//echo date('H:i:s dmY',$event['time_end']).' end last<br>'.chr(10);
//echo '<br><br>'.chr(10);
if ($end < $event['time_end']) {
$rowspan = ($end + $resolution - $event['time_start']) / $resolution;
} else {
$rowspan = ($event['time_end'] - $event['time_start']) / $resolution;
}
$event['rowspan'] = $rowspan;
$entries_room[$t][$event['entry_id']] = $event;
// Finding when a <td> with an entry starts
$room_time[$t][date('Hi', $event['time_start'])][$event['entry_id']] = $event['entry_id'];
// "Mark" all resolutions that this entry is in as "used"
for ($z = $event['time_start']; $z < $event['time_end']; $z += $resolution) {
$room_time2[$t][date('Hi', $z)][$event['entry_id']] = $event['entry_id'];
}
示例10: sql_query
echo "<br>DEBUG: query={$sql} <br>slots={$first_slot}:{$last_slot}\n";
}
$res = sql_query($sql);
if (!$res) {
echo sql_error();
} else {
for ($i = 0; $row = sql_row($res, $i); $i++) {
if ($debug_flag) {
echo "<br>DEBUG: result {$i}, id {$row['4']}, starts {$row['0']}, ends {$row['1']}\n";
}
# Fill in slots for the meeting. Start at the meeting start time or
# week start (which ever is later), and end one slot before the meeting
# end time or week end (which ever is earlier).
# Note: int casts on database rows for min and max is needed for PHP3.
$t = max(round_t_down($row[0], $resolution), $week_start);
$end_t = min(round_t_up($row[1], $resolution), $week_end + 1);
$weekday = (date("w", $t) + 7 - $weekstarts) % 7;
$prev_weekday = -1;
# Invalid value to force initial label.
$slot = ($t - $week_midnight) % 86400 / $resolution;
do {
if ($debug_flag) {
echo "<br>DEBUG: t={$t}, weekday={$weekday}, slot={$slot}\n";
}
if ($slot < $first_slot) {
# This is before the start of the displayed day; skip to first slot.
$slot = $first_slot;
$t = $weekday * 86400 + $am7;
continue;
}
if ($slot <= $last_slot) {
示例11: type
#row[4] = id of this booking
#row[5] = type (internal/external)
# $today is a map of the screen that will be displayed
# It looks like:
# $today[Room ID][Time][id]
# [color]
# [data]
# Fill in the map for this meeting. Start at the meeting start time,
# or the day start time, whichever is later. End one slot before the
# meeting end time (since the next slot is for meetings which start then),
# or at the last slot in the day, whichever is earlier.
# Note: int casts on database rows for max may be needed for PHP3.
# Adjust the starting and ending times so that bookings which don't
# start or end at a recognized time still appear.
$start_t = max(round_t_down($row[1], $resolution), $am7);
$end_t = min(round_t_up($row[2], $resolution) - $resolution, $pm7);
for ($t = $start_t; $t <= $end_t; $t += $resolution) {
$today[$row[0]][$t]["id"] = $row[4];
$today[$row[0]][$t]["color"] = $row[5];
$today[$row[0]][$t]["data"] = "";
}
# Show the name of the booker in the first segment that the booking
# happens in, or at the start of the day if it started before today.
if ($row[1] < $am7) {
$today[$row[0]][$am7]["data"] = $row[3];
} else {
$today[$row[0]][$start_t]["data"] = $row[3];
}
}
# We need to know what all the rooms area called, so we can show them all
# pull the data from the db and store it. Convienently we can print the room