protected function _getInput()
    {
        $element = parent::_getInput();
        $options = '';
        foreach ($this->_values as $value => $name) {
            // Things can get weird if we have mixed types
            $sval = $this->_value;
            if (gettype($value) == "integer" && gettype($sval) == "string") {
                $value = strval($value);
            }
            if (isset($this->_attributes['multiple'])) {
                $selected = in_array($value, (array) $sval);
            } else {
                $selected = $sval == $value;
            }
            if (!empty(trim($name)) || is_numeric($name)) {
                $name_str = htmlspecialchars(gettext($name));
            } else {
                // Fixes HTML5 validation: Element option without attribute label must not be empty
                $name_str = " ";
            }
            $options .= '<option value="' . htmlspecialchars($value) . '"' . ($selected ? ' selected' : '') . '>' . $name_str . '</option>';
        }
        return <<<EOT
\t{$element}
\t\t{$options}
\t</select>
EOT;
    }
Exemple #2
0
    protected function _getInput()
    {
        $element = parent::_getInput();
        $options = '';
        foreach ($this->_values as $value => $name) {
            // Things can get wierd if we have mixed types
            $sval = $this->_value;
            if (gettype($value) == "integer" && gettype($sval) == "string") {
                $value = strval($value);
            }
            if (isset($this->_attributes['multiple'])) {
                $selected = in_array($value, (array) $sval);
            } else {
                $selected = $sval == $value;
            }
            if (!empty($name) || $name == '0') {
                $options .= '<option value="' . htmlspecialchars($value) . '"' . ($selected ? ' selected' : '') . '>' . htmlspecialchars(gettext($name)) . '</option>';
            }
        }
        return <<<EOT
\t{$element}
\t\t{$options}
\t</select>
EOT;
    }
 protected function _getInput()
 {
     $input = parent::_getInput();
     if (!isset($this->_attributes['href'])) {
         return $input;
     }
     return $input . htmlspecialchars($this->_title) . '</a>';
 }
    protected function _getInput()
    {
        $element = parent::_getInput();
        $value = htmlspecialchars($this->_value);
        return <<<EOT
\t{$element}{$value}</textarea>
EOT;
    }
 protected function _getInput()
 {
     $input = parent::_getInput();
     if (!isset($this->_description)) {
         return $input;
     }
     return '<label>' . $input . ' ' . htmlspecialchars(gettext($this->_description)) . '</label>';
 }
 protected function _getInput()
 {
     $input = parent::_getInput();
     if (empty($this->_description)) {
         return '<label class="chkboxlbl">' . $input . '</label>';
     }
     return '<label class="chkboxlbl">' . $input . ' ' . htmlspecialchars(gettext($this->_description)) . '</label>';
 }
    protected function _getInput()
    {
        $input = parent::_getInput();
        if (!isset($this->_mask)) {
            return $input;
        }
        return <<<EOT
\t\t<div class="input-group">
\t\t\t{$input}
\t\t\t<span class="input-group-addon input-group-inbetween pfIpMask">/</span>
\t\t\t{$this->_mask}
\t\t</div>
EOT;
    }