本文整理汇总了PHP中Time::formatDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::formatDateTime方法的具体用法?PHP Time::formatDateTime怎么用?PHP Time::formatDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::formatDateTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_res
/**
* Checks to see if a time is already reserved
* @return whether the time is reserved or not
*/
function check_res($resources_to_add)
{
$is_valid = $add_valid = true;
$reserved = $this->db->checkAdditionalResources($this, $resources_to_add);
$add_valid = count($reserved) <= 0;
if (!$add_valid) {
for ($i = 0; $i < count($reserved); $i++) {
$this->add_error(translate('Additional resource is reserved', array($reserved[$i]['name'], $reserved[$i]['number_available'])));
}
} else {
$is_valid = !$this->db->check_res($this);
}
if (!$is_valid) {
$this->add_error(translate('reserved or unavailable', array(Time::formatDateTime($this->start_date + 60 * $this->start), Time::formatDateTime($this->end_date + 60 * $this->end))));
}
return $is_valid && $add_valid;
}
示例2: showReservationTable
//.........这里部分代码省略.........
echo translate('My Reservations');
?>
</a></div>
</td>
<td class="tableTitle2">
<!-- <a href="export.php">Export Calendar to File</a> -->
<!-- <?php
$link->doImageLink('export.php', 'img/export.gif', 'Export Reservations');
?>
-->
</td>
<td class="tableTitle">
<div align="right">
<!-- <a href="export.php">Export Calendar to File</a> -->
<!-- <?php
$link->doLink('javascript: help(\'my_reservations\');', '?', '', 'color: #FFFFFF;', translate('Help') . ' - ' . translate('My Reservations'));
?>
-->
</div>
</td>
</tr>
</table>
<div id="reservation" style="display: <?php
echo getShowHide('reservation');
?>
">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="rowHeaders">
<td width="10%">
<?php
$link->doLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($qs, 'start_date'), translate('Start Date'));
?>
</td>
<td width="10%">
<?php
$link->doLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($qs, 'end_date'), translate('End Date'));
?>
</td>
<td width="23%">
<?php
$link->doLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($qs, 'name'), translate('Room'));
?>
</td>
<td width="10%">
<?php
$link->doLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($qs, 'starttime'), translate('Start Time'));
?>
</td>
<td width="10%">
<?php
$link->doLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($qs, 'endtime'), translate('End Time'));
?>
</td>
<!--<td width="20%">
<?php
$link->doLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($qs, 'created'), translate('Created'));
?>
</td>
<td width="8%"><?php
echo '-';
?>
</td>
<td width="8%"><?php
echo '-';
?>
</td>
-->
</tr>
<?php
// Write message if they have no reservations
if (!$res) {
echo ' <tr class="cellColor"><td colspan="8" align="center">' . $err . '</td></tr>';
}
// For each reservation, clean up the date/time and print it
for ($i = 0; is_array($res) && $i < count($res); $i++) {
$bgcolor = '';
$rs = $res[$i];
$class = 'cellColor' . $i % 2;
if ($res[$i]['is_pending']) {
$class = 'cpanelCell';
$bgcolor = '#' . $conf['ui']['pending'][0]['color'];
}
$modified = isset($rs['modified']) && !empty($rs['modified']) ? Time::formatDateTime($rs['modified']) : 'N/A';
echo " <tr class=\"{$class}\" align=\"center\" style=\"background-color:{$bgcolor};\">" . " <td>" . Time::formatReservationDate($rs['start_date'], $rs['starttime']) . '</td>' . ' <td>' . Time::formatReservationDate($rs['end_date'], $rs['endtime']) . '</td>' . ' <td style="text-align:left;">' . $rs['name'] . '</td>' . ' <td>' . Time::formatTime($rs['starttime']) . '</td>' . ' <td>' . Time::formatTime($rs['endtime']) . '</td>' . " </tr>\n";
}
?>
</table>
</div>
</td>
</tr>
</table>
<?php
}
示例3: search
//.........这里部分代码省略.........
$recs = count($res);
// Print number of results found and a link to the text version
echo '<h3 align="center">' . translate('Search Results found', array($recs)) . "</h3>\n" . '<h5 align="center">' . $link->getLink($_SERVER['PHP_SELF'], translate('Try a different search')) . "</h5>\n";
print_change_output($_POST);
echo "<hr noshade size=\"1\">\n";
// If there were no results found, exit
if ($recs <= 0) {
return;
}
// Set up initial booleans
$newUser = false;
$newMach = false;
$totalHours = 0;
$resNo = 1;
// Get first row
$rs = $res[0];
// Set up initial previous user/machine variables
$prevUser = $rs['memberid'];
$prevMach = $rs['machid'];
/* Text file variables */
// Create text output
// Make global to share with other functions
if ($type == 'text') {
$GLOBALS['dblStr'] = str_repeat('=', 50) . "\n";
$GLOBALS['sglStr'] = str_repeat('-', 50) . "\n";
}
if ($type != 'html') {
// Plain-text view
echo '<pre>';
echo translate('Search Run On') . ' ' . date('M jS, Y - h:i:s a') . "\r\n\r\n";
}
// Print out first table with this information
printUserInfo($rs['fname'], $rs['lname'], $rs['memberid'], $type);
printTableHeader($rs['fname'], $rs['lname'], $rs['name'], $type, $rs['scheduletitle']);
if ($type == 'csv') {
// Print record id line for csv output
print_csv_header();
}
// Repeat for each record
for ($i = 0; $i < count($res); $i++) {
$rs = $res[$i];
// Current reservation
// If we are at a new user, set them to prevUser
if ($prevUser != $rs['memberid']) {
$prevUser = $rs['memberid'];
$newUser = true;
}
// If we are at a new resource, set it to prevMach
if ($prevMach != $rs['machid']) {
$prevMach = $rs['machid'];
$newMach = true;
}
// If we are making a new table (by advancing to new user or resource)
if ($newUser || $newMach) {
// Write total hours row and close table
// Write out total hours for this machine
printTableFooter($totalHours, $type, $percent);
$totalHours = 0;
// Reset total hours
$resNo = 1;
// Reset total reservations
// If it is a new user, write a comment, a extra break, and the user info
if ($newUser) {
// Write extra break to text output
if ($type == 'text') {
echo "\r\n\r\n";
}
if ($html) {
echo '<p> </p>';
}
printUserInfo($rs['fname'], $rs['lname'], $rs['memberid'], $type);
}
// Set both newUser and newResource to false
$newUser = false;
$newMach = false;
// Write next table header
printTableHeader($rs['fname'], $rs['lname'], $rs['name'], $type, $rs['scheduletitle']);
}
// Keep running total of hours on this machine
$totalHours = $totalHours + ($rs['end_date'] / 60 + $rs['endtime'] - ($rs['start_date'] / 60 + $rs['starttime']));
// Calculate what percentage that is of total machine time
$percent = sprintf('%.02f', $totalHours / $rs_hours[$rs['machid']] * 100);
// Store variables
$start_date = Time::formatDate($rs['start_date'], null, false);
$end_date = Time::formatDate($rs['end_date'], null, false);
$created = Time::formatDateTime($rs['created'], null, false);
$modified = !empty($rs['modified']) ? Time::formatDateTime($rs['modified'], null, false) : translate('N/A');
$starttime = Time::formatTime($rs['starttime'], false);
$endtime = Time::formatTime($rs['endtime'], false);
$totTime = $rs['end_date'] / 60 + $rs['endtime'] - ($rs['start_date'] / 60 + $rs['starttime']);
print_reservation_data($type, $link, $resNo++, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $rs['resid'], $rs['fname'], $rs['lname'], $rs['name'], $rs['memberid'], $rs['scheduletitle']);
}
unset($rs);
// On last record, print out total hours
// Write out total hours for this machine
printTableFooter($totalHours, $type, $percent);
if (!$html) {
echo '</pre>';
}
}
示例4: print_create_modify
/**
* Print out created and modifed times in a table, if they exist
* @param int $c created timestamp
* @param int $m modified stimestamp
*/
function print_create_modify($c, $m)
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr class="tableBorder">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="formNames" width="100"><?php
echo translate('Created');
?>
</td>
<td class="cellColor"><?php
echo Time::formatDateTime($c);
?>
</td>
</tr>
<tr>
<td class="formNames"><?php
echo translate('Last Modified');
?>
</td>
<td class="cellColor"><?php
echo !empty($m) ? Time::formatDateTime($m) : translate('N/A');
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>
<?php
}