/** * * @param array $rows * @return array */ public function registerSchoolLevel($rows) { $data = array('MANE' => 0, 'FETO' => 0, 'total' => 0); $schoolData = array('total' => 0, 'MANE' => 0, 'FETO' => 0, 'porcent' => 0); $schoolLevel = array(); foreach ($rows as $row) { $gender = trim($row['gender']); $school = empty($row['max_level_scholarity']) ? 'LA IHA' : $row['max_level_scholarity']; if (!array_key_exists($school, $schoolLevel)) { $schoolLevel[$school] = $schoolData; } $schoolLevel[$school][$gender]++; $schoolLevel[$school]['total']++; $data['total']++; $data[$gender]++; } foreach ($schoolLevel as $school => $row) { $schoolLevel[$school]['porcent'] = round(100 * $row['total'] / $data['total'], 2); } $data['rows'] = $schoolLevel; if (!empty($data['rows'])) { $pie = array('series' => array(), 'labels' => array()); $column = array('series' => array(), 'labels' => array(), 'names' => array()); $man = array(); $woman = array(); foreach ($data['rows'] as $school => $row) { $pie['series'][] = $row['total']; $pie['labels'][] = $school; $man[] = $row['MANE']; $woman[] = $row['FETO']; $column['labels'][] = $school; } $column['series'] = array($man, $woman); $column['names'] = array('MANE', 'FETO'); $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::pieChart($pie, 'Nivel Edukasaun'); $scaleConfig = array('LabelRotation' => 20); $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Nivel Edukasaun / Seksu', $scaleConfig); } return $data; }
/** * * @return array */ public function shortlistedReport() { $mapperVacancy = new Job_Model_Mapper_JobVacancy(); $select = $mapperVacancy->getSelectVacancy(); $dbShortlist = App_Model_DbTable_Factory::get('ShortlistVacancy'); $dbPerData = App_Model_DbTable_Factory::get('PerData'); $select->join(array('s' => $dbShortlist), 's.fk_id_jobvacancy = jv.id_jobvacancy', array('count' => new Zend_Db_Expr('COUNT(1)')))->join(array('c' => $dbPerData), 's.fk_id_perdata = c.id_perdata', array('client_gender' => 'gender'))->order(array('vacancy_titule'))->group(array('id_jobvacancy', 'c.gender')); $date = new Zend_Date(); $filters = $this->_data; $select->where('jv.active = ?', (int) $filters['active']); if (!empty($filters['fk_id_profocupation'])) { $select->where('jv.fk_id_profocupation = ?', $filters['fk_id_profocupation']); } if (!empty($filters['fk_id_fefpenterprise'])) { $select->where('jv.fk_id_fefpenterprise = ?', $filters['fk_id_fefpenterprise']); } if (!empty($filters['date_start'])) { $select->where('jv.open_date >= ?', $date->set($filters['date_start'])->toString('yyyy-MM-dd')); } if (!empty($filters['date_finish'])) { $select->where('jv.close_date <= ?', $date->set($filters['date_finish'])->toString('yyyy-MM-dd')); } if (!empty($filters['fk_id_dec'])) { $select->where('jv.fk_id_dec = ?', $filters['fk_id_dec']); } $rows = $dbShortlist->fetchAll($select); $data = array('MANE' => 0, 'FETO' => 0, 'total' => 0); $vacancyData = array('total' => 0, 'MANE' => 0, 'FETO' => 0); $vacancies = array(); foreach ($rows as $row) { $row = $row->toArray(); $gender = trim($row['client_gender']); $vacancy = $row['id_jobvacancy']; if (!array_key_exists($vacancy, $vacancies)) { $vacancies[$vacancy] = $row + $vacancyData; } $vacancies[$vacancy][$gender] += $row['count']; $vacancies[$vacancy]['total'] += $row['count']; $data['total'] += $row['count']; $data[$gender] += $row['count']; } $data['rows'] = $vacancies; $data['graph'] = array(); if (!empty($data['rows'])) { $graph = array('series' => array($data['MANE'], $data['FETO']), 'labels' => array('MANE', 'FETO')); $data['graph'][App_General_String::randomHash()] = App_Util_Chart::pieChart($graph, 'Refere Shortlist MANE no FETO'); } return $data; }