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')); $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperInstitute->listByFilters(); $optInstitutes[''] = ''; foreach ($rows as $row) { $optInstitutes[$row['id_fefpeduinstitution']] = $row['institution']; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optInstitutes)->setLabel('Sentru Formasaun'); $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', 'm-wrap span12')->addMultiOptions($optCountry)->setLabel('Distritu'); $elements[] = $this->createElement('select', 'fk_id_addsubdistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setRegisterInArrayValidator(false)->setLabel('Sub-Distritu'); $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'); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form'); $elements = array(); $elements[] = $this->createElement('hidden', 'fk_id_perdata')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'step')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear')->setValue('nonFormalScholarity'); $elements[] = $this->createElement('hidden', 'fk_id_pertypescholarity')->setDecorators(array('ViewHelper'))->setValue(2)->setAttrib('class', 'no-clear'); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $optCategory = $mapperScholarity->getOptionsCategory(Register_Model_Mapper_PerTypeScholarity::NON_FORMAL); $elements[] = $this->createElement('select', 'category')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 chosen')->setRequired(true)->addMultiOptions($optCategory)->setLabel('Kategoria'); $elements[] = $this->createElement('select', 'fk_id_perscholarity')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setRegisterInArrayValidator(false)->setRequired(true)->setLabel('Kursu'); // Search just for Non Formal Education Institute $filters['fk_id_pertypescholarity'] = Register_Model_Mapper_PerTypeScholarity::NON_FORMAL; $mapperEducationInsitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperEducationInsitute->listByFilters($filters); $optEducationInstitute[''] = ''; foreach ($rows as $row) { $optEducationInstitute[$row->id_fefpeduinstitution] = $row->institution; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Instituisaun Ensinu')->addMultiOptions($optEducationInstitute)->setRequired(true)->setAttrib('class', 'm-wrap span12 chosen'); $elements[] = $this->createElement('text', 'start_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 date-mask')->setLabel('Data Iniciu'); $elements[] = $this->createElement('text', 'finish_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 date-mask')->setLabel('Data Fim'); 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', 'class_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Naran Klase'); $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'); $mapperEducationInsitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperEducationInsitute->listByFilters(); $optEducationInstitute[''] = ''; foreach ($rows as $row) { $optEducationInstitute[$row->id_fefpeduinstitution] = $row->institution; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Instituisaun Ensinu')->addMultiOptions($optEducationInstitute)->setRegisterInArrayValidator(false)->setAttrib('class', 'm-wrap span12 chosen'); $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); $elements[] = $this->createElement('text', 'start_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Inisiu'); $elements[] = $this->createElement('text', 'schedule_finish_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Planu Remata'); $filters = array('type' => Register_Model_Mapper_PerTypeScholarity::NON_FORMAL); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $optScholarity = $mapperScholarity->getOptionsScholarity($filters); $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() { parent::init(); $elements = array(); $elements[] = $this->createElement('hidden', 'path')->setValue('student-class/school-report')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'title')->setValue('Relatoriu: Graduadu liu husi Nivel Eskola')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $mapperEducationInsitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperEducationInsitute->listByFilters(); $optEducationInstitute[''] = ''; foreach ($rows as $row) { $optEducationInstitute[$row->id_fefpeduinstitution] = $row->institution; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Instituisaun Ensinu')->addMultiOptions($optEducationInstitute)->setRegisterInArrayValidator(false)->setAttrib('class', 'm-wrap span12 chosen'); $mapperScholarityArea = new Register_Model_Mapper_ScholarityArea(); $sections = $mapperScholarityArea->fetchAll(); $optScholarityArea[''] = ''; foreach ($sections as $section) { $optScholarityArea[$section['id_scholarity_area']] = $section['scholarity_area']; } $elements[] = $this->createElement('select', 'fk_id_scholarity_area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen focused')->setLabel('Area Kursu')->addMultiOptions($optScholarityArea); $filters = array('type' => Register_Model_Mapper_PerTypeScholarity::NON_FORMAL); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $optScholarity = $mapperScholarity->getOptionsScholarity($filters); $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); }
/** * * @return array */ public function institutionReport() { $mapperInstitution = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperInstitution->listByFilters($this->_data); $data = array('rows' => $rows); return $data; }
public function init() { $this->setAttrib('class', 'horizontal-form'); $elements = array(); $elements[] = $this->createElement('hidden', 'id_action_plan_group')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'step')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear')->setValue('caseGroup'); $dbUser = App_Model_DbTable_Factory::get('SysUser'); $rows = $dbUser->fetchAll(array('fk_id_dec = ?' => Zend_Auth::getInstance()->getIdentity()->fk_id_dec), array('name')); $users[''] = ''; foreach ($rows as $row) { $users[$row->id_sysuser] = $row->name . ' (' . $row->login . ')'; } $elements[] = $this->createElement('select', 'fk_id_counselor')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setRequired(true)->setLabel('Konselleru')->addMultiOptions($users); $mapperEducationInsitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperEducationInsitute->listByFilters(); $optEducationInstitute[''] = ''; foreach ($rows as $row) { $optEducationInstitute[$row->id_fefpeduinstitution] = $row->institution; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Instituisaun Ensinu')->addMultiOptions($optEducationInstitute)->setAttrib('onchange', 'Client.CaseGroup.setRequiredGroup( this.value, "E" )')->setRegisterInArrayValidator(false)->setAttrib('class', 'm-wrap span12 chosen'); $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')->setAttrib('onchange', 'Client.CaseGroup.setRequiredGroup( this.value, "C" )')->setLabel('Nasaun')->addMultiOptions($optCountry)->setRequired(true); $elements[] = $this->createElement('text', 'name')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 50)->addFilter('StringTrim')->addFilter('StringToUpper')->setRequired(true)->setAttrib('class', 'm-wrap span12')->setLabel('Naran'); App_Form_Toolbar::build($this, self::ID); $this->addElements($elements); }
/** * */ public function fetchInstituteAction() { $mapperInsitute = new Register_Model_Mapper_EducationInstitute(); $institute = $mapperInsitute->detailEducationInstitution($this->_getParam('id')); $data = array(); $data['fk_id_fefpeduinstitution'] = $institute['id_fefpeduinstitution']; $data['institution'] = $institute['institution']; $this->_helper->json($data); }
/** * */ public function init() { parent::init(); $elements = array(); $elements[] = $this->createElement('hidden', 'path')->setValue('student-class/area-report')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $elements[] = $this->createElement('hidden', 'title')->setValue('Relatoriu: Graduadu liu husi Area')->setAttrib('class', 'no-clear')->setDecorators(array('ViewHelper')); $mapperEducationInsitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperEducationInsitute->listByFilters(); $optEducationInstitute[''] = ''; foreach ($rows as $row) { $optEducationInstitute[$row->id_fefpeduinstitution] = $row->institution; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Instituisaun Ensinu')->addMultiOptions($optEducationInstitute)->setRegisterInArrayValidator(false)->setAttrib('class', 'm-wrap span12 chosen'); $this->addElements($elements); }
/** * */ public function detailCoursesAction() { $this->_helper->layout()->disableLayout(); $id = $this->_getParam('id'); $this->view->row = $this->_mapper->detailEducationInstitution($id); $this->view->courses = $this->_mapper->listCourses($id); $this->view->contact = $this->_mapper->listContacts($id); }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $dbUser = App_Model_DbTable_Factory::get('SysUser'); $rows = $dbUser->fetchAll(array(), array('name')); $users[''] = ''; foreach ($rows as $row) { $users[$row->id_sysuser] = $row->name . ' (' . $row->login . ')'; } $elements[] = $this->createElement('select', 'fk_id_counselor')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Konselleru')->addMultiOptions($users); $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_profocupationtimor')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Meta Empregu')->addMultiOptions($optOccupations); $mapperEducationInsitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperEducationInsitute->listByFilters(); $optEducationInstitute[''] = ''; foreach ($rows as $row) { $optEducationInstitute[$row->id_fefpeduinstitution] = $row->institution; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Instituisaun Ensinu')->addMultiOptions($optEducationInstitute)->setRegisterInArrayValidator(false)->setAttrib('class', 'm-wrap span12 chosen'); $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('Nasaun')->addMultiOptions($optCountry); $optType[''] = ''; $optType['G'] = 'Kazu Grupu'; $optType['S'] = 'Individual'; $elements[] = $this->createElement('select', 'type')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Tipu')->addMultiOptions($optType); $optStatus[''] = ''; $optStatus['1'] = 'Loke'; $optStatus['0'] = 'Taka'; $optStatus['2'] = 'Kansela'; $elements[] = $this->createElement('select', 'status')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Status')->addMultiOptions($optStatus); $this->addElements($elements); }
/** * * @param array $trainingProviders * @return string */ public function getTrainingProviderNotFound($trainingProviders) { $message = 'Sentru Formasaun sira ne\'e seidauk rejistu iha sistema INDMO: <br /><p>'; $mapperEduInstitution = new Register_Model_Mapper_EducationInstitute(); $view = Zend_Layout::getMvcInstance()->getView(); $link = '<a href="%s" target="_blank">%s</a>'; $namesTraining = array(); foreach ($trainingProviders as $id) { $provider = $mapperEduInstitution->detailEducationInstitution($id); $namesTraining[] = sprintf($link, $view->baseUrl('/register/education-institution/edit/id/' . $id), $provider['institution']); } $message .= '<ul><li>' . implode('</li><li>', $namesTraining) . '</li></ul></p>'; return $message; }
/** * */ public function addStaffAction() { if ($this->getRequest()->isXmlHttpRequest()) { $this->_helper->layout()->disableLayout(); } $defaultValues = array('unit_cost' => 0, 'final_cost' => 0, 'training_fund' => 0); $row = $this->_getParam('row'); if (!empty($row)) { $defaultValues = $row->toArray(); $this->view->staff = $row; } else { $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $staff = $mapperInstitute->fetchStaff($this->_getParam('id')); $this->view->staff = $staff; } $this->view->defaultValues = $defaultValues; }
/** * */ public function fetchStaffAction() { $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $staff = $mapperInstitute->fetchStaff($this->_getParam('id')); $data = array(); $data['fk_id_staff'] = $staff['id_staff']; $data['beneficiary'] = $staff['staff_name']; $this->_helper->json($data); }
/** * * @return Zend_Db_Select */ public function getSelect() { $dbAnnualPlanning = App_Model_DbTable_Factory::get('FPAnnualPlanning'); $dbPlanningCourse = App_Model_DbTable_Factory::get('FPPlanningCourse'); $dbPerScholarity = App_Model_DbTable_Factory::get('PerScholarity'); $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $select = $mapperInstitute->getSelectEducationInstitute(); $select->reset(Zend_Db_Select::GROUP); $select->join(array('ap' => $dbAnnualPlanning), 'ap.fk_id_fefpeduinstitution = ei.id_fefpeduinstitution', array('id_annual_planning', 'year_planning', 'total_students', 'total_cost'))->join(array('pc' => $dbPlanningCourse), 'pc.fk_id_annual_planning = ap.id_annual_planning', array('id_planning_course', 'date_start', 'date_finish', 'total_man', 'total_woman', 'students_course' => 'total_students', 'cost_course' => 'total_cost', 'fk_id_fefpstudentclass'))->join(array('ps' => $dbPerScholarity), 'pc.fk_id_perscholarity = ps.id_perscholarity', array('id_perscholarity', 'scholarity', 'external_code', 'category'))->group(array('pc.id_planning_course'))->order(array('ap.year_planning DESC', 'pc.date_start')); return $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); }
/** * * @return Zend_Db_Table_Rowset */ public function listInstitutes() { $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $select = $mapperInstitute->getSelectEducationInstitute(); $dbFeContract = App_Model_DbTable_Factory::get('FEContract'); $select->join(array('fec' => $dbFeContract), 'fec.fk_id_fefpeduinstitution = ei.id_fefpeduinstitution', array()); return $dbFeContract->fetchAll($select); }
/** * * @param int $id * @return Zend_Db_Table_Rowset */ public function listInstitute($id) { $mapperEducationInstitue = new Register_Model_Mapper_EducationInstitute(); $select = $mapperEducationInstitue->getSelectEducationInstitute(); $dbGroupContact = App_Model_DbTable_Factory::get('SmsGroupContact'); $select->join(array('gc' => $dbGroupContact), 'gc.fk_id_fefpeduinstitution = ei.id_fefpeduinstitution', array())->where('gc.fk_id_sms_group = ?', $id); return $dbGroupContact->fetchAll($select); }
/** * */ public function exportAction() { $id = $this->_getParam('id'); $contract = $this->_mapper->detail($id); $data = $contract->toArray(); $data['contract'] = Fefop_Model_Mapper_Contract::buildNumById($contract->fk_id_fefop_contract); $data['date_start'] = $this->view->date($data['date_start']); $data['date_finish'] = $this->view->date($data['date_finish']); $data['date_inserted'] = $this->view->date($data['date_inserted']); $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $contacts = $mapperInstitute->listContacts($contract->fk_id_fefpeduinstitution)->toArray(); $beneficiaries = $this->_mapper->listBeneficiaries($id)->toArray(); foreach ($beneficiaries as $key => $beneficiary) { $beneficiaries[$key]['complete_nane'] = Client_Model_Mapper_Client::buildName($beneficiary); $beneficiaries[$key]['evidence'] = Client_Model_Mapper_Client::buildNumRow($beneficiary); } $excelPath = APPLICATION_PATH . '/../library/PHPExcel/'; require_once $excelPath . 'PHPExcel/IOFactory.php'; $objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load(APPLICATION_PATH . '/../public/forms/FEFOP/Contrato_FP_tet.xlsx'); $activeSheet = $objPHPExcel->getActiveSheet(); $activeSheet->setCellValue('S14', $data['contract']); $activeSheet->setCellValue('W12', $data['date_inserted']); $activeSheet->setCellValue('E17', $data['scholarity']); $activeSheet->setCellValue('O17', $data['level_scholarity']); $activeSheet->setCellValue('S17', $data['class_name']); $activeSheet->setCellValue('E20', $data['district']); $activeSheet->setCellValue('Q20', $data['date_start']); $activeSheet->setCellValue('Q21', $data['date_finish']); #$activeSheet->setCellValue( 'F10', $data['institute'] ); if (!empty($contacts)) { $activeSheet->setCellValue('G24', $contacts[0]['contact_name']); $activeSheet->setCellValue('S24', $contacts[0]['cell_fone']); $activeSheet->setCellValue('S25', $contacts[0]['email']); } $activeSheet->setCellValue('R31', $data['unit_cost']); $activeSheet->setCellValue('J29', count($beneficiaries)); $activeSheet->setCellValue('R29', $data['amount']); $startRow = 34; foreach ($beneficiaries as $beneficiary) { $activeSheet->setCellValue('F' . $startRow, $beneficiary['complete_nane']); $activeSheet->setCellValue('L' . $startRow, $beneficiary['evidence']); $activeSheet->setCellValue('N' . $startRow, $beneficiary['electoral']); $activeSheet->setCellValue('P' . $startRow, $beneficiary['gender']); $activeSheet->setCellValue('Q' . $startRow, empty($beneficiary['id_handicapped']) ? 'Lae' : 'Sin'); $activeSheet->setCellValue('R' . $startRow, $beneficiary['amount']); $startRow++; } header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); $file = sprintf('Contract_%s.xlsx', $data['contract']); header(sprintf('Content-Disposition: attachment;filename="%s"', $file)); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); exit; }
public function init() { $this->setAttrib('class', 'horizontal-form'); $elements = array(); $elements[] = $this->createElement('hidden', 'id_fefpstudentclass')->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', 'class_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 200)->setRequired(true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Naran Klase'); $elements[] = $this->createElement('select', 'fk_id_perscholarity')->setDecorators($this->getDefaultElementDecorators())->setRequired(true)->setAttrib('class', 'm-wrap span12 chosen')->setRegisterInArrayValidator(false)->setLabel('Kursu'); $mapperEducationInsitute = new Register_Model_Mapper_EducationInstitute(); $rows = $mapperEducationInsitute->listByFilters(); $optEducationInstitute[''] = ''; foreach ($rows as $row) { $optEducationInstitute[$row->id_fefpeduinstitution] = $row->institution; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Instituisaun Ensinu')->addMultiOptions($optEducationInstitute)->setRegisterInArrayValidator(false)->setRequired(true)->setAttrib('class', 'm-wrap span12 chosen'); $dbTypeProposal = App_Model_DbTable_Factory::get('FEFPTypeProposal'); $typesProposal = $dbTypeProposal->fetchAll(array(), array('type_proposal')); $optTypeProposal[''] = ''; foreach ($typesProposal as $typeProposal) { $optTypeProposal[$typeProposal->id_fefptypeproposal] = $typeProposal->type_proposal; } $elements[] = $this->createElement('select', 'fk_id_fefpproposal')->setDecorators($this->getDefaultElementDecorators())->setLabel('Tipu Formasaun')->addMultiOptions($optTypeProposal)->setAttrib('disabled', true)->setAttrib('class', 'm-wrap span12 chosen'); $elements[] = $this->createElement('text', 'minimal_age')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Tinan Minimo'); $elements[] = $this->createElement('text', 'maximal_age')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Tinan Masimu'); $mapperPerScholarity = new Register_Model_Mapper_PerScholarity(); $rows = $mapperPerScholarity->listAll(array('type' => Register_Model_Mapper_PerTypeScholarity::FORMAL)); $optScholarity = array('' => ''); foreach ($rows as $scholarity) { $optScholarity[$scholarity->id_perscholarity] = $scholarity->scholarity; } $elements[] = $this->createElement('select', 'fk_minimal_scholarity')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optScholarity)->setLabel('Eskolaridade Minima'); $elements[] = $this->createElement('text', 'start_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Inisiu'); $elements[] = $this->createElement('text', 'schedule_finish_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setRequired(true)->setLabel('Loron Planu Remata'); $elements[] = $this->createElement('text', 'real_finish_date')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Real Remata'); $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', 'formation_time')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Durasaun Formasaun'); $elements[] = $this->createElement('text', 'formation_time_class')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Oras Formasaun Klase'); $elements[] = $this->createElement('text', 'formation_time_outclass')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Durasaun Formasaun iha liu'); $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); $elements[] = $this->createElement('text', 'time_start')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('readonly', true)->setRequired(true)->setAttrib('class', 'm-wrap span12 time-picker')->setLabel('Oras Inisiu'); $elements[] = $this->createElement('text', 'time_finish')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('readonly', true)->setRequired(true)->setAttrib('class', 'm-wrap span12 time-picker')->setLabel('Oras Remata'); $elements[] = $this->createElement('checkbox', 'accommodation')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(0)->setAttrib('class', 'toggle-check')->setLabel('Iha Akomodasaun?'); $elements[] = $this->createElement('checkbox', 'transport')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(0)->setAttrib('class', 'toggle-check')->setLabel('Iha Transporte?'); $elements[] = $this->createElement('checkbox', 'snack')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(0)->setAttrib('class', 'toggle-check')->setLabel('Iha Matabisu?'); $elements[] = $this->createElement('checkbox', 'lunch')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(0)->setAttrib('class', 'toggle-check')->setLabel('Iha Hahan Meiu-dia?'); $elements[] = $this->createElement('checkbox', 'dinner')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(0)->setAttrib('class', 'toggle-check')->setLabel('Iha Hahan Kalan?'); $elements[] = $this->createElement('text', 'num_women_student')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Feto Nain Hira'); $elements[] = $this->createElement('text', 'num_men_student')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setRequired(true)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Mane Nain Hira'); $elements[] = $this->createElement('text', 'num_total_student')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('readOnly', true)->setAttrib('class', 'm-wrap span12 text-numeric4')->setLabel('Total Partisipante'); $elements[] = $this->createElement('text', 'student_payment')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 20)->setAttrib('class', 'm-wrap span12 money-mask')->setLabel('Pagamentu Estudante'); $elements[] = $this->createElement('text', 'description_payment')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 500)->setAttrib('class', 'm-wrap span12')->setLabel('Deskrisaun Pagamentu Partisipante'); $elements[] = $this->createElement('text', 'subsidy')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 20)->setAttrib('class', 'm-wrap span12 money-mask')->setLabel('Subsidiu'); $elements[] = $this->createElement('text', 'description_subsity')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 500)->setAttrib('class', 'm-wrap span12')->setLabel('Deskrisaun Subsidiu'); $elements[] = $this->createElement('textarea', 'description')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('class', 'm-wrap span12')->setAttrib('rows', 3)->setLabel('Deskrisaum Jeral'); App_Form_Toolbar::build($this, self::ID); $this->addElements($elements); }
/** * */ public function exportAction() { $id = $this->_getParam('id'); $contract = $this->_mapper->detail($id); $data = $contract->toArray(); $data['contract'] = Fefop_Model_Mapper_Contract::buildNumById($contract->fk_id_fefop_contract); $data['date_start'] = $this->view->date($data['date_start'], 'MM/dd/yyyy'); $data['date_finish'] = $this->view->date($data['date_finish'], 'MM/dd/yyyy'); $data['date_inserted'] = $this->view->date($data['date_inserted']); $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $contacts = $mapperInstitute->listContacts($data['fk_id_fefpeduinstitution'])->toArray(); $expenses = $this->_mapper->listExpenses($id)->toArray(); $itensExpense = $this->_mapper->listItemExpenses($id)->toArray(); $dataItensExpense = array(); foreach ($itensExpense as $item) { if (!array_key_exists($item['fk_id_budget_category'], $dataItensExpense)) { $dataItensExpense[$item['fk_id_budget_category']] = array(); } $dataItensExpense[$item['fk_id_budget_category']][] = $item; } $excelPath = APPLICATION_PATH . '/../library/PHPExcel/'; require_once $excelPath . 'PHPExcel/IOFactory.php'; $objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load(APPLICATION_PATH . '/../public/forms/FEFOP/Contrato_RI_tet.xlsx'); $activeSheet = $objPHPExcel->getActiveSheet(); $activeSheet->setCellValue('S10', $data['contract']); $activeSheet->setCellValue('W8', $data['date_inserted']); $activeSheet->setCellValue('F12', $data['institute']); $activeSheet->setCellValue('F14', $data['district']); $activeSheet->setCellValue('F15', $data['sub_district']); if (!empty($contacts)) { $activeSheet->setCellValue('G18', $contacts[0]['contact_name']); $activeSheet->setCellValue('S18', $contacts[0]['cell_fone']); $activeSheet->setCellValue('S19', $contacts[0]['email']); } $startRow = 24; $startSubRow = 35; $count = 'A'; $styleCell = new PHPExcel_Style(); $borders = array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => '0000000'))); $styleCell->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFFFFFFF')), 'borders' => $borders)); $ranges = array(); foreach ($expenses as $expense) { $marker = $count++ . '.'; $expenseName = ucwords(strtolower($expense['description'])); $activeSheet->setCellValue('C' . $startRow, $marker); $activeSheet->setCellValue('D' . $startRow, $expenseName); $activeSheet->setCellValueExplicit('U' . $startRow, $expense['amount'], PHPExcel_Cell_DataType::TYPE_NUMERIC); $activeSheet->mergeCells('U' . $startRow . ':V' . $startRow); $activeSheet->setCellValue('C' . $startSubRow, $marker); $activeSheet->setCellValue('D' . $startSubRow, $expenseName); $subExpenseRow = $startSubRow + 1; $subRowCount = 0; if (!empty($dataItensExpense[$expense['id_budget_category']])) { foreach ($dataItensExpense[$expense['id_budget_category']] as $subExpense) { $activeSheet->setCellValue('D' . $subExpenseRow, $subExpense['description']); $activeSheet->setCellValue('O' . $subExpenseRow, $subExpense['quantity']); $activeSheet->setCellValue('P' . $subExpenseRow, number_format((double) $subExpense['amount_unit'], 2, '.', ',')); $activeSheet->setCellValue('Q' . $subExpenseRow, number_format((double) $subExpense['amount_total'], 2, '.', ',')); $activeSheet->setCellValue('S' . $subExpenseRow, $subExpense['comments']); $activeSheet->mergeCells('Q' . $subExpenseRow . ':R' . $subExpenseRow); $activeSheet->mergeCells('S' . $subExpenseRow . ':V' . $subExpenseRow); $subRowCount++; $subExpenseRow++; $activeSheet->insertNewRowBefore($subExpenseRow + 1, 1); } $ranges[] = 'O' . ($startSubRow + 2) . ':V' . $subExpenseRow; } $activeSheet->insertNewRowBefore($subExpenseRow, 3); $startSubRow = $subExpenseRow + 2; $startRow++; if ($startRow > 28) { $activeSheet->insertNewRowBefore($startRow + 1, 1); } } $activeSheet->removeRow($startSubRow, 4); foreach ($ranges as $range) { $activeSheet->setSharedStyle($styleCell, $range); } $dateStartCell = 'G' . ($startSubRow + 2); $dateFinishCell = 'G' . ($startSubRow + 3); $formulaDate = $activeSheet->getCell('L' . ($startSubRow + 2))->getValue(); $formulaDate = str_replace('98', $dateStartCell, $formulaDate); $formulaDate = str_replace('99', $dateFinishCell, $formulaDate); $activeSheet->setCellValueExplicit('L' . ($startSubRow + 2), $formulaDate, PHPExcel_Cell_DataType::TYPE_FORMULA); $activeSheet->setCellValue($dateStartCell, $data['date_start']); $activeSheet->setCellValue($dateFinishCell, $data['date_finish']); header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); $file = sprintf('Contract_%s.xlsx', $data['contract']); header(sprintf('Content-Disposition: attachment;filename="%s"', $file)); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); exit; }
/** * */ 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; }