public function save($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (is_null($con)) {
         $con = Propel::getConnection();
     }
     try {
         $con->beginTransaction();
         $values = $this->getValues();
         $school_year = SchoolYearPeer::retrieveByPK($values["school_year_id"]);
         $shift = ShiftPeer::retrieveByPK($values["shift_id"]);
         unset($values["school_year_id"]);
         unset($values["shift_id"]);
         foreach ($values as $student_id) {
             $student = StudentPeer::retrieveByPk($student_id);
             if (!$student->getIsRegistered($school_year)) {
                 $student->registerToSchoolYear($school_year, $shift, $con);
             }
         }
         $con->commit();
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
Ejemplo n.º 2
0
        <th class="th_stats"><?php 
echo __('Shift');
?>
</th>
        <?php 
if (!isset($filters['shift']) || is_null($filters['shift'])) {
    ?>
          <td class="td_stats"><?php 
    echo __('Not specified');
    ?>
</td>
        <?php 
} else {
    ?>
          <td><?php 
    echo ShiftPeer::retrieveByPK($filters['shift']);
    ?>
</td>
        <?php 
}
?>
      </tr>
      <tr>
        <th class="th_stats"><?php 
echo __('Is graduated');
?>
</th>
        <?php 
if (!isset($filters['is_graduated']) || is_null($filters['is_graduated'])) {
    ?>
          <td class="td_stats"><?php 
 public static function countStudentsNotInAnyDivisionForCareerSchoolYear($career_school_year, PropelPDO $con = null)
 {
     $c = new Criteria();
     $c->setDistinct();
     $c->add(self::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
     foreach (ShiftPeer::doSelect(new Criteria()) as $shift) {
         $ids = $shift->getStudentIdsFromDivisions(DivisionStudentPeer::doSelectDivisionsForCareerSchoolYearAndShift($career_school_year, $shift));
         $c->addAnd(self::STUDENT_ID, $ids, Criteria::NOT_IN);
     }
     return self::doCount($c, $con);
 }
Ejemplo n.º 4
0
      <tr>
        <th class="th_stats"><?php 
    echo __('Division');
    ?>
</th>
        <td><?php 
    echo DivisionPeer::retrieveByPk($division);
    ?>
</td>
      </tr>
    <?php 
}
?>
    <?php 
if ($shift != "") {
    ?>
      <tr>
        <th class="th_stats"><?php 
    echo __('Shift') . ' (de la división)';
    ?>
</th>
        <td><?php 
    echo ShiftPeer::retrieveByPk($shift);
    ?>
</td>
      </tr>
    <?php 
}
?>
  </tbody>
</table>
Ejemplo n.º 5
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']);
     }
 }
Ejemplo n.º 6
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;
 }