/**
  * Returns the current student_career_school_year for the given student and career_school_year.
  *
  * @param Student $student
  * @param CareerSchoolYear $career_school_year
  * @return StudentCareerSchoolYear
  */
 public static function getCurrentForStudentAndCareerSchoolYear(Student $student, CareerSchoolYear $career_school_year)
 {
     $c = new Criteria();
     $c->add(self::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
     $c->add(self::STUDENT_ID, $student->getId());
     $c->addDescendingOrderByColumn(self::YEAR);
     return self::doSelectOne($c);
 }
Ejemplo n.º 2
0
 public static function retrieveComissionsForCareerSchoolYear(CareerSchoolYear $career_school_year)
 {
     $c = new Criteria();
     $c->addJoin(CoursePeer::ID, CourseSubjectPeer::COURSE_ID, Criteria::INNER_JOIN);
     $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID, Criteria::INNER_JOIN);
     $c->addJoin(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID, Criteria::INNER_JOIN);
     $c->add(CoursePeer::DIVISION_ID, null, Criteria::ISNULL);
     $c->add(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
     return self::doSelect($c);
 }
 public static function retrieveForStudentAndCareerSchoolYear(Student $student, CareerSchoolYear $career_school_year, PropelPDO $con = null)
 {
     $con = is_null($con) ? Propel::getConnection() : $con;
     $c = new Criteria();
     $c->addJoin(self::COURSE_SUBJECT_STUDENT_ID, CourseSubjectStudentPeer::ID);
     $c->add(CourseSubjectStudentPeer::STUDENT_ID, $student->getId());
     $c->addJoin(CourseSubjectStudentPeer::COURSE_SUBJECT_ID, CourseSubjectPeer::ID);
     $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID);
     $c->add(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
     return self::doSelect($c, $con);
 }
Ejemplo n.º 4
0
 public static function retrieveCriteriaByCareerSchoolYearAndStudent(CareerSchoolYear $career_school_year, Student $student, PropelPDO $con = null, $approved = false)
 {
     if (is_null($con)) {
         $con = Propel::getConnection();
     }
     $c = new Criteria();
     $c->add(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
     $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID);
     $c->addJoin(CourseSubjectPeer::ID, self::COURSE_SUBJECT_ID);
     $c->add(self::STUDENT_ID, $student->getId());
     if ($approved) {
         $c->add(self::STUDENT_APPROVED_COURSE_SUBJECT_ID, null, Criteria::ISNOTNULL);
     }
     $c->addGroupByColumn(self::COURSE_SUBJECT_ID);
     return $c;
 }
Ejemplo n.º 5
0
 public static function retrieveForCareerSchoolYearAndYear(CareerSchoolYear $career_school_year, $year)
 {
     $c = new Criteria();
     $c->addJoin(self::ID, StudentCareerSchoolYearPeer::STUDENT_ID);
     $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
     $c->add(StudentCareerSchoolYearPeer::YEAR, $year);
     return self::doSelect($c);
 }
Ejemplo n.º 6
0
 public function createCareerSchoolYear($career)
 {
     $con = Propel::getConnection(SchoolYearPeer::DATABASE_NAME);
     try {
         $con->beginTransaction();
         $career_school_year = new CareerSchoolYear();
         $career_school_year->setSchoolYear($this);
         $career_school_year->setCareer($career);
         $subject_configuration = $this->createOrCopyLastYearSubjectConfiguration($career, $con);
         $career_school_year->setSubjectConfiguration($subject_configuration);
         $career_school_year->save($con);
         foreach ($career->getCareerSubjects() as $career_subject) {
             $career_subject_school_year = new CareerSubjectSchoolYear();
             $career_subject_school_year->setCareerSchoolYear($career_school_year);
             $career_subject_school_year->setCareerSubject($career_subject);
             $career_subject_school_year->copyLastYearConfiguration();
             $career_subject_school_year->copyLastYearSort();
             $career_subject_school_year->save($con);
         }
         $con->commit();
     } catch (PropelPDOException $e) {
         $con->rollBack();
         throw $e;
     }
 }
Ejemplo n.º 7
0
 public function createStudentsForNextYear(PropelPDO $con = null, CareerSchoolYear $last_career_school_year)
 {
     //$old_division = DivisionPeer::retrieveByDivisionTitleAndYearAndSchoolYear($this->getDivisionTitle(), $this->getYear() - 1, $last_career_school_year);
     //$students = $old_division->getStudents();
     $c = new Criteria();
     $c->addJoin(StudentPeer::ID, DivisionStudentPeer::STUDENT_ID, Criteria::INNER_JOIN);
     $c->addJoin(DivisionStudentPeer::DIVISION_ID, DivisionPeer::ID, Criteria::INNER_JOIN);
     $c->addAnd(DivisionPeer::YEAR, $this->getYear() - 1);
     $c->addAnd(DivisionPeer::DIVISION_TITLE_ID, $this->getDivisionTitleId());
     $c->addAnd(DivisionPeer::CAREER_SCHOOL_YEAR_ID, $last_career_school_year->getId());
     $c->addAnd(StudentPeer::ID, SchoolYearStudentPeer::retrieveStudentIdsForSchoolYear($last_career_school_year->getSchoolYear()), Criteria::IN);
     $students = StudentPeer::doSelect($c);
     foreach ($students as $student) {
         $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $this->getCareerSchoolYear());
         StudentCareerSchoolYearPeer::clearInstancePool();
         //If the student has not repeated last year.
         if (!is_null($student_career_school_year) && !$student_career_school_year->getIsRepproved()) {
             $division_student = new DivisionStudent();
             $division_student->setStudent($student);
             $division_student->setDivision($this);
             $division_student->save($con);
             $division_student->clearAllReferences(true);
             unset($division_student);
             $student_career_school_year->clearAllReferences(true);
             unset($student_career_school_year);
         }
         $student->clearAllReferences(true);
         unset($student);
     }
     StudentPeer::clearInstancePool();
     unset($students);
 }
Ejemplo n.º 8
0
 public function createCopyForSchoolYear(PropelPDO $con = null, Division $division = null, CareerSchoolYear $career_school_year)
 {
     $copy_course = new Course();
     $copy_course->setDivision($division);
     $copy_course->setName($this->getName());
     $copy_course->setQuota($this->getQuota());
     $copy_course->setSchoolYear($career_school_year->getSchoolYear());
     $copy_course->save($con);
     $this->copyCourseSubjects($con, $division, $career_school_year, $copy_course);
     $copy_course->clearAllReferences(true);
     unset($copy_course);
     $this->clearAllReferences(true);
 }
Ejemplo n.º 9
0
 /**
  * This methods returns the year of the careerSchoolYear of the student.
  * @param CareerSchoolYear $career_school_year
  * @return integer
  */
 public function getCareerYear(CareerSchoolYear $career_school_year)
 {
     $c = new Criteria();
     $c->add(StudentCareerSchoolYearPeer::STUDENT_ID, $this->getId());
     $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
     $c->addDescendingOrderByColumn(StudentCareerSchoolYearPeer::YEAR);
     $scsy = StudentCareerSchoolYearPeer::doSelectOne($c);
     return is_null($scsy) ? 1 : $scsy->getYear();
 }