本文整理汇总了PHP中w2p_Utilities_Date类的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date类的具体用法?PHP w2p_Utilities_Date怎么用?PHP w2p_Utilities_Date使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了w2p_Utilities_Date类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventLinks
/**
* Sub-function to collect events within a period
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getEventLinks($startPeriod, $endPeriod, &$links, $notUsed = null, $minical = false)
{
global $event_filter;
$events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
$cwd = explode(',', w2PgetConfig('cal_working_days'));
// assemble the links for the events
foreach ($events as $row) {
$start = new w2p_Utilities_Date($row['event_start_date']);
$end = new w2p_Utilities_Date($row['event_end_date']);
$date = $start;
for ($i = 0, $i_cmp = $start->dateDiff($end); $i <= $i_cmp; $i++) {
// the link
// optionally do not show events on non-working days
if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
if ($minical) {
$link = array();
} else {
$url = '?m=calendar&a=view&event_id=' . $row['event_id'];
$link['href'] = '';
$link['alt'] = '';
$link['text'] = w2PtoolTip($row['event_name'], getEventTooltip($row['event_id']), true) . w2PshowImage('event' . $row['event_type'] . '.png', 16, 16, '', '', 'calendar') . '</a> ' . '<a href="' . $url . '"><span class="event">' . $row['event_name'] . '</span></a>' . w2PendTip();
}
$links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
}
$date = $date->getNextDay();
}
}
}
示例2: 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;
}
示例3: 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();
}
示例4: calcDuration
function calcDuration($start_date, $start_hour, $start_minute, $end_date, $end_hour, $end_minute, $duration_type)
{
$year = substr($start_date, 0, 4);
$month = substr($start_date, 4, 2);
$day = substr($start_date, 6, 2);
$startDate = new w2p_Utilities_Date($year . '-' . $month . '-' . $day);
$startDate->setTime($start_hour, $start_minute);
$year = substr($end_date, 0, 4);
$month = substr($end_date, 4, 2);
$day = substr($end_date, 6, 2);
$endDate = new w2p_Utilities_Date($year . '-' . $month . '-' . $day);
$endDate->setTime($end_hour, $end_minute);
$duration = $startDate->calcDuration($endDate);
if (intval($duration_type) == 24) {
$workHours = intval(w2PgetConfig('daily_working_hours'));
$duration = $duration / $workHours;
}
$response = new xajaxResponse();
$response->assign('task_duration', 'value', $duration);
return $response;
}
示例5: clickDay
$titleBlock->show();
?>
<script language="javascript" type="text/javascript">
function clickDay( uts, fdate ) {
window.location = './index.php?m=calendar&a=day_view&date='+uts+'&tab=0';
}
function clickWeek( uts, fdate ) {
window.location = './index.php?m=calendar&a=week_view&date='+uts;
}
</script>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td>
<?php
// establish the focus 'date'
$date = new w2p_Utilities_Date($date);
// prepare time period for 'events'
// "go back" to the first day shown on the calendar
// and "go forward" to the last day shown on the calendar
$first_time = new w2p_Utilities_Date($date);
$first_time->setDay(1);
$first_time->setTime(0, 0, 0);
// if Sunday is the 1st, we don't need to go back
// as that's the first day shown on the calendar
if ($first_time->getDayOfWeek() != 0) {
$last_day_of_previous_month = $first_time->getPrevDay();
$day_of_previous_month = $last_day_of_previous_month->getDayOfWeek();
$seconds_to_sub_in_previous_month = 86400 * $day_of_previous_month;
// need to cast it to int because Pear::Date_Span::set down the line
// fails to set the seconds correctly
$last_day_of_previous_month->subtractSeconds((int) $seconds_to_sub_in_previous_month);
示例6: 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'));
示例7: __construct
public function __construct($datetime = null, $tz = '')
{
parent::__construct($datetime, $tz);
trigger_error("CDate has been deprecated in v2.0 and will be removed by v4.0. Please use w2p_Utilities_Date instead.", E_USER_NOTICE);
}
示例8: w2p_Utilities_Date
$df = $AppUI->getPref('SHDATEFORMAT');
$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') {
示例9: w2p_Utilities_Date
$upd_task->task_allow_other_user_tasklogs = $bulk_task_allow_other_user_tasklogs;
$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') {
示例10: 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;
}
示例11: array
<?php
$tabview = array('either', 'tabbed', 'flat');
echo arraySelect($tabview, 'pref_name[TABVIEW]', 'class=text size=1', $prefs['TABVIEW'], true);
?>
</td>
</tr>
<tr>
<td align="right"><?php
echo $AppUI->_('Short Date Format');
?>
:</td>
<td>
<?php
// exmample date
$ex = new w2p_Utilities_Date();
$dates = array();
$f = '%d/%m/%Y';
$dates[$f] = $ex->format($f);
$f = '%d/%b/%Y';
$dates[$f] = $ex->format($f);
$f = '%m/%d/%Y';
$dates[$f] = $ex->format($f);
$f = '%b/%d/%Y';
$dates[$f] = $ex->format($f);
$f = '%d.%m.%Y';
$dates[$f] = $ex->format($f);
$f = '%m.%d.%Y';
$dates[$f] = $ex->format($f);
$f = '%Y/%b/%d';
$dates[$f] = $ex->format($f);
示例12: clash_suggest
function clash_suggest(w2p_Core_CAppUI $AppUI, $cal_sdf)
{
global $m, $a;
$obj = new CEvent();
$obj->bind($_SESSION['add_event_post']);
$start_date = new w2p_Utilities_Date($obj->event_start_date);
$end_date = new w2p_Utilities_Date($obj->event_end_date);
$df = $AppUI->getPref('SHDATEFORMAT');
$start_secs = $start_date->getTime();
$end_secs = $end_date->getTime();
$duration = (int) (($end_secs - $start_secs) / 60);
$titleBlock = new w2p_Theme_TitleBlock('Suggest Alternative Event Time', 'myevo-appointments.png', $m, $m . '.' . $a);
$titleBlock->show();
$calurl = W2P_BASE_URL . '/index.php?m=calendar&a=clash&event_id=' . $obj->event_id;
$times = array();
$t = new w2p_Utilities_Date();
$t->setTime(0, 0, 0);
if (!defined('LOCALE_TIME_FORMAT')) {
define('LOCALE_TIME_FORMAT', '%I:%M %p');
}
for ($m = 0; $m < 60; $m++) {
$times[$t->format('%H%M%S')] = $t->format(LOCALE_TIME_FORMAT);
$t->addSeconds(1800);
}
/* TODO: This needs to be refactored to use the core setDate_new function. */
?>
<script language="javascript" type="text/javascript">
function setDate( frm_name, f_date ) {
fld_date = eval( 'document.' + frm_name + '.' + f_date );
fld_real_date = eval( 'document.' + frm_name + '.' + 'event_' + f_date );
if (fld_date.value.length>0) {
if ((parseDate(fld_date.value))==null) {
alert('The Date/Time you typed does not match your prefered format, please retype.');
fld_real_date.value = '';
fld_date.style.backgroundColor = 'red';
} else {
fld_real_date.value = formatDate(parseDate(fld_date.value), 'yyyyMMdd');
fld_date.value = formatDate(parseDate(fld_date.value), '<?php
echo $cal_sdf;
?>
');
fld_date.style.backgroundColor = '';
}
} else {
fld_real_date.value = '';
}
}
function set_clash_action(action) {
document.editFrm.clash_action.value = action;
document.editFrm.submit();
}
</script>
<form name="editFrm" method="post" action="<?php
echo $calurl . '&clash_action=process';
?>
" accept-charset="utf-8">
<table width='100%' class='std addedit'>
<tr>
<td width='50%' align='right'><?php
echo $AppUI->_('Earliest Date');
?>
:</td>
<td width='50%' align='left' nowrap="nowrap">
<input type="hidden" name="event_start_date" id="event_start_date" value="<?php
echo $start_date ? $start_date->format(FMT_TIMESTAMP_DATE) : '';
?>
" />
<input type="text" name="start_date" id="start_date" onchange="setDate('editFrm', 'start_date');" value="<?php
echo $start_date ? $start_date->format($df) : '';
?>
" class="text" />
<a href="javascript: void(0);" onclick="return showCalendar('start_date', '<?php
echo $df;
?>
', 'editFrm', null, true)">
<img src="<?php
echo w2PfindImage('calendar.gif');
?>
" width="24" height="12" alt="<?php
echo $AppUI->_('Calendar');
?>
" border="0" />
</a>
</td>
</tr>
<tr>
<td width='50%' align='right'><?php
echo $AppUI->_('Latest Date');
?>
:</td>
<td width='50%' align='left' nowrap="nowrap">
<input type="hidden" name="event_end_date" id="event_end_date" value="<?php
echo $end_date ? $end_date->format(FMT_TIMESTAMP_DATE) : '';
?>
" />
<input type="text" name="end_date" id="end_date" onchange="setDate('editFrm', 'end_date');" value="<?php
echo $end_date ? $end_date->format($df) : '';
?>
//.........这里部分代码省略.........
示例13: showWeeks
function showWeeks()
{
global $allocated_hours_sum, $end_date, $start_date, $AppUI, $user_list, $user_names, $user_usage, $hideNonWd, $table_header, $table_rows, $df, $working_days_count, $total_hours_capacity, $total_hours_capacity_all;
$working_days_count = 0;
$allocated_hours_sum = 0;
$ed = new w2p_Utilities_Date(Date_Calc::endOfWeek($end_date->day, $end_date->month, $end_date->year));
$sd = new w2p_Utilities_Date(Date_Calc::beginOfWeek($start_date->day, $start_date->month, $start_date->year));
$week_difference = ceil($ed->workingDaysInSpan($sd) / count(explode(',', w2PgetConfig('cal_working_days'))));
$actual_date = $sd;
$table_header = '<tr><th>' . $AppUI->_('User') . '</th>';
for ($i = 0; $i < $week_difference; $i++) {
$actual_date->addSeconds(168 * 3600);
// + one week
$working_days_count = $working_days_count + count(explode(',', w2PgetConfig('cal_working_days')));
}
$table_header .= '<th nowrap="nowrap" colspan="2">' . $AppUI->_('Allocated') . '</th></tr>';
$table_rows = '';
foreach ($user_list as $user_id => $user_data) {
$user_names[$user_id] = $user_data['contact_first_name'] . ' ' . $user_data['contact_last_name'];
if (isset($user_usage[$user_id])) {
$table_rows .= '<tr><td nowrap="nowrap">(' . $user_data['user_username'] . ') ' . $user_data['contact_first_name'] . ' ' . $user_data['contact_last_name'] . '</td>';
$actual_date = $sd;
$array_sum = array_sum($user_usage[$user_id]);
$average_user_usage = number_format($array_sum / ($week_difference * count(explode(',', w2PgetConfig('cal_working_days'))) * w2PgetConfig('daily_working_hours')) * 100, 2);
$allocated_hours_sum += $array_sum;
$bar_color = 'blue';
if ($average_user_usage > 100) {
$bar_color = 'red';
$average_user_usage = 100;
}
$table_rows .= '<td ><div align="left">' . round($array_sum, 2) . ' ' . $AppUI->_('hours') . '</td> <td align="right"> ' . $average_user_usage;
$table_rows .= '%</div>';
$table_rows .= '<div align="left" style="height:2px;width:' . $average_user_usage . '%; background-color:' . $bar_color . '"> </div></td>';
$table_rows .= '</tr>';
}
}
$total_hours_capacity = $working_days_count / 2 * w2PgetConfig('daily_working_hours') * count($user_usage);
$total_hours_capacity_all = $working_days_count / 2 * w2PgetConfig('daily_working_hours') * count($user_list);
}
示例14: foreach
$res = $task->getAssignedUsers($task_id);
foreach ($res as $rw) {
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;
示例15: w2p_Utilities_Date
$no_modify = false;
$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>';