Exemplo n.º 1
0
 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $class_course = new ClassCourse();
         $class_course->setClassGroupId($this->getRequestParameter('class_group_id'));
         $class_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $class_course->setStatus(3);
         $class_course->save();
         $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
         $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
         $this->forward404Unless($academic_calendar);
         $class_group_id = $this->getRequestParameter('class_group_id');
         $class_group = ClassGroupPeer::retrieveByPK($class_group_id);
         $this->forward404Unless($class_group);
         $c = new Criteria();
         $c->add(StudentPeer::CLASS_GROUP_ID, $class_group_id);
         $students = StudentPeer::doSelect($c);
         foreach ($students as $student) {
             $c = new Criteria();
             $c->add(VCourseSchedulePeer::CLASS_GROUP_ID, $class_group_id);
             $c->add(VCourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar_id);
             $courses = VCourseSchedulePeer::doSelect($c);
             foreach ($courses as $course) {
                 $student_course = new StudentCourse();
                 $student_course->setStudentId($student->getId());
                 $student_course->setSubjectAccalId($course->getSubjectAccalId());
                 $student_course->setClassGroupId($course->getClassGroupId());
                 $student_course->setStatus(3);
                 $student_course->save();
             }
         }
     } else {
         $class_course = ClassCoursePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($class_course);
         $class_course->setId($this->getRequestParameter('id'));
         $class_course->setClassGroupId($this->getRequestParameter('class_group_id'));
         $class_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $class_course->setStatus(3);
         $class_course->save();
         $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
         $class_group_id = $this->getRequestParameter('class_group_id');
         $c = new Criteria();
         $c->add(StudentPeer::CLASS_GROUP_ID, $class_group_id);
         $students = StudentPeer::doSelect($c);
         foreach ($students as $student) {
             $c = new Criteria();
             $c->add(VCourseSchedulePeer::CLASS_GROUP_ID, $class_group_id);
             $c->add(VCourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar_id);
             $courses = VCourseSchedulePeer::doSelect($c);
             foreach ($courses as $course) {
                 $c = new Critaria();
                 $c->add(StudenCoursePeer::STUDENT_ID, $student->getId());
                 $stu_courses = StudentCoursePeer::doSelect($c);
                 foreach ($stu_courses as $stu_courses) {
                     $student_course = StudentCoursePeer::retrieveByPk($stu_courses->getId());
                     $student_course->setStudentId($student->getId());
                     $student_course->setSubjectAccalId($course->getSubjectAccalId());
                     $student_course->setClassGroupId($course->getClassGroupId());
                     $student_course->setStatus(3);
                     $student_course->save();
                 }
             }
         }
     }
     return $this->redirect('subject_plan/list');
 }
Exemplo n.º 2
0
 public function addStudentCourse(StudentCourse $l)
 {
     $this->collStudentCourses[] = $l;
     $l->setSubjectCurr($this);
 }
Exemplo n.º 3
0
 public function addStudentCourse(StudentCourse $l)
 {
     $this->collStudentCourses[] = $l;
     $l->setClassGroupId($this->ClassGroupId);
 }
Exemplo n.º 4
0
 public function addStudentCourse(StudentCourse $l)
 {
     $this->collStudentCourses[] = $l;
     $l->setSchedule($this);
 }
Exemplo n.º 5
0
 public function executeUpdatePackaged()
 {
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->forward404Unless($student);
     $this->student = $student;
     $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $class_group_id = $this->getRequestParameter('class_group_id');
     $class_group = ClassGroupPeer::retrieveByPK($class_group_id);
     $this->forward404Unless($class_group);
     $status = $this->getRequestParameter('status');
     $this->forward404Unless($status);
     $subject_accals = $academic_calendar->getSubjectAccals();
     $sas = array();
     foreach ($subject_accals as $sa) {
         if ($sa->getSubject()) {
             $sas[] = $sa->getId();
         }
     }
     $saved_sas = array();
     $saved_student_courses = $student->getStudentCourses();
     foreach ($saved_student_courses as $ssc) {
         $saved_sas[] = $ssc->getSubjectAccalId();
     }
     $disabled_sa = array_intersect($sas, $saved_sas);
     // calculate sc rules
     $objs = SubjectAccalPeer::doSelectByAccal();
     foreach ($objs as $o) {
         $content[$o->getId()] = $o->toStringWithLector();
         $c = new Criteria();
         $c->add(SubjectAccalPeer::ID, $o->getId());
         $c->add(SubjectCurrPeer::SUBJECT_ID, $o->getSubjectId());
         $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID);
         $c->addJoin(AcademicCalendarPeer::CURRICULUM_ID, SubjectCurrPeer::CURRICULUM_ID);
         $c->addJoin(SubjectCurrPeer::ID, SubjectPrereqPeer::SUBCURR);
         $sps = SubjectPrereqPeer::doSelect($c);
         foreach ($sps as $sp) {
             $s = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject();
             // prereq subject must be in closed state
             $c = new Criteria();
             $c->add(SubjectAccalPeer::SUBJECT_ID, $s->getId());
             $c->add(StudentCoursePeer::STUDENT_ID, $student_id);
             $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_CLOSED);
             $c->addJoin(StudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
             $scs = StudentCoursePeer::doSelect($c);
             $isPassGrade = false;
             $isPassCredit = true;
             $isPassIndex = true;
             foreach ($scs as $sc) {
                 $grade = $sc->getFinalGrade();
                 $gc = GradeConversionPeer::retrieveByName($grade[0]);
                 // check prereq subject grade
                 if ($gc && $gc->getGrade() >= $sp->getGradeConversion()->getGrade()) {
                     $isPassGrade = true;
                 } else {
                     $isPassGrade = false;
                 }
                 // check credit requirement
                 if ($sp->getTotalCredit() > 0) {
                     if ($sc->getTotalCreditClosed() >= $sp->getTotalCredit()) {
                         $isPassCredit = true;
                     } else {
                         $isPassCredit = false;
                     }
                 }
                 // check index requirement
                 if ($sp->getPerformanceIndex() > 0) {
                     if ($sc->getPerformanceIndex() >= $sp->getPerformanceIndex()) {
                         $isPassIndex = true;
                     } else {
                         $isPassIndex = false;
                     }
                 }
             }
             $s0 = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject()->toString();
             $s1 = $sp->getSubjectCurrRelatedBySubcurr()->getSubject()->toString();
             if (!$isPassGrade || !$isPassCredit || !$isPassIndex) {
                 $disabled_sa[] = $o->getId();
             }
         }
     }
     $selected_sa = array_diff($sas, $disabled_sa);
     foreach ($selected_sa as $sa_id) {
         $student_course = new StudentCourse();
         $student_course->setStudentId($student_id);
         $student_course->setSubjectAccalId($sa_id);
         $student_course->setStatus($status);
         $student_course->setClassGroupId($class_group_id);
         $student_course->save();
     }
     return $this->redirect('student_course_s/list?student_id=' . $student->getId());
 }
Exemplo n.º 6
0
 public function executeSelectByAccal()
 {
     $student_course_id = $this->getRequestParameter('student_course_id');
     $student_course = StudentCoursePeer::retrieveByPK($student_course_id);
     if (!$student_course) {
         $student_course = new StudentCourse();
     }
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     //		$this->forward404Unless($student);
     $accal_id = $this->getRequestParameter('accal_id');
     $accal = AcademicCalendarPeer::retrieveByPK($accal_id);
     $disabled = array();
     if ($student) {
         $student_courses = $student->getStudentCoursesJoinSubjectAccal();
         foreach ($student_courses as $sc) {
             if ($sc->getSubjectAccal()->getAcademicCalendarId() == $accal->getId() && $student_course->getSubjectAccalId() != $sc->getSubjectAccal()->getId()) {
                 $disabled[] = $sc->getSubjectAccal()->getId();
             }
         }
     }
     $content = array();
     $objs = SubjectAccalPeer::doSelectByAccal();
     if ($student) {
         foreach ($objs as $o) {
             $content[$o->getId()] = $o->toString();
             $c = new Criteria();
             $c->add(SubjectAccalPeer::ID, $o->getId());
             $c->add(SubjectCurrPeer::SUBJECT_ID, $o->getSubjectId());
             $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID);
             $c->addJoin(AcademicCalendarPeer::CURRICULUM_ID, SubjectCurrPeer::CURRICULUM_ID);
             $c->addJoin(SubjectCurrPeer::ID, SubjectPrereqPeer::SUBCURR);
             $sps = SubjectPrereqPeer::doSelect($c);
             foreach ($sps as $sp) {
                 $s = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject();
                 // prereq subject must be in closed state
                 $c = new Criteria();
                 $c->add(SubjectAccalPeer::SUBJECT_ID, $s->getId());
                 $c->add(StudentCoursePeer::STUDENT_ID, $student_id);
                 $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_CLOSED);
                 $c->addJoin(StudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
                 $scs = StudentCoursePeer::doSelect($c);
                 $isPassGrade = false;
                 $isPassCredit = true;
                 $isPassIndex = true;
                 foreach ($scs as $sc) {
                     $grade = $sc->getFinalGrade();
                     $gc = GradeConversionPeer::retrieveByName($grade[0]);
                     // check prereq subject grade
                     if ($gc && $gc->getGrade() >= $sp->getGradeConversion()->getGrade()) {
                         $isPassGrade = true;
                     } else {
                         $isPassGrade = false;
                     }
                     // check credit requirement
                     if ($sp->getTotalCredit() > 0) {
                         if ($sc->getTotalCreditClosed() >= $sp->getTotalCredit()) {
                             $isPassCredit = true;
                         } else {
                             $isPassCredit = false;
                         }
                     }
                     // check index requirement
                     if ($sp->getPerformanceIndex() > 0) {
                         if ($sc->getPerformanceIndex() >= $sp->getPerformanceIndex()) {
                             $isPassIndex = true;
                         } else {
                             $isPassIndex = false;
                         }
                     }
                 }
                 $s0 = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject()->toString();
                 $s1 = $sp->getSubjectCurrRelatedBySubcurr()->getSubject()->toString();
                 //				echo "<div align=left><pre>";
                 //				echo "$s1 -> $s0 | isPassGrade:$isPassGrade isPassCredit:$isPassCredit isPassIndex:$isPassIndex";
                 //				echo "</pre></div>";
                 if (!$isPassGrade || !$isPassCredit || !$isPassIndex) {
                     $disabled[] = $o->getId();
                 }
             }
         }
     } else {
         foreach ($objs as $o) {
             $content[$o->getId()] = $o->toString();
         }
     }
     $this->content = $content;
     $this->disabled = $disabled;
 }
Exemplo n.º 7
0
 public function executeUpdateDevelopment()
 {
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->forward404Unless($student);
     $this->student = $student;
     $student_course = new StudentCourse();
     $student_course->setStudentId($student->getId());
     $student_course->setClassGroupId($student->getClassGroupId());
     $student_course->setAcademicCalendarId($student->getAcademicCalendarId());
     $student_course->setGradeComponentId($this->getRequestParameter('grade_component_id'));
     $student_course->save();
     $g = new StudentRaport();
     $g->setStudentCourse($student_course);
     $g->setGradeComponentId($this->getRequestParameter('grade_component_id'));
     $g->setGrade($this->getRequestParameter('grade'));
     $g->save();
     return $this->redirect('student_score/listDev?student_id=' . $student->getId());
 }
Exemplo n.º 8
0
 public function addStudentCourse(StudentCourse $l)
 {
     $this->collStudentCourses[] = $l;
     $l->setGradeComponent($this);
 }
Exemplo n.º 9
0
 public function executeSavePreview()
 {
     $class_id = $this->getRequestParameter('class_group_id');
     $accal_id = $this->getRequestParameter('academic_calendar_id');
     $c = new Criteria();
     $c->add(StudentPeer::CLASS_GROUP_ID, $this->getRequestParameter('class_group_id'));
     $students = StudentPeer::doSelect($c);
     $counts = StudentPeer::doCount($c);
     $c = new Criteria();
     $c->add(GradeComponentPeer::GRADE_SPEC_ID, '20');
     $c->add(GradeComponentPeer::PUBLISHED, '1');
     $components = GradeComponentPeer::doSelect($c);
     $accal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('academic_calendar_id'));
     $c = new Criteria();
     $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $accal_id);
     $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_id);
     $course_schedules = CourseSchedulePeer::doSelect($c);
     $counts = CourseSchedulePeer::doCount($c);
     if ($accal->getCurriculum()->getCourseModel() == Curriculum::CM_PACKAGED || $accal->getCurriculum()->getCourseModel() == Curriculum::CM_PACKAGED_CUSTOM) {
         #if ($counts > 1) {
         foreach ($course_schedules as $course_schedule) {
             foreach ($students as $student) {
                 $c = new Criteria();
                 $c->add(StudentCoursePeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
                 $stu_courses = StudentCoursePeer::doCount($c);
                 if ($stu_courses < 1) {
                     $student_course = new StudentCourse();
                     $student_course->setStudentId($student->getId());
                     $student_course->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $student_course->setStatus(1);
                     $student_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
                     $student_course->setClassGroupId($this->getRequestParameter('class_group_id'));
                     $student_course->save();
                 }
             }
         }
         foreach ($students as $student) {
             foreach ($components as $component) {
                 $c = new Criteria();
                 $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
                 $c->add(StudentCoursePeer::GRADE_COMPONENT_ID, $component->getId());
                 $com_courses = StudentCoursePeer::doCount($c);
                 if ($com_courses < 1) {
                     $student_course = new StudentCourse();
                     $student_course->setStudentId($student->getId());
                     $student_course->setStatus(1);
                     $student_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
                     $student_course->setClassGroupId($this->getRequestParameter('class_group_id'));
                     $student_course->setGradeComponentId($component->getId());
                     $student_course->save();
                 }
             }
         }
         #}
     }
     return $this->redirect('course_schedule/list');
 }