/** * Queue mail to allow the queue manager to trigger * the email transfer. * * @access private */ function QueueMail() { global $AppUI; require_once $AppUI->getSystemClass('event_queue'); $ec = new EventQueue(); $vars = get_object_vars($this); return $ec->add(array('Mail', 'SendQueuedMail'), $vars, 'libmail', TRUE); }
/** * Injects a reminder event into the event queue. * Repeat interval is one day, repeat count * and days to trigger before event overdue is * set in the system config. */ function addReminder() { $day = 86400; if (!dPgetConfig('task_reminder_control')) { return; } if (!$this->task_end_date) { // No end date, can't do anything. return $this->clearReminder(true); // Also no point if it is changed to null } if ($this->task_percent_complete >= 100) { return $this->clearReminder(true); } $eq = new EventQueue(); $pre_charge = dPgetConfig('task_reminder_days_before', 1); $repeat = dPgetConfig('task_reminder_repeat', 100); /* * If we don't need any arguments (and we don't) then we set this to null. * We can't just put null in the call to add as it is passed by reference. */ $args = null; // Find if we have a reminder on this task already $old_reminders = $eq->find('tasks', 'remind', $this->task_id); if (count($old_reminders)) { /* * It shouldn't be possible to have more than one reminder, * but if we do, we may as well clean them up now. */ foreach ($old_reminders as $old_id => $old_data) { $eq->remove($old_id); } } // Find the end date of this task, then subtract the required number of days. $date = new CDate($this->task_end_date); $today = new CDate(date('Y-m-d')); if (CDate::compare($date, $today) < 0) { $start_day = time(); } else { $start_day = $date->getDate(DATE_FORMAT_UNIXTIME); $start_day -= $day * $pre_charge; } $eq->add(array($this, 'remind'), $args, 'tasks', false, $this->task_id, 'remind', $start_day, $day, $repeat); }
/** * Queue mail to allow the queue manager to trigger * the email transfer. * * @access private */ public function QueueMail() { global $AppUI; $ec = new EventQueue(); $vars = get_object_vars($this); return $ec->add(array('Mail', 'SendQueuedMail'), $vars, 'libmail', true); }