本文整理汇总了PHP中w2p_Utilities_Date::format方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::format方法的具体用法?PHP w2p_Utilities_Date::format怎么用?PHP w2p_Utilities_Date::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Utilities_Date
的用法示例。
在下文中一共展示了w2p_Utilities_Date::format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatDate
private function formatDate($mysqlDate)
{
$myDate = new w2p_Utilities_Date($mysqlDate);
$myDatetime = $myDate->format('%Y%m%d %T');
$myDatetime = str_replace(':', '', $myDatetime);
$myDatetime = str_replace(' ', 'T', $myDatetime) . 'Z';
return $myDatetime;
}
示例2: hook_preStore
protected function hook_preStore()
{
if ($this->budget_start_date) {
$date = new w2p_Utilities_Date($this->budget_start_date);
$this->budget_start_date = $date->format(FMT_DATETIME_MYSQL);
}
if ($this->budget_end_date) {
$date = new w2p_Utilities_Date($this->budget_end_date);
$this->budget_end_date = $date->format(FMT_DATETIME_MYSQL);
}
parent::hook_preStore();
}
示例3: canView
$canRead = canView($m);
if (!$canRead) {
$AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
w2PsetMicroTime();
// retrieve any state parameters
if (isset($_REQUEST['company_id'])) {
$AppUI->setState('CalIdxCompany', intval(w2PgetParam($_REQUEST, 'company_id', 0)));
}
$company_id = $AppUI->getState('CalIdxCompany', 0);
// Using simplified set/get semantics. Doesn't need as much code in the module.
$event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', 'my'), 'EVENTFILTER', 'my');
// get the passed timestamp (today if none)
$ctoday = new w2p_Utilities_Date();
$today = $ctoday->format(FMT_TIMESTAMP_DATE);
$date = w2PgetParam($_GET, 'date', $today);
// get the list of visible companies
$company = new CCompany();
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
// setup the title block
$titleBlock = new CTitleBlock('Monthly Calendar', 'myevo-appointments.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=calendar&a=year_view&date=' . $date, 'year view');
$titleBlock->addCrumb('?m=calendar&date=' . $date, 'month view');
$titleBlock->addCrumb('?m=calendar&a=week_view&date=' . $date, 'week view');
$titleBlock->addCrumb('?m=calendar&a=day_view&date=' . $date, 'day view');
$titleBlock->addCell($AppUI->_('Company') . ':');
$titleBlock->addCell(arraySelect($companies, 'company_id', 'onChange="document.pickCompany.submit()" class="text"', $company_id), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickCompany" accept-charset="utf-8">', '</form>');
$titleBlock->addCell($AppUI->_('Event Filter') . ':');
$titleBlock->addCell(arraySelect($event_filter_list, 'event_filter', 'onChange="document.pickFilter.submit()" class="text"', $event_filter, true), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickFilter" accept-charset="utf-8">', '</form>');
示例4: CForum
}
$forum = new CForum();
$forum->load($forum_id);
$project = new CProject();
$project->load($forum->forum_project);
$messages = $forum->getMessages(null, $forum_id, $message_id, $sort);
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$df .= ' ' . $AppUI->getPref('TIMEFORMAT');
$pdfdata = array();
$pdfhead = array('Date', 'User', 'Message');
foreach ($messages as $row) {
// Find the parent message - the topic.
if ($row['message_id'] == $message_id) {
$topic = $row['message_title'];
}
$date = new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['message_date'], '%Y-%m-%d %T'));
$pdfdata[] = array($date->format($df), $row['contact_display_name'], '<b>' . $row['message_title'] . '</b>' . "\n" . $row['message_body']);
}
$font_dir = W2P_BASE_DIR . '/lib/ezpdf/fonts';
$temp_dir = W2P_BASE_DIR . '/files/temp';
$output = new w2p_Output_PDFRenderer();
$pdf = $output->getPDF();
$pdf->selectFont($font_dir . '/Helvetica.afm');
$pdf->ezText('Project: ' . $project->project_name);
$pdf->ezText('Forum: ' . $forum->forum_name);
$pdf->ezText('Topic: ' . $topic);
$pdf->ezText('');
$options = array('showLines' => 1, 'showHeadings' => 1, 'fontSize' => 8, 'rowGap' => 2, 'colGap' => 5, 'xPos' => 35, 'xOrientation' => 'right', 'width' => '400', 'cols' => array(0 => array('justification' => 'left', 'width' => 75), 1 => array('justification' => 'left', 'width' => 100), 2 => array('justification' => 'left', 'width' => 350)));
$pdf->ezTable($pdfdata, $pdfhead, null, $options);
$pdf->ezStream(array('Content-Disposition' => 'forum-thread-' . $forum_id . '.pdf'));
示例5: elseif
$df .= ' ' . $AppUI->getPref('TIMEFORMAT');
$contact_updatekey = $carr[$z][$x]['contact_updatekey'];
$contact_lastupdate = $carr[$z][$x]['contact_lastupdate'];
$contact_updateasked = $carr[$z][$x]['contact_updateasked'];
$last_ask = new w2p_Utilities_Date($contact_updateasked);
$lastAskFormatted = $last_ask->format($df);
if (count($projectList) > 0) {
echo '<a href="" onclick=" window.open(\'./index.php?m=public&a=selector&dialog=1&callback=goProject&table=projects&user_id=' . $carr[$z][$x]['contact_id'] . '\', \'selector\', \'left=50,top=50,height=250,width=400,resizable\');return false;">' . w2PshowImage('projects.png', '', '', $m, 'click to view projects associated with this contact') . '</a>';
}
if ($contact_updateasked && (!$contact_lastupdate || $contact_lastupdate == 0) && $contact_updatekey) {
echo w2PtoolTip('info', 'Waiting for Contact Update Information. (Asked on: ' . $lastAskFormatted . ')') . '<img src="' . w2PfindImage('log-info.gif') . '" style="float: right;">' . w2PendTip();
} elseif ($contact_updateasked && (!$contact_lastupdate || $contact_lastupdate == 0) && !$contact_updatekey) {
echo w2PtoolTip('info', 'Waiting for too long! (Asked on ' . $lastAskFormatted . ')') . '<img src="' . w2PfindImage('log-error.gif') . '" style="float: right;">' . w2PendTip();
} elseif ($contact_updateasked && !$contact_updatekey) {
$last_ask = new w2p_Utilities_Date($contact_lastupdate);
echo w2PtoolTip('info', 'Update sucessfully done on: ' . $last_ask->format($df) . '') . '<img src="' . w2PfindImage('log-notice.gif') . '" style="float: right;">' . w2PendTip();
}
?>
</span>
</th>
</table>
</td>
</tr>
<tr>
<?php
reset($showfields);
$s = '';
while (list($key, $val) = each($showfields)) {
if (mb_strlen($carr[$z][$x][$key]) > 0) {
if ($val == 'contact_email') {
$s .= '<td class="hilite" colspan="2">' . w2p_email($carr[$z][$x][$key]) . '</td></tr>';
示例6: elseif
$result = $upd_task->store($AppUI);
if (is_array($result)) {
break;
}
}
}
//Action: Other Actions
if (isset($_POST['bulk_task_other']) && $bulk_task_other != '') {
if ($upd_task->task_id) {
//Option 1 - Mark as finished
if ($bulk_task_other == '1') {
$upd_task->task_percent_complete = 100;
if (!$upd_task->task_end_date || $upd_task->task_end_date == '0000-00-00 00:00:00') {
$end_date = null;
$end_date = new w2p_Utilities_Date();
$upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
$result = $upd_task->store($AppUI);
if (is_array($result)) {
break;
}
//Option 2 - Mark as milestone
} elseif ($bulk_task_other == '2') {
$upd_task->task_milestone = 1;
$result = $upd_task->store($AppUI);
if (is_array($result)) {
break;
}
//Option 3 - Mark as non milestone
} elseif ($bulk_task_other == '3') {
$upd_task->task_milestone = 0;
示例7: addHelpDeskTaskLog
public function addHelpDeskTaskLog()
{
global $helpdesk_available;
if ($helpdesk_available && $this->file_helpdesk_item != 0) {
// create task log with information about the file that was uploaded
$task_log = new CHDTaskLog();
$task_log->overrideDatabase($this->_query);
$task_log->task_log_help_desk_id = $this->_hditem->item_id;
if ($this->_message != 'deleted') {
$task_log->task_log_name = 'File ' . $this->file_name . ' uploaded';
} else {
$task_log->task_log_name = 'File ' . $this->file_name . ' deleted';
}
$task_log->task_log_description = $this->file_description;
$task_log->task_log_creator = $this->_AppUI->user_id;
$date = new w2p_Utilities_Date();
$task_log->task_log_date = $date->format(FMT_DATETIME_MYSQL);
if ($msg = $task_log->store()) {
$this->_AppUI->setMsg($msg, UI_MSG_ERROR);
}
}
return null;
}
示例8: die
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$del = (int) w2PgetParam($_POST, 'del', 0);
$obj = new CEvent();
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
if ($obj->event_start_date) {
$start_date = new w2p_Utilities_Date($obj->event_start_date . $_POST['start_time']);
$obj->event_start_date = $start_date->format(FMT_DATETIME_MYSQL);
}
if ($obj->event_end_date) {
$end_date = new w2p_Utilities_Date($obj->event_end_date . $_POST['end_time']);
$obj->event_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
$action = $del ? 'deleted' : 'stored';
$clashRedirect = false;
if ($del) {
$result = $obj->delete();
} else {
if ($_POST['event_assigned'] > '' && ($clash = $obj->checkClash($_POST['event_assigned']))) {
$last_a = $a;
$GLOBALS['a'] = "clash";
$clashRedirect = true;
} else {
$result = $obj->store();
if (isset($_POST['event_assigned'])) {
$obj->updateAssigned(explode(',', $_POST['event_assigned']));
}
示例9: clash_process
function clash_process(CAppUI $AppUI)
{
global $do_include;
$obj = new CEvent();
$obj->bind($_SESSION['add_event_post']);
$attendees = $_SESSION['add_event_attendees'];
$users = array();
if (isset($attendees) && $attendees) {
$users = explode(',', $attendees);
}
array_push($users, $obj->event_owner);
// First remove any duplicates
$users = array_unique($users);
// Now remove any null entries, so implode doesn't create a dud SQL
// Foreach is safer as it works on a copy of the array.
foreach ($users as $key => $user) {
if (!$user) {
unset($users[$key]);
}
}
$start_date = new w2p_Utilities_Date($_POST['event_start_date'] . "000000");
$end_date = new w2p_Utilities_Date($_POST['event_end_date'] . "235959");
// First find any events in the range requested.
$event_list = $obj->getEventsInWindow($start_date->format(FMT_DATETIME_MYSQL), $end_date->format(FMT_DATETIME_MYSQL), (int) ($_POST['start_time'] / 100), (int) ($_POST['end_time'] / 100), $users);
$event_start_date = new w2p_Utilities_Date($_POST['event_start_date'] . $_POST['start_time']);
$event_end_date = new w2p_Utilities_Date($_POST['event_end_date'] . $_POST['end_time']);
if (!$event_list || !count($event_list)) {
// First available date/time is OK, seed addEdit with the details.
$obj->event_start_date = $event_start_date->format(FMT_DATETIME_MYSQL);
$obj->event_end_date = $event_end_date->format(FMT_DATETIME_MYSQL);
$_SESSION['add_event_post'] = get_object_vars($obj);
$AppUI->setMsg('No clashes in suggested timespan', UI_MSG_OK);
$_SESSION['event_is_clash'] = true;
$_GET['event_id'] = $obj->event_id;
$do_include = W2P_BASE_DIR . "/modules/calendar/addedit.php";
return;
}
// Now we grab the events, in date order, and compare against the
// required start and end times.
// Working in 30 minute increments from the start time, and remembering
// the end time stipulation, find the first hole in the times.
// Determine the duration in hours/minutes.
$start_hour = (int) ($_POST['start_time'] / 10000);
$start_minutes = (int) ($_POST['start_time'] % 10000 / 100);
$start_time = $start_hour * 60 + $start_minutes;
$end_hour = (int) ($_POST['end_time'] / 10000);
$end_minutes = (int) ($_POST['end_time'] % 10000 / 100);
$end_time = $end_hour * 60 + $end_minutes - $_POST['duration'];
// First, build a set of "slots" that give us the duration
// and start/end times we need
$first_day = $start_date->format('%E');
$end_day = $end_date->format('%E');
$days_between = $end_day + 1 - $first_day;
$oneday = new Date_Span(array(1, 0, 0, 0));
$slots = array();
$slot_count = 0;
$first_date = new w2p_Utilities_Date($start_date);
for ($i = 0; $i < $days_between; $i++) {
if ($first_date->isWorkingDay()) {
$slots[$i] = array();
for ($j = $start_time; $j <= $end_time; $j += 30) {
$slot_count++;
$slots[$i][] = array('date' => $first_date->format('%Y-%m-%d'), 'start_time' => $j, 'end_time' => $j + $_POST['duration'], 'committed' => false);
}
}
$first_date->addSpan($oneday);
}
// Now process the events list
foreach ($event_list as $event) {
$sdate = new w2p_Utilities_Date($event['event_start_date']);
$edate = new w2p_Utilities_Date($event['event_end_date']);
$sday = $sdate->format('%E');
$day_offset = $sday - $first_day;
// Now find the slots on that day that match
list($syear, $smonth, $sday, $shour, $sminute, $ssecond) = sscanf($event['event_start_date'], "%4d-%2d-%2d %2d:%2d:%2d");
list($eyear, $emonth, $eday, $ehour, $eminute, $esecond) = sscanf($event['event_start_date'], "%4d-%2d-%2d %2d:%2d:%2d");
$start_mins = $shour * 60 + $sminute;
$end_mins = $ehour * 60 + $eminute;
if (isset($slots[$day_offset])) {
foreach ($slots[$day_offset] as $key => $slot) {
if ($start_mins <= $slot['end_time'] && $end_mins >= $slot['start_time']) {
$slots[$day_offset][$key]['committed'] = true;
}
}
}
}
// Third pass through, find the first uncommitted slot;
foreach ($slots as $day_offset => $day_slot) {
foreach ($day_slot as $slot) {
if (!$slot['committed']) {
$hour = (int) ($slot['start_time'] / 60);
$min = $slot['start_time'] % 60;
$ehour = (int) ($slot['end_time'] / 60);
$emin = $slot['end_time'] % 60;
$obj->event_start_date = $slot['date'] . ' ' . sprintf("%02d:%02d:00", $hour, $min);
$obj->event_end_date = $slot['date'] . ' ' . sprintf("%02d:%02d:00", $ehour, $emin);
$_SESSION['add_event_post'] = get_object_vars($obj);
$AppUI->setMsg('First available time slot', UI_MSG_OK);
$_SESSION['event_is_clash'] = true;
$_GET['event_id'] = $obj->event_id;
//.........这里部分代码省略.........
示例10: switch
switch ($rw['perc_assignment']) {
case 100:
$caption .= $rw['contact_display_name'] . ';';
break;
default:
$caption .= $rw['contact_display_name'] . ' [' . $rw['perc_assignment'] . '%];';
break;
}
}
$q->clear();
$caption = mb_substr($caption, 0, mb_strlen($caption) - 1);
}
if ($flags == 'm') {
$start = new w2p_Utilities_Date($start);
$start->addDays(0);
$s = $start->format($df);
if ($caller == 'todo') {
$gantt->addMilestone(array($name, $pname, '', $s, $s), $a['task_start_date']);
} else {
$gantt->addMilestone(array($name, '', $s, $s), $a['task_start_date']);
}
} else {
$type = $a['task_duration_type'];
$dur = $a['task_duration'];
if ($type == 24) {
$dur *= $w2Pconfig['daily_working_hours'];
}
if ($showWork == '1') {
$work_hours = 0;
$q = new w2p_Database_Query();
$q->addTable('tasks', 't');
示例11: getEventTooltip
$start_date = new w2p_Utilities_Date('2001-01-01 00:00:00');
$end_date = new w2p_Utilities_Date('2100-12-31 23:59:59');
// assemble the links for the events
$events = CEvent::getEventsForPeriod($start_date, $end_date, 'all', 0, $project_id);
$start_hour = w2PgetConfig('cal_day_start');
$end_hour = w2PgetConfig('cal_day_end');
$tf = $AppUI->getPref('TIMEFORMAT');
$df = $AppUI->getPref('SHDATEFORMAT');
$types = w2PgetSysVal('EventType');
$html = '<table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl">';
$html .= '<tr><th>' . $AppUI->_('Date') . '</th><th>' . $AppUI->_('Type') . '</th><th>' . $AppUI->_('Event') . '</th></tr>';
foreach ($events as $row) {
$html .= '<tr>';
$start = new w2p_Utilities_Date($row['event_start_date']);
$end = new w2p_Utilities_Date($row['event_end_date']);
$html .= '<td width="25%" nowrap="nowrap">' . $start->format($df . ' ' . $tf) . ' - ';
$html .= $end->format($df . ' ' . $tf) . '</td>';
$href = '?m=calendar&a=view&event_id=' . $row['event_id'];
$alt = $row['event_description'];
$html .= '<td width="10%" nowrap="nowrap">';
$html .= w2PshowImage('event' . $row['event_type'] . '.png', 16, 16, '', '', 'calendar');
$html .= ' <b>' . $AppUI->_($types[$row['event_type']]) . '</b><td>';
$html .= w2PtoolTip($row['event_title'], getEventTooltip($row['event_id']), true);
$html .= '<a href="' . $href . '" class="event">';
$html .= $row['event_title'];
$html .= '</a>';
$html .= w2PendTip();
$html .= '</td></tr>';
}
$html .= '</table>';
echo $html;
示例12: formatCurrency
echo $project['project_id'];
?>
"><?php
echo $project['project_name'];
?>
</a>
</td>
<td nowrap="nowrap"><?php
echo $project['contact_first_name'];
?>
<?php
echo $project['contact_last_name'];
?>
</td>
<td nowrap="nowrap"><?php
echo $start_date->format($df);
?>
</td>
<td nowrap="nowrap"><?php
echo $AppUI->_($pstatus[$project['project_status']]);
?>
</td>
<td nowrap="nowrap">
<?php
echo $w2Pconfig['currency_symbol'];
echo formatCurrency($project['project_target_budget'], $AppUI->getPref('CURRENCYFORM'));
?>
</td>
</tr>
<?php
}
示例13: IN
}
$q->clear();
$q->addQuery('a.*, b.resource_name');
$q->addTable('resource_tasks', 'a');
$q->addJoin('resources', 'b', 'a.resource_id = b.resource_id', 'inner');
$q->addWhere('a.task_id IN (' . implode(',', $task_list) . ')');
$res = $q->exec();
if (!$res) {
$AppUI->setMsg(db_error(), UI_MSG_ERROR);
$q->clear();
$AppUI->redirect();
}
while ($row = db_fetch_assoc($res)) {
$resources[$row['task_id']][$row['resource_id']] = $row['resource_name'] . ' [' . $row['percent_allocated'] . '%]';
}
$q->clear();
}
// Build the data columns
foreach ($tasks as $task_id => $detail) {
$row =& $pdfdata[];
$row[] = $detail['task_name'];
$row[] = $detail['user_username'];
$row[] = implode("\n", $assigned_users[$task_id]);
if ($hasResources) {
$row[] = implode("\n", $resources[$task_id]);
}
$end_date = new w2p_Utilities_Date($detail['task_end_date']);
$row[] = $end_date->format($df);
}
$pdf->ezTable($pdfdata, $columns, $title, $options);
$pdf->ezStream();
示例14: clickDay
* @param string Formatted date
*/
function clickDay( idate, fdate ) {
window.opener.<?php
echo $callback;
?>
(idate,fdate);
window.close();
}
</script>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<tr>
<?php
$s = '';
for ($i = 0; $i < 12; $i++) {
$this_month->setMonth($i + 1);
$s .= '<td width="8%"><a href="index.php?m=public&a=calendar&dialog=1&callback=' . $callback . '&date=' . $this_month->format(FMT_TIMESTAMP_DATE) . '&uts=' . $prev_date . '" class="">' . substr($this_month->format('%b'), 0, 1) . '</a></td>';
}
echo $s;
?>
</tr>
<tr>
<?php
echo '<td colspan="6" align="left">';
echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback={$callback}&date=" . $cal->prev_year->format(FMT_TIMESTAMP_DATE) . "&uts={$prev_date}\" class=\"\">" . $cal->prev_year->getYear() . '</a>';
echo '</td><td colspan="6" align="right">';
echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback={$callback}&date=" . $cal->next_year->format(FMT_TIMESTAMP_DATE) . "&uts={$prev_date}\" class=\"\">" . $cal->next_year->getYear() . '</a>';
echo '</td>';
?>
</tr>
</table>
示例15: formatTZAwareTime
/**
* This converts the date from the GMT/UTC value stored in the database to the
* user-specific timezone specified by the user.
*/
public function formatTZAwareTime($datetime = '', $format = '')
{
$userTimezone = $this->getPref('TIMEZONE');
$userTimezone = '' == $userTimezone ? 'UTC' : $userTimezone;
$userTZ = new DateTimeZone($userTimezone);
$systemTZ = new DateTimeZone('UTC');
$ts = new DateTime($datetime, $systemTZ);
$ts->setTimezone($userTZ);
if ('' == $format) {
$df = $this->getPref('FULLDATEFORMAT');
} else {
$df = $format;
$ts = new w2p_Utilities_Date($ts->format('Y-m-d H:i:s'));
}
return $ts->format($df);
}