当前位置: 首页>>代码示例>>PHP>>正文


PHP round_t_down函数代码示例

本文整理汇总了PHP中round_t_down函数的典型用法代码示例。如果您正苦于以下问题:PHP round_t_down函数的具体用法?PHP round_t_down怎么用?PHP round_t_down使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了round_t_down函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: time

     echo "<br>DEBUG: result {$i}, id {$row['4']}, starts {$row['0']}, ends {$row['1']}\n";
 }
 # $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];
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:week.php

示例2: date

    $test = $display_day[date("w", $i)];
    $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']);
开发者ID:swirly,项目名称:GRR,代码行数:31,代码来源:day.php

示例3: grr_sql_query

if ($debug_flag) {
    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;
开发者ID:Birssan,项目名称:GRR,代码行数:31,代码来源:week.php

示例4: 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']);
//.........这里部分代码省略.........
开发者ID:cvelayo,项目名称:worklog,代码行数:101,代码来源:temp.php

示例5: mktime

    $resolution = 60;
}
// 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)) {
开发者ID:dev-lav,项目名称:htdocs,代码行数:31,代码来源:edit_entry_handler.php

示例6: 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;
}
开发者ID:Rahul6818,项目名称:mrbs,代码行数:101,代码来源:import.php

示例7: sql_query

if ($debug_flag) {
    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;
            }
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:week.php

示例8: while

while ($R_room = mysql_fetch_assoc($Q_room)) {
    $rooms[$R_room['room_id']] = $R_room['room_name'];
}
$entries = array();
$timed_entries = array();
foreach ($rooms as $room_id => $room) {
    $events_room = checktime_Room($start, $end, $area, $room_id);
    if (isset($events_room[$room_id])) {
        foreach ($events_room[$room_id] as $entry_id) {
            $event = getEntry($entry_id);
            if (count($event)) {
                $entries[$event['entry_id']] = $event;
                if ($event['time_start'] < $start) {
                    $event['time_start'] = $start;
                }
                $event['time_start'] = round_t_down($event['time_start'], $resolution);
                $timed_entries[$event['time_start']][$event['entry_id']] = $event['entry_id'];
            }
        }
    }
}
echo '<table width="1024" style="border-collapse: collapse;">' . chr(10);
echo ' <tr>' . chr(10);
echo '  <td height="135px">' . chr(10);
echo ' <tr>' . chr(10);
echo '  <td width="160" height="200px">&nbsp;</td>' . chr(10);
echo '  <td align="center" valign="top"><font style="font-size: 110px; font-family: arial;">' . $area2['area_name'] . '</font></td>' . chr(10);
echo ' <tr>' . chr(10);
echo '<td width="1000" align="center" colspan="2" height="360px" style="padding: 40px 100px 40px 100px;">';
foreach ($entries as $entry) {
    if ($entry['infoscreen_txt'] != '') {
开发者ID:HNygard,项目名称:JM-booking,代码行数:31,代码来源:infoskjerm.php

示例9: type

    #row[3] = short description
    #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
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:day.php


注:本文中的round_t_down函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。