Exemple #1
0
 /**
  * exibe o widget na tela
  */
 public function show()
 {
     if ($this->items) {
         // percorre cada uma das opções do rádio
         foreach ($this->items as $index => $label) {
             $button = new CheckButton("{$this->name}[]");
             $button->setValue($index);
             // verifica se deve ser marcado
             if (in_array($index, (array) $this->value)) {
                 $button->setProperty('checked', '1');
             }
             $obj = new Label($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // exibe uma tag de quebra de linha
                 $br = new Element('br');
                 $br->show();
                 echo "\n";
             }
         }
     }
 }
Exemple #2
0
 /**
  * Exibe o widget na tela
  */
 public function show()
 {
     if ($this->items) {
         // percorre cada uma das opções do rádio
         foreach ($this->items as $index => $label) {
             $button = new RadioButton($this->name);
             $button->setValue($index);
             // se o índice coincide
             if ($this->value == $index) {
                 // marca o radio button
                 $button->setProperty('checked', '1');
             }
             $obj = new Label($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // exibe uma tag de quebra de linha
                 $br = new Element('br');
                 $br->show();
             }
             echo "\n";
         }
     }
 }