public function render() { foreach ($this->buttons as $value => $desc) { $is_checked = false; //----------------------------------------- // Is Checked? //----------------------------------------- if (isset($this->checked_value) && $this->checked_value == $value) { $is_checked = true; } //----------------------------------------- // Create Radio Button //----------------------------------------- $r = new radio($this->name, $value, $is_checked); //----------------------------------------- // Element Attributes //----------------------------------------- if (isset($this->elements_attrs[$value])) { $r->attrs($this->elements_attrs[$value]); } //----------------------------------------- // Output //----------------------------------------- print $r . ' ' . $desc; if ($this->style == 'newline') { print '<br/>'; } else { if ($this->style == 'custom') { print $this->custom_style; } } } }
public function render() { //============================================ // Pull items from database //============================================ $data = new data_trans($this->data_src); $data->data_query($this->strsql); $result = $data->data_assoc_result(); foreach ($result as $row) { //----------------------------------------- // Create Radio Button //----------------------------------------- $tmp_radio = new radio($this->name, $row[$this->opt_key]); //----------------------------------------- // Is Checked? //----------------------------------------- if (isset($this->checked_value)) { if ($this->checked_value == $row[$this->opt_key]) { $tmp_radio->set_attribute('checked', 'checked'); } } //----------------------------------------- // Element Attributes //----------------------------------------- if (isset($this->elements_attrs[$row[$this->opt_key]])) { $tmp_radio->attrs($this->elements_attrs[$row[$this->opt_key]]); } //----------------------------------------- // Output //----------------------------------------- $tmp_radio->render(); print ' ' . $row[$this->opt_val]; if ($this->style == 'newline') { print '<br/>'; } else { if ($this->style == 'custom') { print $this->custom_style; } } print "\n"; } }