public function deleteOldEvents() { $db = JFactory::getDBO(); // Load all events happening now or before now $query = 'SELECT `id`' . ' FROM #__acctexp_event' . ' WHERE `due_date` <= \'' . date('Y-m-d H:i:s', (int) gmdate('U')) . '\'' . ' AND `status` = \'waiting\''; $db->setQuery($query); $events = xJ::getDBArray($db); // Call each event individually foreach ($events as $evid) { $event = new aecEvent(); $event->load($evid); $event->trigger(); } }
public function issueEvent($request, $event, $due_date, $context = array(), $params = array(), $customparams = array()) { if (!empty($request->metaUser)) { $context['user_id'] = $request->metaUser->userid; $userid = $request->metaUser->userid; } else { $context['user_id'] = 0; $userid = 0; } if (!empty($request->metaUser->focusSubscription->id)) { $context['subscription_id'] = $request->metaUser->focusSubscription->id; } if (!empty($request->invoice->id)) { $context['invoice_id'] = $request->invoice->id; } if (!empty($request->invoice->invoice_number)) { $context['invoice_number'] = $request->invoice->invoice_number; } $aecEvent = new aecEvent(); return $aecEvent->issue('mi', $this->info['name'], $this->id, $event, $userid, $due_date, $context, $params, $customparams); }