Author: Fabien Potencier (fabien.potencier@symfony-project.com)
Inheritance: extends sfForm
Ejemplo n.º 1
0
 public function save($conn = null)
 {
     parent::save();
     $OR = $this->getObject();
     if (!is_null($this['Categories']->getValue())) {
         $OR->setCategories(implode('@', $this['Categories']->getValue()));
     }
     $BASE = sfConfig::get('sf_web_dir') . '/' . $this->WEB_IMATGE;
     if ($OR instanceof Activitats) {
         $I = $OR->getImatge();
         if (!empty($I) && file_exists($BASE . $I)) {
             $img = new sfImage($BASE . $I, 'image/jpg');
             $img->resize(150, 150);
             $nom = $OR->getActivitatid() . '.jpg';
             $img->saveAs($BASE . $nom);
             if ($I != $nom) {
                 unlink($BASE . $I);
             }
             $OR->setImatge($nom);
         }
         $P = $OR->getPdf();
         if (!empty($P) && file_exists($BASE . $P)) {
             $nom = $OR->getActivitatid() . '.pdf';
             rename($BASE . $P, $BASE . $nom);
             if ($I != $nom) {
                 unlink($BASE . $P);
             }
             $OR->setPdf($nom);
         }
     }
     $OR->save();
 }
Ejemplo n.º 2
0
 public function setup()
 {
     $this->setWidgets(array('usuari_id' => new sfWidgetFormInputHidden(), 'app_id' => new sfWidgetFormChoice(array('choices' => AppsPeer::select())), 'nivell_id' => new sfWidgetFormChoice(array('choices' => NivellsPeer::getSelect()))));
     $this->setValidators(array('usuari_id' => new sfValidatorPropelChoice(array('model' => 'Usuaris', 'column' => 'UsuariID', 'required' => false)), 'app_id' => new sfValidatorPropelChoice(array('model' => 'Apps', 'column' => 'app_id', 'required' => false)), 'nivell_id' => new sfValidatorPropelChoice(array('model' => 'Nivells', 'column' => 'idNivells', 'required' => false))));
     $this->widgetSchema->setNameFormat('usuaris_apps[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
     parent::setup();
 }
Ejemplo n.º 3
0
 public function setup()
 {
     $this->setWidgets(array('idLlistes' => new sfWidgetFormInputHidden(), 'Nom' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'isActiva' => new sfWidgetFormChoice(array('choices' => array(true => 'Sí', false => 'No')))));
     $this->setValidators(array('idLlistes' => new sfValidatorPropelChoice(array('model' => 'Llistes', 'column' => 'idLlistes', 'required' => false)), 'Nom' => new sfValidatorString(), 'isActiva' => new sfValidatorBoolean()));
     $this->widgetSchema->setNameFormat('llistes[%s]');
     $this->widgetSchema->setLabels(array('Nom' => 'Nom: ', 'isActiva' => 'Està activa? '));
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
     parent::setup();
 }
Ejemplo n.º 4
0
 public function save($conn = null)
 {
     parent::save($conn);
     $OI = $this->getObject();
     $DR = $OI->getDataresolucio();
     if ($OI->getEstat() == IncidenciesPeer::ESTAT_RESOLT && is_null($DR)) {
         $OI->setDataresolucio(date('Y-m-d', time()));
     }
     $OI->save();
 }
 public function updateDefaultsFromObject()
 {
     parent::updateDefaultsFromObject();
     if (isset($this->widgetSchema['course_subject_student_list'])) {
         $values = array();
         foreach ($this->object->getCourseSubjectStudents() as $course_subject_student) {
             $values[] = $course_subject_student->getStudentId();
         }
         $this->setDefault('course_subject_student_list', $values);
     }
 }
Ejemplo n.º 6
0
 public function save($conn = null)
 {
     $OPromocions = $this->getObject();
     PromocionsPeer::gestionaOrdre($this->getValue('Ordre'), $OPromocions->getOrdre(), $this->getOption('IDS'));
     parent::save();
     $nom = $OPromocions->getExtensio();
     if (!empty($nom)) {
         $img = new sfImage($this->URL . $nom, 'image/jpg');
         $img->resize(171, 63)->saveAs($this->URL . $nom);
     }
 }
 public function configure()
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N'));
     //Set the formatter to the form
     $sf_formatter_revisited = new sfWidgetFormSchemaFormatterRevisited($this);
     $this->getWidgetSchema()->addFormFormatter('Revisited', $sf_formatter_revisited);
     $this->getWidgetSchema()->setFormFormatterName('Revisited');
     $this->setDefault('id', $this->getObject()->getId());
     $this->setWidget('id', new sfWidgetFormInputHidden());
     $this->setValidator('id', new sfValidatorPropelChoice(array('model' => 'CourseSubjectStudent', 'required' => 'true')));
     $this->mark_fields = $this->configureMarks();
     $this->close_field = $this->configureCloseCourse();
     $this->examination_fields = $this->configureExaminationSubjects();
     $this->student_approved_career_subject = $this->configureStudentApprovedCareerSubject();
     //$this->repproved_course_subjects = $this->configureRepprovedCourseSubjects();
     $this->getWidgetSchema()->setNameFormat('course_subject_student[%s]');
     parent::configure();
 }
Ejemplo n.º 8
0
 /**
  * Override sfFormDoctrine to prepare the
  * values: FORMNAME-FIELDNAME has to be transformed
  * to FORMNAME[FIELDNAME]
  */
 public function updateObject($values = null)
 {
     if (is_null($values)) {
         $values = $this->values;
         foreach ($this->embeddedForms as $name => $form) {
             foreach ($form as $field => $f) {
                 if (isset($values["{$name}-{$field}"])) {
                     // Re-rename the form field and remove
                     // the original field
                     $values[$name][$field] = $values["{$name}-{$field}"];
                     unset($values["{$name}-{$field}"]);
                 }
             }
         }
     }
     // Give the request to the original method
     parent::updateObject($values);
 }
 protected function doSave($con = null)
 {
     parent::doSave($con);
     $this->saveDivisionStudentList($con);
 }
Ejemplo n.º 10
0
 public function save($conn = null)
 {
     $ONodes = $this->getObject();
     NodesPeer::gestionaOrdre($this->getValue('Ordre'), $ONodes->getOrdre(), $this->getOption('IDS'));
     parent::save();
 }
 protected function doSave($con = null)
 {
     parent::doSave($con);
     $this->saveOptionCareerSubjectList($con);
 }
 public function setup()
 {
     parent::setup();
 }
 protected function doSave($con = null)
 {
     parent::doSave($con);
     $this->saveExaminationSubjectStudentList($con);
 }
 protected function doSave($con = null)
 {
     parent::doSave($con);
     $this->saveDivisionPreceptorList($con);
 }
Ejemplo n.º 15
0
 protected function doSave($con = null)
 {
     parent::doSave($con);
     $this->saveStudentBrotherList($con);
 }