Exemplo n.º 1
0
 /**
  * 
  * @return int|bool
  */
 public function save()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $row = $this->_checkOcupation($this->_data);
         if (!empty($row)) {
             $this->_message->addMessage('Okupasaun Internasional iha tiha ona.', App_Message::ERROR);
             return false;
         }
         $mapperMiniGroup = new Register_Model_Mapper_ProfMiniGroup();
         $miniGroup = $mapperMiniGroup->fetchRow($this->_data['fk_id_profminigroup']);
         $this->_data['acronym'] = $miniGroup->acronym . $this->_data['acronym'];
         if (empty($this->_data['id_profocupation'])) {
             $history = 'INSERE OCUPASAUN INTERNASIONAU: %s DADUS PRINCIPAL - INSERE NOVO OCUPASAUN INTERNASIONAU';
         } else {
             $history = 'ALTERA OCUPASAUN INTERNASIONAU: %s DADUS PRINCIPAL - ALTERA OCUPASAUN INTERNASIONAU';
         }
         $id = parent::_simpleSave();
         $history = sprintf($history, $this->_data['ocupation_name']);
         $this->_sysAudit($history);
         $dbAdapter->commit();
         return $id;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  * 
  */
 public function listAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->view->rows = $this->_mapper->listAll();
 }
 /**
  * 
  */
 public function searchMiniGroupAction()
 {
     $mapperMiniGroup = new Register_Model_Mapper_ProfMiniGroup();
     $rows = $mapperMiniGroup->listAll($this->_getParam('id'));
     $opts = array(array('id' => '', 'name' => ''));
     foreach ($rows as $row) {
         $opts[] = array('id' => $row->id_profminigroup, 'name' => $row->acronym . ' - ' . $row->mini_group);
     }
     $this->_helper->json($opts);
 }