/** * */ public function init() { parent::init(); $elements = array(); $elements[] = $this->createElement('hidden', 'path')->setValue('job/register-report')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'title')->setValue('Relatoriu: List Vagas Rejista')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'orientation')->setValue('landscape')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $optTransport['1'] = 'Loke'; $optTransport['0'] = 'Taka'; $optTransport['2'] = 'Kansela'; $elements[] = $this->createElement('select', 'active')->setDecorators($this->getDefaultElementDecorators())->setLabel('Status')->setAttrib('class', 'm-wrap span12')->addMultiOptions($optTransport)->setValue(1)->setRequired(true); $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); $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $rows = $mapperEnterprise->listByFilters(); $optEnterprise[''] = ''; foreach ($rows as $row) { $optEnterprise[$row->id_fefpenterprise] = $row->enterprise_name; } $elements[] = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setLabel('Empreza')->addMultiOptions($optEnterprise)->setAttrib('class', 'm-wrap span12 chosen'); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $elements[] = $this->createElement('text', 'vacancy_titule')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Titulu Vaga'); $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', 'open_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('readOnly', true)->setAttrib('class', 'm-wrap span8')->setLabel('Data Loke'); $elements[] = $this->createElement('text', 'close_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('readOnly', true)->setAttrib('class', 'm-wrap span8')->setLabel('Data Taka'); $optTransport['1'] = 'Loke'; $optTransport['0'] = 'Taka'; $optTransport['2'] = 'Kansela'; $elements[] = $this->createElement('select', 'active')->setDecorators($this->getDefaultElementDecorators())->setLabel('Status')->addMultiOptions($optTransport)->setValue(1)->setRequired(true); $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); $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $rows = $mapperEnterprise->listByFilters(); $optEnterprise[''] = ''; foreach ($rows as $row) { $optEnterprise[$row->id_fefpenterprise] = $row->enterprise_name; } $elements[] = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setLabel('Empreza')->addMultiOptions($optEnterprise)->setAttrib('class', 'm-wrap span12 chosen'); $this->addElements($elements); }
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(100000)->setDecorators(array('ViewHelper')); $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $rows = $mapperEnterprise->listByFilters(); $optEnteprises[''] = ''; foreach ($rows as $row) { $optEnteprises[$row['id_fefpenterprise']] = $row['enterprise_name']; } $elements[] = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optEnteprises)->setLabel('Instituisaun responsavel ba implementasaun'); $elements[] = $this->createElement('select', 'fk_id_per_area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'span12')->setLabel('Area projetu nian'); $dbDistrict = App_Model_DbTable_Factory::get('AddDistrict'); $districts = $dbDistrict->fetchAll(); $optCountry[''] = ''; foreach ($districts as $district) { $optCountry[$district['id_adddistrict']] = $district['District']; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'span12')->setValue(Admin_Model_Mapper_SysUser::userCeopToDistrict())->addMultiOptions($optCountry)->setLabel('Distritu'); $elements[] = $this->createElement('select', 'fk_id_addsubdistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'span12')->setRegisterInArrayValidator(false)->setLabel('Sub-Distritu'); $elements[] = $this->createElement('select', 'fk_id_addsucu')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'span12')->setRegisterInArrayValidator(false)->setLabel('Suku'); $elements[] = $this->createElement('text', 'date_start')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Inisiu'); $elements[] = $this->createElement('text', 'date_finish')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Remata'); $elements[] = $this->createElement('select', 'fk_id_per_area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'span12')->setLabel('Area projetu nian'); $this->addElements($elements); }
/** * * @param int $id * @return Zend_Db_Table_Rowset */ public function listEnterprise($id) { $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $select = $mapperEnterprise->getSelectEnterprise(); $dbGroupContact = App_Model_DbTable_Factory::get('SmsGroupContact'); $select->join(array('gc' => $dbGroupContact), 'gc.fk_id_fefpenterprise = e.id_fefpenterprise', array())->where('gc.fk_id_sms_group = ?', $id); return $dbGroupContact->fetchAll($select); }
/** * * @return array */ public function enterpriseReport() { $filters = $this->_data; $filters['fk_nationality'] = $this->_data['fk_id_addcountry']; $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $rows = $mapperEnterprise->listByFilters($filters); $data = array('rows' => $rows); return $data; }
/** * */ public function init() { $this->setName('searchclient'); parent::init(); $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $rows = $mapperEnterprise->listByFilters(); $optEnterprise[''] = ''; foreach ($rows as $row) { $optEnterprise[$row->id_fefpenterprise] = $row->enterprise_name; } $element = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setLabel('Empreza')->addMultiOptions($optEnterprise)->setRequired(true)->setAttrib('class', 'm-wrap span12 chosen'); $this->addElement($element); }
/** * */ public function saveAbstractAction() { $step = $this->_getParam('step'); $form = $this->_initForm($step); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $this->_mapper->setData($form->getValues()); $method = 'save' . ucfirst($step); $return = call_user_func(array($this->_mapper, $method)); $message = $this->_mapper->getMessage()->toArray(); $result = array('status' => (bool) $return, 'id' => $return, 'description' => $message, 'data' => $form->getValues(), 'fields' => $this->_mapper->getFieldsError()); $this->_helper->json($result); } else { $message = new App_Message(); $message->addMessage($this->_config->messages->warning, App_Message::WARNING); $result = array('status' => false, 'description' => $message->toArray(), 'errors' => $form->getMessages()); $this->_helper->json($result); } } else { $this->_helper->redirector->goToSimple('index'); } }
/** * */ public function detailEnterpriseAction() { if ($this->getRequest()->isXmlHttpRequest()) { $this->_helper->layout()->disableLayout(); } $id = $this->_getParam('id'); $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $enterprise = $mapperEnterprise->detail($id); $address = $mapperEnterprise->listAddress($id)->current(); $staff = $mapperEnterprise->listStaff($id)->current(); $this->view->enterprise = $enterprise; $this->view->address = $address; $this->view->staff = $staff; }
public function init() { $this->setAttrib('class', 'horizontal-form'); $elements = array(); $elements[] = $this->createElement('hidden', 'id_jobvacancy')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'step')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear')->setValue('information'); $elements[] = $this->createElement('text', 'vacancy_titule')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 250)->setRequired(true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Titulu Vaga'); $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'); $elements[] = $this->createElement('text', 'start_salary')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 20)->setAttrib('class', 'm-wrap span12 money-mask')->setLabel('Salariu Husi'); $elements[] = $this->createElement('text', 'finish_salary')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 20)->setAttrib('class', 'm-wrap span12 money-mask')->setLabel('Salariu Too'); $elements[] = $this->createElement('text', 'additional_salary')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 20)->setAttrib('class', 'm-wrap span12 money-mask')->setLabel('Salariu Adisional'); $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)->setRequired(true); $elements[] = $this->createElement('text', 'registration_date')->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'); $elements[] = $this->createElement('text', 'start_job_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Inisiu Serbisu'); $elements[] = $this->createElement('text', 'finish_job_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Remata Serbisu'); $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $rows = $mapperEnterprise->listByFilters(); $optEnterprise[''] = ''; foreach ($rows as $row) { $optEnterprise[$row->id_fefpenterprise] = $row->enterprise_name; } $elements[] = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setLabel('Empreza')->addMultiOptions($optEnterprise)->setRequired(true)->setAttrib('class', 'm-wrap span12 chosen'); $elements[] = $this->createElement('text', 'open_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Loke'); $elements[] = $this->createElement('text', 'close_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Taka'); $elements[] = $this->createElement('text', 'num_position')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Pozisaun Hira'); $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)->setRequired(true); $elements[] = $this->createElement('text', 'minimum_experience')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Esperiensia Minima (Anos)'); $elements[] = $this->createElement('text', 'category_drive_licence')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('class', 'm-wrap span12')->setLabel('Kategoria Karga Kondusaun'); $elements[] = $this->createElement('text', 'minimum_age')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Idade Minima (Anos)'); $elements[] = $this->createElement('text', 'maximum_age')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Idade Masima (Anos)'); $elements[] = $this->createElement('text', 'weekly_workload')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Oras Semana'); $optTransport['1'] = 'Presiza'; $optTransport['0'] = 'La Presiza'; $elements[] = $this->createElement('radio', 'use_vehicle')->setDecorators($this->getDefaultElementDecorators())->setLabel('Transporte Rasik')->addMultiOptions($optTransport)->setAttrib('label_class', 'radio')->setSeparator('')->setValue(0)->setRequired(true); $elements[] = $this->createElement('text', 'start_time_job')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('readonly', true)->setAttrib('class', 'm-wrap span12 time-picker')->setLabel('Oras Inisiu'); $elements[] = $this->createElement('text', 'finish_time_job')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('readonly', true)->setAttrib('class', 'm-wrap span12 time-picker')->setLabel('Oras Remata'); $elements[] = $this->createElement('text', 'vehicle')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 255)->setAttrib('class', 'm-wrap span12')->setLabel('Deskrisaum Transporte'); $elements[] = $this->createElement('textarea', 'description_vacancy')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('class', 'm-wrap span12')->setAttrib('rows', 3)->setLabel('Deskrisaum Vaga'); $elements[] = $this->createElement('textarea', 'description_job')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('rows', 3)->setAttrib('class', 'm-wrap span12')->setLabel('Observasaun'); $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_location_overseas')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Lokalizasaun Internasional')->addMultiOptions($optNations); $optGender['0'] = 'MANE NO FETO'; $optGender['M'] = 'MANE'; $optGender['F'] = 'FETO'; $elements[] = $this->createElement('select', 'gender')->setDecorators($this->getDefaultElementDecorators())->setLabel('Seksu')->addMultiOptions($optGender)->setAttrib('class', 'm-wrap span12')->setRequired(true); App_Form_Toolbar::build($this, self::ID); $this->addElements($elements); }
/** * */ public function fetchEnterpriseAction() { $mapperEnterpise = new Register_Model_Mapper_Enterprise(); $enterprise = $mapperEnterpise->fetchRow($this->_getParam('id')); $data = array(); $data['fk_id_fefpenterprise'] = $enterprise['id_fefpenterprise']; $data['beneficiary'] = $enterprise['enterprise_name']; $this->_helper->json($data); }
/** * * @return Zend_Db_Table_Rowset */ public function listEnterprises() { $mapperEnterprises = new Register_Model_Mapper_Enterprise(); $select = $mapperEnterprises->getSelectEnterprise(); $dbFeContract = App_Model_DbTable_Factory::get('FEContract'); $select->join(array('fec' => $dbFeContract), 'fec.fk_id_fefpenterprise = e.id_fefpenterprise', array()); return $dbFeContract->fetchAll($select); }
/** * * @param int $id * @return Zend_Db_Table_Rowset */ public function listEntities($id) { $dbRegistratonEntity = App_Model_DbTable_Factory::get('FERegistrationEntity'); $mapperEduInstitute = new Register_Model_Mapper_EducationInstitute(); $selectEduInstitute = $mapperEduInstitute->getSelectEducationInstitute(); $mapperEnterprise = new Register_Model_Mapper_Enterprise(); $selectEnterprise = $mapperEnterprise->getSelectEnterprise(); $select = $dbRegistratonEntity->select()->from(array('re' => $dbRegistratonEntity))->setIntegrityCheck(false)->joinLeft(array('ee' => new Zend_Db_Expr('(' . $selectEnterprise . ')')), 'ee.id_fefpenterprise = re.fk_id_fefpenterprise', array())->joinLeft(array('ei' => new Zend_Db_Expr('(' . $selectEduInstitute . ')')), 'ei.id_fefpeduinstitution = re.fk_id_fefpeduinstitution', array('type' => "IF(re.fk_id_fefpenterprise, 'enterprise', 'institute')", 'id' => 'IFNULL(re.fk_id_fefpenterprise, re.fk_id_fefpeduinstitution)', 'name' => 'IFNULL(ee.enterprise_name, ei.institution)'))->where('re.fk_id_fe_registration = ?', $id)->where('IFNULL(re.fk_id_fefpenterprise, re.fk_id_fefpeduinstitution) IS NOT NULL'); return $dbRegistratonEntity->fetchAll($select); }
/** * */ 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; }