Takes recurring tasks into account.
public getNextDue ( ) : Horde_Date | null | ||
리턴 | Horde_Date | null | The next due date or null if no due date. |
/** * 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; }
/** * 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; }