Example #1
0
 /**
  *
  * @return array
  */
 public function areaReport()
 {
     $rows = $this->selectGraduated();
     $data = array('MANE' => 0, 'FETO' => 0, 'total' => 0);
     $schoolData = array('total' => 0, 'MANE' => 0, 'FETO' => 0, 'porcent' => 0);
     $areaScholarity = array();
     foreach ($rows as $row) {
         $gender = trim($row['gender']);
         $area = trim($row['scholarity_area']);
         if (!array_key_exists($area, $areaScholarity)) {
             $areaScholarity[$area] = $schoolData;
         }
         $areaScholarity[$area][$gender]++;
         $areaScholarity[$area]['total']++;
         $data['total']++;
         $data[$gender]++;
     }
     foreach ($areaScholarity as $area => $row) {
         $areaScholarity[$area]['porcent'] = round(100 * $row['total'] / $data['total'], 2);
     }
     $data['rows'] = $areaScholarity;
     if (!empty($data['rows'])) {
         $pie = array('series' => array(), 'labels' => array());
         $column = array('series' => array(), 'labels' => array(), 'names' => array());
         $man = array();
         $woman = array();
         $view = Zend_Layout::getMvcInstance()->getView();
         foreach ($data['rows'] as $area => $row) {
             $area = App_General_String::addBreakLine($view->truncate(ucfirst(strtolower($area)), 20), 1);
             $pie['series'][] = $row['total'];
             $pie['labels'][] = $area;
             $man[] = $row['MANE'];
             $woman[] = $row['FETO'];
             $column['labels'][] = $area;
         }
         $column['series'] = array($man, $woman);
         $column['names'] = array('MANE', 'FETO');
         $scaleConfig = array('LabelRotation' => 90, 'XMargin' => 20);
         $data['graph'][App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Graduadu liu husi Area / Seksu', $scaleConfig);
     }
     return $data;
 }
Example #2
0
 /**
  *
  * @return array
  */
 public function visitPurposeReport()
 {
     $dbPerData = App_Model_DbTable_Factory::get('PerData');
     $dbPerVisitPurpose = App_Model_DbTable_Factory::get('PerVisitPurpose');
     $dbVisitPurpose = App_Model_DbTable_Factory::get('VisitPurpose');
     $select = $dbPerData->select()->setIntegrityCheck(false)->from(array('c' => $dbPerData), array('gender'))->join(array('pvp' => $dbPerVisitPurpose), 'pvp.fk_id_perdata = c.id_perdata', array())->join(array('vp' => $dbVisitPurpose), 'vp.id_visitpurpose = pvp.fk_id_visitpurpose', array('purpose'));
     $filters = $this->_data;
     $date = new Zend_Date();
     if (!empty($filters['date_start'])) {
         $select->where('pvp.visit_date >= ?', $date->set($filters['date_start'])->toString('yyyy-MM-dd'));
     }
     if (!empty($filters['date_finish'])) {
         $select->where('pvp.visit_date <= ?', $date->set($filters['date_finish'])->toString('yyyy-MM-dd'));
     }
     if (!empty($filters['fk_id_dec'])) {
         $select->where('c.fk_id_dec = ?', $filters['fk_id_dec']);
     }
     $rows = $dbPerData->fetchAll($select);
     $data = $this->visitPurpose($rows);
     $column = array('series' => array(), 'labels' => array(), 'names' => array());
     $man = array();
     $woman = array();
     $view = Zend_Layout::getMvcInstance()->getView();
     foreach ($data['rows'] as $row) {
         $man[] = $row['total_man'];
         $woman[] = $row['total_woman'];
         $column['labels'][] = App_General_String::addBreakLine($view->truncate($row['purpose']), 2);
     }
     $column['series'] = array($man, $woman);
     $column['names'] = array('MANE', 'FETO');
     $data['graph'][App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Kliente husi Distritu');
     return $data;
 }
Example #3
0
 /**
  *
  * @return array 
  */
 public function youthIndicatorReport()
 {
     $data = array();
     $data += $this->youthJobSearch();
     $data += $this->youthJobPlacement();
     $data += $this->youthFormation();
     $this->_graphs = array();
     // Graph Youth Seek Job Level School
     if (!empty($data['school'])) {
         $man = array();
         $woman = array();
         foreach ($data['school']['rows'] as $school => $row) {
             $man[] = $row['MANE'];
             $woman[] = $row['FETO'];
             $column['labels'][] = App_General_String::addBreakLine($school, 1);
         }
         $column['series'] = array($man, $woman);
         $column['names'] = array('MANE', 'FETO');
         $scaleConfig = array('LabelRotation' => 90);
         $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Buka Servisu Nivel Eskola', $scaleConfig);
     }
     // Graph Youth Seek Job District
     if (!empty($data['district'])) {
         $man = array();
         $woman = array();
         foreach ($data['district']['rows'] as $district => $row) {
             $man[] = $row['MANE'];
             $woman[] = $row['FETO'];
             $column['labels'][] = App_General_String::addBreakLine($district, 1);
         }
         $column['series'] = array($man, $woman);
         $column['names'] = array('MANE', 'FETO');
         $scaleConfig = array('LabelRotation' => 90);
         $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Buka Servisu Distrito', $scaleConfig);
     }
     // Graph Youth Got Job Level School
     if (!empty($data['school_job'])) {
         $man = array();
         $woman = array();
         foreach ($data['school_job']['rows'] as $school => $row) {
             $man[] = $row['MANE'];
             $woman[] = $row['FETO'];
             $column['labels'][] = App_General_String::addBreakLine($school, 1);
         }
         $column['series'] = array($man, $woman);
         $column['names'] = array('MANE', 'FETO');
         $scaleConfig = array('LabelRotation' => 90);
         $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Hetan Servisu Nivel Eskola', $scaleConfig);
     }
     // Graph Youth Got Job District
     if (!empty($data['district_job'])) {
         $man = array();
         $woman = array();
         foreach ($data['district_job']['rows'] as $district => $row) {
             $man[] = $row['MANE'];
             $woman[] = $row['FETO'];
             $column['labels'][] = App_General_String::addBreakLine($district, 1);
         }
         $column['series'] = array($man, $woman);
         $column['names'] = array('MANE', 'FETO');
         $scaleConfig = array('LabelRotation' => 90);
         $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Hetan Servisu Distrito', $scaleConfig);
     }
     // Graph Youth Got Job Occupation
     if (!empty($data['occupation'])) {
         $column = array('series' => array(), 'labels' => array(), 'names' => array());
         $man = array();
         $woman = array();
         $view = Zend_Layout::getMvcInstance()->getView();
         foreach ($data['occupation']['rows'] as $ocupation => $row) {
             $man[] = $row['MANE'];
             $woman[] = $row['FETO'];
             $column['labels'][] = App_General_String::addBreakLine($view->truncate(ucfirst(strtolower($ocupation)), 15), 1);
         }
         $column['series'] = array($man, $woman);
         $column['names'] = array('MANE', 'FETO');
         $scaleConfig = array('LabelRotation' => 90);
         $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Hetan Servisu Okupasaun', $scaleConfig);
     }
     if (!empty($data['sector'])) {
         $column = array('series' => array(), 'labels' => array(), 'names' => array());
         $man = array();
         $woman = array();
         $view = Zend_Layout::getMvcInstance()->getView();
         foreach ($data['sector']['rows'] as $sector => $row) {
             $man[] = $row['MANE'];
             $woman[] = $row['FETO'];
             $column['labels'][] = App_General_String::addBreakLine($view->truncate(ucfirst(strtolower($sector)), 20), 1);
         }
         $column['series'] = array($man, $woman);
         $column['names'] = array('MANE', 'FETO');
         $scaleConfig = array('LabelRotation' => 90);
         $this->_graphs[App_General_String::randomHash()] = App_Util_Chart::columnChart($column, 'Hetan Servisu Sektor Industria', $scaleConfig);
     }
     $data['graph'] = $this->_graphs;
     return $data;
 }