예제 #1
0
 public function paramAction()
 {
     $this->view->table_display = "none";
     $form = new Application_Form_Param();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             $sess = Zend_Registry::get('session');
             $sess->host1 = $formData['host1'];
             $sess->user1 = $formData['user1'];
             $sess->password1 = $formData['password1'];
             $sess->host2 = $formData['host2'];
             $sess->user2 = $formData['user2'];
             $sess->password2 = $formData['password2'];
             $this->view->table_display = "block";
             $this->view->host1 = $sess->host1;
             $this->view->user1 = $sess->user1;
             $this->view->password1 = $sess->password1;
             $this->view->host2 = $sess->host2;
             $this->view->user2 = $sess->user2;
             $this->view->password2 = $sess->password2;
         }
         $form->populate($formData);
     }
 }
예제 #2
0
 /**
  * passes transfer data from history to current form and transfet session data edition
  */
 public function addtoparamAction()
 {
     $edit = $this->_getParam('edit');
     $transfer = new Application_Model_DbTable_Transfers();
     $result = $transfer->addTransfertoParam($edit);
     $result = $result[0];
     $data = array('host1' => $result['source_host'], 'user1' => $result['source_user'], 'host2' => $result['target_host'], 'user2' => $result['target_user']);
     $form = new Application_Form_Param();
     $this->view->form = $form;
     $form->populate($data);
     $sess = Zend_Registry::get('session');
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             $add_transfers = array($formData['host1'], $formData['user1'], $formData['password1'], $formData['host2'], $formData['user2'], $formData['password2']);
             $transfers = $sess->transfers;
             $transfers[] = $add_transfers;
             $sess->transfers = $transfers;
         } else {
             $form->populate($formData);
         }
     }
     $this->view->transfers = $sess->transfers;
 }