/** * */ public function init() { parent::init(); $this->removeElement('date_start'); $this->removeElement('date_finish'); $elements = array(); $elements[] = $this->createElement('hidden', 'path')->setAttrib('class', 'no-clear')->setValue('register/institution-report')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'title')->setAttrib('class', 'no-clear')->setValue('Relatoriu: Rejistu Inst. Ensinu')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'orientation')->setValue('landscape')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $rows = $mapperDistrict->listAll(); $optDistrict[''] = ''; foreach ($rows as $row) { $optDistrict[$row->id_adddistrict] = $row->District; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Distritu')->addMultiOptions($optDistrict); $dbTypeInstitution = App_Model_DbTable_Factory::get('TypeInstitution'); $rows = $dbTypeInstitution->fetchAll(array(), array('type_institution')); $optType[''] = ''; foreach ($rows as $row) { $optType[$row->id_typeinstitution] = $row->type_institution; } $elements[] = $this->createElement('select', 'fk_typeinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Tipu Instituisaun')->addMultiOptions($optType)->setAttrib('class', 'm-wrap span12'); $optRegister[''] = ''; $optRegister['1'] = 'Sim'; $optRegister['0'] = 'Lae'; $elements[] = $this->createElement('select', 'register')->setDecorators($this->getDefaultElementDecorators())->setLabel('Rejistu ?')->addMultiOptions($optRegister)->setAttrib('class', 'm-wrap span6'); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $optScholarity = $mapperScholarity->getOptionsScholarity(); $elements[] = $this->createElement('select', 'fk_id_perscholarity')->setDecorators($this->getDefaultElementDecorators())->setRegisterInArrayValidator(false)->addMultiOptions($optScholarity)->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Kursu'); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form'); $elements = array(); $elements[] = $this->createElement('hidden', 'fk_id_jobvacancy')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'id_relationship')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'step')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear')->setValue('address'); $mapperCountry = new Register_Model_Mapper_AddCountry(); $countries = $mapperCountry->fetchAll(); $optNations[''] = ''; foreach ($countries as $country) { $optNations[$country['id_addcountry']] = $country['country']; } $elements[] = $this->createElement('select', 'fk_id_addcountry')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Nasaun')->setRequired(true)->addMultiOptions($optNations); // List Districts just from Timor $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $districts = $mapperDistrict->listAll(1); $optDistrict[''] = ''; foreach ($districts as $district) { $optDistrict[$district->id_adddistrict] = $district->District; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optDistrict)->setLabel('Distritu')->setRegisterInArrayValidator(false); $elements[] = $this->createElement('select', 'fk_id_addsubdistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setRegisterInArrayValidator(false)->setLabel('Sub-Distritu'); App_Form_Toolbar::build($this, self::ID); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $elements[] = $this->createElement('text', 'institution')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Naran Instituisaun Ensinu'); $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $rows = $mapperDistrict->listAll(); $optDistrict[''] = ''; foreach ($rows as $row) { $optDistrict[$row->id_adddistrict] = $row->District; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Distritu')->addMultiOptions($optDistrict); $dbDec = App_Model_DbTable_Factory::get('Dec'); $rows = $dbDec->fetchAll(array(), array('name_dec')); $optCeop[''] = ''; foreach ($rows as $row) { $optCeop[$row->id_dec] = $row->name_dec; } $elements[] = $this->createElement('select', 'fk_id_dec')->setDecorators($this->getDefaultElementDecorators())->setLabel('CEOP')->addMultiOptions($optCeop)->setAttrib('class', 'm-wrap span12'); $dbTypeInstitution = App_Model_DbTable_Factory::get('TypeInstitution'); $rows = $dbTypeInstitution->fetchAll(array(), array('type_institution')); $optType[''] = ''; foreach ($rows as $row) { $optType[$row->id_typeinstitution] = $row->type_institution; } $elements[] = $this->createElement('select', 'fk_typeinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Tipu Instituisaun')->addMultiOptions($optType)->setAttrib('class', 'm-wrap span12'); $optRegister[''] = ''; $optRegister['1'] = 'Sim'; $optRegister['0'] = 'Lae'; $elements[] = $this->createElement('select', 'register')->setDecorators($this->getDefaultElementDecorators())->setLabel('Rejistu ?')->addMultiOptions($optRegister)->setAttrib('class', 'm-wrap span6'); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $optScholarity = $mapperScholarity->getOptionsScholarity(); $elements[] = $this->createElement('select', 'fk_id_perscholarity')->setDecorators($this->getDefaultElementDecorators())->setRegisterInArrayValidator(false)->addMultiOptions($optScholarity)->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Kursu'); $this->addElements($elements); }
/** * */ public function searchDistrictAction() { $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $rows = $mapperDistrict->listAll($this->_getParam('id')); $opts = array(array('id' => '', 'name' => '')); foreach ($rows as $row) { $opts[] = array('id' => $row->id_adddistrict, 'name' => $row->District); } $this->_helper->json($opts); }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $dataForm = $this->_data; // If there is no business plan yet if (empty($dataForm['id_businessplan'])) { $mapperModule = new Fefop_Model_Mapper_Module(); $module = $mapperModule->fetchModule($dataForm['module']); // Get the District $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $district = $mapperDistrict->fetchRow($dataForm['fk_id_adddistrict']); $dataForm += array('fk_id_fefop_modules' => $module->id_fefop_modules, 'num_district' => $district->acronym, 'num_module' => $module->num_module, 'num_year' => date('y')); $dataForm['num_sequence'] = str_pad($this->_getNumSequence($dataForm), 4, '0', STR_PAD_LEFT); $dataForm['bussines_plan_developer'] = $dataForm['fk_id_perdata']; //If it is not CEG, fetch the first contract if (Fefop_Model_Mapper_Module::CEG != $dataForm['module']) { $dbPceContract = App_Model_DbTable_Factory::get('PCEContract'); $whereContract = array('fk_id_fefop_modules = ?' => $dataForm['module'], 'fk_id_perdata = ?' => $dataForm['fk_id_perdata']); $pceContract = $dbPceContract->fetchRow($whereContract); $dataForm['fk_id_pce_contract'] = $pceContract->id_pce_contract; } } // If it is CED module, check to see if the client has any disability if (Fefop_Model_Mapper_Module::CED == $dataForm['module'] && !Client_Model_Mapper_Client::isHandicapped($dataForm['fk_id_perdata'])) { $this->_message->addMessage("Benefisiariu ne'e la iha defisiénsia ba halo modulu CED.", App_Message::ERROR); return false; } // Check to see if there are another participants $dataForm['partisipants'] = !empty($dataForm['clients']) ? 'G' : 'S'; if (!empty($dataForm['clients'])) { $dataForm['total_partisipants'] = count($dataForm['clients']) + 1; } else { $dataForm['total_partisipants'] = 1; } $this->_data = $dataForm; $id = parent::_simpleSave(); $dataForm['id_businessplan'] = $id; if (!empty($dataForm['clients']) && count($dataForm['clients']) > 5) { throw new Exception('More then five clients'); } // save participants in the Business Plan $this->_saveParticipants($dataForm); $history = "INSERE PLANU NEGOSIU: %s BA PROGRAMA PCE IHA MODULU: %s"; $history = sprintf($history, $id, $dataForm['id_businessplan']); $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 init() { $this->setAttrib('class', 'horizontal-form'); $elements = array(); $elements[] = $this->createElement('hidden', 'id_perdata')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'step')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear')->setValue('information'); $elements[] = $this->createElement('hidden', 'by_pass_name')->setDecorators(array('ViewHelper'))->setValue('0'); $elements[] = $this->createElement('text', 'first_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setRequired(true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Naran Primeiru'); $elements[] = $this->createElement('text', 'medium_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Segundu'); $elements[] = $this->createElement('text', 'last_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setRequired(true)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Apelidu'); $elements[] = $this->createElement('text', 'date_registration')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 date-mask date')->setValue(Zend_Date::now()->toString('dd/MM/yyyy'))->setLabel('Data Rejistu'); $optMaritalStatus['KABENNAIN'] = 'KABENNAIN'; $optMaritalStatus['SOLTEIRU'] = 'SOLTEIRU'; $optMaritalStatus['DIVORS'] = 'DIVORS'; $optMaritalStatus['FALUK'] = 'FALUK'; $elements[] = $this->createElement('select', 'marital_status')->setDecorators($this->getDefaultElementDecorators())->setLabel('Estadu Sivil')->addMultiOptions($optMaritalStatus); $elements[] = $this->createElement('text', 'father_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Aman'); $elements[] = $this->createElement('text', 'birth_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Moris'); $elements[] = $this->createElement('text', 'age')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span6')->setAttrib('readOnly', 'true')->setLabel('Tinan'); $elements[] = $this->createElement('text', 'mother_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Inan'); $optGender['FETO'] = 'FETO'; $optGender['MANE'] = 'MANE'; $elements[] = $this->createElement('select', 'gender')->setDecorators($this->getDefaultElementDecorators())->setLabel('Seksu')->setRequired(true)->addMultiOptions($optGender); $mapperCountry = new Register_Model_Mapper_AddCountry(); $countries = $mapperCountry->fetchAll(); $optNations[''] = ''; foreach ($countries as $country) { $optNations[$country['id_addcountry']] = $country['country']; } $elements[] = $this->createElement('select', 'fk_country_birth')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setRequired(true)->setLabel('Nasionalidade')->addMultiOptions($optNations); // List Districts just from Timor $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $districts = $mapperDistrict->listAll(1); $optDistrict[''] = ''; foreach ($districts as $district) { $optDistrict[$district->id_adddistrict] = $district->District; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optDistrict)->setLabel('Distritu Kliente')->setRequired(true); $elements[] = $this->createElement('select', 'num_subdistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setRegisterInArrayValidator(false)->setRequired(true)->setLabel('Sub-Distritu'); $dbDec = App_Model_DbTable_Factory::get('Dec'); $rows = $dbDec->fetchAll(array(), array('name_dec')); $optCeop[''] = ''; foreach ($rows as $row) { $optCeop[$row->id_dec] = $row->name_dec; } $elements[] = $this->createElement('select', 'fk_id_dec')->setDecorators($this->getDefaultElementDecorators())->setLabel('Rejistu iha CEOP')->addMultiOptions($optCeop)->setRequired(true)->setAttrib('class', 'm-wrap span12'); $elements[] = $this->createElement('text', 'client_fone')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 15)->setAttrib('class', 'm-wrap span12 phone-mask')->setLabel('Telefone'); $elements[] = $this->createElement('text', 'website')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 250)->addFilter('StringTrim')->setAttrib('class', 'm-wrap span12')->setLabel('Website'); $elements[] = $this->createElement('text', 'email')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 250)->addFilter('StringTrim')->addValidator('EmailAddress')->setAttrib('class', 'm-wrap span12')->setLabel('E-mail'); $elements[] = $this->createElement('checkbox', 'active')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(1)->setAttrib('class', 'toggle-check')->setLabel('Ativu?'); $elements[] = $this->createElement('checkbox', 'hired')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setAttrib('class', 'toggle-check')->setLabel('Iha serbisu?'); App_Form_Toolbar::build($this, self::ID); $this->addElements($elements); }
/** * */ public function init() { $elements = array(); $elements[] = $this->createElement('hidden', 'fk_id_jobvacancy')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear'); $elements[] = $this->createElement('hidden', 'clients')->setIsArray(true)->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'source')->setValue('M')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear'); $elements[] = $this->createElement('hidden', 'minimum_age')->setValue(20)->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'maximum_age')->setValue(40)->setDecorators(array('ViewHelper')); // List Districts just from Timor $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $districts = $mapperDistrict->listAll(1); $optDistrict[''] = ''; foreach ($districts as $district) { $optDistrict[$district->id_adddistrict] = $district->District; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optDistrict)->setLabel('Distritu')->setRegisterInArrayValidator(false); $elements[] = $this->createElement('select', 'fk_id_addsubdistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setRegisterInArrayValidator(false)->setLabel('Sub-Distritu'); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $optCategory = $mapperScholarity->getOptionsCategory(Register_Model_Mapper_PerTypeScholarity::FORMAL); $elements[] = $this->createElement('select', 'category')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optCategory)->setLabel('Kategoria'); $elements[] = $this->createElement('select', 'fk_id_perscholarity')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Kurso')->setRegisterInArrayValidator(false); $dbLanguage = App_Model_DbTable_Factory::get('PerLanguage'); $languages = $dbLanguage->fetchAll(array(), array('language')); $optLanguage[''] = ''; foreach ($languages as $language) { $optLanguage[$language['id_perlanguage']] = $language['language']; } $elements[] = $this->createElement('multiselect', 'fk_id_perlanguage')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Lian Fuan')->addMultiOptions($optLanguage); $dbOccupationTimor = App_Model_DbTable_Factory::get('PROFOcupationTimor'); $occupations = $dbOccupationTimor->fetchAll(); $optOccupations[''] = ''; foreach ($occupations as $occupation) { $optOccupations[$occupation['id_profocupationtimor']] = $occupation['acronym'] . ' ' . $occupation['ocupation_name_timor']; } $elements[] = $this->createElement('select', 'fk_id_profocupation')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Okupasaun')->addMultiOptions($optOccupations); $elements[] = $this->createElement('text', 'minimum_experience')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span8 text-numeric4')->setAttrib('style', 'background: #fff;')->setLabel('Esperiensia Minima (Anos)'); $optGender[''] = 'MANE NO FETO'; $optGender['M'] = 'MANE'; $optGender['F'] = 'FETO'; $elements[] = $this->createElement('select', 'gender')->setDecorators($this->getDefaultElementDecorators())->setLabel('Seksu')->addMultiOptions($optGender); $optDrive['1'] = 'Presiza'; $optDrive['0'] = 'La Presiza'; $elements[] = $this->createElement('radio', 'drive_licence')->setDecorators($this->getDefaultElementDecorators())->setLabel('Karta Kondusaun')->addMultiOptions($optDrive)->setAttrib('label_class', 'radio')->setSeparator('')->setValue(0); $filters = array('type' => Register_Model_Mapper_PerTypeScholarity::NON_FORMAL); $optProfessional = $mapperScholarity->getOptionsScholarity($filters); $elements[] = $this->createElement('multiselect', 'fk_id_training')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Formasaun Profisional')->addMultiOptions($optProfessional); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $elements[] = $this->createElement('text', 'enterprise_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Naran Empreza'); $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $rows = $mapperDistrict->listAll(); $optDistrict[''] = ''; foreach ($rows as $row) { $optDistrict[$row->id_adddistrict] = $row->District; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Distritu')->addMultiOptions($optDistrict); $dbTypeEnterprise = App_Model_DbTable_Factory::get('FEFPTypeEnterprise'); $rows = $dbTypeEnterprise->fetchAll(array(), array('type_enterprise')); $optTypeEnterprise[''] = ''; foreach ($rows as $row) { $optTypeEnterprise[$row->id_fefptypeenterprise] = $row->type_enterprise; } $elements[] = $this->createElement('select', 'fk_fefptypeenterprite')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Tipu Empreza')->addMultiOptions($optTypeEnterprise); $mapperClassTimor = new Register_Model_Mapper_IsicTimor(); $rows = $mapperClassTimor->listAll(); $optClassTimor[''] = ''; foreach ($rows as $row) { $optClassTimor[$row->id_isicclasstimor] = $row->name_classtimor; } $elements[] = $this->createElement('select', 'fk_id_sectorindustry')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Setor da Industria')->addMultiOptions($optClassTimor); $dbCountry = App_Model_DbTable_Factory::get('AddCountry'); $countries = $dbCountry->fetchAll(); $optCountry[''] = ''; foreach ($countries as $country) { $optCountry[$country['id_addcountry']] = $country['country']; } $elements[] = $this->createElement('select', 'fk_nationality')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Nasionalidade')->addMultiOptions($optCountry); $dbDec = App_Model_DbTable_Factory::get('Dec'); $rows = $dbDec->fetchAll(array(), array('name_dec')); $optCeop[''] = ''; foreach ($rows as $row) { $optCeop[$row->id_dec] = $row->name_dec; } $elements[] = $this->createElement('select', 'fk_id_dec')->setDecorators($this->getDefaultElementDecorators())->setLabel('CEOP')->addMultiOptions($optCeop)->setAttrib('class', 'm-wrap span12'); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $dbDec = App_Model_DbTable_Factory::get('Dec'); $rows = $dbDec->fetchAll(array(), array('name_dec')); $optCeop[''] = ''; foreach ($rows as $row) { $optCeop[$row->id_dec] = $row->name_dec; } $elements[] = $this->createElement('select', 'fk_id_dec')->setDecorators($this->getDefaultElementDecorators())->setLabel('CEOP')->addMultiOptions($optCeop)->setAttrib('class', 'm-wrap span12'); $elements[] = $this->createElement('text', 'evidence')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 evidence_card')->setLabel('Kartaun Evidensia'); // List Districts just from Timor $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $districts = $mapperDistrict->listAll(1); $optDistrict[''] = ''; foreach ($districts as $district) { $optDistrict[$district->acronym] = $district->acronym; } $elements[] = $this->createElement('select', 'num_district')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->setRequired(true)->addMultiOptions($optDistrict)->setRegisterInArrayValidator(false); // List Sub Districts $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict(); $subDistricts = $mapperSubDistrict->listAll(); $optSubDistrict[''] = ''; foreach ($subDistricts as $subDistrict) { $optSubDistrict[$subDistrict->acronym] = $subDistrict->acronym; } $elements[] = $this->createElement('select', 'num_subdistrict')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->addMultiOptions($optSubDistrict)->setRequired(true)->setRegisterInArrayValidator(false); $elements[] = $this->createElement('text', 'num_servicecode')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('readOnly', true)->setValue('BU')->setAttrib('class', 'm-wrap span2'); $elements[] = $this->createElement('text', 'num_year')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('class', 'm-wrap span2 text-numeric4'); $elements[] = $this->createElement('text', 'num_sequence')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 4)->setAttrib('class', 'm-wrap span2'); $elements[] = $this->createElement('text', 'first_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setRequired(true)->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Primeru'); $elements[] = $this->createElement('text', 'last_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Ultimu'); $elements[] = $this->createElement('checkbox', 'active')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(1)->setAttrib('class', 'toggle-check')->setLabel('Ativu?'); $optHired[''] = ''; $optHired['1'] = 'Sim'; $optHired['0'] = 'Lae'; $elements[] = $this->createElement('select', 'hired')->setDecorators($this->getDefaultElementDecorators())->addMultiOptions($optHired)->setAttrib('class', 'm-wrap span12')->setLabel('Iha serbisu?'); $elements[] = $this->createElement('text', 'date_registration_ini')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Rejistu Inisiu'); $elements[] = $this->createElement('text', 'date_registration_fim')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Rejistu Final'); $this->addElements($elements); }
/** * * @return int|bool */ public function save($dataExternal) { try { // Get the Module $mapperModule = new Fefop_Model_Mapper_Module(); $module = $mapperModule->fetchModule($dataExternal['module']); // Get the District $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $district = $mapperDistrict->fetchRow($dataExternal['district']); $data = array('fk_id_fefop_modules' => $module->id_fefop_modules, 'fk_id_fefop_programs' => $module->id_fefop_programs, 'fk_id_sysuser' => Zend_Auth::getInstance()->getIdentity()->id_sysuser, 'num_district' => $district->acronym, 'num_program' => $module->num_program, 'num_module' => $module->num_module, 'num_year' => date('y')); $data['num_sequence'] = str_pad($this->_getNumSequence($data), 4, '0', STR_PAD_LEFT); $this->_data = $data; $id = parent::_simpleSave($this->_dbTable, false); $dataStatus = array('contract' => $id, 'status' => !empty($dataExternal['status']) ? $dataExternal['status'] : Fefop_Model_Mapper_Status::ANALYSIS, 'description' => 'Kontraktu rejistu'); $mapperStatus = new Fefop_Model_Mapper_Status(); $mapperStatus->setData($dataStatus)->save(); return $id; } catch (Exception $ex) { throw $ex; } }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $elements[] = $this->createElement('hidden', 'minimum_amount')->setValue(0)->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'maximum_amount')->setValue(200000)->setDecorators(array('ViewHelper')); $mapperStatus = new Fefop_Model_Mapper_Status(); $rows = $mapperStatus->getStatuses(); $optStatuses[''] = ''; foreach ($rows as $row) { $optStatuses[$row['id_fefop_status']] = $row['status_description']; } $elements[] = $this->createElement('select', 'fk_id_fefop_status')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Status')->addMultiOptions($optStatuses); $dbFefopProgram = App_Model_DbTable_Factory::get('FEFOPPrograms'); $programs = $dbFefopProgram->fetchAll(); $optPrograms[''] = ''; foreach ($programs as $program) { $optPrograms[$program['id_fefop_programs']] = $program['acronym']; } $elements[] = $this->createElement('select', 'fk_id_fefop_programs')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Programa')->addMultiOptions($optPrograms); $dbFefopModule = App_Model_DbTable_Factory::get('FEFOPModules'); $modules = $dbFefopModule->fetchAll(); $optModules[''] = ''; foreach ($modules as $module) { $optModules[$module['id_fefop_modules']] = $module['acronym']; } $elements[] = $this->createElement('select', 'fk_id_fefop_modules')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Modules')->addMultiOptions($optModules); // List Districts just from Timor $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $districts = $mapperDistrict->listAll(1); $optDistrict[''] = ''; foreach ($districts as $district) { $optDistrict[$district->acronym] = $district->acronym; } $elements[] = $this->createElement('select', 'num_district')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Distritu')->addMultiOptions($optDistrict)->setRegisterInArrayValidator(false); $elements[] = $this->createElement('text', 'num_year')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 2)->setLabel('Tinan')->setAttrib('class', 'm-wrap span12 text-numeric4'); $elements[] = $this->createElement('text', 'num_sequence')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 4)->setLabel('Sequence')->setAttrib('class', 'm-wrap span12'); $this->addElements($elements); }
/** * */ public function init() { parent::init(); $this->removeElement('date_start'); $this->removeElement('date_finish'); $elements = array(); $elements[] = $this->createElement('hidden', 'path')->setAttrib('class', 'no-clear')->setValue('register/enterprise-report')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'title')->setAttrib('class', 'no-clear')->setValue('Relatoriu: Rejistu Empreza')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'orientation')->setValue('landscape')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $rows = $mapperDistrict->listAll(); $optDistrict[''] = ''; foreach ($rows as $row) { $optDistrict[$row->id_adddistrict] = $row->District; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Distritu')->addMultiOptions($optDistrict); $dbTypeEnterprise = App_Model_DbTable_Factory::get('FEFPTypeEnterprise'); $rows = $dbTypeEnterprise->fetchAll(array(), array('type_enterprise')); $optTypeEnterprise[''] = ''; foreach ($rows as $row) { $optTypeEnterprise[$row->id_fefptypeenterprise] = $row->type_enterprise; } $elements[] = $this->createElement('select', 'fk_fefptypeenterprite')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Tipu Empreza')->addMultiOptions($optTypeEnterprise); $mapperClassTimor = new Register_Model_Mapper_IsicTimor(); $rows = $mapperClassTimor->listAll(); $optClassTimor[''] = ''; foreach ($rows as $row) { $optClassTimor[$row->id_isicclasstimor] = $row->name_classtimor; } $elements[] = $this->createElement('select', 'fk_id_sectorindustry')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Setor da Industria')->addMultiOptions($optClassTimor); $dbCountry = App_Model_DbTable_Factory::get('AddCountry'); $countries = $dbCountry->fetchAll(); $optCountry[''] = ''; foreach ($countries as $country) { $optCountry[$country['id_addcountry']] = $country['country']; } $elements[] = $this->createElement('select', 'fk_id_addcountry')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Nasionalidade')->addMultiOptions($optCountry); $this->addElements($elements); }
/** * */ public function init() { $elements = array(); $elements[] = $this->createElement('hidden', 'fk_id_jobtraining')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear'); $elements[] = $this->createElement('hidden', 'clients')->setIsArray(true)->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'source')->setValue('D')->setDecorators(array('ViewHelper')); $dbDec = App_Model_DbTable_Factory::get('Dec'); $rows = $dbDec->fetchAll(array(), array('name_dec')); $optCeop[''] = ''; foreach ($rows as $row) { $optCeop[$row->id_dec] = $row->name_dec; } $elements[] = $this->createElement('select', 'fk_id_dec')->setDecorators($this->getDefaultElementDecorators())->setLabel('CEOP')->addMultiOptions($optCeop)->setRequired(true)->setAttrib('class', 'm-wrap span12'); // List Districts just from Timor $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $districts = $mapperDistrict->listAll(1); $optDistrict[''] = ''; foreach ($districts as $district) { $optDistrict[$district->acronym] = $district->acronym; } $elements[] = $this->createElement('select', 'num_district')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->setRequired(true)->addMultiOptions($optDistrict)->setRegisterInArrayValidator(false); // List Sub Districts $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict(); $subDistricts = $mapperSubDistrict->listAll(); $optSubDistrict[''] = ''; foreach ($subDistricts as $subDistrict) { $optSubDistrict[$subDistrict->acronym] = $subDistrict->acronym; } $elements[] = $this->createElement('select', 'num_subdistrict')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->addMultiOptions($optSubDistrict)->setRequired(true)->setRegisterInArrayValidator(false); $elements[] = $this->createElement('text', 'num_servicecode')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('readOnly', true)->setValue('BU')->setAttrib('class', 'm-wrap span2'); $elements[] = $this->createElement('text', 'num_year')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('class', 'm-wrap span2 text-numeric4'); $elements[] = $this->createElement('text', 'num_sequence')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 4)->setAttrib('class', 'm-wrap span2'); $elements[] = $this->createElement('text', 'first_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setRequired(true)->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Primeru'); $elements[] = $this->createElement('text', 'last_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Ultimu'); $this->addElements($elements); }
/** * * @return int|bool */ public function saveInformation() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $dataForm = $this->_data; $dateBirth = new Zend_Date($this->_data['birth_date']); $age = App_General_Date::getAge($dateBirth); if ($age < 14) { $this->_message->addMessage('Erro: Kliente iha jovem liu ba heta rejistrasaum.', App_Message::ERROR); $this->addFieldError('birth_date'); return false; } if ($age > 110) { $this->_message->addMessage('Erro: Kliente iha katuas liu ba heta rejistrasaum.', App_Message::ERROR); $this->addFieldError('birth_date'); return false; } if (!$this->_validateName()) { $this->_message->addMessage('Erro: Kliente naran tiha ona.', App_Message::ERROR); $this->addFieldError('first_name')->addFieldError('last_name'); return false; } if (empty($this->_data['id_perdata'])) { $dateRegistration = new Zend_Date($this->_data['date_registration']); $dateNow = new Zend_Date(); if ($dateRegistration->isLater($dateNow)) { $this->_message->addMessage('Erro: Data Rejistu depois ho data ohin', App_Message::ERROR); $this->addFieldError('date_registration'); return false; } $districtMapper = new Register_Model_Mapper_AddDistrict(); $district = $districtMapper->fetchRow($this->_data['fk_id_adddistrict']); $this->_data['num_year'] = date('y'); $this->_data['num_district'] = $district->acronym; $this->_data['num_servicecode'] = 'BU'; $this->_data['num_sequence'] = str_pad($this->_getNumSequence($this->_data), 4, '0', STR_PAD_LEFT); $this->_data['date_registration'] = $dateRegistration->toString('yyyy-MM-dd'); $history = 'REJISTRU KLIENTE: %s HAKAT 1 - REJISTRU DADOS OBRIGATORIU HUSI KLIENTE'; // Prepare the data to the history $dataHistory = array('action' => 'KLIENTE HALO REJISTRU CEOP', 'description' => 'REJISTRU DADOS OBRIGATORIU HUSI KLIENTE'); } else { unset($this->_data['date_registration'], $this->_data['fk_id_adddistrict'], $this->_data['num_subdistrict']); $history = 'ATUALIZA KLIENTE: %s DADUS PRINCIPAL - ATUALIZA DADOS OBRIGATORIU HUSI KLIENTE'; // Prepare the data to the history $dataHistory = array('action' => 'ATUALIZA KLIENTE DADUS PRINCIPAL', 'description' => 'ATUALIZA DADOS OBRIGATORIU HUSI KLIENTE'); } $this->_data['birth_date'] = $dateBirth->toString('yyyy-MM-dd'); // Save the Client $id = parent::_simpleSave(); // If it is inserting the client and it has document if (empty($dataForm['id_perdata']) && !empty($dataForm['fk_id_pertypedocument'])) { $dataForm['fk_id_perdata'] = $id; $this->_saveDocument($dataForm); } // Set the missing data to the history $dataHistory['fk_id_perdata'] = $id; $dataHistory['fk_id_dec'] = $dataForm['fk_id_dec']; // Save the client history $this->_saveHistory($dataHistory); // 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; } }
/** * */ public function listAction() { $this->_helper->layout()->disableLayout(); $this->view->rows = $this->_mapper->listAll(); }
/** * */ public function getFilters() { $filters = $this->_data; if (!empty($this->_data['fk_id_dec'])) { $dbDec = App_Model_DbTable_Factory::get('Dec'); $select = $dbDec->select()->from($dbDec, array('name_dec'))->where('id_dec IN(?)', $this->_data['fk_id_dec']); $rows = $dbDec->fetchAll($select); $filters['ceop'] = ''; foreach ($rows as $key => $row) { $filters['ceop'] .= $row->name_dec; if ($rows->count() != ++$key) { $filters['ceop'] .= ', '; } } } if (!empty($this->_data['fk_id_counselor'])) { $dbSysUser = App_Model_DbTable_Factory::get('SysUser'); $select = $dbSysUser->select()->from($dbSysUser, array('name'))->where('id_sysuser IN(?)', $this->_data['fk_id_counselor']); $rows = $dbSysUser->fetchAll($select); $filters['fk_id_counselor'] = ''; foreach ($rows as $key => $row) { $filters['fk_id_counselor'] .= $row->name; if ($rows->count() != ++$key) { $filters['fk_id_counselor'] .= ', '; } } } if (!empty($this->_data['fk_id_addcountry'])) { $mapperCountry = new Register_Model_Mapper_AddCountry(); $contry = $mapperCountry->fetchRow($this->_data['fk_id_addcountry']); $filters['country'] = $contry->country; } if (!empty($this->_data['fk_id_adddistrict'])) { $mapperDistrict = new Register_Model_Mapper_AddDistrict(); $district = $mapperDistrict->fetchRow($this->_data['fk_id_adddistrict']); $filters['district'] = $district->District; } if (!empty($this->_data['fk_id_fefpenterprise'])) { $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $enterprise = $mapperEnterprise->fetchRow($this->_data['fk_id_fefpenterprise']); $filters['enterprise'] = $enterprise->enterprise_name; } if (!empty($this->_data['fk_id_fefpeduinstitution'])) { $mapperEducationInstititue = new Register_Model_Mapper_EducationInstitute(); $educationInstititute = $mapperEducationInstititue->fetchRow($this->_data['fk_id_fefpeduinstitution']); $filters['institute'] = $educationInstititute->institution; } if (!empty($this->_data['fk_id_profocupation'])) { $mapperOccupation = new Register_Model_Mapper_ProfOcupationTimor(); $occupation = $mapperOccupation->fetchRow($this->_data['fk_id_profocupation']); $filters['occupation'] = $occupation['acronym'] . ' ' . $occupation['ocupation_name_timor']; } if (!empty($this->_data['fk_id_scholarity_area'])) { $mapperScholarityArea = new Register_Model_Mapper_ScholarityArea(); $area = $mapperScholarityArea->fetchRow($this->_data['fk_id_scholarity_area']); $filters['area'] = $area['scholarity_area']; } if (!empty($this->_data['fk_id_pertypescholarity'])) { $mapperTypeScholarity = new Register_Model_Mapper_PerTypeScholarity(); $typeScholarity = $mapperTypeScholarity->fetchRow($this->_data['fk_id_pertypescholarity']); $filters['type_scholarity'] = $typeScholarity['type_scholarity']; } if (!empty($this->_data['fk_typeinstitution'])) { $mapperTypeInstitution = App_Model_DbTable_Factory::get('TypeInstitution'); $typeInstitution = $mapperTypeInstitution->fetchRow(array('id_typeinstitution = ?' => $this->_data['fk_typeinstitution'])); $filters['type_institution'] = $typeInstitution['type_institution']; } if (!empty($this->_data['fk_id_sectorindustry'])) { $mapperIsicClass = App_Model_DbTable_Factory::get('ISICClassTimor'); $sectorIndustry = $mapperIsicClass->fetchRow(array('id_isicclasstimor = ?' => $this->_data['fk_id_sectorindustry'])); $filters['sector_industry'] = $sectorIndustry['name_classtimor']; } if (!empty($this->_data['fk_fefptypeenterprite'])) { $mapperTypeEnterprise = App_Model_DbTable_Factory::get('FEFPTypeEnterprise'); $typeEnterprise = $mapperTypeEnterprise->fetchRow(array('id_fefptypeenterprise = ?' => $this->_data['fk_fefptypeenterprite'])); $filters['type_enterprise'] = $typeEnterprise['type_enterprise']; } if (!empty($this->_data['fk_id_perlevelscholarity'])) { $dbLevelScholarity = App_Model_DbTable_Factory::get('PerLevelScholarity'); $levelScholarity = $dbLevelScholarity->fetchRow(array('id_perlevelscholarity = ?' => $this->_data['fk_id_perlevelscholarity'])); $filters['level_scholarity'] = $levelScholarity['level_scholarity']; } if (!empty($this->_data['fk_id_perscholarity'])) { $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $course = $mapperScholarity->fetchRow($this->_data['fk_id_perscholarity']); $filters['course'] = (empty($course['external_code']) ? '' : $course['external_code'] . ' - ') . $course['scholarity']; } if (!empty($this->_data['fk_id_sysuser'])) { $mapperSysUser = new Admin_Model_Mapper_SysUser(); $user = $mapperSysUser->fetchRow($this->_data['fk_id_sysuser']); $filters['user'] = $user['name'] . ' (' . $user['login'] . ')'; } if (!empty($this->_data['fk_id_department'])) { $mapperDepartment = new Admin_Model_Mapper_Department(); $department = $mapperDepartment->fetchRow($this->_data['fk_id_department']); $filters['department'] = $department['name']; } if (!empty($this->_data['fk_id_campaign_type'])) { $mapperCampaignType = new Sms_Model_Mapper_CampaignType(); $campaignType = $mapperCampaignType->fetchRow($this->_data['fk_id_campaign_type']); $filters['campaign_type'] = $campaignType['campaign_type']; } if (!empty($this->_data['status_campaign'])) { $view = Zend_Layout::getMvcInstance()->getView(); $optStatuses = $view->campaign()->getStatuses(); $filters['status_campaign'] = $optStatuses[$this->_data['status_campaign']]; } if (!empty($this->_data['fk_id_campaign'])) { $mapperCampaign = new Sms_Model_Mapper_Campaign(); $campaign = $mapperCampaign->fetchRow($this->_data['fk_id_campaign']); $filters['campaign_title'] = $campaign['campaign_title']; } if (!empty($this->_data['id_fefop_programs']) || !empty($this->_data['fk_id_fefop_programs'])) { $dbFEFOPPrograms = App_Model_DbTable_Factory::get('FEFOPPrograms'); if (!empty($this->_data['id_fefop_programs'])) { if (!is_array($this->_data['id_fefop_programs'])) { $row = $dbFEFOPPrograms->find($this->_data['id_fefop_programs'])->current(); $filters['fefop_program'] = $row->acronym . ' - ' . $row->description; } else { $select = $dbFEFOPPrograms->select()->from($dbFEFOPPrograms, array('description', 'acronym'))->where('id_fefop_programs IN(?)', $this->_data['id_fefop_programs']); $rows = $dbFEFOPPrograms->fetchAll($select); $filters['fefop_program'] = ''; foreach ($rows as $key => $row) { $filters['fefop_program'] .= $row->acronym . ' - ' . $row->description; if ($rows->count() != ++$key) { $filters['fefop_program'] .= ', '; } } } } else { if (!empty($this->_data['fk_id_fefop_programs'])) { $row = $dbFEFOPPrograms->find($this->_data['fk_id_fefop_programs'])->current(); $filters['fefop_program'] = $row->acronym . ' - ' . $row->description; } } } if (!empty($this->_data['id_fefop_modules']) || !empty($this->_data['fk_id_fefop_modules'])) { $dbFEFOPModules = App_Model_DbTable_Factory::get('FEFOPModules'); if (!empty($this->_data['id_fefop_modules'])) { if (!is_array($this->_data['id_fefop_modules'])) { $row = $dbFEFOPModules->find($this->_data['id_fefop_modules'])->current(); $filters['fefop_module'] = $row->acronym . ' - ' . $row->description; } else { $select = $dbFEFOPModules->select()->from($dbFEFOPModules, array('description', 'acronym'))->where('id_fefop_modules IN(?)', $this->_data['id_fefop_modules']); $rows = $dbFEFOPModules->fetchAll($select); $filters['fefop_module'] = ''; foreach ($rows as $key => $row) { $filters['fefop_module'] .= $row->acronym . ' - ' . $row->description; if ($rows->count() != ++$key) { $filters['fefop_module'] .= ', '; } } } } else { if (!empty($this->_data['fk_id_fefop_modules'])) { $row = $dbFEFOPModules->find($this->_data['fk_id_fefop_modules'])->current(); $filters['fefop_module'] = $row->acronym . ' - ' . $row->description; } } } if (!empty($this->_data['id_adddistrict'])) { $dbAddDistrict = App_Model_DbTable_Factory::get('AddDistrict'); if (is_array($this->_data['id_adddistrict'])) { $select = $dbAddDistrict->select()->from($dbAddDistrict, array('District'))->where('id_adddistrict IN(?)', $this->_data['id_adddistrict']); $rows = $dbAddDistrict->fetchAll($select); $filters['district'] = ''; foreach ($rows as $key => $row) { $filters['district'] .= $row->District; if ($rows->count() != ++$key) { $filters['district'] .= ', '; } } } else { $row = $dbAddDistrict->find($this->_data['id_adddistrict'])->current(); $filters['district'] = $row->District; } } if (!empty($this->_data['num_district'])) { $row = App_Model_DbTable_Factory::get('AddDistrict')->fetchRow(array('acronym = ?' => $this->_data['num_district'])); $filters['district'] = $row->District; } if (!empty($this->_data['id_scholarity_area'])) { $row = App_Model_DbTable_Factory::get('ScholarityArea')->find($this->_data['id_scholarity_area'])->current(); $filters['scholarity_area'] = (empty($row->acronym) ? '' : $row->acronym . ' - ') . $row->scholarity_area; } if (!empty($this->_data['id_profocupationtimor'])) { $row = App_Model_DbTable_Factory::get('PROFOcupationTimor')->find($this->_data['id_profocupationtimor'])->current(); $filters['ocupationtimor'] = $row->acronym . ' - ' . $row->ocupation_name_timor; } if (!empty($this->_data['id_fefpeduinstitution'])) { $row = App_Model_DbTable_Factory::get('FefpEduInstitution')->find($this->_data['id_fefpeduinstitution'])->current(); $filters['institution'] = $row->institution; } if (!empty($this->_data['fk_id_user_inserted'])) { $row = App_Model_DbTable_Factory::get('SysUser')->find($this->_data['fk_id_user_inserted'])->current(); $filters['user_inserted'] = $row->name; } if (!empty($this->_data['fk_id_user_removed'])) { $row = App_Model_DbTable_Factory::get('SysUser')->find($this->_data['fk_id_user_removed'])->current(); $filters['user_removed'] = $row->name; } if (array_key_exists('status', $this->_data) && is_numeric($this->_data['status'])) { $filters['status_description'] = $this->_data['status'] ? 'Loos' : 'Lae'; } if (!empty($this->_data['date_registration_ini'])) { $filters['date_registration_ini'] = $this->_data['date_registration_ini']; } if (!empty($this->_data['date_registration_fim'])) { $filters['date_registration_fim'] = $this->_data['date_registration_fim']; } if (!empty($this->_data['num_year'])) { $filters['num_year'] = $this->_data['num_year']; } if (!empty($this->_data['num_sequence'])) { $filters['num_sequence'] = $this->_data['num_sequence']; } if (array_key_exists('minimum_amount', $this->_data) && array_key_exists('maximum_amount', $this->_data)) { $min = new Zend_Currency('en_US'); $min->setValue($this->_data['minimum_amount']); $max = new Zend_Currency('en_US'); $max->setValue($this->_data['maximum_amount']); $filters['minmaxamount'] = $min . ' - ' . $max; } if (!empty($this->_data['id_fefop_status']) || !empty($this->_data['fk_id_fefop_status'])) { $dbFEFOPStatus = App_Model_DbTable_Factory::get('FEFOPStatus'); if (!empty($this->_data['id_fefop_status'])) { if (!is_array($this->_data['id_fefop_status'])) { $row = $dbFEFOPStatus->find($this->_data['id_fefop_status'])->current(); $filters['fefop_status'] = $row->status_description; } else { $select = $dbFEFOPStatus->select()->from($dbFEFOPStatus, array('status_description'))->where('id_fefop_status IN(?)', $this->_data['id_fefop_status']); $rows = $dbFEFOPStatus->fetchAll($select); $filters['fefop_status'] = ''; foreach ($rows as $key => $row) { $filters['fefop_status'] .= $row->status_description; if ($rows->count() != ++$key) { $filters['fefop_status'] .= ', '; } } } } else { $row = $dbFEFOPStatus->find($this->_data['fk_id_fefop_status'])->current(); $filters['fefop_status'] = $row->status_description; } } if (!empty($this->_data['id_budget_category_type'])) { $row = App_Model_DbTable_Factory::get('BudgetCategoryType')->find($this->_data['id_budget_category_type'])->current(); $filters['budget_category_type'] = $row->description; } if (!empty($this->_data['type_fefopfund'])) { if ('G' == $this->_data['type_fefopfund']) { $filters['description_type_fefopfund'] = 'Governo'; } else { $filters['description_type_fefopfund'] = 'Donor'; } } if (!empty($this->_data['id_beneficiary'])) { $mapper = new Fefop_Model_Mapper_Contract(); $adapter = App_Model_DbTable_Abstract::getDefaultAdapter(); $select = $adapter->select()->from(array('b' => new Zend_Db_Expr('(' . $mapper->getSelectBeneficiary() . ')')), array('name'))->where('b.id = ?', $this->_data['id_beneficiary']); $row = $adapter->fetchRow($select); $filters['beneficiary'] = $row['name']; } if (!empty($this->_data['type_beneficiary'])) { switch ($this->_data['type_beneficiary']) { case 'fk_id_staff': $type_beneficiary = 'Empreza Staff'; break; case 'fk_id_fefpenterprise': $type_beneficiary = 'Empreza'; break; case 'fk_id_fefpeduinstitution': $type_beneficiary = 'Inst Ensinu'; break; case 'fk_id_perdata': $type_beneficiary = 'Kliente'; break; default: $type_beneficiary = 'N/A'; } $filters['type_beneficiary'] = $type_beneficiary; } return $filters; }