public function updateOptionalCareerSubject($widget, $value)
 {
     $school_year_id = array_shift($value);
     $criteria = new Criteria();
     if ($school_year_id != "") {
         $career_subject = $this->getObject()->getCareerSubject();
         $school_year = SchoolYearPeer::retrieveByPK($school_year_id);
         $career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByCareerSubjectAndSchoolYear($career_subject, $school_year);
         $opcions = array();
         foreach ($career_subject_school_year->getChoices() as $optional_career_subject_school_year) {
             $cs = CareerSubjectPeer::retrieveByCareerSubjectSchoolYearId($optional_career_subject_school_year->getChoiceCareerSubjectSchoolYearId());
             $opcions[] = $cs->getId();
         }
         //$opcions es un arreglo con todas las posibles optativas
         $criteria->add(CareerSubjectPeer::ID, $opcions, Criteria::IN);
         $widget->getOption('widget')->setOption('criteria', $criteria);
     }
 }
 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 retrieveByStudentApprovedCareerSubject($student_approved_career_subject, $school_year = null)
 {
     $career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByCareerSubjectAndSchoolYear($student_approved_career_subject->getCareerSubject(), $school_year);
     return self::retrieveByCareerSubjectSchoolYearAndStudent($career_subject_school_year, $student_approved_career_subject->getStudentId());
 }
Beispiel #4
0
 public function createAllCourses($con = null)
 {
     if (is_null($con)) {
         $con = Propel::getConnection();
     }
     try {
         $con->beginTransaction();
         /* @var $career_subject CareerSubject */
         foreach ($this->getUnrelatedCareerSubjects() as $career_subject) {
             $career_subject_school_year_id = CareerSubjectSchoolYearPeer::retrieveByCareerSubjectAndSchoolYear($career_subject, $this->getSchoolYear())->getId();
             $this->createCourse($career_subject_school_year_id, $con);
         }
         $con->commit();
     } catch (PropelException $e) {
     }
 }
Beispiel #5
0
 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);
 }