Exemplo n.º 1
0
 /**
  * define page title and load template files
  */
 public function index()
 {
     $action = $_GET['action'];
     $sms_model = new \models\sms();
     $smsgroup_model = new \models\smsgroup();
     $this->data['groups'] = $smsgroup_model->all();
     $this->data['title'] = 'SMS';
     if (isset($_POST) && !empty($_POST)) {
         $group_id = $_POST['group_id'];
         $message = $_POST['content'];
         $sender = 'TheWorkCourt';
         $subscribers = $sms_model->get(array('group_id' => $group_id));
         foreach ($subscribers as $item) {
             echo $item->phone . "<br>";
             \helpers\document::sendSMS($sender, $item->phone, $message);
         }
         $this->data['success'] = 'SMS Sent!';
     }
     View::rendertemplate('home_header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('sms/sms', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Exemplo n.º 2
0
 public function sms($param)
 {
     $action = $_GET['action'];
     $sms_model = new \models\newsletter();
     $user_model = new \models\users();
     $this->data['subscribers'] = $sms_model->byGroup();
     $this->data['title'] = 'SMS';
     if (isset($_POST) && !empty($_POST)) {
         $group = $_POST['subscribers'];
         $message = $_POST['content'];
         $sender = 'TheWorkCourt';
         $subscribers = $sms_model->get(array('group' => $group));
         foreach ($subscribers as $item) {
             $send = \helpers\document::sendSMS($sender, $item->phone, $message);
         }
         $this->data['success'] = 'Mails Sent!';
     }
     View::rendertemplate('home_header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('crm/sms', $this->data);
     View::rendertemplate('footer', $this->data);
 }