public function configure() { $this->setWidgets(array( /* 'partner' => new sfWidgetFormInputText(), */ 'message' => new sfWidgetFormTextarea(), /* 'fee' => new sfWidgetFormInputText() */ )); /* $role = new sfWidgetFormChoice(array( 'expanded' => true, 'multiple' => false, 'choices' => array('follower' => 'Follower', 'leader' => 'Leader') )); */ /* $this->widgetSchema['role'] = $role; $this->setValidator('role' , new sfValidatorString(array('required' => true))); $this->setValidators(array( 'fee' => new sfValidatorString(array('required' => true)) )); */ $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); parent::configure(); // $this->addCSRFProtection('flkd445rvvrGV34G'); $this->disableLocalCSRFProtection(); }
public function configure() { parent::configure(); $this->setWidget('username_or_email', new sfWidgetFormInput(array(), array('maxlength' => 100))); $this->setValidator('username_or_email', new sfValidatorOr(array(new sfValidatorAnd(array(new sfValidatorString(array('required' => true, 'trim' => true, 'min_length' => 4, 'max_length' => 16)), new sfValidatorDoctrineChoice(array('model' => 'sfGuardUser', 'column' => 'username'), array("invalid" => "There is no such user.")))), new sfValidatorEmail(array('required' => true))))); $this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]'); }
public function configure() { $this->widgetSchema['query'] = new sfWidgetFormInputText(); $this->validatorSchema['query'] = new sfValidatorString(array('required' => true)); $this->widgetSchema->setLabels(array('query' => 'Запрос')); parent::configure(); }
public function configure() { $this->setWidgets(array( 'studio_id' => new sfWidgetFormDoctrineChoice(array('model' => 'dsStudio', 'add_empty' => false)), 'time' => new sfWidgetFormTime(), 'duration' => new sfWidgetFormInputText(), 'num_lessons' => new sfWidgetFormInputText(), 'start_date' => new sfWidgetFormDate(), 'teachers_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'dsTeacher')), )); // "dateFormat" => 'd.m.yy' $date_options = array( 'culture' => 'de', "change_month" => true, "change_year" => true ); $this->widgetSchema['start_date'] = new MOvEWidgetFormDateJQueryUI( $date_options ); $time_options = array( 'can_be_empty' => true, 'format' => '%hour% : %minute%', 'hours' => array_combine( range(8,23), range(8,23)), 'minutes' => array( 0 => '00', 15 => '15', 30 => '30', 45 => '45', ) ); $this->widgetSchema['time']= new sfWidgetFormTime($time_options); $this->widgetSchema['teachers_list'] ->setOption('renderer_class', 'sfWidgetFormSelectDoubleList' ); $this->setValidators(array( 'studio_id' => new sfValidatorDoctrineChoice(array('model' => 'dsStudio')), 'time' => new sfValidatorTime(array('required' => false)), 'duration' => new sfValidatorInteger(array('required' => false)), 'num_lessons' => new sfValidatorInteger(array('required' => false)), 'start_date' => new sfValidatorDate(array('required' => false)), 'teachers_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'dsTeacher', 'required' => false)), )); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); parent::configure(); $this->widgetSchema->setNameFormat('ds_class_schedule[%s]'); $this->addCSRFProtection('flkd445rvvrGV34G'); }
public function configure() { parent::configure(); $this->setWidget('title', new sfWidgetFormInputText()); $this->setValidator('title', new sfValidatorString(array('min_length' => 2, 'required' => true))); $this->widgetSchema->setNameFormat('a_new_event[%s]'); $this->widgetSchema->setFormFormatterName('aAdmin'); }
public function configure() { parent::configure(); $this->setWidgets(array('email' => new sfWidgetFormInput(), 'password' => new sfWidgetFormInputPassword())); $this->setValidators(array('email' => new sfValidatorEmail(array('required' => true), array('required' => 'El email es obligatorio')), 'password' => new sfValidatorString(array('required' => true), array('required' => 'Escribe tu contraseña')))); $this->widgetSchema->setNameFormat('login[%s]'); $this->widgetSchema->setFormFormatterName('list'); }
public function configure() { parent::configure(); $this->setWidgets(array('email' => new sfWidgetFormInput(), 'password' => new sfWidgetFormInputPassword(), 'password2' => new sfWidgetFormInputPassword())); $this->setValidators(array('email' => new sfValidatorEmail(array('required' => true), array('required' => "El email es obligatorio")), 'password' => new sfValidatorString(array('required' => true), array('required' => "La contraseña es obligatoria")), 'password2' => new sfValidatorString(array('required' => true), array('required' => "La contraseña es obligatoria")))); $this->widgetSchema->setNameFormat('register[%s]'); $this->widgetSchema->setFormFormatterName('list'); $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorSchemaCompare('password2', sfValidatorSchemaCompare::EQUAL, 'password', array('throw_global_error' => true), array('invalid' => "Las dos contraseñas no coinciden")), new sfValidatorDoctrineUnique(array('model' => 'User', 'column' => array('email')), array('invalid' => "Este email ya está en uso"))))); }
public function configure() { parent::configure(); $this->setWidgets(array('cedula' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'validateregex,required', 'data-bvalidator-msg' => 'Indique su cedula de indentidad en formato V-000000')), 'producto' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'digit', 'data-bvalidator-msg' => 'Indique el identificador del producto, sólo dígitos')))); $this->widgetSchema->setLabels(array('cedula' => 'Cedula de Identidad', 'producto' => 'Número de artículo')); $this->widgetSchema->setNameFormat('buscaproducto[%s]'); $this->widgetSchema->setFormFormatterName('table'); $this->setValidators(array('cedula' => new sfValidatorRegex(array('pattern' => '/^(V|J)-[0-9]+$/')), 'producto' => new sfValidatorDoctrineChoice(array('model' => 'Productos', 'required' => false)))); //$this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new validatorUsuarioProducto()))); }
public function configure() { parent::configure(); $tipos_tdc = array('visa' => '<img src="' . sfConfig::get('app_serverhost', false) . '/imagenes/icon_tdc_visa" alt="Visa"/>', 'mastercard' => '<img src="' . sfConfig::get('app_serverhost', false) . '/imagenes/icon_tdc_mastercard" alt="MasterCard"/>'); $this->setWidgets(array('email' => new sfWidgetFormInputHidden(array(), array('data-bvalidator' => 'email,required', 'data-bvalidator-msg' => 'Dirección de correo electrónico inválida.')), 'monto' => new sfWidgetFormInputHidden(array(), array('data-bvalidator' => 'number,required', 'data-bvalidator-msg' => 'Monto inválido.')), 'paquete' => new sfWidgetFormInputHidden(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Numero de paquete inválido.')), 'tipo_tdc' => new sfWidgetFormSelectRadio(array('choices' => $tipos_tdc, 'class' => 'tipo-tdc-list'), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'tdc' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'vence' => new sfWidgetFormCCExpirationDate(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'banco' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'cedula' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')))); $this->widgetSchema->setLabels(array('tipo_tdc' => 'Tipo de Trajeta', 'tdc' => 'Número de Tarjeta', 'vence' => 'Fecha de Vencimiento', 'banco' => 'Banco Emisor', 'cedula' => 'Cedula de Identidad')); $this->widgetSchema->setNameFormat('datospago[%s]'); $this->widgetSchema->setFormFormatterName('table'); $this->setValidators(array('email' => new sfValidatorEmail(array(), array()), 'monto' => new sfValidatorNumber(array(), array()), 'paquete' => new sfValidatorDoctrineChoice(array('model' => 'Productos'), array()), 'tipo_tdc' => new sfValidatorChoice(array('choices' => array_keys($tipos_tdc)), array()), 'tdc' => new sfValidatorCreditCardNumber(array(), array('invalid' => 'Número de tarjeta inválido')), 'vence' => new sfValidatorCCExpirationDate(), 'banco' => new sfValidatorString(array(), array()), 'cedula' => new sfValidatorString(array(), array()))); $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorCreditCardType(), new sfValidatorPagoESite()))); }
public function configure() { self::$subjects = sfConfig::get('app_feedback_subjects', array('Subject A', 'Subject B', 'Subject C')); $this->widgetSchema->setNameFormat('feedback[%s]'); $this->setWidgets(array('name' => new sfWidgetFormInput(array(), array('placeholder' => 'First and last name')), 'email' => new sfWidgetFormInputEmail(array(), array('placeholder' => '*****@*****.**')), 'subject' => new sfWidgetFormSelect(array('choices' => self::$subjects)), 'message' => new sfWidgetFormTextarea(array(), array('placeholder' => 'Tell us what you want to say...')))); $this->widgetSchema->setNameFormat('feedback[%s]'); $this->setValidators(array('name' => new sfValidatorString(array('required' => false)), 'email' => new sfValidatorEmail(), 'subject' => new sfValidatorChoice(array('choices' => array_keys(self::$subjects))), 'message' => new sfValidatorString(array('min_length' => 4)))); $this->widgetSchema->setLabels(array('name' => 'Your Name', 'email' => 'Your Email Address', 'subject' => 'Subject', 'message' => 'Your Message')); if (sfConfig::get('app_recaptcha_active', false)) { $this->setWidget('response', new sfWidgetFormInputHidden()); $this->validatorSchema->setPostValidator(new sfValidatorSchemaReCaptcha('challenge', 'response')); $this->validatorSchema->setOption('allow_extra_fields', true); $this->validatorSchema->setOption('filter_extra_fields', false); } parent::configure(); }
public function configure() { $this->setWidgets(array( 'message' => new sfWidgetFormTextarea(), )); $role = new sfWidgetFormChoice(array( 'expanded' => true, 'multiple' => false, 'choices' => array('follower' => 'Follower', 'leader' => 'Leader') )); $this->widgetSchema['role'] = $role; $this->setValidator('role' , new sfValidatorString(array('required' => true))); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); parent::configure(); $this->addCSRFProtection('flk34Gd445rvvrGV'); }
public function configure() { #$this->widgetSchema->setIdFormat('registration_form_%s'); $this->widgetSchema['firstname'] = new sfWidgetFormInputText(); $this->widgetSchema['lastname'] = new sfWidgetFormInputText(); $this->widgetSchema['street'] = new sfWidgetFormInputText(); $this->widgetSchema['zipcode'] = new sfWidgetFormInputText(); $this->widgetSchema['city'] = new sfWidgetFormInputText(); $this->widgetSchema['phone'] = new sfWidgetFormInputText(); $this->widgetSchema['email'] = new sfWidgetFormInput(); $this->widgetSchema['student'] = new sfWidgetFormSelectCheckbox( array( 'choices' => array('1' => 'Ja, ich studiere / bin in Ausbildung') )); $this->widgetSchema['partner'] = new sfWidgetFormInputText(); $this->widgetSchema['message'] = new sfWidgetFormTextarea(); /* $this->setWidgets(array( 'firstname' => new sfWidgetFormInputText(), 'lastname' => new sfWidgetFormInputText(), /* 'gender' => new sfWidgetFormChoice(), /* 'date_of_birth'=> new sfWidgetFormI18nDate(), 'street' => new sfWidgetFormInputText(), 'zipcode' => new sfWidgetFormInputText(), 'city' => new sfWidgetFormInputText(), 'phone' => new sfWidgetFormInputText(), 'email' => new sfWidgetFormInput(), 'partner' => new sfWidgetFormInputText(), 'message' => new sfWidgetFormTextarea(), )); */ $w = new sfWidgetFormChoice(array( 'expanded' => true, 'multiple' => false, 'choices' => array('m' => 'Mann', 'w' => 'Frau') )); $this->setValidator('gender' , new sfValidatorString(array('required' => true))); $this->widgetSchema['gender'] = $w; $w = new sfWidgetFormChoice(array( 'expanded' => true, 'multiple' => false, 'choices' => array('L' => 'Leader', 'F' => 'Follower') )); $this->setValidator('role' , new sfValidatorString(array('required' => true))); $this->widgetSchema['role'] = $w; // do some additional styling $years = range(date('Y'), date('Y')-100); $this->widgetSchema['date_of_birth'] = new sfWidgetFormI18nDate(array( 'culture' => 'de', 'years' => array_combine($years, $years), 'can_be_empty' => true, 'empty_values' => array('day' => 'Tag', 'month' => 'Monat', 'year' => 'Jahr') )); $this->widgetSchema->setLabel( 'date_of_birth', 'Geburtstag' ); // VALIDATORS $this->setValidator('firstname' , new sfValidatorString(array('required' => true))); $this->setValidator('lastname' , new sfValidatorString(array('required' => true))); $this->setValidator('email' , new sfValidatorEmail() ); $this->setValidator('street' , new sfValidatorString(array('required' => true))); $this->setValidator('city' , new sfValidatorString(array('required' => true))); $this->setValidator('zipcode', new sfValidatorString(array('min_length' => 4 ))); $this->setValidator('phone' , new sfValidatorString(array('min_length' => 10 ))); $this->setValidator('student', new sfValidatorBoolean() ); $this->setValidator('message' , new sfValidatorString( array('required' => false) )); $this->setValidator('partner' , new sfValidatorString( array('required' => false) )); $this->setValidator('date_of_birth' , new sfValidatorDate( array('required' => false) )); //$this->setValidator('message' , new sfValidatorString( array('min_length' => 4) )); /* $this->setDefaults(array( 'email' => '*****@*****.**' )); */ // add custom VIRTUAL FIELDS /* // TOS terms of service $this->widgetSchema['toc'] = new sfWidgetFormInputCheckbox(); $this->widgetSchema->setLabel( 'toc', 'Terms of Service & Privacy' ); $this->widgetSchema->setHelp('toc', 'I agree to the Terms of Service & Privacy policies'); $this->validatorSchema['toc'] = new sfValidatorBoolean( array('required' => true), array( 'required' => 'You need to accept the terms and conditions to proceed') ); */ // HELP $this->widgetSchema->setHelp('email', 'Wir werden dir eine Bestätigung deiner Anmeldung und die Kurs-Infos an diese Adresse schicken.'); $this->widgetSchema->setHelp('role', 'Normalerweise führen die Männer beim Lindy Hop tanzen, wir nennen sie "Leader", die Frauen "Follower". Die Rollen können aber auch getauscht werden, was v.a. fortgeschrittene Tänzer manchmal machen.'); $this->widgetSchema->setHelp('partner', 'Du brauchst keinen Tanzpartner. Im Kurs werden regelmässig Partner gewechselt. Anmeldungen mit Partner werden jedoch bevorzugt behandelt. <br/>Achtung: Diese Anmeldung gilt nur für dich, dein Partner muss sich separat anmelden!'); $this->widgetSchema->setHelp('student', 'Studenten und Lehrlinge profitieren von reduzierten Kurspreisen.'); // do all the default configuration // uniform parent::configure(); $this->widgetSchema->setNameFormat('registration[%s]'); $this->addCSRFProtection('flkd445rvvrGV34G'); }