コード例 #1
0
 public function checkstatusAction()
 {
     $request = $this->getRequest();
     $id = $this->_helper->IdConvert->hexToStr($request->getParam('id'));
     $data = array();
     if (!empty($id)) {
         try {
             $model = new SmsStorageStatus();
             $lastStatus = $model->getSmsBySmsStorage($id, true);
             if (isset($lastStatus[0])) {
                 if ($lastStatus[0]['status_dict'] < 4 || $lastStatus[0]['status_dict'] == 8 || $lastStatus[0]['status_dict'] == 9) {
                     $http = new Zend_Controller_Request_Http();
                     $ip = $http->getServer('SERVER_ADDR');
                     $serviceModel = new WsServiceSms();
                     $service = $serviceModel->getService($lastStatus[0]['ws_service_sms_id']);
                     $sms = new Logic_Sms($service, $ip);
                     if ($lastStatus[0]['ws_package_sms_id'] === NULL) {
                         $sms->info($lastStatus[0]['smsid']);
                     } else {
                         $sms->packageinfo($lastStatus[0]['smsid']);
                     }
                 }
             }
             $data = $model->getSmsBySmsStorage($id);
             $paginator = new Base_Paginator(new Base_Paginator_Adapter_Array($data, array('RowClass' => 'Row_SmsStorageStatus')));
             $this->view->paginator = $paginator;
             if ($lastStatus[0]['ws_package_sms_id'] === NULL) {
                 $this->view->headers = array('smsid', 'status_dict', 'messagePriority', 'idProt', 'conectorId', 'encoding', 'smsType', 'validTo', 'delivNotifRequest', 'sendDate', 'lastStatusChange', 'created_at');
             } else {
                 $this->view->headers = array('smsid', 'status_dict', 'numberOfMessages', 'numberOfMessagesLeftToSent', 'created_at');
             }
         } catch (Logic_Service_Exception $ex) {
             $this->_helper->redirector('index');
             $this->_helper->messenger('error', 'Nie udało się pobrać statusu');
             return;
         }
     } else {
         $this->_helper->messenger('error', 'Brak ID!');
         $this->_helper->redirector('index');
         return;
     }
 }