Пример #1
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]');
 }
Пример #2
0
 public function configure()
 {
     $years = range(1920, date('Y'));
     $this->setWidgets(array('passwordNew' => new sfWidgetFormInputText(array('type' => 'password')), 'password_again' => new sfWidgetFormInputText(array('type' => 'password'))));
     $this->widgetSchema->setNameFormat('changer[%s]');
     $this->widgetSchema->setLabels(array('passwordNew' => sfContext::getInstance()->getI18N()->__('Password', array(), 'notices'), 'password_again' => sfContext::getInstance()->getI18N()->__('Password (otra vez)', array(), 'notices')));
     $this->setValidators(array('passwordNew' => new sfValidatorPassword(array('required' => true), sfVoForm::getStringMessages()), 'password_again' => new sfValidatorPassword(array('required' => true), sfVoForm::getStringMessages())));
     $this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare('passwordNew', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), sfVoForm::getCompareMessages()));
 }
Пример #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()
 {
     unset($this['sumu'], $this['sumd'], $this['created_at'], $this['modified_at'], $this['id'], $this['vanity']);
     $this->setWidgets(array('op' => new sfWidgetFormInputHidden(), 'titulo' => new sfWidgetFormInputHidden(array()), 'descripcion' => new sfWidgetFormInputHidden(array()), 'imagen' => new sfWidgetFormInputHidden(array()), 'doc' => new sfWidgetFormInputHidden(array()), 'culture' => new sfWidgetFormInputHidden(array())));
     $this->widgetSchema->setNameFormat('propuesta[%s]');
     $this->setValidators(array('titulo' => new sfValidatorString(array("min_length" => SfVoUtil::VANITY_MIN_LENGTH, 'required' => true), sfVoForm::getStringMessages()), 'descripcion' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages()), 'vanity' => new sfValidatorString(array('required' => true)), 'sf_guard_user_id' => new sfValidatorInteger(array('required' => true)), 'imagen' => new sfValidatorString(array('required' => false)), 'doc' => new sfValidatorString(array('required' => false)), 'culture' => new sfValidatorString(array('required' => false))));
     // Vacíos
     $idx = 0;
     while ($idx < 5) {
         $idx++;
         // create a new enlace form for a new enlace model object
         $enlaceForm = new PropuestaEnlaceForm();
         // embed the enlace form in the main politico form
         $this->embedForm("enlace_n{$idx}", $enlaceForm);
         $this->widgetSchema["enlace_n{$idx}"]['orden'] = new sfWidgetFormInputHidden();
         $this->widgetSchema["enlace_n{$idx}"]['url'] = new sfWidgetFormInputHidden();
     }
 }
Пример #6
0
 public function configure()
 {
     unset($this['id'], $this['vanity']);
     $this->setWidgets(array('op' => new sfWidgetFormInputHidden(), 'titulo' => new sfWidgetFormTextArea(array()), 'descripcion' => new sfWidgetFormTextArea(array(), array('rows' => 20, 'cols' => 30)), 'imagen' => new sfWidgetFormInputFileEditable(array('label' => sfContext::getInstance()->getI18N()->__('Imagen', array(), 'notices'), 'file_src' => $this->getObject() ? '' . S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $this->getObject()->getImagen() : '', 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div>' . ($this->getObject()->getImagen() ? '<p><img src="%file%" alt="' . $this->getObject()->getTitulo() . '" /> %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>')), 'doc' => new sfWidgetFormInputFileEditable(array('label' => sfContext::getInstance()->getI18N()->__('Imagen', array(), 'notices'), 'file_src' => $this->getObject() ? '' . S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $this->getObject()->getDoc() : '', 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div>' . ($this->getObject()->getImagen() ? '<p>' . $this->getObject()->getTitulo() . ' %delete% <label for="profile_imagen_delete">' . sfContext::getInstance()->getI18N()->__('Eliminar documento actual', array(), 'notices') . '</label></p>' : '') . '%input% <span class="hints">' . sfContext::getInstance()->getI18N()->__('(opcional)') . '</span></div>'))));
     $this->widgetSchema->setNameFormat('propuesta[%s]');
     $this->widgetSchema->setLabels(array('titulo' => sfContext::getInstance()->getI18N()->__('Título', array(), 'notices'), 'descripcion' => sfContext::getInstance()->getI18N()->__('Descripción', array(), 'notices')));
     $this->setValidators(array('titulo' => new sfValidatorString(array("min_length" => SfVoUtil::VANITY_MIN_LENGTH, 'required' => true), sfVoForm::getStringMessages()), 'descripcion' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages()), 'vanity' => new sfValidatorString(array('required' => true)), 'sf_guard_user_id' => new sfValidatorInteger(array('required' => true)), 'imagen' => new sfValidatorFile(array('required' => false, 'max_size' => '512000', 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir') . '/propuestas', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages("500K")), 'doc' => new sfValidatorFile(array('required' => false, 'max_size' => '2048000', 'path' => sfConfig::get('sf_upload_dir') . '/docs', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages("2M"))));
     $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorPropelUnique(array('model' => 'Propuesta', 'column' => array('vanity')), sfVoForm::getUniqueMessages()), new sfValidatorPropelUnique(array('model' => 'Propuesta', 'column' => array('titulo')), sfVoForm::getUniqueMessages()))));
     // Vacíos
     $idx = 0;
     while ($idx < 5) {
         $idx++;
         // create a new enlace form for a new enlace model object
         $enlaceForm = new PropuestaEnlaceForm();
         // 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');
     }
 }
Пример #7
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');
         }
     }
 }
Пример #8
0
 public function configure()
 {
     $this->setWidgets(array('mensaje' => new sfWidgetFormTextarea(array())));
     $this->widgetSchema->setNameFormat('contact[%s]');
     $this->setValidators(array('mensaje' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages())));
 }
Пример #9
0
 public function configure()
 {
     $this->setWidgets(array('q' => new sfWidgetFormInputText(array())));
     $this->widgetSchema->setNameFormat('search[%s]');
     $this->setValidators(array('q' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages())));
 }