Example #1
0
 /**
  * 
  * @return int|bool
  */
 public function save()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $row = $this->_checkSubGroup($this->_data);
         if (!empty($row)) {
             $this->_message->addMessage('Sub-Grupu Okupasaun iha tiha ona.', App_Message::ERROR);
             return false;
         }
         $mapperGroup = new Register_Model_Mapper_ProfGroup();
         $group = $mapperGroup->fetchRow($this->_data['fk_id_profgroup']);
         $this->_data['acronym'] = $group->acronym . $this->_data['acronym'];
         if (empty($this->_data['id_profsubgroup'])) {
             $history = 'INSERE SUB-GROUP: %s - INSERIDO NOVO SUB-GRUPO';
         } else {
             $history = 'ALTERA SUB-GROUP: %s - ALTERADO SUB-GROUP';
         }
         $id = parent::_simpleSave();
         $history = sprintf($history, $this->_data['sub_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 init()
 {
     $this->setAttrib('class', 'horizontal-form');
     $elements = array();
     $elements[] = $this->createElement('hidden', 'id_profsubgroup')->setDecorators(array('ViewHelper'));
     $mapperGroup = new Register_Model_Mapper_ProfGroup();
     $groups = $mapperGroup->fetchAll();
     $optGroups[''] = '';
     foreach ($groups as $group) {
         $optGroups[$group['id_profgroup']] = $group['group_name'];
     }
     $elements[] = $this->createElement('select', 'fk_id_profgroup')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Grupu')->addMultiOptions($optGroups)->setRequired(true);
     $elements[] = $this->createElement('text', 'sub_group')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Naran Sub-Grupu')->setRequired(true);
     $elements[] = $this->createElement('text', 'acronym')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 1)->setAttrib('class', 'm-wrap span4')->setLabel('Sigla')->setRequired(true);
     $elements[] = $this->createElement('textarea', 'description')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('class', 'span12')->setAttrib('cols', 100)->setAttrib('rows', 5)->setLabel('Deskrisaun');
     $this->addElements($elements);
     App_Form_Toolbar::build($this, self::ID);
     $this->setDecorators($this->getDefaultFormDecorators());
 }
Example #3
0
 /**
  * 
  */
 public function listAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->view->rows = $this->_mapper->fetchAll();
 }