public function countValidCourseSubjectStudentPathwayMarks()
 {
     $c = new Criteria();
     $c->add(CourseSubjectStudentPathwayPeer::STUDENT_ID, $this->getStudent()->getId());
     $c->add(CourseSubjectStudentPathwayPeer::COURSE_SUBJECT_ID, $this->getCourseSubject()->getId());
     $c->add(CourseSubjectStudentPathwayPeer::MARK, null, Criteria::ISNOTNULL);
     return CourseSubjectStudentPathwayPeer::doCount($c);
 }
 public static function countStudentInscriptionsForCareerSubjectSchoolYear($course_subject_id, $student_id)
 {
     $course_subject = CourseSubjectPeer::retrieveByPk($course_subject_id);
     $c = new Criteria();
     $c->addJoin(CourseSubjectStudentPathwayPeer::COURSE_SUBJECT_ID, CourseSubjectPeer::ID);
     $c->add(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, $course_subject->getCareerSubjectSchoolYearId());
     $c->add(CourseSubjectStudentPathwayPeer::STUDENT_ID, $student_id);
     $c->addAnd(CourseSubjectPeer::ID, $course_subject_id, Criteria::NOT_EQUAL);
     return CourseSubjectStudentPathwayPeer::doCount($c);
 }
Exemplo n.º 3
0
 public function CanClosePathway(PropelPDO $con = null)
 {
     if ($this->getIsClosed()) {
         return false;
     }
     if ($this->countPathwayStudents() == 0) {
         return false;
     }
     $c = new Criteria();
     $c->addJoin(CourseSubjectStudentPathwayPeer::COURSE_SUBJECT_ID, CourseSubjectPeer::ID);
     $c->addJoin(CourseSubjectStudentPathwayPeer::STUDENT_ID, StudentPeer::ID);
     $c->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID);
     $c->addJoin(PersonPeer::IS_ACTIVE, true);
     $c->addJoin(CourseSubjectPeer::COURSE_ID, $this->getId());
     $c->add(CourseSubjectStudentPathwayPeer::MARK, null, Criteria::ISNULL);
     return CourseSubjectStudentPathwayPeer::doCount($c) == 0;
 }
 public function postValidateAvailableStudents(sfValidatorBase $validator, $values)
 {
     $duplicated_students = array();
     $student_ids = $values['course_subject_student_list'];
     $course_subject_id = $values['id'];
     if (!empty($student_ids)) {
         foreach ($student_ids as $student_id) {
             if (CourseSubjectStudentPathwayPeer::countStudentInscriptionsForCareerSubjectSchoolYear($course_subject_id, $student_id) != 0) {
                 $duplicated_students[] = StudentPeer::retrieveByPk($student_id);
             }
         }
         if ($duplicated_students) {
             $error = new sfValidatorError($validator, 'Los siguientes estudiantes seleccionados ya se encuentran inscriptos en otro curso para esta misma materia: ' . implode(',', $duplicated_students));
             throw new sfValidatorErrorSchema($validator, array('course_subject_student_list' => $error));
         }
     }
     return $values;
 }
Exemplo n.º 5
0
 public function getCourseSubjectStudentPathwayMark()
 {
     $c = new Criteria();
     $c->add(CourseSubjectStudentPathwayPeer::STUDENT_ID, $this->getStudentId());
     $c->add(CourseSubjectStudentPathwayPeer::COURSE_SUBJECT_ID, $this->getCourseSubjectId());
     $c->addJoin(CourseSubjectStudentPathwayPeer::PATHWAY_STUDENT_ID, PathwayStudentPeer::ID, Criteria::INNER_JOIN);
     $c->add(PathwayStudentPeer::PATHWAY_ID, PathwayPeer::retrieveCurrent()->getId());
     return CourseSubjectStudentPathwayPeer::doSelect($c);
 }