public function createStudentCareerSchoolYear($con) { $c = new Criteria(); $c->add(CareerStudentPeer::STUDENT_ID, $this->getStudentId()); foreach (CareerStudentPeer::doSelect($c) as $career_student) { /* * @CareerStudent $career_student */ $career_school_year = $career_student->getCareer()->getCareerSchoolYear($this->getSchoolYear()); if ($career_school_year && StudentCareerSchoolYearPeer::countByCareerAndStudent($career_student->getCareerId(), $career_student->getStudentId(), $this->getSchoolYearId()) == 0) { $last_student_career_school_year = $career_student->getCurrentStudentCareerSchoolYear(); $year = is_null($last_student_career_school_year) ? $career_student->getStartYear() : $last_student_career_school_year->suggestYear(); if ($year <= $career_school_year->getCareer()->getQuantityYears()) { $student_career_school_year = new StudentCareerSchoolYear(); $student_career_school_year->setCareerSchoolYear($career_school_year); $student_career_school_year->setStudentId($this->getStudentId()); //SI REPITIO if (!is_null($last_student_career_school_year) && $last_student_career_school_year->getStatus() == StudentCareerSchoolYearStatus::REPPROVED) { $student_career_school_year->setStatus(StudentCareerSchoolYearStatus::LAST_YEAR_REPPROVED); } $student_career_school_year->setYear($year); $student_career_school_year->save($con); } } } }
public function getCareerStudent(PropelPDO $con = null) { $c = new Criteria(); $c->add(CareerStudentPeer::STUDENT_ID, $this->getStudentId()); $c->add(CareerStudentPeer::CAREER_ID, $this->getCareerSubject()->getCareerId()); return CareerStudentPeer::doSelectOne($c); }
protected function doSave($con = null) { $career_id = $this->getValue('career_id'); $student_career = CareerStudentPeer::retrieveByCareerAndStudent($career_id, $this->getObject()->getId()); $student_career->setOrientationId($this->getValue('orientation_id')); $student_career->setSubOrientationId($this->getValue('sub_orientation_id')); $student_career->setOrientationChangeObservations($this->getValue('orientation_change_observations')); $student_career->save($con); }
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; } }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $con = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); $this->createContextInstance('backend'); $c = new Criteria(); $student_career_school_years = StudentCareerSchoolYearPeer::doSelect($c); try { $school_year = SchoolYearPeer::retrieveByPk(3); foreach ($student_career_school_years as $student_career_school_year) { $year = $student_career_school_year->getYear(); $c = new Criteria(); $c->add(StudentCareerSubjectAllowedPeer::STUDENT_ID, $student_career_school_year->getStudentId()); StudentCareerSubjectAllowedPeer::doDelete($c); if ($year < 7) { $year++; if ($year == 1 || $year == 4) { $career = CareerPeer::retrieveByPk(8); } else { $career = CareerPeer::retrieveByPk(4); } $career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear($career, $school_year); $c = new Criteria(); $c->add(CareerStudentPeer::STUDENT_ID, $student_career_school_year->getStudentId()); $career_student = CareerStudentPeer::doSelectOne($c); $career_student->setCareer($career); $career_student->setFileNumber($career_student->getFileNumber() + rand()); $career_student->save($con); $career_student->createStudentsCareerSubjectAlloweds($year, $con); $new_student_career_school_year = new StudentCareerSchoolYear(); $new_student_career_school_year->setStudent($student_career_school_year->getStudent()); $new_student_career_school_year->setCareerSchoolYear($career_school_year); $new_student_career_school_year->setYear($year); $new_student_career_school_year->save($con); } else { $student_career_school_year->delete($con); } } } catch (PropelException $e) { $con->rollback(); throw $e; } // add your code here }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); $this->createContextInstance('backend'); $c = new Criteria(); //$c->add(CareerStudentPeer::STUDENT_ID, 1080); $school_year = SchoolYearPeer::retrieveCurrent(); try { $connection->beginTransaction(); foreach (CareerStudentPeer::doSelect($c) as $career_student) { $student = $career_student->getStudent(); $career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear($career_student->getCareer(), $school_year); $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $career_school_year); if (is_null($student_career_school_year)) { $this->logSection("Continue", '1'); continue; } $year = $student_career_school_year->getYear(); $c = new Criteria(); $c->add(CareerSubjectPeer::CAREER_ID, $career_student->getCareerId()); $c->add(CareerSubjectPeer::YEAR, $year); foreach (CareerSubjectPeer::doSelect($c) as $career_subject) { if (StudentCareerSubjectAllowedPeer::doCountStudentAndCareerSubject($student, $career_subject) == 0) { $obj = new StudentCareerSubjectAllowed(); $obj->setStudentId($student->getId()); $obj->setCareerSubject($career_subject); $obj->save($connection); $this->logSection("Allowed agregado: ", $career_subject->getId()); } } } $connection->commit(); } catch (PropelException $e) { $connection->rollback(); throw $e; } }
public function save() { $origin_career_school_year = CareerSchoolYearPeer::retrieveByPk($this->getValue('career_school_year_id')); $destiny_career_school_year = CareerSchoolYearPeer::retrieveByPk($this->getOption('destiny_career_id')); $last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear(SchoolYearPeer::retrieveCurrent()); $students = CareerStudentPeer::retrieveLastYearCareerGraduatedStudents($origin_career_school_year); $con = Propel::getConnection(); try { $con->beginTransaction(); foreach ($students as $student) { $student->registerToCareer($destiny_career_school_year->getCareer(), null, null, $destiny_career_school_year->getCareer()->getMinYear(), $con); $shift = $student->getShiftForSchoolYear($last_year_school_year); if (!$student->getIsRegistered($destiny_career_school_year->getSchoolYear())) { $student->registerToSchoolYear($destiny_career_school_year->getSchoolYear(), $shift, $con); } } $con->commit(); } catch (PropelException $e) { $con->rollBack(); throw $e; } }
public function executeUpdateChangeStudentStatus(sfWebRequest $request) { $this->student = StudentPeer::retrieveByPK($request->getParameter('student_id')); $this->status = $request->getParameter('student_career_school_year[status]'); $this->motive = $request->getParameter('student_career_school_year[change_status_motive_id]'); $student_career_school_year = $this->student->getLastStudentCareerSchoolYear(); if (is_null($student_career_school_year)) { $this->getUser()->setFlash('error', 'Ocurrió un error al guardar los datos'); } else { switch ($this->status) { case StudentCareerSchoolYearStatus::WITHDRAWN: //Retirado //cambio el estado $this->form = new StudentCareerSchoolYearForm($student_career_school_year); $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $a = $this->form->save(); //desmatricular $s = $this->student->getSchoolYearStudentForSchoolYear($student_career_school_year->getCareerSchoolYear()->getSchoolYear()); if (!is_null($s)) { $s->delete(); } //deshabilito la persona $this->student->getPerson()->setIsActive(false); $this->student->getPerson()->save(); //seteo en sus course_subject_student_mark is_closed en TRUE; $this->student->setCourseSubjectStudentMarksForSchoolYear($student_career_school_year->getCareerSchoolYear()->getSchoolYear(), true); $this->getUser()->setFlash('info', 'The item was updated successfully.'); break; case StudentCareerSchoolYearStatus::WITHDRAWN_WITH_RESERVE: //Retirado con reserva de banco $this->start_date = $request->getParameter('student_career_school_year[start_date_reserve]'); //Si no existe la reserva la creo. $student_reserve = $this->student->hasActiveReserve(); if (is_null($student_reserve)) { if (is_null($this->start_date) || $this->start_date == '') { $this->getUser()->setFlash('error', 'El campo Fecha de inicio de la reserva es obligatorio.'); } else { $this->start_date = str_replace('/', '-', $this->start_date); $this->start_date = date('Y-m-d', strtotime($this->start_date)); $student_reserve = new StudentReserveStatusRecord(); $student_reserve->setStudentId($this->student->getId()); $student_reserve->setStartDate(new DateTime($this->start_date)); StudentReserveStatusRecordPeer::doInsert($student_reserve); //cambio el estado $this->form = new StudentCareerSchoolYearForm($student_career_school_year); $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $a = $this->form->save(); //desmatricular $s = $this->student->getSchoolYearStudentForSchoolYear($student_career_school_year->getSchoolYear()); if (!is_null($s)) { $s->delete(); } //seteo en sus course_subject_student_mark is_closed en TRUE; $this->student->setCourseSubjectStudentMarksForSchoolYear($student_career_school_year->getCareerSchoolYear()->getSchoolYear(), true); $this->getUser()->setFlash('info', 'The item was updated successfully.'); } } else { //Ya existe la reserva solo modifico la fecha $this->start_date = str_replace('/', '-', $this->start_date); $this->start_date = date('Y-m-d', strtotime($this->start_date)); $student_reserve->setStartDate(new DateTime($this->start_date)); $student_reserve->save(); $this->getUser()->setFlash('info', 'The item was updated successfully.'); } break; case StudentCareerSchoolYearStatus::FREE: //Libre $max_year = $student_career_school_year->getCareerSchoolYear()->getCareer()->getMaxYear(); //chequeo que sea el ultimo año. if ($student_career_school_year->getYear() == $max_year) { //chequeo que deba materias. if ($this->student->getCountStudentRepprovedCourseSubject() > 0) { //cambio el estado $this->form = new StudentCareerSchoolYearForm($student_career_school_year); $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $a = $this->form->save(); //si no esta activo, lo activo if (!$this->student->getPerson()->getIsActive()) { $this->student->getPerson()->setIsActive(true); $this->student->getPerson()->save(); } //desmatricular $s = $this->student->getSchoolYearStudentForSchoolYear($student_career_school_year->getSchoolYear()); if (!is_null($s)) { $s->delete(); } $this->getUser()->setFlash('info', 'The item was updated successfully.'); } else { $this->getUser()->setFlash('error', 'El alumno no debe materias.'); } } else { $this->getUser()->setFlash('error', 'El alumno debe estar en el ultimo año de la carrera.'); } break; case StudentCareerSchoolYearStatus::IN_COURSE: //En curso //Chequeo que el estado anterior sea Retirado con Reserva de Banco. if ($student_career_school_year->getStatus() != StudentCareerSchoolYearStatus::WITHDRAWN_WITH_RESERVE) { $this->getUser()->setFlash('error', 'El estado anterior debe ser Retirado con reserva de Banco.'); } else { $this->end_date = $request->getParameter('student_career_school_year[end_date_reserve]'); if (is_null($this->end_date) || $this->end_date == '') { $this->getUser()->setFlash('error', 'El campo Fecha de fin de la reserva es obligatorio.'); } else { //guardo la fecha de fin de la reserva. $this->end_date = str_replace('/', '-', $this->end_date); $this->end_date = date('Y-m-d', strtotime($this->end_date)); $student_reserve = $this->student->hasActiveReserve(); $student_reserve->setEndDate(new DateTime($this->end_date)); $student_reserve->save(); //cambio el estado $this->form = new StudentCareerSchoolYearForm($student_career_school_year); $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $a = $this->form->save(); $this->getUser()->setFlash('info', 'The item was updated successfully.'); } } break; case StudentCareerSchoolYearStatus::APPROVED: if ($student_career_school_year->getStatus() == StudentCareerSchoolYearStatus::IN_COURSE || $student_career_school_year->getStatus() == StudentCareerSchoolYearStatus::FREE) { if ($student_career_school_year->getStatus() == StudentCareerSchoolYearStatus::FREE) { //no debe materias. if ($this->student->getCountStudentRepprovedCourseSubject() == 0) { //cambio el estado $this->form = new StudentCareerSchoolYearForm($student_career_school_year); $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $a = $this->form->save(); //cambio el estado de la carrera. $career = $student_career_school_year->getCareerSchoolYear()->getCareer(); $career_student = CareerStudentPeer::retrieveByCareerAndStudent($career->getId(), $this->student->getId()); $career_student->setStatus(CareerStudentStatus::GRADUATE); $current_school_year = SchoolYearPeer::retrieveCurrent(); $career_student->setGraduationSchoolYearId($current_school_year->getId()); $career_student->save(Propel::getConnection()); //deshabilito la persona $this->student->getPerson()->setIsActive(false); $this->student->getPerson()->save(); $this->getUser()->setFlash('info', 'The item was updated successfully.'); } else { $this->getUser()->setFlash('error', 'El alumno tiene materias previas sin aprobar.'); } } else { /*SOLO CHEQUEA QUE TENGA LAS MATERIAS CERRADAS*/ $course_subject_students = $this->student->getCourseSubjectStudentsForSchoolYear($student_career_school_year->getCareerSchoolYear()->getSchoolYear()); $css = array_shift($course_subject_students); /* Si tengo alguna materia sin cerrar */ if (!$css->areAllMarksClosed()) { $this->getUser()->setFlash('error', "El alumno tiene cursadas sin cerrar."); } else { //cambio el estado $this->form = new StudentCareerSchoolYearForm($student_career_school_year); $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $a = $this->form->save(); $this->getUser()->setFlash('info', 'The item was updated successfully.'); } } } else { $this->getUser()->setFlash('error', 'El alumno debe estar cursando o estar Libre.'); } break; } } $this->redirect('student/changeStudentStatus?id=' . $this->student->getId()); }
public function closeStudentExaminationRepprovedSubject(StudentExaminationRepprovedSubject $student_examination_repproved_subject, PropelPDO $con) { if ($student_examination_repproved_subject->getMark() >= $this->getExaminationNote()) { $student_approved_career_subject = new StudentApprovedCareerSubject(); $student_approved_career_subject->setCareerSubject($student_examination_repproved_subject->getExaminationRepprovedSubject()->getCareerSubject()); $student_approved_career_subject->setStudent($student_examination_repproved_subject->getStudent()); $student_approved_career_subject->setSchoolYear($student_examination_repproved_subject->getExaminationRepprovedSubject()->getExaminationRepproved()->getSchoolYear()); if ($student_examination_repproved_subject->getExaminationRepprovedSubject()->getExaminationRepproved()->getExaminationType() == ExaminationRepprovedType::REPPROVED) { //Final average is the average of the course_subject_student and the mark of student_examination_repproved_subject $average = (string) (($student_examination_repproved_subject->getStudentRepprovedCourseSubject()->getCourseSubjectStudent()->getMarksAverage() + $student_examination_repproved_subject->getMark()) / 2); $average = sprintf('%.4s', $average); if ($average < self::MIN_NOTE) { $average = self::MIN_NOTE; } $student_approved_career_subject->setMark($average); } else { //Final calification is the mark of student_examination_repproved_subject $student_approved_career_subject->setMark($student_examination_repproved_subject->getMark()); } $student_repproved_course_subject = $student_examination_repproved_subject->getStudentRepprovedCourseSubject(); $student_repproved_course_subject->setStudentApprovedCareerSubject($student_approved_career_subject); $student_repproved_course_subject->save($con); $career = $student_repproved_course_subject->getCourseSubjectStudent()->getCourseSubject()->getCareerSubjectSchoolYear()->getCareerSchoolYear()->getCareer(); ##se corrobora si la previa es la última y del último año, hay que egresarlo $previous = StudentRepprovedCourseSubjectPeer::countRepprovedForStudentAndCareer($student_repproved_course_subject->getStudent(), $career); if ($student_repproved_course_subject->getStudent()->getCurrentOrLastStudentCareerSchoolYear()->getYear() >= CareerPeer::getMaxYear() && $previous == 0) { $career_student = CareerStudentPeer::retrieveByCareerAndStudent($career->getId(), $student_repproved_course_subject->getStudent()->getId()); $career_student->setStatus(CareerStudentStatus::GRADUATE); //se guarda el school_year en que termino esta carrera $career_student->setGraduationSchoolYearId(SchoolYearPeer::retrieveCurrent()->getId()); $career_student->save($con); //se guarda el estado en el student_career_school_year $scsy = $student_repproved_course_subject->getCourseSubjectStudent()->getStudent()->getCurrentOrLastStudentCareerSchoolYear(); $scsy->setStatus(StudentCareerSchoolYearStatus::APPROVED); $scsy->save(); } ##se agrega el campo en student_disapproved_course_subject a el link del resultado final $student_repproved_course_subject->getCourseSubjectStudent()->getCourseResult()->setStudentApprovedCareerSubject($student_approved_career_subject)->save($con); $student_approved_career_subject->save($con); } }
public function canBeDeleted(PropelPDO $con = null) { $criteria = new Criteria(); $criteria->add(CareerStudentPeer::SUB_ORIENTATION_ID, $this->getId()); return !CareerStudentPeer::doCount($criteria); }
public function getGraduationSchoolYear() { $c = new Criteria(); $c->addJoin(StudentPeer::ID, CareerStudentPeer::STUDENT_ID); $c->add(CareerStudentPeer::STATUS, CareerStudentStatus::GRADUATE); $c->add(CareerStudentPeer::STUDENT_ID, $this->getId()); $c->addDescendingOrderByColumn(CareerStudentPeer::ID); $cs = CareerStudentPeer::doSelectOne($c); if (!is_null($cs)) { $sy = SchoolYearPeer::retrieveByPk($cs->getGraduationSchoolYearId()); } return $sy ? $sy->getYear() : '-'; }
?> "><?php echo __('Go back'); ?> </a></div> </div> <?php foreach ($students as $student) { ?> <?php $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $division->getCareerSchoolYear()); ?> <div class="report-wrapper"> <?php include_partial('header', array('student' => $student, 'division' => $division, 'career_id' => $career_id, 'school_year' => $student_career_school_year->getSchoolYear(), 'student_career' => CareerStudentPeer::retrieveByCareerAndStudent($career_id, $student->getId()))); ?> <div class="report-content"> <?php $periods = CareerSchoolYearPeriodPeer::getQuaterlyPeriodsSchoolYear($division->getCareerSchoolYearId()); ?> <?php $school_year = $division->getSchoolYear(); ?> <?php $course_subject_students = $student->getCourseSubjectStudentsForSchoolYear($school_year); ?> <?php
public function fixRepetidores($con) { $c = new Criteria(); $c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::LAST_YEAR_REPPROVED); foreach (StudentCareerSchoolYearPeer::doSelect($c) as $student_career_school_year) { $c = new Criteria(); $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, 2); $c->add(StudentCareerSchoolYearPeer::STUDENT_ID, $student_career_school_year->getStudentId()); $last_year_student = StudentCareerSchoolYearPeer::doSelectOne($c); if ($last_year_student->getStatus() == StudentCareerSchoolYearStatus::APPROVED) { $year = $student_career_school_year->getYear() + 1; $student_career_school_year->setStatus(StudentCareerSchoolYearStatus::IN_COURSE); $student_career_school_year->setYear($year); $c = new Criteria(); $c->add(StudentCareerSubjectAllowedPeer::STUDENT_ID, $student_career_school_year->getStudentId()); StudentCareerSubjectAllowedPeer::doDelete($c); $c = new Criteria(); $c->add(CareerStudentPeer::STUDENT_ID, $student_career_school_year->getStudentId()); $career_student = CareerStudentPeer::doSelectOne($c); $career_student->createStudentsCareerSubjectAlloweds($year, $con); $student_career_school_year->save($con); } } /* $career_school_year = CareerSchoolYearPeer::retrieveByPk(2); $student_career_school_years = StudentCareerSchoolYearPeer::doSelect(StudentCareerSchoolYearPeer::retrieveLastYearRepprovedStudentCriteria($career_school_year)); foreach ($student_career_school_years as $student_career_school_year) { $student = $student_career_school_year->getStudent(); die(var_dump($student)); } */ }
?> </strong> <em><?php echo $student_career_school_year->getStatusString(); ?> </em> </div> <?php $career_school_year = $student_career_school_year->getCareerSchoolYear(); ?> <?php $course_subject_students = $student_career_school_year->getCourses(); ?> <?php $career_student = CareerStudentPeer::retrieveByCareerAndStudent($career_school_year->getCareerId(), $student->getId()); ?> <?php $back_url = isset($back_url) ? $back_url : ''; ?> <?php isset($course_subject_students['ANUAL']) ? include_partial("student/current_course_subjects", array("course_subject_students" => $course_subject_students['ANUAL'], 'career_student' => $career_student, 'back_url' => $back_url, 'student' => $student, 'course_type' => CourseType::TRIMESTER)) : ''; ?> <?php isset($course_subject_students['QUATERLY']) ? include_partial("student/current_course_subjects", array("course_subject_students" => $course_subject_students['QUATERLY'], 'career_student' => $career_student, 'back_url' => $back_url, 'student' => $student, 'course_type' => CourseType::QUATERLY)) : ''; ?>
protected function doSave($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (is_null($con)) { $con = $this->getConnection(); } // Delete only the subjects off the selected career $c = new Criteria(); $c->add(StudentCareerSubjectAllowedPeer::STUDENT_ID, $this->object->getPrimaryKey()); // added: $subc = new Criteria(); $subc->clearSelectColumns(); $subc->addSelectColumn(CareerSubjectPeer::ID); $subc->add(CareerSubjectPeer::CAREER_ID, $this->getValue("career_id")); $stmt = CareerSubjectPeer::doSelectStmt($subc); $ids = $stmt->fetchAll(PDO::FETCH_COLUMN); $c->add(StudentCareerSubjectAllowedPeer::CAREER_SUBJECT_ID, $ids, Criteria::IN); $allowed = StudentCareerSubjectAllowedPeer::doSelectOne($c, $con); if ($allowed) { // Se consulta si el alumno esta en trayectorias antes de eliminarlo $student_id = $this->object->getPrimaryKey(); $criteria = new Criteria(); $criteria->add(PathwayStudentPeer::STUDENT_ID, $student_id); $pathway = PathwayStudentPeer::doSelectOne($criteria, $con); if (!$pathway) { StudentCareerSubjectAllowedPeer::doDelete($c, $con); } } $year = $this->getValue('year'); $career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear(CareerPeer::retrieveByPK($this->getValue('career_id')), SchoolYearPeer::retrieveCurrent()); //First update the year at student_career_school_year // var_dump($career_school_year);die(); $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($this->getObject(), $career_school_year); // if (!$student_career_school_year) // { // $student_career_school_year = new StudentCareerSchoolYear(); // $student_career_school_year->setCareerSchoolYear($career_school_year); // $student_career_school_year->setStudent($this->getObject()); // $student_career_school_year->save(); // } $career_student = CareerStudentPeer::retrieveByCareerAndStudent($this->getValue('career_id'), $this->getObject()->getId()); try { $con->beginTransaction(); $student_career_school_year->setYear($year); $student_career_school_year->save($con); $c = new Criteria(); $c->add(CareerSubjectPeer::CAREER_ID, $this->getValue('career_id')); $c->add(CareerSubjectPeer::YEAR, $year); foreach (CareerSubjectPeer::doSelect($c) as $career_subject) { $obj = new StudentCareerSubjectAllowed(); $obj->setStudentId($this->object->getPrimaryKey()); $obj->setCareerSubject($career_subject); $obj->save($con); } $prev_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($career_school_year->getSchoolYear()); if ($prev_school_year) { $prev_student_career_school_year = StudentCareerSchoolYearPeer::retrieveCareerSchoolYearForStudentAndYear($this->getObject(), $prev_school_year); } if (!empty($prev_student_career_school_year)) { $prev_student_career_school_year = array_shift($prev_student_career_school_year); if ($year <= $prev_student_career_school_year->getYear()) { $prev_student_career_school_year->setStatus(StudentCareerSchoolYearStatus::REPPROVED); $prev_student_career_school_year->save($con); } } $con->commit(); } catch (PropelException $e) { $con->rollBack(); throw $e; } }
private function generateGeneralReports($career_school_years) { $student_reports_by_career = array(); $filters = array('school_year' => $this->school_year->getId()); $student_reports = array($this->generateReportArray('Estudiantes matriculados', $this->school_year->countSchoolYearStudents(null, false), $filters)); if (!is_null($last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->school_year))) { $total = bcsub($this->school_year->countSchoolYearStudents(null, true), $last_year_school_year->countSchoolYearStudents(), 0); $filters['is_entrant'] = true; $student_reports[] = $this->generateReportArray('Ingresantes con respecto al año lectivo anterior', $total, $filters); } $filters = array('school_year' => $this->school_year->getId(), 'has_disciplinary_sanctions' => true); $disciplinary_sanctions = StudentDisciplinarySanctionPeer::countStudentDisciplinarySanctionsForSchoolYear($this->school_year); $student_reports[] = $this->generateReportArray('Estudiantes con sanciones disciplinarias', $disciplinary_sanctions, $filters); $student_reports_by_career['For school year'] = $student_reports; foreach ($career_school_years as $csy) { $student_reports = array(); $filters = array('career_school_year' => $csy->getId()); $student_reports[] = $this->generateReportArray('Estudiantes inscriptos', $csy->countStudentCareerSchoolYears(null, true), $filters); //Total no inscriptos en la carrera $not_inscripted_in_csy = $csy->countNotMatriculatedStudents(); if ($not_inscripted_in_csy < 0) { $not_inscripted_in_csy = 0; } $student_reports[] = $this->generateReportArray('Estudiantes no inscriptos', $not_inscripted_in_csy, null); //Total graduated students for career $filters['is_graduated'] = true; $student_reports[] = $this->generateReportArray('Estudiantes graduados', CareerStudentPeer::doCountGraduatedForCareerSchoolYear($csy), $filters); $student_reports_by_career['Carrera: ' . $csy->getCareer()->getCareerName()] = $student_reports; } return $student_reports_by_career; }
* * Kimkëlen is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kimkëlen. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>. */ use_helper('I18N', 'Object', 'Form'); include_partial('career/assets'); ?> <?php $career = CareerPeer::RetrieveByPk($sf_user->getAttribute('career_id')); $students = CareerStudentPeer::retrieveStudentsForCareer($sf_user->getAttribute('career_id')); ?> <div id="sf_admin_container"> <div class="career_view_title"> <h1><?php echo $career->getCareerName() . ' | ' . $career->getPlanName(); ?> </h1> <h2><?php echo __('Alumnos Inscriptos'); ?> :</h2> <table class="sf_career_table"> <thead> <tr>