public function diagnosticAction() { if (!$this->getRequest()->isGet()) { throw new UnexpectedException("Resquest must be GET"); } // Get sim $sim = $this->_getSim(); $this->_helper->allowed('diagnosis', $sim); // Get type $map = array('administrative' => SimModel::SIM_DIAGNOSIS_TYPE_ADM_STATUS, 'gsm' => SimModel::SIM_DIAGNOSIS_TYPE_GSM_STATUS, 'gprs' => SimModel::SIM_DIAGNOSIS_TYPE_GPRS_STATUS, 'ip' => SimModel::SIM_DIAGNOSIS_TYPE_IP_REACHABILITY); $type = $map[$this->_getParam('type')]; // Load diagnosis result $result = $this->_simSrv->diagnosis($sim, $type); if ($type === SimModel::SIM_DIAGNOSIS_TYPE_ADM_STATUS) { $this->view->globalStatus = $result['globalDiagnosticResultOk']; $this->view->globalIssues = $result['globalIssues']; $this->view->voiceStatus = $result['voiceDiagnosticResultOk']; $this->view->voiceIssues = $result['voiceIssues']; $this->view->dataStatus = $result['dataDiagnosticResultOk']; $this->view->dataIssues = $result['dataIssues']; $this->view->smsStatus = $result['smsDiagnosticResultOk']; $this->view->smsIssues = $result['smsIssues']; } else { $this->view->transactionId = $result->id; } }
/** * Diagnosis of a sim by type */ public function diagnosisAction() { $sim = $this->getSim(); $this->_helper->allowed('diagnosis', $sim); if (!$this->_hasParam('diagnosisType')) { throw new InvalidArgumentException('Bad Request. Invalid Parameters'); } $type = $this->_getParam('diagnosisType'); $this->_helper->allowed('diagnosis_' . strtolower($type), $sim); $result = $this->_simSrv->diagnosis($sim, $type); if ($type === \Application\Model\SimModel::SIM_DIAGNOSIS_TYPE_ADM_STATUS) { $this->view->data = $result; // Sync } else { $this->_helper->filterNotAllowedFields('read_field', $result); $this->view->watcher = $result; // Async } }