本文整理汇总了PHP中w2p_Utilities_Date::after方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::after方法的具体用法?PHP w2p_Utilities_Date::after怎么用?PHP w2p_Utilities_Date::after使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Utilities_Date
的用法示例。
在下文中一共展示了w2p_Utilities_Date::after方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$rec['task_start_date'] = date('Y-m-d H:i:s');
}
$tsd = new w2p_Utilities_Date($rec['task_start_date']);
if ($tsd->before(new w2p_Utilities_Date($start_min))) {
$start_min = $rec['task_start_date'];
}
// calculate or set blank task_end_date if unset
if ($rec['task_end_date'] == '0000-00-00 00:00:00') {
if ($rec['task_duration']) {
$rec['task_end_date'] = db_unix2dateTime(db_dateTime2unix($rec['task_start_date']) + SECONDS_PER_DAY * convert2days($rec['task_duration'], $rec['task_duration_type']));
} else {
$rec['task_end_date'] = '';
}
}
$ted = new w2p_Utilities_Date($rec['task_end_date']);
if ($ted->after(new w2p_Utilities_Date($end_max))) {
$end_max = $rec['task_end_date'];
}
$projects[$rec['task_project']]['tasks'][] = $rec;
}
$q->clear();
reset($projects);
foreach ($projects as $p) {
$tnums = count($p['tasks']);
for ($i = 0; $i < $tnums; $i++) {
$task = $p['tasks'][$i];
if ($task['task_parent'] == $task['task_id']) {
showgtask($task, 0, $p['project_id']);
findgchild($p['tasks'], $task['task_id'], 0, $p['project_id']);
}
}
示例2: min
if ($tsd->before(new w2p_Utilities_Date($start_min))) {
$start_min = $row['task_start_date'];
}
//Check if end date exists, if not try giving it the start date.
//If the start date does not exist then set it for today.
//This avoids jpgraphs internal errors that render the gantt completely useless
if ($row['task_end_date'] == '0000-00-00 00:00:00') {
if ($row['task_duration']) {
$row['task_end_date'] = db_unix2dateTime(db_dateTime2unix($row['task_start_date']) + SECONDS_PER_DAY * convert2days($row['task_duration'], $row['task_duration_type']));
} else {
$todaydate = new w2p_Utilities_Date();
$row['task_end_date'] = $todaydate->format(FMT_TIMESTAMP_DATE);
}
}
$ted = new w2p_Utilities_Date($row['task_end_date']);
if ($ted->after(new w2p_Utilities_Date($end_max))) {
$end_max = $row['task_end_date'];
}
if ($ted->after(new w2p_Utilities_Date($projects[$row['task_project']]['project_end_date'])) || $projects[$row['task_project']]['project_end_date'] == '') {
$projects[$row['task_project']]['project_end_date'] = $row['task_end_date'];
}
$projects[$row['task_project']]['tasks'][] = $row;
}
$width = min(w2PgetParam($_GET, 'width', 600), 1400);
$start_date = w2PgetParam($_GET, 'start_date', $start_min);
$end_date = w2PgetParam($_GET, 'end_date', $end_max);
//consider critical (concerning end date) tasks as well
if ($caller != 'todo') {
$start_min = $projects[$project_id]['project_start_date'];
$end_max = $projects[$project_id]['project_end_date'] > $criticalTasks[0]['task_end_date'] ? $projects[$project_id]['project_end_date'] : $criticalTasks[0]['task_end_date'];
}
示例3: taskstyle_pd
function taskstyle_pd($task)
{
$now = new w2p_Utilities_Date();
$start_date = intval($task['task_start_date']) ? new w2p_Utilities_Date($task['task_start_date']) : null;
$end_date = intval($task['task_end_date']) ? new w2p_Utilities_Date($task['task_end_date']) : null;
if ($start_date && !$end_date) {
$end_date = $start_date;
$end_date->addSeconds($task['task_duration'] * $task['task_duration_type'] * SEC_HOUR);
} else {
if (!$start_date) {
return '';
}
}
$style = 'class=';
if ($task['task_percent_complete'] == 0) {
$style .= $now->before($start_date) ? '"task_future"' : '"task_notstarted"';
} else {
if ($task['task_percent_complete'] == 100) {
$t = new CTask();
$t->load($task['task_id']);
$actual_end_date = new w2p_Utilities_Date(get_actual_end_date_pd($t->task_id, $t));
$style .= $actual_end_date->after($end_date) ? '"task_late"' : '"task_done"';
} else {
$style .= $now->after($end_date) ? '"task_overdue"' : '"task_started"';
}
}
return $style;
}
示例4: remove
public function remove(CAppUI $AppUI, w2p_Utilities_Date $date)
{
$perms = $AppUI->acl();
$removed = false;
if ($this->holiday_id && $perms->checkModuleItem('holiday', 'edit', $this->holiday_id)) {
$holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
$holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
if ($holiday_start_date->equals($date->duplicate())) {
if ($holiday_end_date->equals($date->duplicate())) {
$removed = $this->delete($AppUI);
} else {
$holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
$this->holiday_start_date = $holiday_start_date->getNextDay()->getDate();
$removed = $this->store($AppUI);
}
} elseif ($holiday_end_date->equals($date->duplicate())) {
$holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
$this->holiday_end_date = $holiday_end_date->getPrevDay()->getDate();
$removed = $this->store($AppUI);
} elseif ($holiday_start_date->before($date->duplicate()) && $holiday_end_date->after($date->duplicate())) {
$holiday_end_date = $this->holiday_end_date;
$this->holiday_end_date = $date->getPrevDay()->getDate();
$removed = $this->store($AppUI);
$this->holiday_id = 0;
// create new record
$this->holiday_start_date = $date->getNextDay()->getDate();
$this->holiday_end_date = $holiday_end_date;
$removed = $this->store($AppUI);
}
}
return $removed;
}
示例5: getTaskLinks
/**
* Sub-function to collect tasks 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
* @param int the company id to filter by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0, $minical = false)
{
global $a, $AppUI, $w2Pconfig;
$tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, 0);
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
//subtract one second so we don't have to compare the start dates for exact matches with the startPeriod which is 00:00 of a given day.
$startPeriod->subtractSeconds(1);
$link = array();
$sid = 3600 * 24;
// assemble the links for the tasks
foreach ($tasks as $row) {
// the link
$link['task'] = true;
if (!$minical) {
$link['href'] = '?m=tasks&a=view&task_id=' . $row['task_id'];
// the link text
if (mb_strlen($row['task_name']) > $strMaxLen) {
$row['short_name'] = mb_substr($row['task_name'], 0, $strMaxLen) . '...';
} else {
$row['short_name'] = $row['task_name'];
}
$link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['short_name'] . ($row['task_milestone'] ? ' ' . w2PshowImage('icons/milestone.gif') : '') . '</span>';
}
// determine which day(s) to display the task
$start = new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['task_start_date'], '%Y-%m-%d %T'));
$end = $row['task_end_date'] ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['task_end_date'], '%Y-%m-%d %T')) : null;
// First we test if the Tasks Starts and Ends are on the same day, if so we don't need to go any further.
if ($start->after($startPeriod) && ($end && $end->after($startPeriod) && $end->before($endPeriod) && !$start->dateDiff($end))) {
if ($minical) {
$temp = array('task' => true);
} else {
$temp = $link;
if ($a != 'day_view') {
$temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], true, true, $tasks), true) . w2PshowImage('block-start-16.png') . $start->format($tf) . ' ' . $temp['text'] . ' ' . $end->format($tf) . w2PshowImage('block-end-16.png') . w2PendTip();
$temp['text'] .= '<a href="?m=tasks&a=view&task_id=' . $row['task_id'] . '&tab=1&date=' . $AppUI->formatTZAwareTime($row['task_end_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>';
}
}
$links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
} else {
// If they aren't, we will now need to see if the Tasks Start date is between the requested period
if ($start->after($startPeriod) && $start->before($endPeriod)) {
if ($minical) {
$temp = array('task' => true);
} else {
$temp = $link;
if ($a != 'day_view') {
$temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], true, false, $tasks), true) . w2PshowImage('block-start-16.png') . $start->format($tf) . ' ' . $temp['text'] . w2PendTip();
$temp['text'] .= '<a href="?m=tasks&a=view&task_id=' . $row['task_id'] . '&tab=1&date=' . $AppUI->formatTZAwareTime($row['task_start_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>';
}
}
$links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp;
}
// And now the Tasks End date is checked if it is between the requested period too.
if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) {
if ($minical) {
$temp = array('task' => true);
} else {
$temp = $link;
if ($a != 'day_view') {
$temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], false, true, $tasks), true) . ' ' . $temp['text'] . ' ' . $end->format($tf) . w2PshowImage('block-end-16.png') . w2PendTip();
$temp['text'] .= '<a href="?m=tasks&a=view&task_id=' . $row['task_id'] . '&tab=1&date=' . $AppUI->formatTZAwareTime($row['task_end_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>';
}
}
$links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
}
}
}
}
示例6: testAfterIsSame
/**
* Tests after then the dates are equal
*/
public function testAfterIsSame()
{
$date1 = new w2p_Utilities_Date('2010-11-04 11:00:00');
$date2 = new w2p_Utilities_Date('2010-11-04 11:00:00');
$this->assertFalse($date1->after($date2));
}
示例7: showtask
function showtask(&$arr, $level = 0, $is_opened = true, $today_view = false, $hideOpenCloseLink = false, $allowRepeat = false)
{
global $AppUI, $query_string, $durnTypes, $userAlloc, $showEditCheckbox;
global $m, $a, $history_active, $expanded;
//Check for Tasks Access
$canAccess = canTaskAccess($arr['task_id'], $arr['task_access'], $arr['task_owner']);
if (!$canAccess) {
return false;
}
$now = new w2p_Utilities_Date();
$tf = $AppUI->getPref('TIMEFORMAT');
$df = $AppUI->getPref('SHDATEFORMAT');
$fdf = $df . ' ' . $tf;
$show_all_assignees = w2PgetConfig('show_all_task_assignees', false);
$start_date = intval($arr['task_start_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($arr['task_start_date'], '%Y-%m-%d %T')) : null;
$end_date = intval($arr['task_end_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($arr['task_end_date'], '%Y-%m-%d %T')) : null;
$last_update = isset($arr['last_update']) && intval($arr['last_update']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($arr['last_update'], '%Y-%m-%d %T')) : null;
// prepare coloured highlight of task time information
$sign = 1;
$style = '';
if ($start_date) {
if (!$end_date) {
/*
** end date calc has been moved to calcEndByStartAndDuration()-function
** called from array_csort and tasks.php
** perhaps this fallback if-clause could be deleted in the future,
** didn't want to remove it shortly before the 2.0.2
*/
$end_date = new w2p_Utilities_Date('0000-00-00 00:00:00');
}
if ($now->after($start_date) && $arr['task_percent_complete'] == 0) {
$style = 'background-color:#ffeebb';
} elseif ($now->after($start_date) && $arr['task_percent_complete'] < 100) {
$style = 'background-color:#e6eedd';
}
if ($now->after($end_date)) {
$sign = -1;
$style = 'background-color:#cc6666;color:#ffffff';
}
if ($arr['task_percent_complete'] == 100) {
$style = 'background-color:#aaddaa; color:#00000';
}
$days = $now->dateDiff($end_date) * $sign;
}
$jsTaskId = 'project_' . $arr['task_project'] . '_level-' . $level . '-task_' . $arr['task_id'] . '_';
if ($expanded) {
$s = '<tr id="' . $jsTaskId . '" >';
} else {
$s = '<tr id="' . $jsTaskId . '" ' . ($level > 0 && !($m == 'tasks' && $a == 'view') ? 'style="display:none"' : '') . '>';
}
// edit icon
$s .= '<td align="center">';
$canEdit = $arr['task_represents_project'] ? false : true;
$canViewLog = true;
if ($canEdit) {
$s .= '<a href="?m=tasks&a=addedit&task_id=' . $arr['task_id'] . '">' . w2PtoolTip('edit task', 'click to edit this task') . w2PshowImage('icons/pencil.gif', 12, 12) . w2PendTip() . '</a>';
}
$s .= '</td>';
// pinned
$pin_prefix = $arr['task_pinned'] ? '' : 'un';
$s .= '<td><a href="?m=tasks&pin=' . ($arr['task_pinned'] ? 0 : 1) . '&task_id=' . $arr['task_id'] . '">' . w2PtoolTip('Pin', 'pin/unpin task') . '<img src="' . w2PfindImage('icons/' . $pin_prefix . 'pin.gif') . '" border="0" alt="" />' . w2PendTip() . '</a></td>';
// New Log
if ($arr['task_log_problem'] > 0) {
$s .= '<td valign="middle"><a href="?m=tasks&a=view&task_id=' . $arr['task_id'] . '&tab=0&problem=1">' . w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem!') . '</a></td>';
} elseif ($canViewLog && $arr['task_dynamic'] != 1 && 0 == $arr['task_represents_project']) {
$s .= '<td align="center"><a href="?m=tasks&a=view&task_id=' . $arr['task_id'] . '&tab=1">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a></td>';
} else {
$s .= '<td align="center">' . $AppUI->_('-') . '</td>';
}
// percent complete and priority
$s .= '<td align="right">' . (int) $arr['task_percent_complete'] . '%</td><td align="center" nowrap="nowrap">';
if ($arr['task_priority'] < 0) {
$s .= '<img src="' . w2PfindImage('icons/priority-' . -$arr['task_priority'] . '.gif') . '" alt="" />';
} elseif ($arr['task_priority'] > 0) {
$s .= '<img src="' . w2PfindImage('icons/priority+' . $arr['task_priority'] . '.gif') . '" alt="" />';
}
$s .= '</td><td align="center" nowrap="nowrap">';
if (isset($arr['user_task_priority'])) {
if ($arr['user_task_priority'] < 0) {
$s .= '<img src="' . w2PfindImage('icons/priority-' . -$arr['user_task_priority'] . '.gif') . '" alt="" />';
} elseif ($arr['user_task_priority'] > 0) {
$s .= '<img src="' . w2PfindImage('icons/priority+' . $arr['user_task_priority'] . '.gif') . '" alt="" />';
}
}
$s .= '</td>';
// dots
$s .= '<td width="' . ($today_view ? '50%' : '90%') . '">';
//level
if ($level == -1) {
$s .= '...';
}
for ($y = 0; $y < $level; $y++) {
if ($y + 1 == $level) {
$s .= '<img src="' . w2PfindImage('corner-dots.gif') . '" width="16" height="12" border="0" alt="">';
} else {
$s .= '';
}
}
if ($arr['task_description']) {
$s .= w2PtoolTip('Task Description', $arr['task_description'], true);
//.........这里部分代码省略.........
示例8: showtask_pd
function showtask_pd(&$a, $level = 0, $today_view = false)
{
global $AppUI, $w2Pconfig, $done, $query_string, $durnTypes, $userAlloc, $showEditCheckbox;
global $task_access, $task_priority, $PROJDESIGN_CONFIG, $m, $expanded;
$types = w2Pgetsysval('TaskType');
$now = new w2p_Utilities_Date();
$tf = $AppUI->getPref('TIMEFORMAT');
$df = $AppUI->getPref('SHDATEFORMAT');
$fdf = $df . ' ' . $tf;
$perms =& $AppUI->acl();
$show_all_assignees = $w2Pconfig['show_all_task_assignees'] ? true : false;
$done[] = $a['task_id'];
$start_date = intval($a['task_start_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($a['task_start_date'], '%Y-%m-%d %T')) : null;
$end_date = intval($a['task_end_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($a['task_end_date'], '%Y-%m-%d %T')) : null;
$last_update = isset($a['last_update']) && intval($a['last_update']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($a['last_update'], '%Y-%m-%d %T')) : null;
// prepare coloured highlight of task time information
$sign = 1;
$style = '';
if ($start_date) {
if (!$end_date) {
$end_date = new w2p_Utilities_Date('0000-00-00 00:00:00');
}
if ($now->after($start_date) && $a['task_percent_complete'] == 0) {
$style = 'background-color:#ffeebb';
} elseif ($now->after($start_date) && $a['task_percent_complete'] < 100) {
$style = 'background-color:#e6eedd';
}
if ($now->after($end_date)) {
$sign = -1;
$style = 'background-color:#cc6666;color:#ffffff';
}
if ($a['task_percent_complete'] == 100) {
$style = 'background-color:#aaddaa; color:#00000';
}
$days = $now->dateDiff($end_date) * $sign;
}
$jsTaskId = 'task_proj_' . $a['task_project'] . '_level-' . $level . '-task_' . $a['task_id'] . '_';
if ($expanded) {
$s = '<tr id="' . $jsTaskId . '" onmouseover="highlight_tds(this, true, ' . $a['task_id'] . ')" onmouseout="highlight_tds(this, false, ' . $a['task_id'] . ')" onclick="select_box(\'selected_task\', \'' . $a['task_id'] . '\', \'' . $jsTaskId . '\',\'frm_tasks\')">';
// edit icon
} else {
$s = '<tr id="' . $jsTaskId . '" onmouseover="highlight_tds(this, true, ' . $a['task_id'] . ')" onmouseout="highlight_tds(this, false, ' . $a['task_id'] . ')" onclick="select_box(\'selected_task\', \'' . $a['task_id'] . '\', \'' . $jsTaskId . '\',\'frm_tasks\')" ' . ($level ? 'style="display:none"' : '') . '>';
// edit icon
}
$s .= '<td>';
$canEdit = $a['task_represents_project'] ? false : true;
$canViewLog = true;
if ($canEdit) {
$s .= '<a href="?m=tasks&a=addedit&task_id=' . $a['task_id'] . '">' . w2PtoolTip('edit tasks panel', 'click to edit this task') . w2PshowImage('icons/pencil.gif', 12, 12) . w2PendTip() . '</a>';
}
$s .= '</td>';
// percent complete
$s .= '<td align="right">' . (int) $a['task_percent_complete'] . '%</td>';
// priority
$s .= '<td align="center" nowrap="nowrap">';
if ($a['task_priority'] < 0) {
$s .= '<img src="' . w2PfindImage('icons/priority-' . -$a['task_priority'] . '.gif') . '" width="13" height="16" alt="" />';
} elseif ($a['task_priority'] > 0) {
$s .= '<img src="' . w2PfindImage('icons/priority+' . $a['task_priority'] . '.gif') . '" width="13" height="16" alt="" />';
}
$s .= '</td><td align="center" nowrap="nowrap">';
if ($a['user_task_priority'] < 0) {
$s .= '<img src="' . w2PfindImage('icons/priority-' . -$a['user_task_priority'] . '.gif') . '" alt="" />';
} elseif ($a['user_task_priority'] > 0) {
$s .= '<img src="' . w2PfindImage('icons/priority+' . $a['user_task_priority'] . '.gif') . '" alt="" />';
}
$s .= '</td>';
// access
$s .= '<td nowrap="nowrap">';
$s .= mb_substr($task_access[$a['task_access']], 0, 3);
$s .= '</td>';
// type
$s .= '<td nowrap="nowrap">';
$s .= mb_substr($types[$a['task_type']], 0, 3);
$s .= '</td>';
// type
$s .= '<td nowrap="nowrap">';
$s .= $a['queue_id'] ? 'Yes' : '';
$s .= '</td>';
// inactive
$s .= '<td nowrap="nowrap">';
$s .= $a['task_status'] == '-1' ? 'Yes' : '';
$s .= '</td>';
// add log
$s .= '<td align="center" nowrap="nowrap">';
if ($a['task_dynamic'] != 1 && 0 == $a['task_represents_project']) {
$s .= '<a href="?m=tasks&a=view&tab=1&project_id=' . $a['task_project'] . '&task_id=' . $a['task_id'] . '">' . w2PtoolTip('tasks', 'add work log to this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>';
}
$s .= '</td>';
// dots
if ($today_view) {
$s .= '<td>';
} else {
$s .= '<td width="20%">';
}
for ($y = 0; $y < $level; $y++) {
if ($y + 1 == $level) {
$s .= '<img src="' . w2PfindImage('corner-dots.gif', $m) . '" width="16" height="12" border="0" alt="" />';
} else {
$s .= '<img src="' . w2PfindImage('shim.gif', $m) . '" width="16" height="12" border="0" alt="" />';
//.........这里部分代码省略.........