/** * Displays the input component. * * @todo Add procedure injection! * @todo Add translations. * @param array $attributes The opt:display attribute list. */ public function display($attributes = array()) { $name = $this->_item->getFullyQualifiedName(); $value = $this->_item->getValue(); echo '<fieldset class="' . Opf_Design::getClass('yesno', $this->_item->isValid()) . '"> <label class="yes"><input type="radio" name="' . $name . '" value="1" ' . ($value == true ? 'checked="checked"' : '') . '> Yes</label> <label class="no"><input type="radio" name="' . $name . '" value="0" ' . ($value == false ? 'checked="checked"' : '') . '> No</label> </fieldset>'; }
/** * Displays the select component. * * @param array $attributes The opt:display attribute list. */ public function display($attributes = array()) { $attributes = array('name' => $this->_item->getFullyQualifiedName(), 'class' => Opf_Design::getClass('select', $this->_item->isValid())); $code = '<select ' . Opt_Function::buildAttributes($attributes) . '>'; foreach ($this->_options as $id => $option) { if ($id == $this->_item->getValue()) { $code .= '<option value="' . $id . '" selected="selected">' . $option . '</option>'; } else { $code .= '<option value="' . $id . '">' . $option . '</option>'; } } echo $code . '</select>'; }
/** * Displays the input component. * * @param array $attributes The opt:display attribute list. */ public function display($attributes = array()) { $attributes = array('name' => $this->_item->getFullyQualifiedName(), 'value' => $this->_item->getDisplayedValue(), 'class' => Opf_Design::getClass('input', $this->_item->isValid())); echo '<input type="text" ' . Opt_Function::buildAttributes($attributes) . ' />'; }
public function manageAttributes($tagName, array $attributes) { $valid = $this->_item->isValid(); $attributes['class'] = Opf_Design::getClass($this->getComponentName() . '.field', $valid); if ($attributes['class'] === null) { $attributes['class'] = Opf_Design::getClass('field', $valid); } return $attributes; }