Example #1
0
 /**
  * 
  * @return int|bool
  */
 public function save()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $row = $this->_checkMiniGroup($this->_data);
         if (!empty($row)) {
             $this->_message->addMessage('Mini-Grupu Okupasaun iha tiha ona.', App_Message::ERROR);
             return false;
         }
         $mapperSubGroup = new Register_Model_Mapper_ProfSubGroup();
         $subGroup = $mapperSubGroup->fetchRow($this->_data['fk_id_profsubgroup']);
         $this->_data['acronym'] = $subGroup->acronym . $this->_data['acronym'];
         if (empty($this->_data['id_profminigroup'])) {
             $history = 'INSERE MINI-GROUP: %s - INSERIDO NOVO MINI-GRUPO';
         } else {
             $history = 'ALTERA MINI-GROUP: %s - ALTERADO MINI-GRUPO COM SUCESSO';
         }
         $id = parent::_simpleSave();
         // Save the client history
         $history = sprintf($history, $this->_data['mini_group']);
         $this->_sysAudit($history);
         $dbAdapter->commit();
         return $id;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }
Example #2
0
 /**
  * 
  */
 public function searchSubGroupAction()
 {
     $mapperSubGroup = new Register_Model_Mapper_ProfSubGroup();
     $rows = $mapperSubGroup->listAll($this->_getParam('id'));
     $opts = array(array('id' => '', 'name' => ''));
     foreach ($rows as $row) {
         $opts[] = array('id' => $row->id_profsubgroup, 'name' => $row->sub_group);
     }
     $this->_helper->json($opts);
 }
Example #3
0
 /**
  * 
  */
 public function listAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->view->rows = $this->_mapper->listAll();
 }