/** * Show the widget at the screen */ public function show() { if ($this->items) { // iterate the RadioButton options foreach ($this->items as $index => $label) { $button = new TRadioButton($this->name); $button->setTip($this->tag->title); $button->setValue($index); // check if contains any value if ($this->value == $index) { // mark as checked $button->setProperty('checked', '1'); } // check whether the widget is non-editable if (!parent::getEditable()) { $button->setEditable(FALSE); } // create the label for the button $obj = new TLabel($label); $obj->add($button); $obj->show(); if ($this->layout == 'vertical') { // shows a line break $br = new TElement('br'); $br->show(); } echo "\n"; } } }
/** * método show() * 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 TRadioButton($this->name); $button->setValue($index); // se possui qualquer valor if ($this->value == $index) { // marca o radio button $button->setProperty('checked', '1'); } $button->show(); $obj = new TLabel($label); $obj->show(); if ($this->layout == 'vertical') { // exibe uma tag de quebra de linha $br = new TElement('br'); $br->show(); } echo "\n"; } } }
/** * Show the widget at the screen */ public function show() { if ($this->items) { // iterate the RadioButton options foreach ($this->items as $index => $label) { $button = new TRadioButton($this->name); $button->setTip($this->tag->title); $button->setValue($index); // check if contains any value if ($this->value == $index) { // mark as checked $button->setProperty('checked', '1'); } // check whether the widget is non-editable if (parent::getEditable()) { if (isset($this->changeAction)) { if (!TForm::getFormByName($this->formName) instanceof TForm) { throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()')); } $string_action = $this->changeAction->serialize(FALSE); $button->setProperty('onChange', "serialform=(\$('#{$this->formName}').serialize());\n ajaxLookup('{$string_action}&'+serialform, this)"); } } else { $button->setEditable(FALSE); } // create the label for the button $obj = new TLabel($label); $obj->add($button); $obj->show(); if ($this->layout == 'vertical') { // shows a line break $br = new TElement('br'); $br->show(); } echo "\n"; } } }