Example #1
0
 public function __construct(AuthenticationService $authService)
 {
     parent::__construct('login');
     $this->filter = new InputFilter();
     $email = new Element\Email('email');
     $email->setAttribute('required', true);
     $email->setAttribute('placeholder', 'Email Address');
     $this->add($email);
     $emailFilter = new Input('email');
     $emailFilter->setRequired(true);
     $this->filter->add($emailFilter);
     $password = new Element\Password('password');
     $password->setAttribute('required', true);
     $password->setAttribute('placeholder', 'Password');
     $this->add($password);
     $passwordFilter = new Input('password');
     $passwordFilter->setRequired(true);
     $passwordFilter->getValidatorChain()->attach(new AuthValidator\Authentication(array('message' => 'Invalid email address or password', 'service' => $authService, 'adapter' => $authService->getAdapter(), 'identity' => 'email', 'credential' => 'password')));
     $this->filter->add($passwordFilter);
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'log-in');
     $submit->setLabel('Log In');
     $buttons->add($submit);
     $forgot = new Element\Submit('forgot');
     $forgot->setAttribute('formnovalidate', true);
     $forgot->setAttribute('class', 'btn-warning pull-right');
     $forgot->setOption('glyphicon', 'question-sign');
     $forgot->setLabel('Forgot Password');
     $buttons->add($forgot);
     $this->add($buttons);
 }
Example #2
0
 public function __construct()
 {
     parent::__construct('password');
     $this->filter = new InputFilter();
     $oldPassword = new Element\Password('oldPassword');
     $oldPassword->setAttribute('required', true);
     $oldPassword->setAttribute('placeholder', 'Current Password');
     $this->add($oldPassword);
     $oldPasswordFilter = new Input('oldPassword');
     $oldPasswordFilter->setRequired(true);
     $this->filter->add($oldPasswordFilter);
     $newPassword = new Element\Password('newPassword');
     $newPassword->setAttribute('required', true);
     $newPassword->setAttribute('placeholder', 'New Password');
     $this->add($newPassword);
     $newPasswordFilter = new Input('newPassword');
     $newPasswordFilter->setRequired(true);
     $newPasswordFilter->getFilterChain()->attach(new Filter\StringTrim());
     $newPasswordFilter->getValidatorChain()->attach(new AppValidator\PasswordStrength());
     $this->filter->add($newPasswordFilter);
     $confirmPassword = new Element\Password('confirmPassword');
     $confirmPassword->setAttribute('required', true);
     $confirmPassword->setAttribute('placeholder', 'Confirm New Password');
     $this->add($confirmPassword);
     $confirmPasswordFilter = new Input('confirmPassword');
     $confirmPasswordFilter->setRequired(true);
     $confirmPasswordFilter->getFilterChain()->attach(new Filter\StringTrim());
     $confirmPasswordFilter->getValidatorChain()->attach(new Validator\Identical('newPassword'));
     $this->filter->add($confirmPasswordFilter);
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'lock');
     $submit->setLabel('Change Password');
     $buttons->add($submit);
     $cancel = new Element\Submit('cancel');
     $cancel->setAttribute('formnovalidate', true);
     $cancel->setAttribute('class', 'btn-warning pull-right');
     $cancel->setOption('glyphicon', 'ban-circle');
     $cancel->setLabel('Cancel');
     $buttons->add($cancel);
     $this->add($buttons);
 }
Example #3
0
 public function __construct()
 {
     parent::__construct('confirm');
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('confirm');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'lock');
     $submit->setLabel('Secure Checkout with PayPal');
     $buttons->add($submit);
     $back = new Element\Submit('back');
     $back->setAttribute('formnovalidate', true);
     $back->setAttribute('class', 'btn-warning pull-right');
     $back->setOption('glyphicon', 'chevron-left');
     $back->setLabel('Go Back');
     $buttons->add($back);
     $this->add($buttons);
 }
Example #4
0
 public function __construct(ObjectManager $objectManager)
 {
     parent::__construct('register');
     $this->filter = new InputFilter();
     $primary = new Element\Hidden('primary');
     $this->add($primary);
     $callName = new Element\Text('callName');
     $callName->setAttribute('required', true);
     $callName->setAttribute('placeholder', 'Call Name');
     $this->add($callName);
     $callNameFilter = new Input('callName');
     $callNameFilter->setRequired(true);
     $callNameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
     $callNameFilter->getFilterChain()->attach(new Filter\StringTrim());
     $callNameFilter->getFilterChain()->attach(new Filter\StripTags());
     $callNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 15)));
     $callNameFilter->getValidatorChain()->attach(new LocaleValidator\Alpha(array('allowWhiteSpace' => true)));
     $this->filter->add($callNameFilter);
     $regName = new Element\Text('regName');
     $regName->setAttribute('placeholder', 'Registered Name');
     $this->add($regName);
     $regNameFilter = new Input('regName');
     $regNameFilter->setRequired(false);
     $regNameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
     $regNameFilter->getFilterChain()->attach(new Filter\StringTrim());
     $regNameFilter->getFilterChain()->attach(new Filter\StripTags());
     $regNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 50)));
     $regNameFilter->getValidatorChain()->attach(new Validator\Regex("/^[a-z][a-z\\'\\- ]*\$/i"));
     $this->filter->add($regNameFilter);
     $sex = new Element\Select('sex');
     $sex->setAttribute('required', true);
     $sex->setValueOptions(array(1 => 'Male', 2 => 'Female'));
     $sex->setEmptyOption('Select a Sex');
     $this->add($sex);
     $sexFilter = new Input('sex');
     $sexFilter->setRequired(true);
     $this->filter->add($sexFilter);
     $breed = new AppElement\ObjectLiveSearch('breed');
     $breed->setOption('object_manager', $objectManager);
     $breed->setOption('target_class', 'Application\\Entity\\Breed');
     $breed->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('name' => 'ASC'))));
     $breed->setEmptyOption('Select a Breed');
     $this->add($breed);
     $breedFilter = new Input('breed');
     $breedFilter->setRequired(true);
     $this->filter->add($breedFilter);
     $dateOfBirth = new Element\Date('dateOfBirth');
     $dateOfBirth->setAttribute('required', true);
     $dateOfBirth->setAttribute('data-placeholder', 'Date of Birth');
     // placeholder attr is invalid for date input
     $dateOfBirth->setAttribute('data-mask', '0000-00-00');
     $dateOfBirth->setAttribute('class', 'datepicker');
     $this->add($dateOfBirth);
     $dateOfBirthFilter = new Input('dateOfBirth');
     $dateOfBirthFilter->setRequired(true);
     $dateOfBirthFilter->getValidatorChain()->attach(new Validator\Date());
     $this->filter->add($dateOfBirthFilter);
     $height = new Element\Number('height');
     $height->setAttribute('required', true);
     $height->setAttribute('placeholder', 'Height (Inches)');
     $this->add($height);
     $heightFilter = new Input('height');
     $heightFilter->setRequired(true);
     $heightFilter->getValidatorChain()->attach(new Validator\Between(array('min' => 6, 'max' => 30)));
     $this->filter->add($heightFilter);
     $champion = new Element\Checkbox('champion');
     $champion->setLabel('Dog is a champion of record.');
     $this->add($champion);
     $championFilter = new Input('champion');
     $championFilter->setRequired(false);
     $this->filter->add($championFilter);
     $rescue = new Element\Checkbox('rescue');
     $rescue->setLabel('Dog is a rescue.');
     $this->add($rescue);
     $rescueFilter = new Input('rescue');
     $rescueFilter->setRequired(false);
     $this->filter->add($rescueFilter);
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'circle-arrow-up');
     $submit->setLabel('Register');
     $buttons->add($submit);
     $cancel = new Element\Submit('cancel');
     $cancel->setAttribute('formnovalidate', true);
     $cancel->setAttribute('class', 'btn-warning pull-right');
     $cancel->setOption('glyphicon', 'ban-circle');
     $cancel->setLabel('Cancel');
     $buttons->add($cancel);
     $this->add($buttons);
 }
Example #5
0
 /**
  * {@inheritDoc}
  */
 public function setOption($option, $value)
 {
     switch ($option) {
         case 'use_form_label':
             $this->setUseFormLabel($value);
             break;
         case 'form_timeout':
             $this->setFormTimeout($value);
             break;
         case 'use_csrf':
             $this->setUseCsrf($value);
             break;
         case 'captcha_options':
             $this->setCaptchaOptions($value);
             break;
         case 'use_captcha':
             $this->setUseCaptcha($value);
             break;
         case 'use_submit_element':
             $this->setUseSubmitElement($value);
             break;
         case 'use_reset_element':
             $this->setUseResetElement($value);
             break;
         case 'merge_input_filter':
             $this->setMergeInputFilter($value);
             break;
     }
     return parent::setOption($option, $value);
 }
Example #6
0
 public function __construct(Member $memberEntity, Event $eventEntity, ObjectManager $objectManager)
 {
     parent::__construct('entry');
     $this->filter = new InputFilter();
     $dog = new AppElement\ObjectLiveSearch('dog');
     $dog->setOption('object_manager', $objectManager);
     $dog->setOption('target_class', 'Application\\Entity\\Dog');
     $dog->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array('primary' => $memberEntity->getId()), 'orderBy' => array('callName' => 'ASC'))));
     $dog->setEmptyOption('Select a Dog');
     $this->add($dog);
     $dogFilter = new Input('dog');
     $dogFilter->setRequired(true);
     $this->filter->add($dogFilter);
     $entryNum = 0;
     foreach ($eventEntity->getTrials() as $trialEntity) {
         $trial = new Form('trial_' . $trialEntity->getId());
         $trial->setLabel($trialEntity->getDateDisplay());
         $this->add($trial);
         foreach ($trialEntity->getTrialDivisions() as $trialDivisionEntity) {
             $divisionEntity = $trialDivisionEntity->getDivision();
             for ($whichDivisionNum = 1; $whichDivisionNum <= $trialDivisionEntity->getNumOffered(); $whichDivisionNum++) {
                 $entry = new Fieldset('entry_' . $entryNum++);
                 $entry->setOption('twb-layout', 'inline');
                 $entry->setAttribute('data-price', trim($trialDivisionEntity->getEntryFee(), '$'));
                 $entry->setAttribute('class', 'form-group entry-form');
                 $this->add($entry);
                 $entry->filter = new InputFilter();
                 $this->filter->add($entry->filter);
                 $hiddenTrial = new Element\Hidden('trial');
                 $hiddenTrial->setValue($trialEntity->getId());
                 $entry->add($hiddenTrial);
                 $hiddenDivision = new Element\Hidden('division');
                 $hiddenDivision->setValue($divisionEntity->getId());
                 $entry->add($hiddenDivision);
                 $whichDivision = new Element\Hidden('whichDivision');
                 $whichDivision->setValue($whichDivisionNum);
                 $entry->add($whichDivision);
                 $entered = new Element\Checkbox('entered');
                 $entered->setLabel($divisionEntity . ($trialDivisionEntity->getNumOffered() > 1 ? ' #' . $whichDivisionNum : ''));
                 $entry->add($entered);
                 $enteredFilter = new Input('entered');
                 $enteredFilter->setRequired(false);
                 $entry->filter->add($enteredFilter);
                 if (!$divisionEntity->isAllLevels()) {
                     $level = new AppElement\ObjectLiveSearch('level');
                     $level->setOption('object_manager', $objectManager);
                     $level->setOption('target_class', 'Application\\Entity\\Level');
                     $level->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('rank' => 'ASC'))));
                     $level->setEmptyOption('Select a Level');
                     $entry->add($level);
                     $levelFilter = new Input('level');
                     $levelFilter->setRequired(false);
                     $entry->filter->add($levelFilter);
                 }
                 $exhibitionOnly = new Element\Checkbox('exhibitionOnly');
                 $exhibitionOnly->setLabelAttributes(array('class' => 'small col-md-offset-2'));
                 $exhibitionOnly->setLabel('For exhibition only');
                 $entry->add($exhibitionOnly);
                 $exhibitionOnlyFilter = new Input('exhibitionOnly');
                 $exhibitionOnlyFilter->setRequired(false);
                 $entry->filter->add($exhibitionOnlyFilter);
             }
         }
     }
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-event pull-right');
     $submit->setOption('glyphicon', 'circle-arrow-up');
     $submit->setLabel('Submit Entry');
     $buttons->add($submit);
     $cancel = new Element\Submit('cancel');
     $cancel->setAttribute('formnovalidate', true);
     $cancel->setAttribute('class', 'btn-warning pull-right');
     $cancel->setOption('glyphicon', 'ban-circle');
     $cancel->setLabel('Cancel');
     $buttons->add($cancel);
     $this->add($buttons);
 }
Example #7
0
 public function __construct(EntityRepository $repository)
 {
     parent::__construct('apply');
     $this->filter = new InputFilter();
     $primary = new Element\Hidden('primary');
     $this->add($primary);
     $primaryFilter = new Input('primary');
     $primaryFilter->getValidatorChain()->attach(new DoctrineValidator\NoObjectExists(array('message' => 'Member already owns an affiliate', 'object_repository' => $repository, 'fields' => 'primary')));
     $this->filter->add($primaryFilter);
     $name = new Element\Text('name');
     $name->setAttribute('required', true);
     $name->setAttribute('placeholder', 'Organization Name');
     $this->add($name);
     $nameFilter = new Input('name');
     $nameFilter->setRequired(true);
     $nameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
     $nameFilter->getFilterChain()->attach(new Filter\StringTrim());
     $nameFilter->getFilterChain()->attach(new Filter\StripTags());
     $nameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 80)));
     $nameFilter->getValidatorChain()->attach(new DoctrineValidator\NoObjectExists(array('message' => 'Name already in use', 'object_repository' => $repository, 'fields' => 'name')));
     $this->filter->add($nameFilter);
     $street = new Element\Text('street');
     $street->setAttribute('required', true);
     $street->setAttribute('placeholder', 'Street Address');
     $this->add($street);
     $streetFilter = new Input('street');
     $streetFilter->setRequired(true);
     $streetFilter->getFilterChain()->attach(new Filter\StringTrim());
     $streetFilter->getFilterChain()->attach(new Filter\StripTags());
     $streetFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 50)));
     $this->filter->add($streetFilter);
     $city = new Element\Text('city');
     $city->setAttribute('required', true);
     $city->setAttribute('placeholder', 'City');
     $this->add($city);
     $cityFilter = new Input('city');
     $cityFilter->setRequired(true);
     $cityFilter->getFilterChain()->attach(new Filter\StringTrim());
     $cityFilter->getFilterChain()->attach(new Filter\StripTags());
     $cityFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 30)));
     $this->filter->add($cityFilter);
     $state = new Element\Text('state');
     $state->setAttribute('required', true);
     $state->setAttribute('placeholder', 'State');
     $this->add($state);
     $stateFilter = new Input('state');
     $stateFilter->setRequired(true);
     $stateFilter->getFilterChain()->attach(new Filter\StringTrim());
     $stateFilter->getFilterChain()->attach(new Filter\StripTags());
     $stateFilter->getFilterChain()->attach(new Filter\StringToUpper());
     $stateFilter->getValidatorChain()->attach(new Validator\StringLength(array('min' => 2, 'max' => 2)));
     $this->filter->add($stateFilter);
     $postalCode = new Element\Text('postalCode');
     $postalCode->setAttribute('required', true);
     $postalCode->setAttribute('placeholder', 'Postal Code');
     $this->add($postalCode);
     $postalCodeFilter = new Input('postalCode');
     $postalCodeFilter->setRequired(true);
     $postalCodeFilter->getFilterChain()->attach(new Filter\StringTrim());
     $postalCodeFilter->getFilterChain()->attach(new Filter\StripTags());
     $this->filter->add($postalCodeFilter);
     $phone = new AppElement\Phone('phone');
     $phone->setAttribute('required', true);
     $phone->setAttribute('placeholder', 'Phone Number');
     $this->add($phone);
     $phoneFilter = new Input('phone');
     $phoneFilter->setRequired(true);
     $this->filter->add($phoneFilter);
     $email = new Element\Email('email');
     $email->setAttribute('required', true);
     $email->setAttribute('placeholder', 'Email Address');
     $this->add($email);
     $emailFilter = new Input('email');
     $emailFilter->setRequired(true);
     $this->filter->add($emailFilter);
     $website = new Element\Url('website');
     $website->setAttribute('placeholder', 'Website');
     $this->add($website);
     $websiteFilter = new Input('website');
     $websiteFilter->setRequired(false);
     $this->filter->add($websiteFilter);
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'circle-arrow-up');
     $submit->setLabel('Apply');
     $buttons->add($submit);
     $cancel = new Element\Submit('cancel');
     $cancel->setAttribute('formnovalidate', true);
     $cancel->setAttribute('class', 'btn-warning pull-right');
     $cancel->setOption('glyphicon', 'ban-circle');
     $cancel->setLabel('Cancel');
     $buttons->add($cancel);
     $this->add($buttons);
 }