예제 #1
0
 public function configure()
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N', 'Url'));
     $this->setWidget('student_id', new sfWidgetFormInputHidden());
     $this->setWidget('is_free', new sfWidgetFormInputHidden());
     $this->getWidget('career_school_year_id')->setOption('criteria', CareerSchoolYearPeer::retrieveCurrentForStudentCriteria($this->getObject()->getStudent()));
     #widget de periodos
     $w = new sfWidgetFormPropelChoice(array('model' => 'CareerSchoolYearPeriod', 'add_empty' => true));
     $this->setWidget('career_school_year_period_id', new dcWidgetAjaxDependence(array('dependant_widget' => $w, 'observe_widget_id' => 'student_free_career_school_year_id', "message_with_no_value" => "Seleccione una carrera y apareceran los periodos que correspondan", 'get_observed_value_callback' => array(get_class($this), 'getPeriods'))));
     $this->getWidgetSchema()->moveField('career_school_year_period_id', 'after', 'career_school_year_id');
     $this->getWidget('career_school_year_period_id')->setLabel('Periodo');
     $this->getWidgetSchema()->setHelp('career_school_year_period_id', 'Elegir en caso de que quede libre para un período en especial.');
     $this->getWidget('course_subject_id')->setOption('criteria', $this->getCourseSubjectCriteria());
     $this->getWidget('course_subject_id')->setLabel('Course subject');
     $this->getWidgetSchema()->setHelp('course_subject_id', 'Elegir curso en caso de que quede libre para un curso en especial.');
     if ($this->getObject()->isNew()) {
         $this->getValidatorSchema()->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateUnique'))));
     }
 }