Esempio n. 1
0
 public function new_option($o)
 {
     $name = $this->get_name() . '_' . $o->name;
     $input = new radio($o->container, $name);
     if (isset($o->id)) {
         $input->set_attribute('id', $o->id);
     }
     if (isset($o->label)) {
         $input->label($o->label);
     }
     $input->set_attribute('name', $name);
     $input->set_attribute('value', $o->value);
     $input->label->update_for();
     if ($this->is_required()) {
         $input->required();
     }
     return $input;
 }
Esempio n. 2
0
 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";
     }
 }