本文整理汇总了PHP中Time::formatDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::formatDate方法的具体用法?PHP Time::formatDate怎么用?PHP Time::formatDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::formatDate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_date_span
/**
* Print out week being viewed above schedule tables
* @param array $d array of date information about this schedule
* @param string $title title of schedule
*/
function print_date_span($d, $title)
{
// Print out current week being viewed
// echo '<h3 align="center">' . $title . '<br/>' . Time::formatDate($d['firstDayTs']) . ' - ' . Time::formatDate($d['lastDayTs']) . '</h3>';
// AK: Updated version. We want to display current date only.
echo '<h3 align="center">' . Time::formatDate($d['todayTs']) . '</h3>';
}
示例2: showAnnouncementTable
/**
* This function prints out the announcement table
*
* @param array announcements
* @global $conf
* @global $link
*/
function showAnnouncementTable($announcements)
{
global $link;
global $conf;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td class="tableBorder">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="tableTitle">
<a href="javascript: void(0);" onclick="showHideCpanelTable('announcements');">› <?php
echo translate('My Announcements');
?>
</a>
</td>
<td class="tableTitle">
<div align="right">
<?php
$link->doLink('javascript: help(\'my_announcements\');', '?', '', 'color: #FFFFFF;', translate('Help') . ' - ' . translate('My Announcements'));
?>
</div>
</td>
</tr>
</table>
<div id="announcements" style="display: <?php
echo getShowHide('announcements');
?>
">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="cellColor">
<td colspan="2"><b><?php
echo translate('Announcements as of', array(Time::formatDate(mktime())));
?>
</b>
<ul style="margin-bottom: 0px; margin-left: 20px; margin-top: 5px">
<?php
// Cycle through and print out announcements
if (!$announcements) {
echo "<li>" . translate('There are no announcements') . ".</li>\n";
} else {
// For each reservation, clean up the date/time and print it
for ($i = 0; is_array($announcements) && $i < count($announcements); $i++) {
$rs = $announcements[$i];
echo '<li>' . $rs['announcement'] . '</li>';
}
unset($announcements);
}
?>
</ul>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<?php
}
示例3: _buildBody
function _buildBody($reminder)
{
return translate_email('Reminder Body', $reminder->resource_name, Time::formatDate($reminder->start_date), Time::formatTime($reminder->start_time), Time::formatDate($reminder->end_date), Time::formatTime($reminder->end_time));
}
示例4: PHPMailer
$mailer = new PHPMailer();
$mailer->From = $conf['app']['adminEmail'];
$mailer->FromName = $conf['app']['title'];
$mailer->Subject = translate($translate_index, array($user->get_name(), Time::formatDate($res->start_date)));
$mailer->IsHTML(false);
$mailer->AddAddress($owner->get_email());
$mailer->Body = translate($translate_index, array($user->get_name(), Time::formatDate($res->start_date)));
$mailer->Send();
if (count($failed) > 0) {
echo '<p>' . translate('You are not participating on the following reservation dates because they are at full capacity.') . '</p>';
for ($i = 0; $i < count($failed); $i++) {
echo '<p>' . Time::formatDate($failed[$i]['start_date']) . '</p>';
}
}
$msg = '';
$msg .= translate($translate_index, array($user->get_name(), Time::formatDate($res->start_date))) . '<br/>';
if (Auth::is_logged_in()) {
$msg .= Link::getLink('ctrlpnl.php', translate('Return to My Control Panel'));
} else {
$msg .= Link::getLink('index.php', translate('Login to manage all of your invitiations'));
}
CmnFns::do_message_box($msg);
}
} else {
CmnFns::do_error_box(translate('That record could not be found.'), '', false);
}
} else {
CmnFns::do_error_box(translate('That reservation is at full capacity.'), '', false);
}
}
} else {
示例5: print_export_table
/**
* Provides ability to generate an iCalendar export file for a reservation or reservations within a date range
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @version 04-24-06
* @package phpScheduleIt.iCalendar
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
function print_export_table()
{
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom:10px;">
<tr>
<td class="tableTitle">
<?php
echo translate('Select reservations to export');
?>
</td>
</tr>
</table>
<table style="background-color:#CCCCCC;" cellspacing="1">
<tr class="cellColor">
<td width="70" class="formNames" style="font-weight:bold;"><?php
echo translate('Starting Date');
?>
</td>
<td width="120">
<div id="div_start_date" style="float:left;" class="textbox"><?php
echo Time::formatDate(mktime());
?>
</div><a href="javascript:void(0);"><img src="img/calendar.gif" style="padding-left:10px;" border="0" id="img_start_date" alt="' <?php
echo translate('Start');
?>
"/></a>
<input type="hidden" id="hdn_start_date" name="start_date" value="<?php
echo date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', mktime());
?>
"/>
</td>
<td width="70" class="formNames" style="font-weight:bold;"><?php
echo translate('Ending Date');
?>
</td>
<td width="120">
<div id="div_end_date" style="float:left;" class="textbox"><?php
echo Time::formatDate(mktime());
?>
</div><a href="javascript:void(0);"><img src="img/calendar.gif" style="padding-left:10px;" border="0" id="img_end_date" alt="' <?php
echo translate('End');
?>
" /></a>
<input type="hidden" id="hdn_end_date" name="end_date" value="<?php
echo date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', mktime());
?>
" />
</td>
<td width="70" class="formNames" style="font-weight:bold;"><?php
echo translate('Export Format');
?>
:</td>
<td width="120">
<select name="type" id="type" class="textbox">
<option value="ical">iCalendar</option>
<option value="vcal">vCalendar</option>
</select>
</td>
</tr>
<tr class="cellColor">
<td colspan="2"><?php
echo translate('None');
?>
<input type="checkbox" name="nostart" id="nostart" value="nostart" onclick="blurDiv(this, 'div_start_date');" /></td>
<td colspan="2"><?php
echo translate('None');
?>
<input type="checkbox" name="noend" id="noend" value="noend" onclick="blurDiv(this, 'div_end_date');" /></td>
<td colspan="2"> </td>
</tr>
<tr class="cellColor">
<td colspan="6" align="right">
<input type="button" value="<?php
echo translate('Export');
?>
" class="button" onclick="exportSearch();" />
</td>
</tr>
</table>
<?php
}
示例6: print_announce_edit
/**
* Interface to add or edit announcement information
* @param mixed $rs array of schedule data
* @param boolean $edit whether this is an edit or not
* @param object $pager Pager object
*/
function print_announce_edit($rs, $edit, &$pager)
{
global $conf;
$start_date_ok = isset($rs['start_datetime']) && !empty($rs['start_datetime']);
$end_date_ok = isset($rs['end_datetime']) && !empty($rs['end_datetime']);
$start_date = $start_date_ok ? $rs['start_datetime'] : mktime();
$end_date = $end_date_ok ? $rs['end_datetime'] : mktime();
?>
<form name="addAnnouncement" method="post" action="admin_update.php" <?php
echo $edit ? "" : "onsubmit=\"return checkAddAnnouncement();\"";
?>
>
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td class="tableBorder">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="formNames"><?php
echo translate('Announcement');
?>
</td>
<td class="cellColor"><input type="text" name="announcement" class="textbox" size="50" maxlength="300" value="<?php
echo isset($rs['announcement']) ? htmlspecialchars($rs['announcement']) : '';
?>
" />
</td>
</tr>
<tr>
<td width="200" class="formNames"><?php
echo translate('Number');
?>
</td>
<td class="cellColor"><input type="text" name="number" class="textbox" size="3" maxlength="3" value="<?php
echo isset($rs['number']) ? $rs['number'] : '';
?>
" />
</td>
</tr>
<tr>
<td class="formNames"><?php
echo translate('Start Date');
?>
</td>
<td class="cellColor">
<?php
echo '<div id="div_start_date" style="float:left;width:70px;">' . Time::formatDate($start_date) . '</div><input type="hidden" id="hdn_start_date" name="start_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $start_date) . '"/> <a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_start_date" alt="' . translate('Start') . '"/></a>';
$s_hour = $start_date_ok ? date('h', $rs['start_datetime']) : '';
$s_min = $start_date_ok ? date('i', $rs['start_datetime']) : '';
$s_pm = $start_date_ok ? intval(date('H', $rs['start_datetime'])) >= 12 : false;
echo ' @ <input type="text" maxlength="2" size="2" class="textbox" name="start_hour" value="' . $s_hour . '"/> : <input type="text" maxlength="2" size="2" class="textbox" name="start_min" value="' . $s_min . '"/>';
echo ' <select name="start_ampm" class="textbox"><option value="am">' . translate('am') . '</option><option value="pm"' . ($s_pm ? ' selected="selected"' : '') . '>' . translate('pm') . '</option></select>';
echo ' <input type="checkbox" name="use_start_time"' . ($start_date_ok ? ' checked="checked"' : '') . '/> ' . translate('Use start date/time?');
?>
</td>
</tr>
<tr>
<td class="formNames"><?php
echo translate('End Date');
?>
</td>
<td class="cellColor">
<?php
echo '<div id="div_end_date" style="float:left;width:70px;">' . Time::formatDate($end_date) . '</div><input type="hidden" id="hdn_end_date" name="end_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $end_date) . '"/> <a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_end_date" alt="' . translate('End') . '"/></a>';
$s_hour = $end_date_ok ? date('h', $rs['end_datetime']) : '';
$s_min = $end_date_ok ? date('i', $rs['end_datetime']) : '';
$s_pm = $end_date_ok ? intval(date('H', $rs['end_datetime'])) >= 12 : false;
echo ' @ <input type="text" maxlength="2" size="2" class="textbox" name="end_hour" value="' . $s_hour . '"/> : <input type="text" maxlength="2" size="2" class="textbox" name="end_min" value="' . $s_min . '"/>';
echo ' <select name="end_ampm" class="textbox"><option value="am">' . translate('am') . '</option><option value="pm"' . ($s_pm ? ' selected="selected"' : '') . '>' . translate('pm') . '</option></select>';
echo ' <input type="checkbox" name="use_end_time"' . ($end_date_ok ? ' checked="checked"' : '') . '/> ' . translate('Use end date/time?');
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<?php
// Print out correct buttons
if (!$edit) {
echo submit_button(translate('Add Announcement'), 'announcementid') . hidden_fn('addAnnouncement') . ' <input type="reset" name="reset" value="' . translate('Clear') . '" class="button" />' . "\n";
} else {
echo submit_button(translate('Edit Announcement'), 'announcementid') . cancel_button($pager) . hidden_fn('editAnnouncement') . '<input type="hidden" name="announcementid" value="' . $rs['announcementid'] . '" />' . "\n";
}
echo "</form>\n";
print_jscalendar_setup($start_date_ok ? $rs['start_datetime'] : null, $end_date_ok ? $rs['end_datetime'] : null);
// Set up the javascript calendars
// Unset variables
unset($rs);
}
示例7: remove_users_email
/**
* Send an email informing the users they have been dropped from the reservation
* @param array $emails array of email addresses
* @param array $dates that have been dropped
*/
function remove_users_email($emails, $dates)
{
global $conf;
$mailer = new PHPMailer();
$mailer->From = $this->user->get_email();
$mailer->FromName = $this->user->get_name();
$mailer->Subject = $conf['app']['title'] . ' ' . translate('Reservation Participation Change');
$mailer->IsHTML(false);
$url = CmnFns::getScriptURL();
// Format dates
$start_date = Time::formatDate($this->start_date);
$end_date = Time::formatDate($this->end_date);
$start = Time::formatTime($this->get_start());
$end = Time::formatTime($this->get_end());
$dates_text = '';
for ($d = 1; $d < count($dates); $d++) {
$dates_text .= Time::formatDate($dates) . ",";
}
foreach ($emails as $email) {
$mailer->ClearAllRecipients();
$mailer->AddAddress($email);
$mailer->Body = translate_email('reservation_removal', $this->resource->properties['name'], $start_date, $start, $end_date, $end, $this->summary, $dates_text);
$mailer->Send();
}
}
示例8: 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>';
}
}
示例9: DBEngine
* @package phpScheduleIt
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/DBEngine.class.php';
if (!(bool) $conf['app']['allowRss'] || (bool) $conf['app']['allowRss'] && !isset($_GET['id'])) {
die;
}
$db = new DBEngine();
$res = $db->get_user_reservations($_GET['id'], 'res.start_date', 'DESC', true);
global $charset;
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?" . ">\n<rss version=\"2.0\">\n";
echo "<channel>\n<title>{$conf['app']['title']} Reservations</title>\n";
if (!$res) {
echo "<item>\n";
echo '<title>' . $db->err_msg . "</title>\n";
echo '<link>' . CmnFns::getScriptURL() . "</link>\n";
echo '<description>' . $db->err_msg . "</description>\n";
echo "</item>\n";
}
for ($i = 0; $i < count($res) && $res != false; $i++) {
$cur = $res[$i];
echo "<item>\n";
echo '<title>' . $cur['name'] . ' [' . Time::formatDate($cur['start_date']) . ' @ ' . Time::formatTime($cur['starttime']) . "]</title>\n";
echo '<link>' . CmnFns::getScriptURL() . "/reserve.php?type=m&resid={$cur['resid']}&scheduleid={$cur['scheduleid']}" . "</link>\n";
echo '<description>' . "</description>\n";
echo "</item>\n";
}
echo "</channel>\n</rss>";
示例10: print_time_info
/**
* Print out available times or current reservation's time
* This function will print out all available times to make
* a reservation or will print out the selected reservation's time
* (if this is a view).
* @param array $res resource data array
* @param object $rs reservation object
* @param bool $print_min_max bool whether to print the min_max cells
* @param bool $allow_multi bool if multiple day reseravtions are allowed
* @global $conf
*/
function print_time_info($res, $rs, $print_min_max = true, $allow_multi = false)
{
global $conf;
$type = $res->get_type();
$interval = $res->sched['timespan'];
$startDay = $res->sched['daystart'];
$endDay = $res->sched['dayend'];
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr class="tableBorder">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="2" class="cellColor">
<h5 align='left'>
<?php
// Print message depending on viewing type
switch ($type) {
case RES_TYPE_ADD:
$msg = translate('Please select the starting and ending times');
break;
case RES_TYPE_MODIFY:
$msg = translate('Please change the starting and ending times');
break;
default:
$msg = translate('Reserved time');
break;
}
if ((bool) $res->get_pending()) {
$msg .= ' (' . translate('Pending Approval') . ')';
}
echo $msg;
?>
</h5>
</td>
</tr>
<tr>
<td class="formNames"><?php
echo translate('Start');
?>
</td>
<td class="formNames"><?php
echo translate('End');
?>
</td>
</tr>
<tr>
<?php
$start_date = $res->get_start_date();
$end_date = $res->get_end_date();
$display_start_date = Time::getAdjustedDate($res->get_start_date(), $res->get_start());
$display_end_date = Time::getAdjustedDate($res->get_end_date(), $res->get_end());
// Show reserved time or select boxes depending on type
if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY || $type == RES_TYPE_APPROVE) {
// Start time select box
echo '<td class="formNames" width="50%"><div id="div_start_date" style="float:left;width:86px;">' . Time::formatDate($display_start_date, '', false) . '</div><input type="hidden" id="hdn_start_date" name="start_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $start_date) . '" onchange="checkCalendarDates();"/>';
if ($allow_multi) {
echo '<a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_start_date" alt="' . translate('Start') . '"/></a>' . '<br/><br/>';
}
echo "<select name=\"starttime\" class=\"textbox\">\n";
// Start at startDay time, end 30 min before endDay
for ($i = $startDay; $i < $endDay + $interval; $i += $interval) {
echo '<option value="' . $i . '"';
// If this is a modification, select corrent time
if ($res->get_start() == $i) {
echo ' selected="selected" ';
}
echo '>' . Time::formatTime($i) . '</option>';
}
echo "</select>\n</td>\n";
// End time select box
echo '<td class="formNames"><div id="div_end_date" style="float:left;width:86px;">' . Time::formatDate($display_end_date, '', false) . '</div><input type="hidden" id="hdn_end_date" name="end_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $end_date) . '" onchange="checkCalendarDates();"/>';
if ($allow_multi) {
echo '<a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_end_date" alt="' . translate('End') . '"/></a>' . '<br/><br/>';
}
echo "<select name=\"endtime\" class=\"textbox\">\n";
// Start at 30 after startDay time, end 30 at endDay time
for ($i = $startDay; $i < $endDay + $interval; $i += $interval) {
echo "<option value=\"{$i}\"";
// If this is a modification, select corrent time
if ($res->get_end() == $i) {
echo ' selected="selected" ';
}
echo '>' . Time::formatTime($i) . "</option>\n";
}
echo "</select>\n</td>\n";
if ($print_min_max & !$allow_multi) {
echo '</tr><tr class="noshow">' . '<td colspan="2">' . translate('Minimum Reservation Length') . ' ' . Time::minutes_to_hours($rs['minres']) . '</td></tr>' . '<tr class="noshow">' . '<td colspan="2">' . translate('Maximum Reservation Length') . ' ' . Time::minutes_to_hours($rs['maxres']) . '</td>';
}
//.........这里部分代码省略.........