Exemplo n.º 1
0
 /**
  * Generates the HTML for the form element.
  * 
  * @return string
  */
 public function __toString()
 {
     $this->attributes['id'] = $this->getId();
     $this->attributes['name'] = $this->getName();
     $value = get::array_def($this->attributes, 'value', '');
     $html = sprintf('<textarea%s>%s</textarea>', get::formattedAttributes($this->getAttributes()), get::entities($value));
     if (is::existset($this->attributes, 'autofocus')) {
         $html .= $this->getAutoFocusScript($this->attributes['id']);
     }
     return $html;
 }
Exemplo n.º 2
0
<!DOCTYPE html>
<html>
<head>
    <title><?php 
echo get::entities($page_title);
?>
</title>
</head>
<body>
<?php 
echo $munla_view_data;
?>
</body>
</html>
Exemplo n.º 3
0
 /**
  * Generates the HTML for the form element.
  * 
  * @return string
  */
 public function __toString()
 {
     $this->attributes['id'] = $this->getId();
     $this->attributes['name'] = $this->getName();
     $keyvalues = get::array_def($this->attributes, 'keyvalues', false, array(true, false));
     $placeholder = get::array_def($this->attributes, 'placeholder', '');
     $separator = get::array_def($this->attributes, 'separator', false);
     $value = get::array_def($this->attributes, 'value', array());
     $multiple = get::array_def($this->attributes, 'multiple', false) == 'multiple';
     if ($multiple && substr($this->attributes['name'], -2) != '[]') {
         $this->attributes['name'] .= '[]';
     }
     if (!is_array($value) && strlen(trim($value)) < 1) {
         $value = array();
     }
     if (!is_array($value)) {
         $value = array($value);
     }
     $html = sprintf('<select%s>', get::formattedAttributes($this->getAttributes()));
     if (!$multiple && isset($placeholder) && strlen(trim($placeholder)) > 0) {
         $html .= sprintf('<option value="%s" disabled%s>%s</option>', get::encodedAttribute($this->emptyValue), count($value) > 0 ? '' : ' selected', get::entities($placeholder));
         if (isset($separator) && $separator !== false) {
             $separator = $separator === true ? '---------------' : $separator;
             $html .= sprintf('<option value="%s" disabled>%s</option>', get::encodedAttribute($this->emptyValue), get::entities($separator));
         }
     }
     if (isset($this->list) && count($this->list) > 0) {
         $stack = $this->build_stack($this->list);
         while ($stack) {
             $current = array_shift($stack);
             if (!is_array($current)) {
                 $html .= $current;
                 continue;
             }
             if (is_array($current['value'])) {
                 if (!is_string($current['key'])) {
                     continue;
                 }
                 $substack = $this->build_stack($current['value']);
                 if ($substack) {
                     $html .= sprintf('<optgroup label="%s">', get::encodedAttribute($current['key']));
                     array_unshift($stack, '</optgroup>');
                     while ($substack) {
                         array_unshift($stack, array_pop($substack));
                     }
                 }
             } else {
                 $v = $keyvalues || is_string($current['key']) ? (string) $current['key'] : $current['value'];
                 $l = $current['value'];
                 $selected = '';
                 if ($l == '-') {
                     $l = !isset($separator) || is_bool($separator) ? '---------------' : $separator;
                     $v = $this->emptyValue;
                 } else {
                     $selected = in_array($v, $value) ? ' selected="selected"' : '';
                 }
                 $html .= sprintf('<option value="%s"%s>%s</option>', get::encodedAttribute($v), $selected, get::entities($l));
             }
         }
     }
     $html .= '</select>';
     if (is::existset($this->attributes, 'autofocus')) {
         $html .= $this->getAutoFocusScript($this->attributes['id']);
     }
     return $html;
 }