Ejemplo n.º 1
0
 public function configure()
 {
     $choices = LsListTable::getNetworksForSelect();
     $this->setWidgets(array('email' => new sfWidgetFormInput(array(), array('size' => 30)), 'home_network_id' => new sfWidgetFormSelect(array('choices' => $choices)), 'enable_announcements' => new sfWidgetFormInputCheckBox(), 'enable_notes_notifications' => new sfWidgetFormInputCheckBox(), 'enable_pointers' => new sfWidgetFormInputCheckbox(), 'enable_recent_views' => new sfWidgetFormInputCheckbox(), 'enable_notes_list' => new sfWidgetFormInputCheckbox(), 'ranking_opt_out' => new sfWidgetFormInputCheckbox(), 'watching_opt_out' => new sfWidgetFormInputCheckbox()));
     $this->setValidators(array('email' => new sfValidatorEmail(array('required' => true)), 'home_network_id' => new sfValidatorChoice(array('choices' => array_keys($choices), 'required' => true)), 'enable_announcements' => new sfValidatorBoolean(), 'enable_notes_notifications' => new sfValidatorBoolean(), 'enable_pointers' => new sfValidatorBoolean(), 'enable_recent_views' => new sfValidatorBoolean(), 'enable_notes_list' => new sfValidatorBoolean(), 'ranking_opt_out' => new sfValidatorBoolean(), 'watching_opt_out' => new sfValidatorBoolean()));
     $this->widgetSchema->setLabels(array('home_network_id' => 'Local network', 'enable_announcements' => 'Receive announcements', 'enable_notes_notifications' => 'Receive Notes notifications', 'enable_pointers' => 'Show pointers', 'enable_recent_views' => 'Show Recent Views', 'enable_notes_list' => 'Show Notes list', 'ranking_opt_out' => 'Opt out of rankings', 'watching_opt_out' => 'Opt out of Who\'s Watching'));
     $this->widgetSchema->setHelps(array('email' => 'use this to login and recieve notifications', 'home_network_id' => 'Default network for new entities', 'enable_announcements' => 'send me important announcements about LittleSis', 'enable_notes_notifications' => 'email me when an analyst writes me a note', 'enable_pointers' => 'display helpful hints when available', 'enable_recent_views' => 'show recently viewed entities', 'enable_notes_list' => 'list your notes about the entity, relationship, or list you\'re viewing', 'ranking_opt_out' => 'if checked, your name will not appear in the Analyst Rankings box on the front page', 'watching_opt_out' => 'if checked, your name will not appear in the "Who\'s Watching" box on the lower left of entity profile pages'));
     $this->widgetSchema->setNameFormat('user_settings[%s]');
 }
Ejemplo n.º 2
0
 public function configure()
 {
     $choices = LsListTable::getNetworksForSelect();
     $this->setWidgets(array('home_network_id' => new sfWidgetFormSelect(array('choices' => $choices)), 'name_first' => new sfWidgetFormInput(array(), array('size' => 30)), 'name_last' => new sfWidgetFormInput(array(), array('size' => 30)), 'public_name' => new sfWidgetFormInput(array(), array('size' => 30)), 'email' => new sfWidgetFormInput(array(), array('size' => 30)), 'reason' => new sfWidgetFormTextarea(array(), array('cols' => 50, 'rows' => 3)), 'password1' => new sfWidgetFormInputPassword(array(), array('size' => 30)), 'password2' => new sfWidgetFormInputPassword(array(), array('size' => 30)), 'user_agrees' => new sfWidgetFormInputCheckbox(), 'captcha' => new sfWidgetFormReCaptcha(array('public_key' => sfConfig::get('app_recaptcha_public_key')))));
     $this->setValidators(array('home_network_id' => new sfValidatorChoice(array('choices' => array_keys($choices), 'required' => true)), 'name_last' => new sfValidatorString(array('max_length' => 50)), 'name_first' => new sfValidatorString(array('max_length' => 50)), 'public_name' => new sfValidatorRegex(array('pattern' => '/^[a-z0-9\\.]{4,30}$/i')), 'email' => new sfValidatorEmail(array('required' => true), array('invalid' => 'You must enter a valid email address')), 'reason' => new sfValidatorString(array('required' => true), array('required' => 'Who are you and why are you signing up?')), 'password1' => new sfValidatorRegex(array('pattern' => '/^[a-z0-9]{6,20}$/i')), 'password2' => new sfValidatorString(array(), array('required' => 'You must enter the password twice')), 'user_agrees' => new sfValidatorBoolean(array('required' => true), array('required' => 'You must accept the user agreement')), 'captcha' => new sfValidatorReCaptcha(array('private_key' => sfConfig::get('app_recaptcha_private_key')), array('invalid' => 'You didn\'t pass the spam test!'))));
     $this->validatorSchema['captcha']->addMessage('captcha', 'You didn\'t pass the spam test!');
     $this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare('password1', sfValidatorSchemaCompare::EQUAL, 'password2'), array(), array('invalid' => 'You must enter the same password twice'));
     sfLoader::loadHelpers(array('Helper', 'Tag', 'Url'));
     $this->widgetSchema->setLabels(array('home_network_id' => 'Local network', 'name_first' => 'First name', 'name_last' => 'Last name', 'reason' => 'A little about you and why you\'re signing up', 'analyst_reason' => 'Why you want to be an ' . link_to('analyst', '@howto'), 'public_name' => 'Public username', 'password1' => 'Password', 'password2' => 'Password (again)', 'user_agrees' => 'Terms of use', 'captcha' => 'Spam test'));
     $this->widgetSchema->setNameFormat('user[%s]');
     $this->validatorSchema->setOption('allow_extra_fields', true);
     $this->validatorSchema->setOption('filter_extra_fields', false);
 }