/**
  * 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);
 }
Exemplo 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);
 }
Exemplo 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;
 }
Exemplo 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);
 }
Exemplo n.º 6
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);
 }
Exemplo n.º 7
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();
 }