public function save($con = null) { if (!isset($this->widgetSchema['students'])) { // somebody has unset this widget return; } if (is_null($con)) { $con = $this->getConnection(); } $con->beginTransaction(); try { $values = $this->getValue('students'); if (is_array($values)) { foreach ($values as $value) { $c = new Criteria(); $c->addJoin(TentativeRepprovedStudentPeer::STUDENT_CAREER_SCHOOL_YEAR_ID, StudentCareerSchoolYearPeer::ID); $c->add(TentativeRepprovedStudentPeer::IS_DELETED, false); $c->add(StudentCareerSchoolYearPeer::STUDENT_ID, $value); $trs = TentativeRepprovedStudentPeer::retrieveByPK($value); $pathway_student = new PathwayStudent(); $pathway_student->setStudentId($trs->getStudentCareerSchoolYear()->getStudentId()); $pathway_student->setPathway(PathwayPeer::retrieveCurrent()); $pathway_student->setYear($trs->getStudentCareerSchoolYear()->getYear()); $pathway_student->save($con); $trs->setIsDeleted(true); $trs->save($con); $trs->getStudentCareerSchoolYear()->setStatus(StudentCareerSchoolYearStatus::APPROVED); $trs->getStudentCareerSchoolYear()->save($con); $student_id = $trs->getStudentCareerSchoolYear()->getStudentId(); $career_id = $trs->getStudentCareerSchoolYear()->getCareerSchoolYear()->getCareerId(); $next_year = $trs->getStudentCareerSchoolYear()->getYear() + 1; $career_student = CareerStudentPeer::retrieveByCareerAndStudent($career_id, $student_id); // Elimino los Allowed y Allowed Pathway del alumno. $career_student->getStudent()->deleteAllCareerSubjectAllowedPathways($con); $career_student->getStudent()->deleteAllCareerSubjectAlloweds($con); // Creo los Allowed Pathway del alumno. $career_student->createStudentsCareerSubjectAllowedPathways($trs->getStudentCareerSchoolYear()->getYear(), $con); // Creo los Allowed para la cursada normal del alumno. $career_student->createStudentsCareerSubjectAlloweds($next_year, $con); } } $con->commit(); } catch (Exception $e) { $con->rollBack(); throw $e; } }
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); }