function displayModelInfoBasic(App_Model_Abstract $model = null) { $this->_modelName = $model->getModelName(); $this->_model = $model; $this->_config = App_Model_Config::get($this->_modelName); return $this->render(); }
function DisplayForm(App_Form $form, $uiName = "default") { $this->_uiName = $uiName; $this->_form_id = $form->getFormId(); $this->_form = $form; $this->_model = $form->getModel(); // ->getModelName(); $this->_modelName = $this->_model->getModelName(); $this->_config = App_Model_Config::get($this->_modelName); return $this->render(); }
/** * * @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; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkExpenseType($this->_data); if (!empty($row)) { $this->_message->addMessage('Komponente iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_budget_category_type'])) { $history = 'INSERE KOMPONENTE: %s - INSERIDO NOVO KOMPONENTE'; } else { $history = 'ALTERA KOMPONENTE: %s - ALTERADO KOMPONENTE'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['description']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkTypeBankAccount($this->_data); if (!empty($row)) { $this->_message->addMessage('Tipu Konta Banku iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_bank'])) { $history = 'INSERE TIPU KONTA BANKU: %s - INSERIDO NOVO TIPU KONTA BANKU'; } else { $history = 'ALTERA TIPU KONTA BANKU: %s - ALTERADO TIPU KONTA BANKU'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['type_bankaccount']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function saveCaseGroup() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { if (empty($this->_data['id_action_plan_group'])) { $this->_data['active'] = 1; $this->_data['fk_id_dec'] = Zend_Auth::getInstance()->getIdentity()->fk_id_dec; $history = 'JESTAUN KAZU GRUPU: %s HAKAT 1 - REJISTRU DADUS PRINSIPAL'; } else { unset($this->_data['fk_id_counselor']); $history = 'ATUALIZA JESTAUN KAZU GRUPU: %s - PLANO DADUS PRINSIPAL'; } // Save the Case Group $id = parent::_simpleSave(); // Save the audit $history = sprintf($history, $id); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkIsicGroup($this->_data); if (!empty($row)) { $this->_message->addMessage('Grupu Setor Industria iha tiha ona.', App_Message::ERROR); return false; } $mapperDivision = new Register_Model_Mapper_IsicDivision(); $division = $mapperDivision->fetchRow($this->_data['fk_id_isicdivision']); $this->_data['acronym'] = $division->acronym . $this->_data['acronym']; if (empty($this->_data['id_isicgroup'])) { $history = 'REJISTRU GRUPU: %s'; } else { $history = 'ALTERA GRUPU: %s'; } $id = parent::_simpleSave(); // Save the client history $history = sprintf($history, $this->_data['acronym']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkScholarityArea($this->_data); if (!empty($row)) { $this->_message->addMessage('Area Kursu iha tiha ona.', App_Message::ERROR); return false; } if (!empty($this->_data['acronym'])) { $row = $this->_checkScholarityAreaAcronym($this->_data); if (!empty($row)) { $this->_message->addMessage('Area Kursu nia sigla iha tiha ona.', App_Message::ERROR); return false; } } if (empty($this->_data['id_scholarity_area'])) { $history = 'INSERE AREA KURSU: %s DADUS PRINCIPAL - INSERE NOVA AREA KURSU'; } else { $history = 'ALTERA AREA KURSU: %s DADUS PRINCIPAL - ALTERA AREA KURSU'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['scholarity_area']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @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; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkAppointmentObjective($this->_data); if (!empty($row)) { $this->_message->addMessage('Intensaun ba Audiensia iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_appointment_objective'])) { $history = 'REJISTRU INTENSAUN BA AUDIENSIA %s - ID: %s'; } else { $history = 'ALTERA INTENSAUN BA AUDIENSIA %s - ID: %s'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['objective_desc'], $id); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkNation($this->_data); if (!empty($row)) { $this->_message->addMessage('Nasaun iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_addcountry'])) { $history = 'INSERE PAIS ID: %s - INSERE NOVO PAIS'; } else { $history = 'ALTERA PAIS NUMERU: %s - ALTERA PAIS'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['country']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkNameCampaignType($this->_data); if (!empty($row)) { $this->_message->addMessage('Tipu Kampanha SMS iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_campaign_type'])) { $history = 'INSERE TIPU KAMPANHA SMS: %s DADUS PRINCIPAL - INSERE NOVA TIPU KAMPANHA SMS'; } else { $history = 'ALTERA TIPU KAMPANHA SMS: %s DADUS PRINCIPAL - ALTERA TIPU KAMPANHA SMS'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['campaign_type']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkClass($this->_data); if (!empty($row)) { $this->_message->addMessage('Klase Setor Industria iha tiha ona.', App_Message::ERROR); return false; } $mapperGroup = new Register_Model_Mapper_IsicGroup(); $miniGroup = $mapperGroup->fetchRow($this->_data['fk_id_isicgroup']); $this->_data['acronym'] = $miniGroup->acronym . $this->_data['acronym']; if (empty($this->_data['id_isicclass'])) { $history = 'INSERE CLASSE: %s'; } else { $history = 'ALTERA ALTERA CLASSE: %s'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['acronym']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $mapperRule = new Fefop_Model_Mapper_Rule(); $mapperRule->validate($this->_message, $this->_data, Fefop_Model_Mapper_Expense::CONFIG_PISE_FE_REGISTRATION); if (empty($this->_data['id_fe_registration'])) { $this->_data['fk_id_sysuser'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser; } $dataForm = $this->_data; $dataForm['id_fe_registration'] = parent::_simpleSave(); // Save Formation $this->_saveFormation($dataForm); // Save Entity $this->_saveEntity($dataForm); if (empty($this->_data['id_fe_contract'])) { $history = 'REJISTU FICHA INSKRISAUN FE: %s'; } else { $history = 'ATUALIZA FICHA INSKRISAUN FE: %s'; } $history = sprintf($history, $dataForm['id_fe_registration']); $this->_sysAudit($history); $dbAdapter->commit(); return $dataForm['id_fe_registration']; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkGroup($this->_data); if (!empty($row)) { $this->_message->addMessage('Grupu Okupasaun iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_profgroup'])) { $history = 'INSERE GRUPO: %s - INSERIDO NOVO GRUPO DE OCUPASAUN'; } else { $history = 'ALTERA GROUP: %s - ALTERADO GRUPO'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['group_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; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkFund($this->_data); if (!empty($row)) { $this->_message->addMessage('Fundu iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_fefopfund'])) { $history = 'FUNDU: %s - INSERIDO NOVO FUNDU'; } else { $history = 'FUNDU RÚBRICA: %s - ALTERADO FUNDU'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['name_fund']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkNameDepartment($this->_data); if (!empty($row)) { $this->_message->addMessage('Departamentu iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_department'])) { $history = 'INSERE DEPARTAMENTU: %s DADUS PRINCIPAL - INSERE NOVO DEPARTAMENTU'; } else { $history = 'ALTERA DEPARTAMENTU: %s DADUS PRINCIPAL - ALTERA DEPARTAMENTU'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['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; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkDistrict($this->_data); if (!empty($row)) { $this->_message->addMessage('Distritu iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_adddistrict'])) { $history = 'INSERE DISTRITU: %s - INSERIDO NOVO DISTRITU'; } else { $history = 'ALTERA DISTRITU: %s - ALTUALIZADO DISTRITO COM SUCESSO'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['District']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int */ public function saveCase() { if (empty($this->_data['id_action_plan'])) { $this->_data['active'] = 1; $this->_data['fk_id_dec'] = Zend_Auth::getInstance()->getIdentity()->fk_id_dec; $history = 'JESTAUN KAZU: %s HAKAT 1 - REJISTRU DADOS PLANO ASAUN'; // Prepare the data to the history $dataHistory = array('action' => 'REJISTU KAZU BA KLIENTE - PLANO ASAUN', 'description' => 'REJISTU KAZU BA KLIENTE - PLANO ASAUN'); } else { unset($this->_data['fk_id_counselor']); $history = 'ATUALIZA JESTAUN KAZU: %s - PLANO ASAUN'; // Prepare the data to the history $dataHistory = array('action' => 'ATUALIZA KAZU BA KLIENTE - PLANO ASAUN', 'description' => 'ATUALIZA KAZU BA KLIENTE - PLANO ASAUN'); } // Save the Client $id = parent::_simpleSave(); // Set the missing data to the history $dataHistory['fk_id_perdata'] = $this->_data['fk_id_perdata']; $dataHistory['fk_id_dec'] = Zend_Auth::getInstance()->getIdentity()->fk_id_dec; // Save the client history $this->_saveHistory($dataHistory); // Save the audit $history = sprintf($history, $id); $this->_sysAudit($history); return $id; }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkClassTimor($this->_data); if (!empty($row)) { $this->_message->addMessage('Klase Timor-Leste iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_isicclasstimor'])) { $history = 'REJISTRU CLASSE TIMOR: %s-%s'; } else { $history = 'ALTERA CLASSE TIMOR: %s-%s'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['acronym'], $this->_data['name_classtimor']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkNameGroup($this->_data); if (!empty($row)) { $this->_message->addMessage('Grupu SMS iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_sms_group'])) { $history = 'INSERE GRUPU SMS: %s DADUS PRINCIPAL - INSERE NOVO GRUPU SMS'; $this->_data['user_registered'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser; } else { $history = 'ALTERA GRUPU SMS: %s DADUS PRINCIPAL - ALTERA GRUPU SMS'; $this->_data['user_updated'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['sms_group_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; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { // $row = $this->_checkOcupationTimor( $this->_data ); // // if ( !empty( $row ) ) { // $this->_message->addMessage( 'Okupasaun Timor-Leste iha tiha ona.', App_Message::ERROR ); // return false; // } if (empty($this->_data['id_profocupationtimor'])) { $history = 'INSERE OCUPASAUN TIMOR: %s DADUS PRINCIPAL - INSERE NOVO OCUPASAUN TIMOR'; } else { $history = 'ALTERA Ocupasaun Timor: %s DADUS PRINCIPAL - ALTERA Ocupasaun Timor'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['ocupation_name_timor']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $this->setValidators(array('_checkScholarityName', '_checkScholarityExternalCode')); if (!parent::isValid()) { return false; } if (empty($this->_data['id_perscholarity'])) { $history = 'INSERE KURSU: %s DADUS PRINCIPAL - INSERE NOVO KURSU'; } else { $history = 'ALTERA KURSU: %s DADUS PRINCIPAL - ALTERA KURSU'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['scholarity']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkGroup($this->_data); if (!empty($row)) { $this->_message->addMessage('Sesaun Industria iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_isicsection'])) { $history = 'REJISTRU SESAUN: %s'; } else { $history = 'ALTERA SESAUN: %s'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['name_section']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkCeop($this->_data); if (!empty($row)) { $this->_message->addMessage('CEOP iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_dec'])) { $history = 'INSERE CEOP-DEC: %s- INSERIDO NOVO CEOP-DEC COM SUCESSO'; $this->_data['fk_id_sysuser'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser; $this->_data['registry_date'] = Zend_Date::now()->toString('yyyy-MM-dd'); } else { $history = 'ALTERA CEOP-DEC: %s DADUS PRINCIPAL - ALTERA CEOP-DEC'; } $id = parent::_simpleSave(); $history = sprintf($history, $id); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkBudgetCategory($this->_data); if (!empty($row)) { $this->_message->addMessage('Categoria Orsamentu iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_budget_category'])) { $history = 'REJISTRU CATEGORIA ORSAMENTU: %s'; } else { $history = 'ALTERA CATEGORIA ORSAMENTU: %s'; } $id = parent::_simpleSave(); // Save the client history $history = sprintf($history, $id); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkDivision($this->_data); if (!empty($row)) { $this->_message->addMessage('Divizaun iha tiha ona.', App_Message::ERROR); return false; } $mapperSection = new Register_Model_Mapper_IsicSection(); $section = $mapperSection->fetchRow($this->_data['fk_id_isicsection']); $this->_data['acronym'] = $section->acronym . $this->_data['acronym']; if (empty($this->_data['id_isicdivision'])) { $history = 'REJISTRU DIVISAUN: %s'; } else { $history = 'ALTERA DIVISAUN: %s'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['name_disivion']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkBarrierType($this->_data); if (!empty($row)) { $this->_message->addMessage('Tipu Barreira iha tiha ona.', App_Message::ERROR); return false; } if (empty($this->_data['id_barrier_type'])) { $history = 'REJISTRU Tipu Barreira %s - ID: %s'; } else { $history = 'ALTERA Tipu Barreira %s - ID: %s'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['barrier_type_name'], $id); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
public function PrintHTML($html, App_Model_Abstract $model = null) { $text = str_replace(array('<body class="scayt-enabled">', '<html>', '</html>', '<head>', '</head>', '<title>', '</title>', '<body>', '</body>'), '', $html); $dataKey = array(); $dataValue = array(); if ($model != null) { $properties = array_keys($model->getProperties()); foreach ($properties as $pop) { $dataKey[] = "@show_{$pop}"; $dataValue[] = $model->{$pop}; } } $dataKey[] = " "; $dataValue[] = " "; $text = str_replace($dataKey, $dataValue, $text); return $text; }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { // Check if there is already a campaign with the title defined $row = $this->_checkTitleCampaign(); if (!empty($row)) { $this->_message->addMessage(sprintf('Iha kampanha tiha ona ho naran %', $this->_data['campaign_title'])); return false; } $dataForm = $this->_data; // Check if the campaign was scheduled to validated and format the date if (!empty($this->_data['date_scheduled'])) { $date = new Zend_Date($this->_data['date_scheduled']); if ($date->isEarlier(Zend_Date::now())) { $this->_message->addMessage('Keta rejistu data atu haruka uluk data ohin'); $this->addFieldError('date_scheduled'); return false; } $this->_data['date_scheduled'] = $date->toString('yyyy-MM-dd'); } if (empty($this->_data['id_campaign'])) { $mapperSmsConfig = new Admin_Model_Mapper_SmsConfig(); $config = $mapperSmsConfig->getConfig(); $this->_data['fk_id_sysuser'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser; $this->_data['fk_id_sms_config'] = $config->id_sms_config; $this->_data['status'] = empty($this->_data['date_scheduled']) ? self::STATUS_STOPPED : self::STATUS_SCHEDULED; $history = 'INSERE KAMPANHA SMS: %s'; } else { $history = 'ALTERA KAMPANHA SMS: %s'; $this->_data['status'] = empty($this->_data['date_scheduled']) ? self::STATUS_STOPPED : self::STATUS_SCHEDULED; } // Save the campaign $id = parent::_simpleSave(); // Save the campaign log if (empty($dataForm['id_campaign'])) { $this->saveLog('KAMPANHA HALOT', $id); } else { $this->saveLog('KAMPANHA ALTERADA', $id); } $dataForm['id_campaign'] = $id; // Save the groups for the campaign $this->_saveCampaignGroups($dataForm); $history = sprintf($history, $id); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }