function generateHTML() { $value = $this->getEffectiveValue(); $options = ''; foreach ($this->options as $i => $option) { if (!isset($option['value'])) { $optgroup = ''; foreach ($option as $suboption) { $attributes = array('value' => $suboption['value']); if ($suboption['value'] == $value) { $attributes['selected'] = 'selected'; } $optgroup .= DingesForm::generateTag('option', $attributes, $suboption['content']); } $options .= DingesForm::generateTag('optgroup', array('label' => $i), $optgroup); continue; } $attributes = array('value' => $option['value']); if (is_array($value)) { if (in_array($option['value'], $value)) { $attributes['selected'] = 'selected'; } } else { if ($option['value'] == $value) { $attributes['selected'] = 'selected'; } } $options .= DingesForm::generateTag('option', $attributes, $option['content']); } return DingesForm::generateTag($this->element, $this->attributes, $options) . $this->getRestrictionComment(); }
function generateHTML() { if (!($content = $this->getEffectiveValue())) { $content = ''; } return DingesForm::generateTag($this->element, $this->attributes, htmlspecialchars($content, ENT_NOQUOTES)) . $this->getRestrictionComment(); }
function generateItemHTML($item, $checked) { $attributes = $this->attributes; $attributes['id'] = $this->getFullId() . '_' . $item['value']; $attributes['value'] = $item['value']; if ($checked) { $attributes['checked'] = 'checked'; } return DingesForm::generateTag('input', $attributes); }
function getLabelTag() { if ($this->realLabelTag) { $element = 'label'; $this->setLabelAttribute('for', $this->getFullId()); } else { $element = 'span'; } return DingesForm::generateTag($element, $this->labelAttributes, $this->label); }
function generateErrorElement() { $attributes = array(); $attributes['id'] = $this->getFullId() . '_error'; $attributes['class'] = 'dingesErrorSpan'; if ($this->isValid() || !$this->form->isPosted()) { $content = ''; } else { $content = $this->form->getErrorMessage($this->errorCode); } if ($content && $this->form->getErrorIcon()) { $imgattributes = array(); $imgattributes['src'] = $this->form->getErrorIcon(); $imgattributes['alt'] = $content; $imgattributes['onClick'] = "alert('" . str_replace("'", ''', $content) . "');"; $content = DingesForm::generateTag('img', $imgattributes); } return DingesForm::generateTag('span', $attributes, $content); }
function generateHTML() { $out = parent::generateHTML(); if ($this->maxFileSize !== NULL) { return DingesForm::generateTag('input', array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => $this->maxFileSize)) . $out; } return $out; }
function generateHTML() { return DingesForm::generateTag('span', array('id' => $this->getFullId()), $this->getDefaultValue()); }