protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $this->createContextInstance();
     $c1 = new Criteria();
     $career_school_year = CareerSchoolYearPeer::retrieveBySchoolYear();
     $c1->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year[0]->getId());
     $c1->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::LAST_YEAR_REPPROVED);
     $students_career_school_year = StudentCareerSchoolYearPeer::doSelectJoinCareerSchoolYear($c1);
     foreach ($students_career_school_year as $student_career_school_year) {
         $this->logSection('STUDENT CAREER SCHOOL YEAR ID', $student_career_school_year->getId());
         $previous_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($student_career_school_year->getCareerSchoolYear()->getSchoolYear());
         if (is_null($previous_school_year)) {
             $this->logSection('action', 'continue');
             continue;
         }
         $c = new Criteria();
         $c->add(StudentCareerSchoolYearPeer::STUDENT_ID, $student_career_school_year->getStudent()->getId());
         $c->addJoin(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID, Criteria::INNER_JOIN);
         $c->addJoin(CareerSchoolYearPeer::CAREER_ID, CareerPeer::ID, Criteria::INNER_JOIN);
         $c->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $previous_school_year->getId());
         $c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::APPROVED);
         if (StudentCareerSchoolYearPeer::doCount($c)) {
             $this->logSection('action', 'fix');
             $student_career_school_year->setStatus(StudentCareerSchoolYearStatus::IN_COURSE);
             $student_career_school_year->save();
         }
     }
 }
 public function save()
 {
     $origin_career_school_year = CareerSchoolYearPeer::retrieveByPk($this->getValue('career_school_year_id'));
     $destiny_career_school_year = CareerSchoolYearPeer::retrieveByPk($this->getOption('destiny_career_id'));
     $last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear(SchoolYearPeer::retrieveCurrent());
     $students = CareerStudentPeer::retrieveLastYearCareerGraduatedStudents($origin_career_school_year);
     $con = Propel::getConnection();
     try {
         $con->beginTransaction();
         foreach ($students as $student) {
             $student->registerToCareer($destiny_career_school_year->getCareer(), null, null, $destiny_career_school_year->getCareer()->getMinYear(), $con);
             $shift = $student->getShiftForSchoolYear($last_year_school_year);
             if (!$student->getIsRegistered($destiny_career_school_year->getSchoolYear())) {
                 $student->registerToSchoolYear($destiny_career_school_year->getSchoolYear(), $shift, $con);
             }
         }
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
예제 #3
0
 *
 * This file is part of Kimkëlen.
 *
 * Kimkëlen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v2.0 as published by
 * the Free Software Foundation.
 *
 * Kimkëlen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimkëlen.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
 */
$examination_repproveds = $student->getStudentRepprovedCourseSubjectForSchoolYear(SchoolYearPeer::retrieveLastYearSchoolYear($division->getCareerSchoolYear()->getSchoolYear()));
$has_to_show_repproveds = SchoolBehaviourFactory::getInstance()->showReportCardRepproveds() && !empty($examination_repproveds) && $student->checkIfRepprovedAreNotApproved($examination_repproveds);
?>
<div class="colsleft">
  <?php 
if ($division->hasCourseType(CourseType::TRIMESTER)) {
    ?>
    <?php 
    $periods = CareerSchoolYearPeriodPeer::getTrimesterPeriodsSchoolYear($division->getCareerSchoolYearId());
    ?>
    <?php 
    if ($division->hasAttendanceForDay()) {
        ?>
      <?php 
        include_partial('trimester_attendance_for_day', array('student' => $student, 'periods' => $periods, 'division' => $division, 'has_to_show_repproveds' => $has_to_show_repproveds));
        ?>
예제 #4
0
 public function getLastYearCareerSubjectSchoolYear()
 {
     $last_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->getSchoolYear());
     $last_year_career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByCareerSubjectAndSchoolYear($this->getCareerSubject(), $last_school_year);
     return $last_year_career_subject_school_year;
 }
 public static function retrieveLastYearStudentNotGraduatedCriteria($career_school_year)
 {
     $school_year = SchoolYearPeer::retrieveLastYearSchoolYear($career_school_year->getSchoolYear());
     $c = new Criteria();
     $c->addJoin(StudentPeer::ID, CareerStudentPeer::STUDENT_ID, Criteria::INNER_JOIN);
     $c->addAnd(CareerStudentPeer::STATUS, CareerStudentStatus::GRADUATE, criteria::NOT_EQUAL);
     $c->addAnd(CareerStudentPeer::CAREER_ID, $career_school_year->getCareer()->getId());
     $c->addAnd(StudentPeer::ID, SchoolYearStudentPeer::retrieveStudentIdsForSchoolYear($school_year), Criteria::IN);
     return $c;
 }
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $this->createContextInstance();
     $username = '******';
     $user = sfContext::getInstance()->getUser();
     $sf_user = sfGuardUserPeer::retrieveByUsername($username);
     $user->signin($sf_user, false);
     $new_career_school_year_2014 = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear(CareerPeer::retrieveByPK(8), SchoolYearPeer::retrieveCurrent());
     $old_career_school_year_2013 = CareerSchoolYearPeer::retrieveByPk(21);
     $new_career_school_year_2013 = CareerSchoolYearPeer::retrieveByPk(22);
     $old_career_school_year_2014 = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear(CareerPeer::retrieveByPK(4), SchoolYearPeer::retrieveCurrent());
     $last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear(SchoolYearPeer::retrieveCurrent());
     // ---------------------------------------------------------------------------------------------- //
     // Alumnos que promueven 6to deben seguir en el plan viejo
     $this->log('1 -Alumnos que promueven 6to deben seguir en el plan viejo');
     $c = new Criteria();
     $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $old_career_school_year_2013->getId());
     $c->add(StudentCareerSchoolYearPeer::IS_PROCESSED, true);
     $c->add(StudentCareerSchoolYearPeer::YEAR, 6);
     $c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::APPROVED);
     $students_to_old_career_school_years = StudentCareerSchoolYearPeer::doSelect($c);
     try {
         $connection->beginTransaction();
         foreach ($students_to_old_career_school_years as $socsy) {
             $shift = $socsy->getStudent()->getShiftForSchoolYear($last_year_school_year);
             if (!$socsy->getStudent()->getIsRegistered($old_career_school_year_2014->getSchoolYear())) {
                 $socsy->getStudent()->registerToSchoolYear($old_career_school_year_2014->getSchoolYear(), $shift, $connection);
             }
         }
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
     // ---------------------------------------------------------------------------------------------- //
     // 2 - Resto de los alumnos que no son del CBFE van al plan nuevo en el año que les corresponda
     $this->log('2 - Resto de los alumnos que no son del CBFE van al plan nuevo en el año que les corresponda');
     try {
         $connection->beginTransaction();
         // con este criteria voy a excluir a los que aprueban 6to y deben ir a 7mo del plan viejo
         $c = new Criteria();
         $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $old_career_school_year_2013->getId());
         $c->add(StudentCareerSchoolYearPeer::IS_PROCESSED, true);
         $c->add(StudentCareerSchoolYearPeer::YEAR, 6);
         $c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::APPROVED);
         $c->clearSelectColumns();
         $c->addSelectColumn(StudentCareerSchoolYearPeer::STUDENT_ID);
         $stmt = StudentCareerSchoolYearPeer::doSelectStmt($c);
         $students_to_old_career_school_years_ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
         // con este criteria voy a excluir a los que son del CBFE
         $c = new Criteria();
         $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, 23);
         $c->add(StudentCareerSchoolYearPeer::IS_PROCESSED, true);
         $c->clearSelectColumns();
         $c->addSelectColumn(StudentCareerSchoolYearPeer::STUDENT_ID);
         $stmt = StudentCareerSchoolYearPeer::doSelectStmt($c);
         $student_cbfe_ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
         // al total le saco $students_to_old_career_school_years_ids y los
         // student_cbfe_ids
         $c = new Criteria();
         //$c = StudentCareerSchoolYearPeer::retrieveLastYearStudentNotGraduatedCriteria($new_career_school_year_2014);
         $c->add(StudentCareerSchoolYearPeer::YEAR, 7, Criteria::NOT_EQUAL);
         $c->addJoin(StudentCareerSchoolYearPeer::STUDENT_ID, StudentPeer::ID, Criteria::INNER_JOIN);
         $c->add(StudentPeer::ID, array_merge($students_to_old_career_school_years_ids, $student_cbfe_ids), Criteria::NOT_IN);
         $students = StudentPeer::doSelectActive($c);
         foreach ($students as $student) {
             $shift = $student->getShiftForSchoolYear($last_year_school_year);
             if (!$student->getIsRegistered($new_career_school_year_2014->getSchoolYear()) && $shift) {
                 $slcsy = $student->getLastStudentCareerSchoolYear();
                 $slcs = $student->getLastCareerStudent();
                 if ($slcsy->getStatus() == StudentCareerSchoolYearStatus::APPROVED) {
                     $start_year = $slcsy->getYear() + 1;
                 } else {
                     $start_year = $slcsy->getYear();
                 }
                 if ($slcs->getCareerId() != $new_career_school_year_2014->getCareerId()) {
                     $student->registerToCareer($new_career_school_year_2014->getCareer(), null, null, $start_year, $connection);
                     $sys = new SchoolYearStudent();
                     $sys->setStudentId($student->getId());
                     $sys->setSchoolYearId($new_career_school_year_2014->getSchoolYear()->getId());
                     $sys->setShift($shift);
                     $sys->save($connection);
                     $this->verify($student, $new_career_school_year_2014, $connection);
                 } else {
                     $sys = new SchoolYearStudent();
                     $sys->setStudentId($student->getId());
                     $sys->setSchoolYearId($new_career_school_year_2014->getSchoolYear()->getId());
                     $sys->setShift($shift);
                     $sys->save($connection);
                     $this->verify($student, $new_career_school_year_2014, $connection);
                 }
                 if (!is_null($shift)) {
                     $shift->clearAllReferences(true);
                 }
                 $student->clearAllReferences(true);
                 unset($student);
                 unset($shift);
             }
             StudentPeer::clearInstancePool();
             unset($students);
         }
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
 }
예제 #7
0
 public function addStatusColumnCriteria(Criteria $criteria, $field, $values)
 {
     $criteria->addJoin(StudentCareerSchoolYearPeer::STUDENT_ID, StudentPeer::ID);
     //si $values es Repetidor del año pasado pero cursando año lectivo actual
     if ($values == StudentCareerSchoolYearStatus::LAST_YEAR_REPPROVED) {
         //chequea que en el año anterior tenga estado REPPROVED y para este año tenga matricula
         $current_school_year = SchoolYearPeer::retrieveCurrent();
         $school_year = SchoolYearPeer::retrieveLastYearSchoolYear($current_school_year);
         $criteria->addJoin(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID);
         $criteria->addJoin(SchoolYearStudentPeer::STUDENT_ID, StudentPeer::ID);
         $criteria->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $school_year->getId());
         $criteria->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::REPPROVED);
         $criteria->add(SchoolYearStudentPeer::SCHOOL_YEAR_ID, $current_school_year->getId());
     } else {
         $criteria->add(StudentCareerSchoolYearPeer::STATUS, $values);
     }
 }
예제 #8
0
 public static function retrieveLastYearCareerGraduatedStudents($career_school_year)
 {
     $last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear(SchoolYearPeer::retrieveCurrent());
     $c = new Criteria();
     $c->addJoin(self::STUDENT_ID, StudentPeer::ID, Criteria::INNER_JOIN);
     $c->add(self::STATUS, CareerStudentStatus::GRADUATE);
     $c->add(self::GRADUATION_SCHOOL_YEAR_ID, $last_year_school_year->getId());
     $c->add(self::CAREER_ID, $career_school_year->getCareer()->getId());
     return StudentPeer::doSelect($c);
 }
예제 #9
0
 public function createOrCopyLastYearSubjectConfiguration($career, PropelPDO $con = null)
 {
     $last_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this);
     $last_year_career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear($career, $last_school_year);
     if (is_null($last_year_career_school_year)) {
         $subject_configuration = new SubjectConfiguration();
     } else {
         $subject_configuration = $last_year_career_school_year->getSubjectConfiguration()->copy();
     }
     $subject_configuration->save($con);
     return $subject_configuration;
 }
예제 #10
0
 public function getMessageCantMatriculateGraduatedFromOtherCareer()
 {
     $last_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->getSchoolYear());
     if ($last_school_year && !$last_school_year->getIsClosed()) {
         return 'Last year school year is still open';
     } elseif (!$last_school_year) {
         return 'No previous school year';
     } else {
         return 'School has only one career';
     }
 }
 * Kimkëlen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v2.0 as published by
 * the Free Software Foundation.
 *
 * Kimkëlen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimkëlen.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
 */
use_helper('Javascript', 'Object', 'I18N', 'Form');
use_stylesheet('/sfPropelRevisitedGeneratorPlugin/css/global.css');
use_stylesheet('/sfPropelRevisitedGeneratorPlugin/css/extended.css');
$last_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($career_school_year->getSchoolYear());
?>
<div id="sf_admin_container">
  <h1><?php 
echo __('Matricular egresados de otra carrera en %career_school_year%', array('%career_school_year%' => $career_school_year->__toString()));
?>
</h1>

  <h2>Esta acción efectúa la matriculación de alumnos que egresaron de una carrera de la institución y deben articular con el principio de otra carrera.</h2>
  <h3>Se tomará a todos los egresados <?php 
echo $last_school_year;
?>
 de la carrera que elija a continuación y los matriculará en el año inicial de <?php 
echo $career_school_year;
?>
</h3>
 protected function doSave($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (is_null($con)) {
         $con = $this->getConnection();
     }
     // Delete only the subjects off the selected career
     $c = new Criteria();
     $c->add(StudentCareerSubjectAllowedPeer::STUDENT_ID, $this->object->getPrimaryKey());
     // added:
     $subc = new Criteria();
     $subc->clearSelectColumns();
     $subc->addSelectColumn(CareerSubjectPeer::ID);
     $subc->add(CareerSubjectPeer::CAREER_ID, $this->getValue("career_id"));
     $stmt = CareerSubjectPeer::doSelectStmt($subc);
     $ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
     $c->add(StudentCareerSubjectAllowedPeer::CAREER_SUBJECT_ID, $ids, Criteria::IN);
     $allowed = StudentCareerSubjectAllowedPeer::doSelectOne($c, $con);
     if ($allowed) {
         // Se consulta si el alumno esta en trayectorias antes de eliminarlo
         $student_id = $this->object->getPrimaryKey();
         $criteria = new Criteria();
         $criteria->add(PathwayStudentPeer::STUDENT_ID, $student_id);
         $pathway = PathwayStudentPeer::doSelectOne($criteria, $con);
         if (!$pathway) {
             StudentCareerSubjectAllowedPeer::doDelete($c, $con);
         }
     }
     $year = $this->getValue('year');
     $career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear(CareerPeer::retrieveByPK($this->getValue('career_id')), SchoolYearPeer::retrieveCurrent());
     //First update the year at student_career_school_year
     //    var_dump($career_school_year);die();
     $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($this->getObject(), $career_school_year);
     //    if (!$student_career_school_year)
     //    {
     //      $student_career_school_year = new StudentCareerSchoolYear();
     //      $student_career_school_year->setCareerSchoolYear($career_school_year);
     //      $student_career_school_year->setStudent($this->getObject());
     //      $student_career_school_year->save();
     //    }
     $career_student = CareerStudentPeer::retrieveByCareerAndStudent($this->getValue('career_id'), $this->getObject()->getId());
     try {
         $con->beginTransaction();
         $student_career_school_year->setYear($year);
         $student_career_school_year->save($con);
         $c = new Criteria();
         $c->add(CareerSubjectPeer::CAREER_ID, $this->getValue('career_id'));
         $c->add(CareerSubjectPeer::YEAR, $year);
         foreach (CareerSubjectPeer::doSelect($c) as $career_subject) {
             $obj = new StudentCareerSubjectAllowed();
             $obj->setStudentId($this->object->getPrimaryKey());
             $obj->setCareerSubject($career_subject);
             $obj->save($con);
         }
         $prev_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($career_school_year->getSchoolYear());
         if ($prev_school_year) {
             $prev_student_career_school_year = StudentCareerSchoolYearPeer::retrieveCareerSchoolYearForStudentAndYear($this->getObject(), $prev_school_year);
         }
         if (!empty($prev_student_career_school_year)) {
             $prev_student_career_school_year = array_shift($prev_student_career_school_year);
             if ($year <= $prev_student_career_school_year->getYear()) {
                 $prev_student_career_school_year->setStatus(StudentCareerSchoolYearStatus::REPPROVED);
                 $prev_student_career_school_year->save($con);
             }
         }
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
예제 #13
0
 /**
  * Returns if the student is inscripted in pathway program for current school year
  *
  * @return boolean
  */
 public function getBelongsToPathway()
 {
     if (SchoolYearPeer::retrieveLastYearSchoolYear(SchoolYearPeer::retrieveCurrent())) {
         $c = new Criteria();
         $c->add(PathwayStudentPeer::STUDENT_ID, $this->getId());
         $c->addJoin(PathwayPeer::ID, PathwayStudentPeer::PATHWAY_ID, Criteria::INNER_JOIN);
         $c->add(PathwayPeer::SCHOOL_YEAR_ID, SchoolYearPeer::retrieveLastYearSchoolYear(SchoolYearPeer::retrieveCurrent())->getId());
         $flag = $this->countPathwayStudents($c) > 0;
     } else {
         $flag = false;
     }
     return $flag;
 }
예제 #14
0
 private function generateGeneralReports($career_school_years)
 {
     $student_reports_by_career = array();
     $filters = array('school_year' => $this->school_year->getId());
     $student_reports = array($this->generateReportArray('Estudiantes matriculados', $this->school_year->countSchoolYearStudents(null, false), $filters));
     if (!is_null($last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->school_year))) {
         $total = bcsub($this->school_year->countSchoolYearStudents(null, true), $last_year_school_year->countSchoolYearStudents(), 0);
         $filters['is_entrant'] = true;
         $student_reports[] = $this->generateReportArray('Ingresantes con respecto al año lectivo anterior', $total, $filters);
     }
     $filters = array('school_year' => $this->school_year->getId(), 'has_disciplinary_sanctions' => true);
     $disciplinary_sanctions = StudentDisciplinarySanctionPeer::countStudentDisciplinarySanctionsForSchoolYear($this->school_year);
     $student_reports[] = $this->generateReportArray('Estudiantes con sanciones disciplinarias', $disciplinary_sanctions, $filters);
     $student_reports_by_career['For school year'] = $student_reports;
     foreach ($career_school_years as $csy) {
         $student_reports = array();
         $filters = array('career_school_year' => $csy->getId());
         $student_reports[] = $this->generateReportArray('Estudiantes inscriptos', $csy->countStudentCareerSchoolYears(null, true), $filters);
         //Total  no inscriptos en la carrera
         $not_inscripted_in_csy = $csy->countNotMatriculatedStudents();
         if ($not_inscripted_in_csy < 0) {
             $not_inscripted_in_csy = 0;
         }
         $student_reports[] = $this->generateReportArray('Estudiantes no inscriptos', $not_inscripted_in_csy, null);
         //Total graduated students for career
         $filters['is_graduated'] = true;
         $student_reports[] = $this->generateReportArray('Estudiantes graduados', CareerStudentPeer::doCountGraduatedForCareerSchoolYear($csy), $filters);
         $student_reports_by_career['Carrera: ' . $csy->getCareer()->getCareerName()] = $student_reports;
     }
     return $student_reports_by_career;
 }