public function configureStudents()
 {
     $this->year = $this->getDefault('year');
     $this->division_id = $this->getDefault('division_id');
     $this->course_subject_id = $this->getDefault('course_subject_id') == '' || $this->getDefault('course_subject_id') === null ? null : $this->getDefault('course_subject_id');
     $this->division = DivisionPeer::retrieveByPK($this->division_id);
     $this->course_subject = CourseSubjectPeer::retrieveByPK($this->course_subject_id);
     $this->career_school_year_id = $this->getDefault('career_school_year_id');
     $this->configureDays();
     $sf_user = sfContext::getInstance()->getUser();
     //$this->students = StudentPeer::getStudentsForAttendance($sf_user, $this->division_id, $this->course_subject_id, $this->career_school_year_id);
     $this->students = $this->getStudents();
     $days_disabled = array();
     foreach ($this->students as $student) {
         $name = 'student_name_' . $student->getId();
         $this->setWidget($name, new mtWidgetFormPlain(array('object' => $student)));
         $this->setValidator($name, new sfValidatorPass());
         foreach ($this->days as $day => $day_i) {
             if (!isset($days_disabled[$day])) {
                 $days_disabled[$day] = true;
             }
             $name = 'student_attendance_' . $student->getId() . '_' . $day;
             $this->setAbsenceWidget($name);
             $student_attendance = StudentAttendancePeer::retrieveByDateAndStudent($day_i, $student, $this->course_subject_id, $this->career_school_year_id);
             if (!is_null($student_attendance)) {
                 $this->setAttendanceDefault($name, $student_attendance);
                 $days_disabled[$day] = false;
             }
         }
     }
     $this->configureDaysWidget($days_disabled);
     return $days_disabled;
 }
Пример #2
0
 public function executeMostrar()
 {
     // Inicializar variables
     $optionsConcepto = array();
     $optionsPeriodo = array();
     $optionsActividad = array();
     $alumno = "";
     $division = "";
     $alumno_id = "";
     $division_id = "";
     $notaAlumno = array();
     $conceptoAlumno = array();
     $aAsistencia = array();
     $alumno_id = $this->alumno_id;
     $division_id = $this->division_id;
     $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id');
     $no_cargar = 0;
     if ($alumno_id) {
         $alumno = AlumnoPeer::retrieveByPK($alumno_id);
         if (!$division_id) {
             $c = new Criteria();
             $c->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $alumno_id);
             $ad = RelAlumnoDivisionPeer::doSelectOne($c);
             if ($ad) {
                 $division_id = $ad->getFkDivisionId();
             } else {
                 $no_cargar = 1;
             }
         }
         if ($no_cargar == 0) {
             $division = DivisionPeer::retrieveByPK($division_id);
             $optionsActividad = $division->getActividadesArray();
             $e = EstablecimientoPeer::retrieveByPk($establecimiento_id);
             $optionsConcepto = $e->getConceptosArray();
             $notaAlumno = $alumno->getNotas($this->getUser()->getAttribute('fk_ciclolectivo_id'));
             $conceptoAlumno = $alumno->getNotasConcepto();
             $c = CiclolectivoPeer::retrieveByPk($this->getUser()->getAttribute('fk_ciclolectivo_id'));
             $optionsPeriodo = $c->getPeriodosArray();
             $aAsistencia = $alumno->getAsistenciasPorCiclolectivo($this->getUser()->getAttribute('fk_ciclolectivo_id'));
         } else {
             $this->getUser()->setFlash('notice', 'Error: el alumno no esta en ninguna división');
         }
     } else {
         $this->getUser()->setFlash('notice', 'Error: no envio el alumno');
     }
     // variables al template
     $this->establecimiento = EstablecimientoPeer::retrieveByPk($establecimiento_id);
     $this->optionsPeriodo = $optionsPeriodo;
     $this->optionsActividad = $optionsActividad;
     $this->cantOptionsActividad = count($optionsActividad);
     $this->alumno = $alumno;
     $this->division = $division;
     $this->optionsConcepto = $optionsConcepto;
     $this->cantOptionsConcepto = count($optionsConcepto);
     $this->notaAlumno = $notaAlumno;
     $this->conceptoAlumno = $conceptoAlumno;
     $this->aAsistencia = $aAsistencia;
     $this->cantOptionsAsistencia = count($aAsistencia) > 0 ? count(current($aAsistencia)) : 0;
 }
 public function postValidateDestinyDivision(sfValidatorBase $validator, $values)
 {
     $origin_division = $this->getOption('division');
     $destiny_division = DivisionPeer::retrieveByPK($values['destiny_division_id']);
     $destiny_cssy_ids = array();
     foreach ($destiny_division->getCourses() as $destiny_course) {
         $destiny_cssy_ids[] = $destiny_course->getCourseSubject()->getCareerSubjectSchoolYearId();
     }
     foreach ($origin_division->getCourses() as $origin_course) {
         if (!in_array($origin_course->getCourseSubject()->getCareerSubjectSchoolYearId(), $destiny_cssy_ids)) {
             $error = new sfValidatorError($validator, 'No es posible mover el/los alumno/s ya que las divisiones origen y destino elegidas difieren en sus cursos');
             throw new sfValidatorErrorSchema($validator, array('destiny_division_id' => $error));
         }
     }
     return $values;
 }
Пример #4
0
 public function executeSubsetReportCardsToPDF(sfWebRequest $request)
 {
     ini_set('max_execution_time', '10000');
     $this->division = DivisionPeer::retrieveByPK($this->getUser()->getReferenceFor('division'));
     if (is_null($this->division)) {
         $this->division = DivisionPeer::retrieveByPk($this->getUser()->getAttribute('division_id'));
     }
     if ($request->getParameter('all_approved')) {
         $this->students = $this->division->getStudentsWithAllSubjectsApproved();
     } else {
         $this->students = $this->division->getStudentsWithDisapprovedSubjects();
     }
     $this->career_id = $this->division->getCareer()->getId();
     $this->setLayout('cleanLayout');
     $this->setTemplate('index');
 }
Пример #5
0
 public function executePrintAttendanceTemplate(sfWebRequest $request)
 {
     $this->month = $request->getParameter('month');
     $this->url = $request->getParameter('url');
     $this->id = $request->getParameter('id');
     $this->nextMonth = $this->month < 12 ? $this->month + 1 : 1;
     $this->prevMonth = $this->month > 1 ? $this->month - 1 : 12;
     $this->monthName = date("F", mktime(0, 0, 0, $this->month, 1, 2015));
     if ($this->url == "division") {
         $this->division_id = $request->getParameter('division_id');
         $this->division = DivisionPeer::retrieveByPK($this->id);
         $this->students = $this->division->getStudents();
         $this->days = $this->getDaysOfMonth($this->month);
         $this->course_subject = null;
     } elseif ($this->url == "commission") {
         $this->course_subject = CourseSubjectPeer::retrieveByPK($this->id);
         $this->students = $this->course_subject->getStudents();
         $this->days = $this->getDaysOfMonth($this->month);
     }
     $this->setLayout('cleanLayout');
 }
Пример #6
0
 public function executeAlumnosPorDivisionListado()
 {
     // inicializando variables
     $aAlumno = array();
     // tomando los datos del formulario
     $division_id = $this->getRequestParameter('division_id');
     // buscando division
     $division = DivisionPeer::retrieveByPK($division_id);
     // buscando alumnos
     $criteria = new Criteria();
     $criteria->add(DivisionPeer::ID, $division_id);
     $criteria->addJoin(RelAlumnoDivisionPeer::FK_ALUMNO_ID, AlumnoPeer::ID);
     $criteria->addJoin(RelAlumnoDivisionPeer::FK_DIVISION_ID, DivisionPeer::ID);
     $criteria->addAscendingOrderByColumn(AlumnoPeer::APELLIDO);
     $alumnos = AlumnoPeer::doSelect($criteria);
     // asignando variables para ser usadas en el template
     $this->aAlumno = $alumnos;
     $this->division = $division;
 }
Пример #7
0
        <th class="th_stats"><?php 
echo __('Division');
?>
</th>
        <?php 
if (!isset($filters['division']) || is_null($filters['division'])) {
    ?>
          <td class="td_stats"><?php 
    echo __('Not specified');
    ?>
</td>
        <?php 
} else {
    ?>
          <td><?php 
    echo DivisionPeer::retrieveByPK($filters['division']);
    ?>
</td>
        <?php 
}
?>
      </tr>
      <tr>
        <th class="th_stats"><?php 
echo __('Shift');
?>
</th>
        <?php 
if (!isset($filters['shift']) || is_null($filters['shift'])) {
    ?>
          <td class="td_stats"><?php 
Пример #8
0
 public function canDivisionAttendanceDayDivision($division)
 {
     if ($this->isPreceptor()) {
         if (sfContext::getInstance()->getRequest()->hasParameter('division_id')) {
             $division_id = sfContext::getInstance()->getRequest()->getParameter('division_id');
             $division = DivisionPeer::retrieveByPK($division_id);
         }
         $division->canBeEditedByPreceptorUser($this->getGuardUser());
     }
     return true;
 }
Пример #9
0
 public function executeCreateAllCourses(sfWebRequest $request)
 {
     $this->division = DivisionPeer::retrieveByPK($request->getParameter('id'));
     $this->division->createAllCourses();
     $this->redirect('@division_course');
 }
Пример #10
0
 public function executeHorarioSegunDivision()
 {
     // tomando los datos del formulario
     $division_id = $this->getRequestParameter('id');
     $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id');
     // trayendo datos necesarios
     $division = DivisionPeer::retrieveByPK($division_id);
     $aHoras = $this->getHorarioEscolar($establecimiento_id, $division->getFkTurnoId(), 1);
     $criteria = new Criteria();
     $criteria->add(RelDivisionActividadDocentePeer::FK_DIVISION_ID, $division_id);
     $aEvento = RelDivisionActividadDocentePeer::doSelect($criteria);
     list($this->view, $this->archivo, $this->date_component) = $this->getEventos($aEvento, "verPorSemana");
     // asignando variables para ser usadas en el template
     $this->division = $division;
 }
Пример #11
0
 public function getShiftFromStudentStatsFilters()
 {
     $user = sfContext::getInstance()->getUser();
     $filters = $user->getAttribute('student_stats.filters', null, 'admin_module');
     if (!isset($filters['shift']) || is_null($filters['shift'])) {
         if (!isset($filters['division']) || is_null($filters['division'])) {
             $result = array();
             if (!isset($filters['career_school_year']) || is_null($filters['career_school_year'])) {
                 foreach (DivisionPeer::retrieveStudentSchoolYearDivisions(SchoolYearPeer::retrieveByPK($filters['school_year']), $this) as $division) {
                     $result[$division->getShift()->getName()] = $division->getShift();
                 }
             } else {
                 $career_school_year_id = $filters['career_school_year'];
                 $divisions = $this->getCurrentDivisions($career_school_year_id);
                 foreach ($divisions as $division) {
                     $result[$division->getShift()->getName()] = $division->getShift()->getName();
                 }
             }
             return implode(', ', $result);
         } else {
             return DivisionPeer::retrieveByPK($filters['division'])->getShift();
         }
     } else {
         return ShiftPeer::retrieveByPK($filters['shift']);
     }
 }
Пример #12
0
 public function executeShowCourses(sfWebRequest $request)
 {
     $division = DivisionPeer::retrieveByPK($request->getParameter('id'));
     return $this->renderPartial('division_courses', array('division' => $division));
 }
Пример #13
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;
 }