public function init() { // Set the method for the display form to POST $this->setMethod('POST'); $this->setAction(Application_Model_General::getBaseUrl() . "/monitor/send/"); $this->setAttrib('class', 'request-form'); $msgTypeOptions = array('label' => 'Message', 'required' => true, 'multioptions' => array('Check' => 'Check', 'Request' => 'Request', 'Update' => 'Update', 'Cancel' => 'Cancel', 'Inquire_number' => 'Inquire_number', 'Return' => 'Return')); $this->addElement('select', 'MSG_TYPE', $msgTypeOptions); $numberOptions = array('label' => 'Phone number', 'required' => true, 'validators' => array('Int', array('StringLength', FALSE, array(10, 10))), 'value' => ''); $this->addElement('text', 'NUMBER', $numberOptions); $d = new Zend_Date(null, null, Application_Model_General::getLocale(null, false)); $dateOptions = array('label' => 'Port Time', 'id' => 'datetimepicker', 'required' => true, 'value' => $d->toString('YYYY-MM-dd HH:mm:ss', Application_Model_General::getLocale(null, false))); $this->addElement('text', 'porttime', $dateOptions); $providers = Application_Model_General::getProviderArray(); $currentProvider = Application_Model_General::getSettings('InternalProvider'); if (($key = array_search($currentProvider, $providers)) !== FALSE) { unset($providers[$key]); } $toOptions = array('label' => 'To', 'multioptions' => array_combine($providers, $providers)); $this->addElement('select', 'TO', $toOptions); $dateTimeLabelOptions = array('label' => 'Date and Time', 'required' => true, 'value' => date('y/m/d:h/i/s'), 'disabled' => 'true'); $this->addElement('text', 'Date and Time', $dateTimeLabelOptions); $submitOptions = array('ignore' => true, 'label' => 'Send'); $this->addElement('submit', 'submit', $submitOptions); }
protected function printTableRow($field, $value, $table, $link = false) { $baseUrl = Application_Model_General::getBaseUrl(); if ($field == 'id' && $link && $table == 'Requests') { echo '<td style="border:solid 1px;"><a href="' . $baseUrl . '/monitor/edit?table=Requests&id=' . (int) $value . '">' . $value . '</td>'; } else { if ($value !== NULL) { echo '<td style="border:solid 1px;">' . $value . '</td>'; } else { echo '<td style="border:solid 1px;"> </td>'; } } }
public function init() { $this->setMethod('POST'); $this->setAction(Application_Model_General::getBaseUrl() . "/monitor/execute/"); $this->setAttrib('class', 'execute-form'); $this->addElement('hidden', 'id'); $this->addElement('hidden', 'request_id'); $this->addElement('hidden', 'from_provider'); $this->addElement('hidden', 'to_provider'); $this->addElement('hidden', 'phone_number'); $executeOptions = array('label' => 'Send Execute'); $this->addElement('submit', 'submit', $executeOptions); }
public function sendAction() { $params = $this->getRequest()->getParams(); $url = 'Internal'; $method = $params['MSG_TYPE']; Application_Model_General::prefixPhoneNumber($params['NUMBER']); $args = array('method' => Application_Model_Internal::getMethodName($method), 'msg_type' => $method, 'provider' => $params['TO'], 'number' => $params['NUMBER'], 'request_time' => time()); if ($method == 'Request' || $method == 'Update') { $args['transfer_time'] = $params['porttime']; } else { if ($method == 'Execute_response') { $args['more']['connect_time'] = time(); } } $success = Application_Model_General::forkProcess($url, $args, true); if ($success) { $params['success'] = 1; $params['message'] = 'Request sent'; } else { $params['success'] = 0; $params['message'] = 'Request failed'; } $this->_redirect(Application_Model_General::getBaseUrl() . '/monitor/request?' . http_build_query($params)); }
/** * get the NPG wsdl * @return string WSDL URL */ public static function getWsdl() { if (!self::$wsdl) { $position = Application_Model_General::getSettings('NpWsdlPosition'); if ($position === "relative") { self::$wsdl = Application_Model_General::getBaseUrl() . Application_Model_General::getSettings('NpWsdl'); } else { return Application_Model_General::getSettings('NpWsdl'); } } return self::$wsdl; }