コード例 #1
0
 /**
  * 
  * @access public
  * @return void
  */
 public function sendAction()
 {
     $request = $this->getRequest();
     if ($request->isPost() && $this->_form->isValid($request->getPost())) {
         $mapper = new Model_Mapper_Auth();
         $mapper->setData($this->_form->getValues());
         $result = array('valid' => $mapper->recovery(), 'message' => $mapper->getMessage()->toArray());
     } else {
         $config = Zend_Registry::get('config');
         $message = new App_Message();
         $message->addMessage($config->messages->warning, App_Message::WARNING);
         $result = array('valid' => false, 'message' => $message->toArray(), 'error' => $this->_form->getMessages());
     }
     $this->_helper->json($result);
 }
コード例 #2
0
 /**
  * 
  */
 public function validateAction()
 {
     if (!$this->getRequest()->isPost()) {
         $result = array('status' => false);
         $this->_helper->json($result);
     }
     $form = $this->_initForm();
     if (!$form->isValid($this->getRequest()->getPost())) {
         $message = new App_Message();
         $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
         $result = array('status' => false, 'description' => $message->toArray(), 'errors' => $form->getMessages());
     } else {
         $result = array('status' => true);
     }
     $this->_helper->json($result);
 }
コード例 #3
0
ファイル: PerfilController.php プロジェクト: fredcido/cenbrap
 /**
  * @access public
  * @return void
  */
 public function sendAction()
 {
     $request = $this->getRequest();
     if ($request->isPost() && $this->_form->isValid($request->getPost())) {
         $values = $this->_form->getValues();
         $values['curso'] = $this->_session->curso;
         $retorno = $this->_mapper->setData($values)->atualizacaoDados();
         $result = array('valid' => (bool) $retorno, 'message' => $this->_mapper->getMessage()->toArray());
     } else {
         $config = Zend_Registry::get('config');
         $message = new App_Message();
         $message->addMessage($config->messages->warning, App_Message::WARNING);
         $result = array('valid' => false, 'message' => $message->toArray(), 'error' => $this->_form->getMessages());
     }
     $this->_helper->json($result);
 }
コード例 #4
0
ファイル: AuthController.php プロジェクト: fredcido/cenbrap
 /**
  * 
  * @access public
  * @return void
  */
 public function loginAction()
 {
     if ($this->getRequest()->isPost()) {
         $form = $this->_getFormAuth();
         if ($form->isValid($this->getRequest()->getPost())) {
             $mapper = new Model_Mapper_Auth();
             $mapper->setData($form->getValues());
             $result = array('valid' => $mapper->login(), 'message' => $mapper->getMessage()->toArray());
         } else {
             $message = new App_Message();
             $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
             $result = array('valid' => false, 'message' => $message->toArray(), 'error' => $form->getMessages());
         }
         $this->_helper->json($result);
     }
 }
コード例 #5
0
 /**
  * @access public
  * @return void
  */
 public function sendAction()
 {
     $form = new Default_Form_Pendencia(array('action' => $this->_helper->url('send')));
     $request = $this->getRequest();
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $mapperCurso = new Model_Mapper_Curso();
         $values = $form->getValues();
         $retorno = $mapperCurso->setData($values)->agendarEncontro();
         $result = array('valid' => (bool) $retorno, 'message' => $mapperCurso->getMessage()->toArray());
     } else {
         $config = Zend_Registry::get('config');
         $message = new App_Message();
         $message->addMessage($config->messages->warning, App_Message::WARNING);
         $result = array('valid' => false, 'message' => $message->toArray(), 'error' => $form->getMessages());
     }
     $this->_helper->json($result);
 }
コード例 #6
0
ファイル: Abstract.php プロジェクト: fredcido/simuweb
 /**
  * 
  * @access 	protected
  * @param 	App_Model_DbTable_Abstract $dbTable
  * @return 	int
  */
 protected function _simpleSave(App_Model_DbTable_Abstract $dbTable, $message = true)
 {
     $primary = $dbTable->getPrimaryKey();
     $this->_data = $this->_emptyToNull($this->_data);
     if (empty($this->_data[$primary])) {
         $row = $dbTable->createRow();
         $row->setFromArray($this->_data);
         $result = $row->save();
     } else {
         $where = array($primary . ' = ?' => $this->_data[$primary]);
         $data = $dbTable->cleanData($this->_data);
         $result = false !== $dbTable->update($data, $where) ? $this->_data['codigo'] : false;
     }
     if ($message) {
         if ($result) {
             $this->_message->addMessage($this->_config->messages->success, App_Message::SUCCESS);
         } else {
             $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         }
     }
     return $result;
 }
コード例 #7
0
ファイル: FundController.php プロジェクト: fredcido/simuweb
 /**
  * @access 	public
  * @return 	void
  */
 public function savePlanningAction()
 {
     $form = new Fefop_Form_FundPlanning();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $this->_mapper->setData($form->getValues());
             $return = $this->_mapper->savePlanning();
             $message = $this->_mapper->getMessage()->toArray();
             $result = array('status' => (bool) $return, 'id' => $return, 'description' => $message, 'data' => $form->getValues(), 'fields' => $this->_mapper->getFieldsError());
         } else {
             $message = new App_Message();
             $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
             $result = array('status' => false, 'description' => $message->toArray(), 'errors' => $form->getMessages());
         }
     }
     $this->_helper->json($result);
 }
コード例 #8
0
ファイル: GroupController.php プロジェクト: fredcido/simuweb
 /**
  * @access 	public
  * @return 	void
  */
 public function saveItensAction()
 {
     if ($this->getRequest()->isPost()) {
         $this->_mapper->setData($this->getRequest()->getPost());
         $return = $this->_mapper->saveItens();
         $message = $this->_mapper->getMessage()->toArray();
         $result = array('status' => (bool) $return, 'id' => $return, 'description' => $message);
     } else {
         $message = new App_Message();
         $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
         $result = array('status' => false, 'description' => $message->toArray());
     }
     $this->_helper->json($result);
 }
コード例 #9
0
 /**
  * 
  */
 public function saveAbstractAction()
 {
     $step = $this->_getParam('step');
     $form = $this->_initForm($step);
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $this->_mapper->setData($form->getValues());
             $method = 'save' . ucfirst($step);
             $return = call_user_func(array($this->_mapper, $method));
             $message = $this->_mapper->getMessage()->toArray();
             $result = array('status' => (bool) $return, 'id' => $return, 'description' => $message, 'data' => $form->getValues(), 'fields' => $this->_mapper->getFieldsError());
             $this->_helper->json($result);
         } else {
             $message = new App_Message();
             $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
             $result = array('status' => false, 'description' => $message->toArray(), 'errors' => $form->getMessages());
             $this->_helper->json($result);
         }
     } else {
         $this->_helper->redirector->goToSimple('index');
     }
 }
コード例 #10
0
ファイル: Default.php プロジェクト: fredcido/cenbrap
 /**
  * 
  * @access public
  * @return void
  */
 public function saveUploadAction()
 {
     $this->_helper->layout->disableLayout();
     $form = $this->_getForm($this->_helper->url('save-upload'));
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $this->_mapper->setData($form->getValues());
             $result = $this->_mapper->save();
             $message = $this->_mapper->getMessage()->toArray();
             $data = array('status' => (bool) $result, 'id' => is_int($result) ? $result : null, 'description' => $message, 'data' => $form->getValues());
         } else {
             $message = new App_Message();
             $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
             $data = array('status' => false, 'description' => $message->toArray(), 'errors' => $form->getMessages());
         }
     }
     $this->view->result = json_encode($data);
 }
コード例 #11
0
ファイル: AuthController.php プロジェクト: fredcido/simuweb
 /**
  * @access 	public
  * @return 	void
  */
 public function editProfileAction()
 {
     $form = new Default_Form_Profile();
     $mapperUser = new Admin_Model_Mapper_SysUser();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $mapperUser->setData($form->getValues());
             $return = $mapperUser->editProfile();
             $message = $mapperUser->getMessage()->toArray();
             $result = array('status' => (bool) $return, 'id' => $return, 'description' => $message, 'data' => $form->getValues());
         } else {
             $config = Zend_Registry::get('config');
             $message = new App_Message();
             $message->addMessage($config->messages->warning, App_Message::WARNING);
             $result = array('status' => false, 'description' => $message->toArray(), 'errors' => $form->getMessages());
         }
     } else {
         $this->_helper->redirector->goToSimple('index', 'index');
     }
     $this->_helper->json($result);
 }
コード例 #12
0
ファイル: CaseController.php プロジェクト: fredcido/simuweb
 /**
  * 
  */
 public function saveAppointmentAction()
 {
     $form = new Client_Form_Appointment();
     $mapperAppointment = new Client_Model_Mapper_Appointment();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $mapperAppointment->setData($form->getValues());
             $return = $mapperAppointment->save();
             $message = $mapperAppointment->getMessage()->toArray();
             $result = array('status' => (bool) $return, 'id' => $return, 'description' => $message, 'data' => $form->getValues(), 'fields' => $mapperAppointment->getFieldsError());
             $this->_helper->json($result);
         } else {
             $message = new App_Message();
             $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
             $result = array('status' => false, 'description' => $message->toArray(), 'errors' => $form->getMessages());
             $this->_helper->json($result);
         }
     } else {
         $this->_helper->redirector->goToSimple('index');
     }
 }