Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 /**
  * checks if request is auto request  
  * 
  * @param string $reqId the request id
  * @param string $transcation the transaction that happened before (default: Check)
  * @return type 
  */
 public static function isAutoCheck($reqId, $transcation = "Check")
 {
     $tbl = new Application_Model_DbTable_Requests(Np_Db::slave());
     $select = $tbl->select()->where('request_id=?', $reqId)->order('id DESC');
     $result = $select->query()->fetchObject();
     if ($result && $result->auto_check) {
         $db = Np_Db::slave();
         $select = $db->select()->from("Transactions")->where('request_id=?', $reqId)->where('message_type=?', $transcation)->where('requested_transfer_time IS NOT NULL')->order('id DESC');
         $result = $select->query()->fetchObject();
         if ($result !== FALSE && isset($result->requested_transfer_time)) {
             $datetime = new Zend_Date($result->requested_transfer_time, null, Application_Model_General::getLocale(null, true));
             return $datetime->getTimestamp();
         } else {
             return TRUE;
         }
     }
     return false;
 }