/** * This action creates a career for the school_year selected */ public function executeCreateCareer(sfWebRequest $request) { $career = CareerPeer::retrieveByPk($request->getParameter('career_id')); $this->school_year->createCareerSchoolYear($career); $this->getUser()->setFlash('notice', 'Se creo la carrera para el año lectivo'); $this->redirect('@career_school_year'); }
public static function getOrientations($widget, $value) { $career = CareerPeer::retrieveByPk($value); $orientations = array('' => ''); foreach ($career->getOrientations() as $orientation) { $orientations[$orientation->getId()] = $orientation->__toString(); } $widget->setOption("choices", $orientations); }
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 }
public static function getYears($widget, $value) { $career = CareerPeer::retrieveByPk($value); $choices = $career->getYearsForOption(true); $widget->setOption("choices", $choices); }
public static function getYears($widget, $values) { $choices = CareerPeer::retrieveByPk($values)->getYearsForOption(true); $widget->setOption('choices', $choices); }