/** * Queues a new SMS Message to be sent out * @param Group $objGroup * @param Login $objLogin * @param string $strSubject can be null/blank * @param string $strBody * @return SmsMessage the queued message that has been queued */ public static function QueueSmsForGroup(Group $objGroup, Login $objLogin, $strSubject, $strBody) { $objSmsMessage = new SmsMessage(); $objSmsMessage->Group = $objGroup; $objSmsMessage->Login = $objLogin; $objSmsMessage->Subject = trim($strSubject); $objSmsMessage->Body = trim($strBody); $objSmsMessage->DateQueued = QDateTime::Now(); $objSmsMessage->Save(); return $objSmsMessage; }
/** * @param \Congredi\NotificationSystem\Drivers\SMS\SmsMessage $message */ public function send(SmsMessage $message) { //for now, will skip from and attachments for Clickatell. $from = $message->getFrom(); $attachments = $message->getAttachImages(); $bodyMessage = $message->composeMessage(); $receivers = $message->getTo(); if (!empty($receivers)) { $this->clickatell->sendMessage($receivers, $bodyMessage); } }
/** * @param \Congredi\NotificationSystem\Drivers\SMS\SmsMessage $message */ public function send(SmsMessage $message) { $from = $message->getFrom(); $bodyMessage = $message->composeMessage(); $receivers = $message->getTo(); $attachments = $message->getAttachImages(); if (!empty($receivers)) { foreach ($receivers as $receiver) { $this->twillioClient->account->messages->create(['To' => $receiver, 'From' => $from, 'Body' => $bodyMessage, 'MediaUrl' => $attachments]); } } }
/** * @param \Congredi\NotificationSystem\Drivers\SMS\SmsMessage $message */ public function send(SmsMessage $message) { //Not used for now $attachments = $message->getAttachImages(); //This can be also a string. $from = $message->getFrom(); $bodyMessage = $message->composeMessage(); $receivers = $message->getTo(); if (!empty($receivers)) { foreach ($receivers as $receiver) { $this->sendMessage($from, $receiver, $bodyMessage); } } }
public function send(SmsMessage $message) { $me = $this; $this->mailer->send($message->getView(), $message->getData(), function ($email) use($me, $message) { $isSMS = $message->isMMS(); foreach ($message->getToWithCarriers() as $number) { $email->to($me->buildEmailAddress($number, $isSMS)); } if ($message->getAttachImages()) { foreach ($message->getAttachImages() as $image) { $email->attach($image); } } $email->from($message->getFrom()); }); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, SmsMessage::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
public function btnSmsSend_Click($strFormId, $strControlId, $strParameter) { if (!QApplication::$Login->Email) { QApplication::DisplayAlert('Your NOAH Account was not set up with your @alcf.net email address, so unfortunately you cannot yet send a SMS Message. Please contact it@alcf.net to have this fixed.'); return; } SmsMessage::QueueSmsForGroup($this->objGroup, QApplication::$Login, $this->txtSmsTitle->Text, $this->txtSmsBody->Text); $this->dtgSmsMessage->Refresh(); $this->txtSmsTitle->Text = null; $this->txtSmsBody->Text = null; QApplication::DisplayAlert('Your SMS Message was queued to be sent! You will receive a copy of this SMS to your email at ' . QApplication::$Login->Email . '.'); }
function adminsmsmessagelistAction() { $this->_helper->layout->setLayout("layout_admin"); $smsMessage = new SmsMessage(); $id = $this->_request->getParam('id'); if ($id) { $smsMessage->update(array("delete" => 1), 'id = ' . $id); $this->_helper->redirector("adminsmsmessagelist"); } $db = Zend_Registry::get('db'); $select = $db->select(); $select->from('sms_message', array('sms_message.*')); $select->where('sms_message.delete =0 '); $select->order('crdate desc'); $this->view->sms = $db->fetchAll($select); }
/** * Main utility method to aid with data binding. It is used by the default BindAllRows() databinder but * could and should be used by any custom databind methods that would be used for instances of this * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. * * If a paginator is set on this DataBinder, it will use it. If not, then no pagination will be used. * It will also perform any sorting (if applicable). * * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return void */ public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null) { // Setup input parameters to default values if none passed in if (!$objCondition) { $objCondition = QQ::All(); } $objClauses = $objOptionalClauses ? $objOptionalClauses : array(); // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below if ($this->Paginator) { $this->TotalItemCount = SmsMessage::QueryCount($objCondition, $objClauses); } // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be a Query result from SmsMessage, given the clauses above $this->DataSource = SmsMessage::QueryArray($objCondition, $objClauses); }
/** * Static Helper Method to Create using PK arguments * You must pass in the PK arguments on an object to load, or leave it blank to create a new one. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to * edit, or if we are also allowed to create a new one, etc. * * @param mixed $objParentObject QForm or QPanel which will be using this SmsMessageMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing SmsMessage object creation - defaults to CreateOrEdit * @return SmsMessageMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objSmsMessage = SmsMessage::Load($intId); // SmsMessage was found -- return it! if ($objSmsMessage) { return new SmsMessageMetaControl($objParentObject, $objSmsMessage); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a SmsMessage object with PK arguments: ' . $intId); } } // If EditOnly is specified, throw an exception } else { if ($intCreateType == QMetaControlCreateType::EditOnly) { throw new QCallerException('No PK arguments specified'); } } // If we are here, then we need to create a new record return new SmsMessageMetaControl($objParentObject, new SmsMessage()); }
/** * Deletes all associated SmsMessages * @return void */ public function DeleteAllSmsMessages() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateSmsMessage on this unsaved Login.'); } // Get the Database Object for this Class $objDatabase = Login::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (SmsMessage::LoadArrayByLoginId($this->intId) as $objSmsMessage) { $objSmsMessage->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `sms_message` WHERE `login_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }
<?php // Up the Memory Limit ini_set('memory_limit', '256M'); // Ensure we are NOT running QApplication::CliProcessEnsureUnique(); // Setup a Lock File QApplication::CliProcessSetupLockFile(); // Run the Logic/Code while (QApplication::CliProcessIsLockFileValid()) { // Analyze only 10 at a time, starting with the oldest (E.g. lowest ID) first $objMessageArray = SmsMessage::LoadArrayByDateSent(null, array(QQ::OrderBy(QQN::SmsMessage()->Id), QQ::LimitInfo(10))); foreach ($objMessageArray as $objMessage) { $objMessage->Send(); } sleep(10); }