public function setCareerSubjectSchoolYearsIds($career_subject_school_years_ids) { foreach ($career_subject_school_years_ids as $career_subject_school_year_id) { $career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByPK($career_subject_school_year_id); $this->setWidget("career_subject_school_year_{$career_subject_school_year_id}", new mtWidgetFormPlain(array("object" => $career_subject_school_year, "add_hidden_input" => true, "use_retrieved_value" => false))); $this->setValidator("career_subject_school_year_{$career_subject_school_year_id}", new sfValidatorPropelChoice(array("model" => "CareerSubjectSchoolYear", "required" => true))); $this->setDefault("career_subject_school_year_{$career_subject_school_year_id}", $career_subject_school_year_id); $this->widgetSchema->setLabel("career_subject_school_year_{$career_subject_school_year_id}", "Subject"); $this->widgetSchema->moveField("career_subject_school_year_{$career_subject_school_year_id}", "before", "course_minimun_mark"); $this->widgetSchema->moveField("career_subject_school_year_{$career_subject_school_year_id}", "before", "course_marks"); } }
protected function doSave($con = null) { $con = is_null($con) ? Propel::getConnection() : $con; $values = $this->getValues(); $value = $values['subject']; if ($value) { try { $con->beginTransaction(); $career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByPK($value); $career_subject_school_year->createCourseSubject($this->getObject()); $con->commit(); } catch (Exception $e) { throw $e; $con->rollBack(); } } }
public function executeUpdateConfiguration(sfWebRequest $request) { $this->career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByPK($request->getParameter('id')); if (null === $this->career_school_year) { $this->getUser()->setFlash('error', 'Debe seleccionar una carrera para editar su configuracion'); $this->redirect('@career_school_year'); } $subject_configuration = $this->career_subject_school_year->getSubjectConfigurationOrCreate(); $this->career_subject_school_year->setSubjectConfiguration($subject_configuration); $parameters = $request->getPostParameters(); $parameter = $parameters["subject_configuration"]; if ($this->career_subject_school_year->hasChoices()) { $course_subjects = array(); foreach ($this->career_subject_school_year->getChoices() as $option) { $course_subjects = array_merge($course_subjects, CourseSubjectPeer::retrieveByCareerSubjectSchoolYear($option->getChoiceCareerSubjectSchoolYearId())); } } else { $course_subjects = CourseSubjectPeer::retrieveByCareerSubjectSchoolYear($this->career_subject_school_year->getId()); } //actualización de las notas para los cursos $this->updateCourseMarksConfiguration($parameter, $subject_configuration, $course_subjects); //actualización del tipo de curso para los cursos $this->updateCourseTypeConfiguration($parameter, $subject_configuration, $course_subjects); //actualización del tipo de asistencia para los cursos y las asistencias de los alumnos $this->updateStudentAssistanceConfiguration($parameter, $subject_configuration, $course_subjects); $form_name = SchoolBehaviourFactory::getInstance()->getFormFactory()->getCareerSubjectSchoolYearConfigurationForm(); $this->form = new $form_name($subject_configuration); $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $notice = $this->getProcessFormNotice($this->form->getObject()->isNew()); $subject_configuration = $this->form->save(); $this->getUser()->setFlash('notice', $notice); } else { $this->setProcessFormErrorFlash(); } $this->setTemplate('configuration'); }
public function saveSubject(PropelPDO $con) { if (!isset($this->widgetSchema['subject'])) { // somebody has unset this widget return; } foreach ($this->getObject()->getCourseSubjects() as $course_subject) { $course_subject->delete($con); } $values = $this->getValue('subject'); if ($values) { try { $con->beginTransaction(); foreach ($values as $value) { $career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByPK($value); $career_subject_school_year->createCourseSubject($this->getObject(), $con); } $con->commit(); } catch (Exception $e) { throw $e; $con->rollBack(); } } }
<tr> <th class ="sf_admin_text"> Alumno </th> <th class ="sf_admin_text"> Materia </th> <th class ="sf_admin_text"> Cantidad de inscripciones </th> </tr> </thead> <tbody> <?php foreach ($result as $student_id => $student_whith_errors) { ?> <tr class ="sf_admin_row"> <td class ="sf_admin_text"><?php echo StudentPeer::retrieveByPK($student_id); ?> </td> <td class ="sf_admin_text"><?php echo CareerSubjectSchoolYearPeer::retrieveByPK(key($student_whith_errors)); ?> </td> <td class ="sf_admin_text"><?php echo $student_whith_errors[key($student_whith_errors)]; ?> </td> </tr> <?php } ?> </tbody> </table> </div>
public function getCareerSubjectSchoolYear() { return CareerSubjectSchoolYearPeer::retrieveByPK($this->getCareerSubjectSchoolYearId()); }
public static function retrieveByCareerSubjectSchoolYearId($career_subject_school_year_id) { return CareerSubjectSchoolYearPeer::retrieveByPK($career_subject_school_year_id)->getCareerSubject(); }