Exemple #1
0
 public function checkstatusAction()
 {
     $this->_helper->getHelper('ViewRenderer')->setNoRender(true);
     $request = $this->getRequest();
     $id = $this->_helper->IdConvert->hexToStr($request->getParam('id'));
     if (empty($id)) {
         $this->_helper->messenger->error('Nie podano parametru ID');
         return null;
     }
     try {
         $smsInfo = $this->_model->getSmsInfo($id);
         $cfg = Zend_Registry::get('config');
         $config = array('throwExceptions' => true, 'clientHash' => $cfg['services']['mrdebug']['hash'], 'serviceHash' => $smsInfo->service_hash);
         $http = new Zend_Controller_Request_Http();
         $host = 'http://' . $http->getServer('HTTP_HOST') . '/ws/';
         switch ($values['env_type']) {
             case '1':
                 $config['wsdl'] = $host . 'sms/?wsdl';
                 break;
             default:
                 $config['wsdl'] = $host . 'sms/?wsdl';
         }
         $sms = new SmsSoapClient($config);
         $sms->registerSmsIDManyRaw($smsInfo->smsid);
         $response = $sms->getSmsInfoMany();
         foreach ($response as $r) {
             if ($r->errorCode == 0) {
                 $message .= "SMS o ID:" . $r->smsId . " został wysłany";
             } else {
                 $message .= "SMS o ID: " . $r->smsId . " nie został wysłany: " . $r->errorMessage . '(' . $r->errorCode . ')';
             }
         }
         $this->_helper->messenger->info($message);
         $this->_redirect($this->getRequest()->getHeader('referer'));
         return;
     } catch (Exception $ex) {
         $this->_helper->messenger->error();
         $this->_redirect($this->getRequest()->getHeader('referer'));
     }
 }