Exemple #1
0
 /**
  * Method to get the end date of a task list
  * based on the latest 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 end date
  *
  * @return   string                 The end date
  */
 public static function getEndDate($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 end date from the task
     $query->select('a.id, a.end_date, a.milestone_id')->select('m.end_date AS m_end')->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.end_date DESC, 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::getEndDate($ms);
         } else {
             $date = modPFganttHelper::$project_end;
         }
     } elseif ($task->end_date == $nd) {
         $date = modPFganttHelperTasks::getEndDate($task->id, $task->milestone_id, $task->m_end);
     } else {
         $date = $task->end_date;
     }
     $cache[$id] = $date;
     return $cache[$id];
 }
 public function getEndDate($id, $ms = 0, $ms_date = null)
 {
     $db = JFactory::getDbo();
     $nd = $db->getNullDate();
     if (!empty($ms_date) && $ms_date != $nd) {
         return $ms_date;
     } elseif ($ms) {
         $mhelper = new modPFganttHelperMilestones($this->pid);
         $date = $mhelper->getEndDate($ms);
     } else {
         $dates = $this->getDateRange($id);
         $date = $dates[1];
     }
     return $date;
 }
Exemple #3
0
 /**
  * Method to get the end date of a task
  * based on the parent list, milestone or project.
  *
  * @param    integer    $id          The task id
  * @param    integer    $ms          The parent milestone id
  * @param    string     $ms_date     The parent milestone end date
  *
  * @return   string                  The end date
  */
 public static function getEndDate($id, $ms = 0, $ms_date = null)
 {
     static $cache = array();
     // Check the cache
     if (isset($cache[$id])) {
         return $cache[$id];
     }
     $nd = JFactory::getDbo()->getNullDate();
     if (!empty($ms_date) && $ms_date != $nd) {
         return $ms_date;
     } elseif ($ms) {
         $date = modPFganttHelperMilestones::getEndDate($ms);
     } else {
         $date = modPFganttHelper::$project_end;
     }
     $cache[$id] = $date;
     return $cache[$id];
 }