/** * Sends a given number of messages in the queue. * * @param int $sourceQueue The ID of the source queue * @param int $numberOfMsgs Number of messages to send * * @return $this */ public function sendFromQueue($sourceQueue, $numberOfMsgs) { $messages = QueuedMessage::findBySourceAndQuantity($sourceQueue, $numberOfMsgs); if ($messages === null) { return $this; } foreach ($messages as $msg) { /* @var $msg QueuedMessage */ $result = $msg->send(); if (!$result) { $msg->error = 1; } else { $msg->dateSent = time(); } $msg->save(); } return $this; }
/** * Return the delete button * @param array * @param string * @param string * @param string * @param string * @param string * @return string */ public function deleteButton($row, $href, $label, $title, $icon, $attributes) { $objMessage = QueuedMessage::findByPk($row['id']); return $objMessage->getStatus() !== 'sent' ? '<a href="' . $this->addToUrl($href . '&id=' . $row['id']) . '" title="' . specialchars($title) . '"' . $attributes . '>' . \Image::getHtml($icon, $label) . '</a> ' : ''; }