getNextDue() public method

Takes recurring tasks into account.
public getNextDue ( ) : Horde_Date | null
return Horde_Date | null The next due date or null if no due date.
示例#1
0
文件: Sql.php 项目: jubinpatel/horde
 /**
  * Lists all alarms near $date.
  *
  * @param integer $date  The unix epoch time to check for alarms.
  *
  * @return array  An array of tasks that have alarms that match.
  * @throws Nag_Exception
  */
 public function listAlarms($date)
 {
     $q = 'SELECT * FROM ' . $this->_params['table'] . ' WHERE task_owner = ?' . ' AND task_alarm > 0' . ' AND (task_due - (task_alarm * 60) <= ?)' . ' AND task_completed = 0';
     $values = array($this->_tasklist, $date);
     try {
         $result = $this->_db->selectAll($q, $values);
     } catch (Horde_Db_Exception $e) {
         throw new Nag_Exception($e->getMessage());
     }
     $tasks = array();
     foreach ($result as $row) {
         $task = new Nag_Task($this, $this->_buildTask($row));
         if ($task->getNextDue()->before($date + $task->alarm * 60)) {
             $tasks[$row['task_id']] = $task;
         }
     }
     return $tasks;
 }
示例#2
0
文件: Sql.php 项目: horde/horde
 /**
  * Lists all alarms near $date.
  *
  * @param integer $date  The unix epoch time to check for alarms.
  *
  * @return array  An array of tasks that have alarms that match.
  * @throws Nag_Exception
  */
 public function listAlarms($date)
 {
     // Check for non-empty alarm AND a non-empty due date.
     // See Bug: 14214
     $q = 'SELECT * FROM nag_tasks' . ' WHERE task_owner = ?' . ' AND task_alarm > 0 AND task_due > 0' . ' AND (task_due - (task_alarm * 60) <= ?)' . ' AND task_completed = 0';
     $values = array($this->_tasklist, $date);
     try {
         $result = $this->_db->select($q, $values);
     } catch (Horde_Db_Exception $e) {
         throw new Nag_Exception($e->getMessage());
     }
     $tasks = array();
     foreach ($result as $row) {
         $task = new Nag_Task($this, $this->_buildTask($row));
         if ($task->getNextDue()->before($date + $task->alarm * 60)) {
             $tasks[$row['task_id']] = $task;
         }
     }
     return $tasks;
 }