Exemplo n.º 1
0
 /**
  * Load Boolean editor
  *
  * @return Element\Checkbox
  */
 public function load()
 {
     $boolean = new Element\Checkbox($this->getName());
     $boolean->setLabel($this->getProperty()->getName());
     $boolean->setAttribute('class', 'input-checkbox');
     $boolean->setAttribute('id', 'boolean' . $this->getProperty()->getId());
     $boolean->setValue($this->getProperty()->getValue());
     return $boolean;
 }
Exemplo n.º 2
0
 /**
  * Test
  *
  * @return void
  */
 public function testRenderOptions()
 {
     $this->element->setValueOptions(array(1, 2, 3));
     $this->element->setValue(1);
     $this->element->setAttribute('id', 'test');
     $this->element->setAttribute('class', 'input-checkbox');
     $this->object->setLabelPosition('prepend');
     $markup = $this->object->render($this->element);
     $this->assertContains('type="checkbox"', $markup);
     $this->assertContains('name="foo[]"', $markup);
 }
Exemplo n.º 3
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id+
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //categoria+
     $this->add(array('name' => 'categoria', 'attributes' => array('type' => 'hidden')));
     //xyz+
     $this->add(array('name' => 'xyz', 'attributes' => array('type' => 'hidden')));
     //nome+
     $this->add(array('name' => 'nome', 'attributes' => array('type' => 'hidden')));
     //sessione+
     $this->add(array('name' => 'sessione', 'attributes' => array('type' => 'hidden')));
     //data+
     $this->add(array('name' => 'data', 'attributes' => array('type' => 'hidden')));
     //messaggio+
     $this->add(array('name' => 'messaggio', 'options' => array('label' => 'Messaggio'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     // Color+
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'color', 'options' => array('label' => 'Colore', 'empty_option' => 'Scegli un colore =>'), 'attributes' => array('class' => 'form-control')));
     // Posterlab+
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posterlab', 'options' => array('label' => 'Posterlab', 'empty_option' => 'Scegli un posterlab =>'), 'attributes' => array('class' => 'form-control')));
     // tipo+
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'tipo', 'options' => array('label' => 'Tipo', 'empty_option' => 'Scegli tipo =>'), 'attributes' => array('class' => 'form-control')));
     //stato+
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 4
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //statosessione
     $this->add(array('name' => 'statosessione', 'attributes' => array('type' => 'hidden')));
     //password visible
     $this->add(array('name' => 'password2', 'attributes' => array('type' => 'hidden')));
     //titolo
     $this->add(array('name' => 'titolo', 'options' => array('label' => 'Titolo'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //password
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'password', 'options' => array('label' => 'Password'), 'attributes' => array('class' => 'form-control')));
     //confirmapassword
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'confirmarPassword', 'options' => array('label' => 'Confermare Password'), 'attributes' => array('class' => 'form-control')));
     // Relatori
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'relatori', 'options' => array('label' => 'Relatori', 'empty_option' => 'Scegli un relatore =>'), 'attributes' => array('class' => 'form-control')));
     // Steps
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'steps', 'options' => array('label' => 'Steps', 'empty_option' => 'Scegli steps =>'), 'attributes' => array('class' => 'form-control')));
     //testo
     $nota = new Element\Textarea('nota');
     $nota->setLabel('Nota');
     $nota->setAttribute('class', 'ckeditor form-control');
     $this->add($nota);
     //Durata
     $this->add(array('name' => 'durata', 'options' => array('label' => 'Durata Sessione'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //Linkedin
     $this->add(array('name' => 'link', 'options' => array('label' => 'Link Report'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //stato
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 5
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //titolo
     $this->add(array('name' => 'titolo', 'options' => array('label' => 'Titolo'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //contenuto
     $nota = new Element\Textarea('contenuto');
     $nota->setLabel('Contenuto');
     $nota->setAttribute('class', 'ckeditor form-control');
     $this->add($nota);
     //Background
     $this->add(array('name' => 'background', 'attributes' => array('type' => 'Zend\\Form\\Element\\File'), 'options' => array('label' => 'Background')));
     // Posterlab
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posterlab', 'options' => array('label' => 'Posterlab', 'empty_option' => 'Scegli un posterlab =>'), 'attributes' => array('class' => 'form-control', 'onChange' => 'javascript:caricaPosizioni()', 'id' => 'posterlabs')));
     // Posizione
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posizione', 'options' => array('label' => 'posizione', 'empty_option' => 'Scegli una posizione =>', 'disable_inarray_validator' => true), 'attributes' => array('class' => 'form-control', 'id' => 'posizioni')));
     // tipo
     $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'tipo', 'options' => array('label' => 'Tipo', 'empty_option' => 'Scegli tipo =>'), 'attributes' => array('class' => 'form-control')));
     //stato
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 6
0
 /**
  * Init Module form
  *
  * @return void
  */
 public function init()
 {
     $showEmail = new Element\Checkbox('show_email');
     $showEmail->setLabel('Show email');
     $showEmail->setAttribute('required', 'required')->setAttribute('id', 'show-email');
     $username = new Element\Text('username');
     $username->setLabel('Username');
     $username->setAttribute('required', 'required')->setAttribute('id', 'username');
     $email = new Element\Text('email');
     $email->setLabel('Email');
     $email->setAttribute('required', 'required')->setAttribute('id', 'email');
     $message = new Element\Textarea('message');
     $message->setLabel('Message');
     $message->setAttribute('required', 'required')->setAttribute('id', 'message');
     $captchaImage = new CaptchaImage(array('font' => GC_PUBLIC_PATH . '/backend/fonts/arial.ttf', 'width' => 250, 'height' => 50, 'dotNoiseLevel' => 40, 'lineNoiseLevel' => 3));
     $captchaImage->setImgDir(GC_PUBLIC_PATH . '/frontend/tmp');
     $captchaImage->setImgUrl('/frontend/tmp');
     $captcha = new Element\Captcha('captcha');
     $captcha->setLabel('Please verify you are human')->setCaptcha($captchaImage)->setAttribute('required', 'required')->setAttribute('id', 'captcha');
     $this->add($showEmail);
     $this->add($username);
     $this->add($email);
     $this->add($message);
     $this->add($captcha);
     $inputFilterFactory = new InputFilterFactory();
     $inputFilter = $inputFilterFactory->createInputFilter(array('show_email' => array('name' => 'show_email', 'required' => false), 'username' => array('name' => 'username', 'required' => true), 'email' => array('name' => 'email', 'required' => true, 'validators' => array(array('name' => 'email_address'))), 'message' => array('name' => 'message', 'required' => true), 'captcha' => $captcha->getInputSpecification()));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 7
0
 public function testIntegerCheckedValue()
 {
     $element = new CheckboxElement();
     $element->setCheckedValue(123);
     $this->assertEquals(false, $element->isChecked());
     $element->setAttribute('value', 123);
     $this->assertEquals(true, $element->isChecked());
 }
Exemplo n.º 8
0
 /**
  * Test
  *
  * @return void
  */
 public function testRenderWithClass()
 {
     $this->element->setValue('checked');
     $this->element->setAttribute('class', 'input-checkbox');
     $markup = $this->object->render($this->element);
     $this->assertContains('checked="checked"', $markup);
     $this->assertContains('class="input-checkbox"', $markup);
 }
Exemplo n.º 9
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'panel-body');
     $confirm = new Checkbox('confirm');
     $confirm->setLabel('confirm.account.deletion');
     $confirm->setAttribute('class', 'checkbox form-control');
     $this->add($confirm);
     $submit = new Submit('send');
     $submit->setValue('delete.account');
     $submit->setAttribute('class', 'btn btn-danger');
     $this->add($submit);
 }
 public function __construct($roleName, array $permissions, Acl $acl)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $roles = $acl->getRoles();
     $parentPermissions = [];
     foreach ($roles as $role) {
         if ($acl->inheritsRole($roleName, $role, true)) {
             foreach ($permissions as $permissionId => $permission) {
                 if ($acl->isAllowed($role, $permission)) {
                     $parentPermissions[$permissionId] = $permissionId;
                 }
             }
         }
     }
     $permissionGroups = [];
     foreach ($permissions as $permissionId => $permission) {
         $fragments = explode('/', $permission);
         $groupName = reset($fragments);
         if (!array_key_exists($groupName, $permissionGroups)) {
             $permissionGroups[$groupName] = [];
         }
         $permissionGroups[$groupName][] = $permissionId;
     }
     foreach ($permissionGroups as $groupName => $groupPermissions) {
         foreach ($groupPermissions as $permission) {
             $permissionCheck = new Checkbox($permission);
             $permissionCheck->setLabel($permissions[$permission]);
             if (array_key_exists($permission, $parentPermissions)) {
                 $permissionCheck->setValue(true);
                 $permissionCheck->setAttribute('disabled', true);
             }
             $this->add($permissionCheck);
             if (!array_key_exists($groupName, $this->permissionGroups)) {
                 $this->permissionGroups[$groupName] = [];
             }
             $this->permissionGroups[$groupName][] = $permissionCheck;
         }
     }
     $submit = new Submit('save');
     $submit->setValue('save');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //nombre
     $this->add(array('name' => 'nome', 'options' => array('label' => 'Nome'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //Email
     $this->add(array('type' => 'Zend\\Form\\Element\\Email', 'name' => 'email', 'options' => array('label' => 'Email'), 'attributes' => array('class' => 'form-control')));
     //password
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'password', 'options' => array('label' => 'Password'), 'attributes' => array('class' => 'form-control')));
     //confirmapassword
     $this->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'confirmarPassword', 'options' => array('label' => 'Confermare Password'), 'attributes' => array('class' => 'form-control')));
     //immagine
     $this->add(array('name' => 'immagine', 'attributes' => array('type' => 'Zend\\Form\\Element\\File'), 'options' => array('label' => 'Immagine')));
     //stato
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }
Exemplo n.º 13
0
 public function init()
 {
     $fileupload = new Element\File('files');
     $fileupload->setLabel("files");
     $fileupload->setAttribute('multiple', 'multiple');
     $this->add($fileupload);
     $button = new Element\Button('start');
     $button->setAttribute("type", 'submit');
     $button->setValue("Start upload")->setLabel("Start upload");
     $this->add($button);
     $button = new Element\Button('cancel');
     $button->setAttribute("type", 'reset');
     $button->setValue("Cancel upload")->setLabel("Cancel upload");
     $this->add($button);
     $button = new Element\Button('delete');
     $button->setAttribute("type", 'button');
     $button->setValue("Delete")->setLabel("Delete");
     $this->add($button);
     $checkbox = new Element\Checkbox('toggle');
     $checkbox->setValue("Toggle")->setLabel("Toggle");
     $checkbox->setAttribute("required", "");
     $this->add($checkbox);
 }
Exemplo n.º 14
0
 /**
  * Get all items as form
  *
  * @return array
  */
 public function getAllItems()
 {
     $elements = array();
     $items = $this->getAllToolbarItems();
     $toolbarItems = $this->getToolbarItems();
     foreach ($items as $group) {
         if (!empty($group['items']) and is_array($group['items'])) {
             $fieldset = new Fieldset($group['name']);
             foreach ($group['items'] as $idxItem => $item) {
                 if ($item == '-') {
                     continue;
                 }
                 $element = new Element\Checkbox('toolbar-items[' . $item . ']');
                 $element->setAttribute('id', 'i' . $group['name'] . $idxItem)->setCheckedValue(1)->setAttribute('class', 'input-checkbox')->setLabel($item);
                 if (!empty($toolbarItems[$item])) {
                     $element->setValue(1);
                 }
                 $fieldset->add($element);
             }
             $elements[] = $fieldset;
         }
     }
     return $elements;
 }
Exemplo n.º 15
0
 /**
  * Set a single element attribute
  *
  * @param  string $key
  * @param  mixed  $value
  * @return MultiCheckbox|ElementInterface
  */
 public function setAttribute($key, $value)
 {
     // Do not include the options in the list of attributes
     // TODO: Deprecate this
     if ($key === 'options') {
         $this->setValueOptions($value);
         return $this;
     }
     return parent::setAttribute($key, $value);
 }
Exemplo n.º 16
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);
 }
Exemplo n.º 17
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     //id
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     //nombre
     $this->add(array('name' => 'nome', 'options' => array('label' => 'Nome'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //apellido
     $this->add(array('name' => 'cognome', 'options' => array('label' => 'Cognome'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //Email
     $this->add(array('type' => 'Zend\\Form\\Element\\Email', 'name' => 'email', 'options' => array('label' => 'Email'), 'attributes' => array('class' => 'form-control')));
     /*
     //password
     $this->add(array(
         'type'=>'Zend\Form\Element\Password',
         'name'=>'password',
         'options'=>array(
             'label'=> 'Password',
         ),
         'attributes'=> array(
            
             'class'=>'form-control',
         ),
     ));
     
     //confirmapassword
     $this->add(array(
         'type'=>'Zend\Form\Element\Password',
         'name'=>'confirmarPassword',
         'options'=>array(
             'label'=> 'Confermare Password',
         ),
         'attributes'=> array(
              
             'class'=>'form-control',
         ),
     ));
     */
     //Linkedin
     $this->add(array('name' => 'link', 'options' => array('label' => 'Link Linkedin'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //immagine
     $this->add(array('name' => 'immagine', 'attributes' => array('type' => 'Zend\\Form\\Element\\File'), 'options' => array('label' => 'Immagine')));
     /*
     $immagine = new File('immagine');
     $immagine->setLabel('Immagine');
     $this->add($immagine);
     */
     //Titolo
     $this->add(array('name' => 'titolo', 'options' => array('label' => 'Titolo'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
     //testo
     $testo = new Element\Textarea('testo');
     $testo->setLabel('Descrizione');
     $testo->setAttribute('class', 'ckeditor form-control');
     $this->add($testo);
     //stato
     $stato = new Element\Checkbox('stato');
     $stato->setLabel('Stato');
     $stato->setAttribute('class', 'make-switch');
     $this->add($stato);
     $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
 }