Exemplo n.º 1
0
 public function getContent()
 {
     include_once dirname(__FILE__) . '/classes/Tm4bSms.php';
     $this->_html = '<h2>' . $this->displayName . '</h2>';
     if (!empty($_POST)) {
         if (isset($_POST['btnTestSms'])) {
             if (!empty($this->_user) and !empty($this->_password) and !empty($_POST['test_number']) and is_numeric($_POST['test_number'])) {
                 $sms = new Tm4bSms($this->_user, $this->_password, $this->_route, $this->_originator);
                 $sms->msg = 'Test SMS for your PrestaShop website';
                 $sms->addRecipient($_POST['test_number']);
                 $ret = $sms->Send($this->_simulation);
                 if ($sms->isSent()) {
                     $this->_html .= $this->displayConfirmation($this->l('Message successfully sent'));
                 } else {
                     $this->_html .= $this->displayError($this->l('Error while sending message'));
                 }
             } else {
                 $this->_html .= $this->displayError($this->l('Login and phone number'));
             }
         } else {
             $this->_postValidation();
             if (!sizeof($this->_postErrors)) {
                 $this->_postProcess();
             } else {
                 foreach ($this->_postErrors as $err) {
                     $this->_html .= $this->displayError($err);
                 }
             }
         }
     }
     $this->_displayTm4b();
     $this->_displayForm();
     return $this->_html;
 }