Exemple #1
0
 /**
  *
  * @param type $model
  * @param type $queue_id
  */
 private static function sendSMS($model, $queue_id = NULL)
 {
     //self::$que
     //new line
     self::$queue_id = $queue_id;
     self::$model = $model;
     self::$model->message = str_replace('\\n', "\n", self::$model->message);
     self::setRecipients();
     //check if recipients is empty
     if (empty(self::$model->recipients)) {
         Yii::log(Lang::t('No recipient mobile phone number found!'), CLogger::LEVEL_ERROR);
         return FALSE;
     }
     //convert to array if a string is given
     if (!is_array(self::$model->recipients)) {
         self::$model->recipients = explode(',', self::$model->recipients);
     }
     //remove any duplicates
     self::$model->recipients = array_unique(self::$model->recipients);
     //set default route
     if (empty(self::$model->sms_route)) {
         self::$model->sms_route = Yii::app()->settings->get(Constants::CATEGORY_SMS, Constants::KEY_SMS_ROUTE, self::ROUTE_AFRICASTALKING);
     }
     switch (self::$model->sms_route) {
         case self::ROUTE_INFOBIP:
             MyInfobip::send();
             break;
         case self::ROUTE_AFRICASTALKING:
             MyAfricaStalking::send();
             break;
         default:
             Yii::log('The Gateway:' . self::$model->sms_route . ' is not supported', CLogger::LEVEL_ERROR);
     }
 }