public function actionSend()
 {
     $model = new Sms();
     if (isset($_POST['Sms'])) {
         $model->attributes = $_POST['Sms'];
         if ($model->validate() && $model->send()) {
             $this->refresh();
         }
     }
     $this->render('/sms/send', ['model' => $model]);
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionSendtogroup()
 {
     $model = new Sms();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Sms'])) {
         $model->attributes = $_POST['Sms'];
         if ($model->validate()) {
             if ($model->uid == 'parent') {
                 $userlist = Guardians::model()->findAll();
             }
             if ($model->uid == 'teacher') {
                 $userlist = Employees::model()->findAll();
             }
             if ($userlist != NULL) {
                 foreach ($userlist as $user) {
                     if ($user->mobile_phone) {
                         // $status = SmsSettings::model()->sendSms($user->mobile_phone,0,$model->message) ;
                         $mobile_phone = $user->mobile_phone;
                     } else {
                         $status = 0;
                         $mobile_phone = 0;
                     }
                     $Sms = new Sms();
                     $Sms->uid = $user->uid;
                     $Sms->phone_number = $mobile_phone;
                     $Sms->message = $model->message;
                     $Sms->status = $status;
                     $Sms->save();
                 }
             }
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }