当前位置: 首页>>代码示例>>PHP>>正文


PHP w2p_Utilities_Date::before方法代码示例

本文整理汇总了PHP中w2p_Utilities_Date::before方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::before方法的具体用法?PHP w2p_Utilities_Date::before怎么用?PHP w2p_Utilities_Date::before使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在w2p_Utilities_Date的用法示例。


在下文中一共展示了w2p_Utilities_Date::before方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
}
开发者ID:eureka2,项目名称:web2project,代码行数:28,代码来源:projectdesigner.class.php

示例2: CTask

 $q->addOrder('project_id, task_start_date');
 $q->addWhere('project_original_parent = ' . (int) $original_project_id);
 //$tasks = $q->loadList();
 $task = new CTask();
 $task->setAllowedSQL($AppUI->user_id, $q);
 $proTasks = $q->loadHashList('task_id');
 $orrarr[] = array('task_id' => 0, 'order_up' => 0, 'order' => '');
 $end_max = '0000-00-00 00:00:00';
 $start_min = date('Y-m-d H:i:s');
 //pull the tasks into an array
 foreach ($proTasks as $rec) {
     if ($rec['task_start_date'] == '0000-00-00 00:00:00') {
         $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;
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:vw_sub_projects_gantt.php

示例3: 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;
 }
开发者ID:Raithlin,项目名称:web2project-holiday,代码行数:32,代码来源:holiday.class.php

示例4: 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'] ? '&nbsp;' . 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&amp;a=view&amp;task_id=' . $row['task_id'] . '&amp;tab=1&amp;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&amp;a=view&amp;task_id=' . $row['task_id'] . '&amp;tab=1&amp;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&amp;a=view&amp;task_id=' . $row['task_id'] . '&amp;tab=1&amp;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;
            }
        }
    }
}
开发者ID:eureka2,项目名称:web2project,代码行数:79,代码来源:links_tasks.php

示例5: testBeforeIsSame

 /**
  * Tests before when the dates are equal
  */
 public function testBeforeIsSame()
 {
     $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->before($date2));
 }
开发者ID:eureka2,项目名称:web2project,代码行数:9,代码来源:date.test.php


注:本文中的w2p_Utilities_Date::before方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。