예제 #1
0
 public function configure()
 {
     $this->setWidgets(array('username' => new sfWidgetFormInputText(array())));
     $this->widgetSchema->setNameFormat('reminder[%s]');
     $this->widgetSchema->setLabels(array('username' => 'Email'));
     $this->setValidators(array('username' => new sfValidatorEmail(array('required' => true), sfVoForm::getEmailMessages())));
 }
예제 #2
0
 public function configure()
 {
     $this->setWidgets(array('username' => new sfWidgetFormInputText(array()), 'password' => new sfWidgetFormInputText(array('type' => 'password')), 'remember' => new sfWidgetFormInputCheckbox(array(), array())));
     $this->widgetSchema->setLabels(array('username' => 'Email', 'password' => sfContext::getInstance()->getI18N()->__('Password', array(), 'notices'), 'remember' => sfContext::getInstance()->getI18N()->__('Recordar', array(), 'notices')));
     $this->setValidators(array('username' => new sfValidatorEmail(array('required' => true), sfVoForm::getEmailMessages()), 'password' => new sfValidatorPassword(array('required' => true), sfVoForm::getStringMessages()), 'remember' => new sfValidatorBoolean()));
     //$this->validatorSchema->setPostValidator(new sfGuardValidatorUser(array(), sfVoForm::getUserMessages()));
     $this->widgetSchema->setNameFormat('signin[%s]');
 }
예제 #3
0
 public function configure()
 {
     if (!$this->mensajeWidget) {
         $this->mensajeWidget = new sfWidgetFormTextarea(array());
     }
     $this->setWidgets(array('nombre' => new sfWidgetFormInputText(array()), 'email' => new sfWidgetFormInputText(array()), 'tipo' => new sfWidgetFormSelect(array('choices' => self::$tipos)), 'mensaje' => $this->mensajeWidget));
     $this->widgetSchema->setNameFormat('contact[%s]');
     $this->setValidators(array('nombre' => new sfValidatorString(array('required' => false), sfVoForm::getStringMessages()), 'email' => new sfValidatorEmail(array('required' => true), sfVoForm::getEmailMessages()), 'tipo' => new sfValidatorString(array('required' => false), sfVoForm::getStringMessages()), 'mensaje' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages())));
 }
예제 #4
0
 public function configure()
 {
     $this->setWidgets(array('op' => new sfWidgetFormInputHidden(), 'username' => new sfWidgetFormInputText(array()), 'nombre' => new sfWidgetFormInputText(array()), 'anonymous' => new sfWidgetFormInputCheckbox(array(), array()), 'apellidos' => new sfWidgetFormInputText(array()), 'password' => new sfWidgetFormInputText(array('type' => 'password')), 'accept' => new sfWidgetFormInputCheckbox(array(), array())));
     $this->widgetSchema->setNameFormat('registration[%s]');
     $this->widgetSchema->setLabels(array('username' => 'Email', 'nombre' => sfContext::getInstance()->getI18N()->__('Nombre', array(), 'notices'), 'apellidos' => sfContext::getInstance()->getI18N()->__('Apellidos', array(), 'notices'), 'password' => sfContext::getInstance()->getI18N()->__('Password', array(), 'notices')));
     $this->setValidators(array('op' => new sfValidatorString(array('required' => false)), 'username' => new sfValidatorEmail(array('required' => true), sfVoForm::getEmailMessages()), 'nombre' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages()), 'anonymous' => new sfValidatorString(array('required' => false), sfVoForm::getStringMessages()), 'accept' => new sfValidatorBoolean(array('required' => true), sfVoForm::getRequiredMessages()), 'apellidos' => new sfValidatorString(array('required' => false), sfVoForm::getStringMessages()), 'password' => new sfValidatorPassword(array('required' => true), sfVoForm::getStringMessages()), 'accept' => new sfValidatorBoolean(array('required' => true), sfVoForm::getRequiredMessages())));
     //$this->validatorSchema->setPostValidator(new sfValidatorPropelUnique(array('model'=>'sfGuardUser', 'column'=>array('username'))));
     $this->validatorSchema->setPostValidator(new sfValidatorPropelUnique(array('model' => 'sfGuardUser', 'column' => array('username')), sfVoForm::getUniqueEmailMessages()));
 }
예제 #5
0
 public function configure()
 {
     $years = range(1920, date('Y'));
     $this->setWidgets(array('fecha_nacimiento' => new sfWidgetFormDate(array('format' => '%day%/%month%/%year%', 'years' => array_combine($years, $years))), 'vanity' => new sfWidgetFormInputText(array()), 'imagen' => new sfWidgetFormInputFileEditable(array('label' => sfContext::getInstance()->getI18N()->__('Imagen Principal', array(), 'notices'), 'file_src' => $this->getObject()->getProfile()->getImagen() ? '' . S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $this->getObject()->getProfile()->getImagen() : '', 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div>' . ($this->getObject()->getProfile()->getImagen() ? '<p><img src="%file%" alt="' . $this->getObject()->getProfile()->getNombre() . ' ' . $this->getObject()->getProfile()->getApellidos() . '" /> %delete% <label for="profile_imagen_delete">' . sfContext::getInstance()->getI18N()->__('Eliminar imagen actual', array(), 'notices') . '</label></p>' : '') . '%input% <span class="hints">' . sfContext::getInstance()->getI18N()->__('(opcional)') . '</span></div>')), 'username' => new sfWidgetFormInputText(array()), 'mails_comentarios' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'mails_noticias' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'mails_contacto' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'mails_seguidor' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'fb_publish_votos' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'fb_publish_votos_otros' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'fb_publish_cambios_perfil' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'tw_publish_votos' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'tw_publish_votos_otros' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'tw_publish_cambios_perfil' => new sfWidgetVoFormInputCheckbox(array('value_attribute_value' => '1')), 'nombre' => new sfWidgetFormInputText(array()), 'apellidos' => new sfWidgetFormInputText(array()), 'anonymous' => new sfWidgetFormInputCheckbox(array(), array()), 'presentacion' => new sfWidgetFormTextarea(array()), 'passwordNew' => new sfWidgetFormInputText(array('type' => 'password')), 'passwordBis' => new sfWidgetFormInputText(array('type' => 'password')), 'passwordOld' => new sfWidgetFormInputText(array('type' => 'password'))));
     $this->widgetSchema->setNameFormat('profile[%s]');
     $this->setValidators(array('fecha_nacimiento' => new sfValidatorDate(array('required' => false), sfVoForm::getDateMessages()), 'vanity' => new sfValidatorString(array("min_length" => SfVoUtil::VANITY_MIN_LENGTH, 'required' => true), sfVoForm::getStringMessages()), 'imagen' => new sfValidatorFile(array('required' => false, 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir') . '/usuarios', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages()), 'imagen_delete' => new sfValidatorString(array('required' => false)), 'username' => new sfValidatorEmail(array('required' => true), sfVoForm::getEmailMessages()), 'mails_comentarios' => new sfValidatorBoolean(), 'mails_noticias' => new sfValidatorBoolean(), 'mails_contacto' => new sfValidatorBoolean(), 'mails_seguidor' => new sfValidatorBoolean(), 'fb_publish_votos' => new sfValidatorBoolean(), 'fb_publish_votos_otros' => new sfValidatorBoolean(), 'fb_publish_cambios_perfil' => new sfValidatorBoolean(), 'tw_publish_votos' => new sfValidatorBoolean(), 'tw_publish_votos_otros' => new sfValidatorBoolean(), 'tw_publish_cambios_perfil' => new sfValidatorBoolean(), 'nombre' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages()), 'apellidos' => new sfValidatorString(array('required' => false)), 'anonymous' => new sfValidatorString(array('required' => false), sfVoForm::getStringMessages()), 'presentacion' => new sfValidatorStringCut(array("max_length" => 280, 'required' => false), sfVoForm::getStringMessages()), 'passwordNew' => new sfValidatorPassword(array('required' => false), sfVoForm::getStringMessages()), 'passwordBis' => new sfValidatorPassword(array('required' => false), sfVoForm::getStringMessages()), 'passwordOld' => new sfValidatorPasswordValid(array('required' => false), sfVoForm::getPasswordMessages())));
     $uniqValidator = new sfValidatorAnd(array(new sfValidatorPropelUniqueUpdater(array('model' => 'sfGuardUser', 'column' => array('username')), sfVoForm::getUniqueMessages()), new sfValidatorPropelUniqueUpdater(array('model' => 'sfGuardUserProfile', 'column' => array('vanity')), sfVoForm::getUniqueMessages())));
     $postValidator = new sfValidatorAnd(array(new sfValidatorAnd(array($uniqValidator, new sfValidatorSchemaCompare('passwordNew', sfValidatorSchemaCompare::EQUAL, 'passwordBis', array(), sfVoForm::getCompareMessages()))), new sfValidatorRequiredIfField('passwordOld', 'passwordNew', array(), sfVoForm::getRequiredMessages())));
     $this->validatorSchema->setPostValidator($postValidator);
     if (!$this->isNew()) {
         // embed all enlace forms
         $idx = 0;
         foreach ($this->getObject()->getEnlaces() as $enlace) {
             $idx++;
             // create a new enlace form for the current enlace model object
             $enlaceForm = new UsuarioEnlaceForm($enlace);
             // embed the enlace form in the main politico form
             $this->embedForm("enlace_n{$idx}", $enlaceForm);
             // set a custom label for the embedded form
             $this->widgetSchema["enlace_n{$idx}"]->setLabel('Enlace ' . $enlace->getId());
             // change the name widget to sfWidgetFormInputDelete
             $this->widgetSchema["enlace_n{$idx}"]['url'] = new sfWidgetFormInputText(array());
             $this->widgetSchema["enlace_n{$idx}"]['orden'] = new sfWidgetFormInputHidden();
         }
         // Vacíos
         while ($idx < 5) {
             $idx++;
             // create a new enlace form for a new enlace model object
             $enlaceForm = new UsuarioEnlaceForm();
             // embed the enlace form in the main politico form
             $this->embedForm("enlace_n{$idx}", $enlaceForm);
             $this->widgetSchema["enlace_n{$idx}"]['orden'] = new sfWidgetFormInputHidden();
             // set a custom label for the embedded form
             $this->widgetSchema["enlace_n{$idx}"]->setLabel('Nuevo enlace');
         }
     }
 }