예제 #1
0
 public function __construct($name = null)
 {
     parent::__construct('page');
     $id_hidden = new Element\Hidden('id');
     $id_hidden->setName('id');
     $title_text = new Element\Text('title');
     $title_text->setLabel('Title');
     $title_text->setLabelAttributes(array('class' => 'type_text type_text_short'));
     $title_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require'));
     $url_text = new Element\Text('url');
     $url_text->setLabel('Url');
     $url_text->setLabelAttributes(array('class' => 'type_text type_text_short'));
     $url_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require'));
     $text_textarea = new Element\Textarea('text');
     $text_textarea->setLabel('Text');
     $text_textarea->setLabelAttributes(array('class' => 'type_text'));
     $text_textarea->setAttributes(array('placeholder' => 'Type something...'));
     $auto_check = new Element\Checkbox('auto');
     $auto_check->setLabel('Automatically');
     $auto_check->setLabelAttributes(array('class' => 'type_text type_check'));
     $auto_check->setUseHiddenElement(true);
     $auto_check->setCheckedValue("1");
     $auto_check->setUncheckedValue("0");
     $auto_check->setValue('1');
     $meta_text = new Element\Text('meta');
     $meta_text->setLabel('Meta');
     $meta_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker'));
     $meta_text->setAttributes(array('class' => 'type_text_input'));
     $keywords_text = new Element\Text('keywords');
     $keywords_text->setLabel('Keywords');
     $keywords_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker'));
     $keywords_text->setAttributes(array('class' => 'type_text_input'));
     $desc_text = new Element\Text('description');
     $desc_text->setLabel('Description');
     $desc_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker'));
     $desc_text->setAttributes(array('class' => 'type_text_input'));
     $submit_button = new Element\Submit('submit');
     $submit_button->setValue('Submit');
     $submit_button->setAttributes(array('class' => 'btn btn_white'));
     $cancel_button = new Element\Submit('cancel');
     $cancel_button->setValue('Cancel');
     $cancel_button->setAttributes(array('class' => 'btn btn_rozy'));
     $this->add($id_hidden);
     $this->add($title_text);
     $this->add($url_text);
     $this->add($text_textarea);
     $this->add($auto_check);
     $this->add($meta_text);
     $this->add($keywords_text);
     $this->add($desc_text);
     $this->add($submit_button);
     $this->add($cancel_button);
 }
예제 #2
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'panel-body');
     $username = new Text('username');
     $username->setLabel('username');
     $username->setAttribute('class', 'form-control');
     $username->setAttribute('data-urr', '/isusernameinuse');
     $this->add($username);
     $mail = new Email('email');
     $mail->setLabel('email');
     $mail->setAttribute('class', 'form-control');
     $this->add($mail);
     $password = new Password('password');
     $password->setLabel('password');
     $password->setAttribute('class', 'form-control');
     $this->add($password);
     $password2 = new Password('password2');
     $password2->setLabel('repeat.password');
     $password2->setAttribute('class', 'form-control');
     $this->add($password2);
     $captcha = new Captcha('registerCaptcha');
     $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']);
     $imageAdapter->setHeight(100);
     $imageAdapter->setWidth(400);
     $imageAdapter->setFontSize(48);
     $imageAdapter->setDotNoiseLevel(400);
     $imageAdapter->setLineNoiseLevel(40);
     $captcha->setCaptcha($imageAdapter);
     $captcha->setLabel('enter.text.from.the.picture');
     $captcha->setAttribute('class', 'form-control');
     $this->add($captcha);
     $agb = new Checkbox('gtcAccept');
     $agb->setLabel('accept.terms.of.gtc');
     $agb->setAttribute('class', 'form-control');
     $agb->setLabelAttributes(['class' => 'checkboxLabel']);
     $this->add($agb);
     $submit = new Submit('register');
     $submit->setValue('register');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
예제 #3
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);
 }
예제 #4
0
 public function addElements()
 {
     //-- Full name --
     $full_name = new Element\Text('full_name');
     $full_name->setAttribute('placeholder', 'Full Name');
     $full_name->setAttribute('class', 'form-control');
     $full_name->setAttribute('id', 'full-name');
     $full_name->setLabel('Full name');
     $full_name->setLabelAttributes(array('class' => 'control-label', 'for' => 'full-name'));
     //-- Bio --
     $bio = new Element\Textarea('bio');
     $bio->setAttribute('placeholder', 'Bio');
     $bio->setAttribute('class', 'form-control');
     $bio->setAttribute('id', 'bio');
     $bio->setLabel('Bio');
     $bio->setLabelAttributes(array('class' => 'control-label', 'for' => 'bio'));
     //-- Link skype --
     $link_skype = new Element\Text('link_skype');
     $link_skype->setAttribute('placeholder', 'skype_name');
     $link_skype->setAttribute('class', 'form-control');
     $link_skype->setAttribute('id', 'link-skype');
     $link_skype->setLabel('Skype');
     $link_skype->setLabelAttributes(array('class' => 'control-label', 'for' => 'link-skype'));
     //-- Link site --
     $link_site = new Element\Text('link_site');
     $link_site->setAttribute('placeholder', 'http://my-site.com');
     $link_site->setAttribute('class', 'form-control');
     $link_site->setAttribute('id', 'link-site');
     $link_site->setLabel('Link my site');
     $link_site->setLabelAttributes(array('class' => 'control-label', 'for' => 'link-site'));
     //-- Link vkontakte --
     $link_vk = new Element\Text('link_vk');
     $link_vk->setAttribute('placeholder', 'http://vk.com/user_name');
     $link_vk->setAttribute('class', 'form-control');
     $link_vk->setAttribute('id', 'link-vk');
     $link_vk->setLabel('Link VKontakte');
     $link_vk->setLabelAttributes(array('class' => 'control-label', 'for' => 'link-vk'));
     //-- Link facebook --
     $link_fb = new Element\Text('link_fb');
     $link_fb->setAttribute('placeholder', 'https://www.facebook.com/user_name');
     $link_fb->setAttribute('class', 'form-control');
     $link_fb->setAttribute('id', 'link-fb');
     $link_fb->setLabel('Link Facebook');
     $link_fb->setLabelAttributes(array('class' => 'control-label', 'for' => 'link-fb'));
     //-- Link twitter --
     $link_tw = new Element\Text('link_tw');
     $link_tw->setAttribute('placeholder', 'https://twitter.com/user_name');
     $link_tw->setAttribute('class', 'form-control');
     $link_tw->setAttribute('id', 'link-tw');
     $link_tw->setLabel('Link Twitter');
     $link_tw->setLabelAttributes(array('class' => 'control-label', 'for' => 'flink-tw'));
     //-- Password --
     $check = new Element\Checkbox('is_active');
     $check->setAttribute('class', 'form-control');
     $check->setAttribute('id', 'is-active');
     $check->setCheckedValue("1");
     $check->setUncheckedValue("0");
     $check->setLabel('Is active');
     $check->setLabelAttributes(array('class' => 'control-label', 'for' => 'is-active'));
     //-- Submit --
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn btn-success');
     $submit->setValue('Send');
     // Binding elements
     $this->add($full_name);
     $this->add($bio);
     $this->add($link_skype);
     $this->add($link_site);
     $this->add($link_vk);
     $this->add($link_fb);
     $this->add($link_tw);
     $this->add($check);
 }