/** * @see Rabbit_Field::getFieldHtml() * * @return string */ public function getFieldHtml() { $ci =& get_instance(); $ci->load->helper('rabbit'); $attr['name'] = $this->getName(); $attr['id'] = $this->getName(); $attr['class'] = $this->getAttribute('class', ''); $attr['style'] = $this->getAttribute('style', ''); return sprintf('<textarea %s>%s</textarea>', rabbit_attributes_build($attr), $this->getValue()); }
/** * @see Rabbit_Field::getFieldHtml() * * @return string */ public function getFieldHtml() { $ci =& get_instance(); $ci->load->helper('rabbit'); $attr['type'] = $this->getAttribute('mode', 'text'); $attr['name'] = $this->getName(); $attr['value'] = $this->getAttribute('mode') == 'password' ? '' : $this->getValue(); $attr['class'] = $this->getAttribute('class', ''); $attr['style'] = $this->getAttribute('style', ''); $attr['id'] = $this->getName(); return sprintf('<input %s />', rabbit_attributes_build($attr)); }
/** * @see Rabbit_Field::getFieldHtml() * * @return string */ public function getFieldHtml() { $ci =& get_instance(); $ci->load->helper('rabbit'); $attr = array(); $attr['type'] = 'checkbox'; $attr['name'] = $this->getName(); $attr['value'] = '1'; $attr['class'] = $this->getAttribute('class', ''); $attr['style'] = $this->getAttribute('style', ''); $attr['id'] = $this->getName(); if ($this->getValue() == 1) { $attr['checked'] = 'checked'; } return sprintf('<input %s />', rabbit_attributes_build($attr)); }
/** * @see Rabbit_Field::getFieldHtml() * * @return string */ public function getFieldHtml() { $ci =& get_instance(); $ci->load->helper('rabbit'); $attr['name'] = $this->getName(); $attr['type'] = 'radio'; $attr['class'] = $this->getAttribute('class', ''); $attr['style'] = $this->getAttribute('style', ''); $html = ''; foreach ($this->getItems() as $value => $name) { $selected = $this->getValue() == $value ? ' checked="checked"' : ''; $attr['value'] = $value; $html .= sprintf('<input %s %s /> %s<br />', rabbit_attributes_build($attr), $selected, $name); } return $html; }
/** * @see Rabbit_Field::getFieldHtml() * * @return string */ public function getFieldHtml() { $ci =& get_instance(); $ci->load->helper('rabbit'); $attr['id'] = $this->getName(); $attr['name'] = $this->getName(); $attr['class'] = $this->getAttribute('class', ''); $attr['style'] = $this->getAttribute('style', ''); if ($this->getAttribute('updateField') !== null) { $ci->load->helper('url'); $update = $this->getAttribute('updateField'); $attr['onchange'] = sprintf("forwardSelect('%s', '%s', '%s')", site_url($update['url']), $this->getName(), $update['target']); } $html = sprintf('<select %s>', rabbit_attributes_build($attr)); foreach ($this->getItems() as $value => $name) { $selected = $this->getValue() == $value ? ' selected="selected"' : ''; $html .= sprintf('<option value="%s"%s>%s</option>', $value, $selected, $name); } $html .= '</select>'; return $html; }