public function getStartDate($id, $ms = 0, $ms_date = null)
 {
     $db = JFactory::getDbo();
     $nd = $db->getNullDate();
     $query = $db->getQuery(true);
     // Get the start date from the task
     $query->select('a.id, a.start_date, a.milestone_id')->select('m.start_date AS m_start')->from('#__pf_tasks AS a')->join('left', '#__pf_milestones AS m ON m.id = a.milestone_id')->where('a.list_id = ' . (int) $id)->where('a.state != -2')->order('a.start_date, a.id ASC');
     $db->setQuery($query, 0, 1);
     $task = $db->loadObject();
     if (empty($task)) {
         if (!empty($ms_date) && $ms_date != $nd) {
             $date = $ms_date;
         } elseif ($ms) {
             $mhelper = new modPFganttHelperMilestones($this->pid);
             $date = $mhelper->getStartDate($ms);
         } else {
             $dates = $this->getDateRange($id);
             $date = $dates[0];
         }
     } elseif ($task->start_date == $nd) {
         $thelper = new modPFganttHelperTasks($this->pid);
         $date = $thelper->getStartDate($task->id, $task->milestone_id, $task->m_start);
     } else {
         $date = $task->start_date;
     }
     return $date;
 }
예제 #2
0
파일: lists.php 프로젝트: MrJookie/pm
 /**
  * Method to get the start date of a task list
  * based on the earliest task assigned to it.
  * Falls back to milestone and then to the project.
  *
  * @param    integer    $id         The task list id
  * @param    integer    $ms         The parent milestone id
  * @param    string     $ms_date    The parent milestone start date
  *
  * @return   string                 The start date
  */
 public static function getStartDate($id, $ms = 0, $ms_date = null)
 {
     static $cache = array();
     // Check the cache
     if (isset($cache[$id])) {
         return $cache[$id];
     }
     $db = JFactory::getDbo();
     $nd = $db->getNullDate();
     $query = $db->getQuery(true);
     // Get the start date from the task
     $query->select('a.id, a.start_date, a.milestone_id')->select('m.start_date AS m_start')->from('#__pf_tasks AS a')->join('left', '#__pf_milestones AS m ON m.id = a.milestone_id')->where('a.list_id = ' . (int) $id)->where('a.state != -2')->order('a.start_date, a.id ASC');
     $db->setQuery($query, 0, 1);
     $task = $db->loadObject();
     if (empty($task)) {
         if (!empty($ms_date) && $ms_date != $nd) {
             $date = $ms_date;
         } elseif ($ms) {
             $date = modPFganttHelperMilestones::getStartDate($ms);
         } else {
             $date = modPFganttHelper::$project_start;
         }
     } elseif ($task->start_date == $nd) {
         $date = modPFganttHelperTasks::getStartDate($task->id, $task->milestone_id, $task->m_start);
     } else {
         $date = $task->start_date;
     }
     $cache[$id] = $date;
     return $cache[$id];
 }