public function configure() { $this->unsetFields(); $this->setWidget('student', new sfWidgetFormFilterInput(array('with_empty' => false))); $this->setValidator('student', new sfValidatorPass(array('required' => false))); $this->getWidgetSchema()->setHelp('student', 'Filtra por apellido o por número de documento'); $sy_criteria = new Criteria(SchoolYearPeer::DATABASE_NAME); $sy_criteria->addAscendingOrderByColumn(SchoolYearPeer::YEAR); $this->setWidget('school_year', new sfWidgetFormPropelChoice(array('model' => 'SchoolYear', 'criteria' => $sy_criteria, 'add_empty' => true))); $this->setValidator('school_year', new sfValidatorPropelChoice(array('model' => 'SchoolYear', 'criteria' => new Criteria(SchoolYearPeer::DATABASE_NAME), 'required' => false))); $max = CareerPeer::getMaxYear(); $years = array('' => ''); for ($i = 1; $i <= $max; $i++) { $years[$i] = $i; } $this->setWidget('year', new sfWidgetFormChoice(array('choices' => $years))); $this->setValidator('year', new sfValidatorChoice(array('choices' => array_keys($years), 'required' => false))); $this->getWidgetSchema()->setHelp('year', 'El año filtra de acuerdo al año lectivo elegido.'); $user_criteria = $this->getDivisionCriteriaForUser(sfContext::getInstance()->getUser()); $this->setWidget('division', new sfWidgetFormPropelChoice(array('model' => 'Division', 'criteria' => $user_criteria, 'add_empty' => true))); $this->setValidator('division', new sfValidatorPropelChoice(array('model' => 'Division', 'criteria' => $user_criteria, 'required' => false))); $this->widgetSchema->setHelp('division', 'Filtra por la división actual del alumno.'); $this->setWidget('is_matriculated', new sfWidgetFormChoice(array('choices' => array('' => 'si o no', 1 => 'si', 0 => 'no')))); $this->setValidator('is_matriculated', new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)))); $this->setWidget('is_inscripted_in_career', new sfWidgetFormChoice(array('choices' => array('' => 'si o no', 1 => 'si', 0 => 'no')))); $this->setValidator('is_inscripted_in_career', new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)))); $this->setWidget('is_free_in_some_period', new sfWidgetFormChoice(array('choices' => array('' => 'si o no', 1 => 'si', 0 => 'no')))); $this->setValidator('is_free_in_some_period', new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)))); $this->getWidgetSchema()->setLabel('is_free_in_some_period', 'Is free in some career school year period?'); $status = StudentCareerSchoolYearStatus::getInstance('StudentCareerSchoolYearStatus'); $this->setWidget('status', new sfWidgetFormChoice(array('choices' => $status->getOptions(true)))); $this->setValidator('status', new sfValidatorChoice(array('choices' => $status->getKeys(), 'required' => false))); $this->widgetSchema->setHelp('status', 'This status is the status of the student in the current school year.'); $this->getWidgetSchema()->setLabel('status', 'Current status'); $this->setWidget('is_graduated', new sfWidgetFormInputCheckbox()); $this->setValidator('is_graduated', new sfValidatorBoolean()); $this->widgetSchema->setHelp('is_graduated', 'If is checked, then will show only students graduated in some career in selected school year.'); $this->setWidget('disciplinary_sanction_count', new sfWidgetFormInput()); $this->setValidator('disciplinary_sanction_count', new sfValidatorNumber(array('required' => false))); $this->widgetSchema->setHelp('disciplinary_sanction_count', 'Students that have more or equal to disciplinary sanctions in current school year.'); $this->setWidget('health_info', new sfWidgetFormChoice(array('choices' => BaseCustomOptionsHolder::getInstance('HealthInfoStatus')->getOptions(true)))); $this->setValidator('health_info', new sfValidatorChoice(array('choices' => BaseCustomOptionsHolder::getInstance('HealthInfoStatus')->getKeys(), 'required' => false))); }
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); } }
<h2>Mesa de exámen: <?php echo $examination; ?> </h2> <ul> <div class="info-box"> <div class="info-box-title"> <strong><?php echo link_to_function(__("Create examinations"), "jQuery('#not_created_examination_subjects').toggle();"); ?> </strong> </div> <div class="info-box-collapsable" style="display: block" id="not_created_examination_subjects" > <?php for ($i = 1; $i <= CareerPeer::getMaxYear(); $i++) { ?> <?php if ($examination->countExaminationSubjectsForYear($i) == 0) { ?> <li><?php echo link_to(__("Create examination subjects for %year%° year", array('%year%' => $i)), 'examination/createExaminationSubjects?year=' . $i . '&id=' . $examination->getId()); ?> </li> <?php } ?> <?php } ?> </div>