/** * add * inserts a new radio button. * * example: * * $myradio = new JamHorzRadioButtons(); * $myradio->add('Blue','B'); * $myradio->add('Red','R'); * * @param mixed $labelText the radio label text * @param string $value the radio value * @param mixed $boolChecked true if this radio option must be checked * @access public * @return the full JamPanel created */ public function add($labelText, $value = 'X', $boolChecked = false) { $radio_id = $this->_name . '_' . $this->_count; $this->_count++; $label = new JamElement('label', $labelText); $label->setHtmlOption('for', $radio_id); $input = new JamElement('input'); $input->setId($radio_id); $input->setHtmlOption('name', $this->_name); $input->setHtmlOption('type', 'radio'); $input->setHtmlOption('value', $value); if ($boolChecked == true) { $input->setHtmlOption('checked', 'checked'); } $hpanel = parent::add(new JamHorzPanel()); $hpanel->setBorderNone(); $hpanel->add($label); $hpanel->add($input); return $hpanel; }
public function add($obj) { $this->getList(); if (!is_object($obj)) { $obj = new JamElement("div", $obj); $obj->setHtmlOption('class', 'jam-element'); } foreach ($this->_childHtmlOptions as $key => $value) { $obj->addHtmlOption($key, $value); } $this->_list[] = $obj; return $obj; }