Exemple #1
0
 private function generateYearShiftDivisionReports($career_school_years, $year, $shift, $division)
 {
     $year_shift_division_reports_by_career = array();
     foreach ($career_school_years as $csy) {
         $reports = array();
         if ($division != "") {
             $division = DivisionPeer::retrieveByPK($division);
         }
         if ($shift == "") {
             foreach (ShiftPeer::doSelect(new Criteria()) as $s) {
                 $filters = array('shift' => $s->getId(), 'career_school_year' => $csy->getId());
                 if ($year == "") {
                     for ($y = 1; $y <= $csy->getCareer()->getQuantityYears(); $y++) {
                         $filters['year'] = $y;
                         if ($division == "") {
                             foreach (DivisionStudentPeer::doSelectForCareerSchoolYearShiftAndYear($csy, $s, $y) as $d) {
                                 $filters['division'] = $d->getId();
                                 $title = 'Estudiantes en el turno ' . strtolower($s) . ', año N°' . $y . ' de la carrera y división ' . $d;
                                 $reports[] = $this->generateReportArray($title, DivisionStudentPeer::doCountForCareerSchoolYearShiftYearAndDivision($csy, $s, $y, $d), $filters);
                             }
                         } else {
                             $filters['division'] = $division->getId();
                             $title = 'Estudiantes en el turno ' . strtolower($s) . ', año N°' . ' ' . $y . ' ' . ' de la carrera y división ' . ' ' . $division;
                             $reports[] = $this->generateReportArray($title, DivisionStudentPeer::doCountForCareerSchoolYearShiftYearAndDivision($csy, $s, $y, $division), $filters);
                         }
                     }
                 } else {
                     $filters['year'] = $year;
                     if ($division == "") {
                         foreach (DivisionStudentPeer::doSelectForCareerSchoolYearShiftAndYear($csy, $s, $year) as $d) {
                             $filters['division'] = $d->getId();
                             $title = 'Estudiantes en el turno ' . strtolower($s) . ', año N°' . $year . ' de la carrera y división ' . $d;
                             $reports[] = $this->generateReportArray($title, DivisionStudentPeer::doCountForCareerSchoolYearShiftYearAndDivision($csy, $s, $year, $d), $filters);
                         }
                     } else {
                         $filters['division'] = $division->getId();
                         $title = 'Estudiantes en el turno ' . strtolower($s) . ', año N°' . $year . ' de la carrera y división ' . $division;
                         $reports[] = $this->generateReportArray($title, DivisionStudentPeer::doCountForCareerSchoolYearShiftYearAndDivision($csy, $s, $year, $division), $filters);
                     }
                 }
             }
         } else {
             $shift = ShiftPeer::retrieveByPK($shift);
             $filters = array('shift' => $shift->getId(), 'year' => $year, 'division' => $division->getId(), 'career_school_year' => $csy->getId());
             $title = 'Estudiantes en el turno ' . strtolower($shift) . ', año N°' . $year . ' de la carrera y división ' . $division;
             $reports[] = $this->generateReportArray($title, DivisionStudentPeer::doCountForCareerSchoolYearShiftYearAndDivision($csy, $shift, $year, $division), $filters);
         }
         $year_shift_division_reports_by_career['Carrera: ' . $csy->getCareer()->getCareerName()] = $reports;
     }
     return $year_shift_division_reports_by_career;
 }