예제 #1
0
 public function getAvailableStudentsForCourseSubjectCriteria(CourseSubject $course_subject, $criteria = null, $filter_by_orientation = true)
 {
     if ($course_subject->getCareerSubjectSchoolYear()->getCareerSubject()->getIsOption() || $course_subject->getCareerSubjectSchoolYear()->getCareerSubject()->getHasOptions()) {
         $filter_by_orientation = false;
     }
     return parent::getAvailableStudentsForCourseSubjectCriteria($course_subject, $criteria, false);
 }
 public static function retrieveCriteriaForCourseSubjectAndExaminationNumber(CourseSubject $course_subject, $examination_number)
 {
     $c = new Criteria();
     $c->add(CourseSubjectStudentPeer::COURSE_SUBJECT_ID, $course_subject->getId());
     $c->addJoin(CourseSubjectStudentPeer::ID, self::COURSE_SUBJECT_STUDENT_ID);
     $c->add(self::EXAMINATION_NUMBER, $examination_number);
     $c->addJoin(self::EXAMINATION_SUBJECT_ID, ExaminationSubjectPeer::ID);
     $c->addJoin(ExaminationSubjectPeer::EXAMINATION_ID, ExaminationPeer::ID);
     return $c;
 }
 public static function setAvailableStudentsForCourse(CourseSubject $course_subject)
 {
     $course = $course_subject->getCourse();
     $school_year = $course->getSchoolYear();
     $pathways = $school_year->getPathways();
     $available_pathway_students = array();
     foreach ($pathways as $pathway) {
         $c = new Criteria();
         $c->addJoin(PathwayStudentPeer::STUDENT_ID, StudentCareerSubjectAllowedPathwayPeer::STUDENT_ID);
         $c->add(PathwayStudentPeer::PATHWAY_ID, $pathway->getId());
         $c->add(PathwayStudentPeer::YEAR, $course_subject->getYear());
         $c->add(StudentCareerSubjectAllowedPathwayPeer::CAREER_SUBJECT_ID, $course_subject->getCareerSubjectSchoolYear()->getCareerSubject()->getId());
         foreach (PathwayStudentPeer::doSelect($c) as $ps) {
             $available_pathway_students[] = $ps->getStudent();
         }
     }
     self::$_students = array_merge($course_subject->getPathwayStudents(), $available_pathway_students);
 }
예제 #4
0
 public function createCourseSubject($course, PropelPDO $con = null)
 {
     if ($this->hasChoices()) {
         foreach ($this->getChoices() as $choice) {
             $course_subject = new CourseSubject();
             $course_subject->setCourse($course);
             $course_subject->setCareerSubjectSchoolYear($choice->getCareerSubjectSchoolYearRelatedByChoiceCareerSubjectSchoolYearId());
             $course_subject->save($con);
         }
     } else {
         $course_subject = new CourseSubject();
         $course_subject->setCourse($course);
         $course_subject->setCareerSubjectSchoolYear($this);
         $course_subject->save($con);
         if ($course->getDivision()) {
             foreach ($course->getDivision()->getDivisionStudents() as $ds) {
                 $course_subject_student = new CourseSubjectStudent();
                 $course_subject_student->setCourseSubject($course_subject);
                 $course_subject_student->setStudent($ds->getStudent());
                 $course_subject_student->save($con);
             }
         }
     }
 }
 /**
  * This methods returns the students available four a course that have a Division
  *
  * @see getAvailableStudentsForCourseSubjectCriteria
  *
  * @param CourseSubject $course_subject
  * @param Criteria $criteria
  * @param Boolean $filter_by_orientation
  * @return Criteria
  */
 public function getAvailableStudentsForDivisionCourseSubjectCriteria(CourseSubject $course_subject, $criteria = null, $filter_by_orientation = true)
 {
     $criteria = is_null($criteria) ? new Criteria() : $criteria;
     if ($course_subject->getCourse()->getDivision()) {
         $c = new Criteria();
         $c->add(DivisionStudentPeer::DIVISION_ID, $course_subject->getCourse()->getDivisionId());
         $c->addJoin(StudentPeer::ID, DivisionStudentPeer::STUDENT_ID);
         $c->clearSelectColumns();
         $c->addSelectColumn(StudentPeer::ID);
         $stmt = StudentPeer::doSelectStmt($c);
         $in = $stmt->fetchAll(PDO::FETCH_COLUMN);
         $criteria->addAnd(StudentPeer::ID, $in, Criteria::IN);
     }
     return $this->getAvailableStudentsForCourseSubjectCriteria($course_subject, $criteria, $filter_by_orientation);
 }
 public static function setAvailableStudentsForCourse(CourseSubject $course_subject)
 {
     self::$_students = array_merge($course_subject->getStudents(), SchoolBehaviourFactory::getInstance()->getAvailableStudentsForDivisionCourseSubject($course_subject, new Criteria(), true));
 }
예제 #7
0
 public function doSaveCourseSubjects($con)
 {
     if (array_key_exists('course_subjects', $this->values)) {
         foreach ($this->getObject()->getCourseSubjects() as $course_subject) {
             $course_subject->delete($con);
         }
         foreach ($this->values['course_subjects'] as $career_subject_school_year_id) {
             $course_subject = new CourseSubject();
             $course_subject->setCourse($this->getObject());
             $course_subject->setCareerSubjectSchoolYearId($career_subject_school_year_id);
             $course_subject->save($con);
         }
     }
 }
예제 #8
0
파일: Course.php 프로젝트: nvidela/kimkelen
 public function copyCourseSubjects(PropelPDO $con = null, Division $division = null, CareerSchoolYear $career_school_year, $copy_course)
 {
     $course_subjects = $this->getCourseSubjects();
     foreach ($course_subjects as $course_subject) {
         $copy_course_subject = new CourseSubject();
         $copy_course_subject->setCourse($copy_course);
         $career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByCareerSubjectAndSchoolYear($course_subject->getCareerSubjectSchoolYear()->getCareerSubject(), $career_school_year->getSchoolYear());
         CareerSubjectSchoolYearPeer::clearInstancePool();
         $copy_course_subject->setCareerSubjectSchoolYear($career_subject_school_year);
         $copy_course_subject->save($con);
         $course_subject->copyTeachersToCourseSubject($con, $copy_course_subject);
         $course_subject->copyCourseSubjectDays($con, $copy_course_subject);
         $career_subject_school_year->clearAllReferences(true);
         unset($career_subject_school_year);
         $copy_course_subject->clearAllReferences(true);
         unset($copy_course_subject);
         $course_subject->clearAllReferences(true);
         unset($course_subject);
     }
     unset($course_subjects);
     $this->clearAllReferences(true);
 }
예제 #9
0
 public function getMarksForCourse(CourseSubject $course_subject)
 {
     $css = CourseSubjectStudentPeer::retrieveByCourseSubjectAndStudent($course_subject->getId(), $this->getId());
     if (!is_null($css)) {
         $cssm = CourseSubjectStudentMarkPeer::retrieveByCourseSubjectStudent($css->getId());
         return $cssm;
     }
     return NULL;
 }