openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 68b0dfe93cf26a31696216e7b15cd62cea693f65
parent bf06d0bcaedf61e293da0753adffc0e3c964a2ae
Author: Jan Dankert <devnull@localhost>
Date:   Sat,  2 Dec 2017 23:45:59 +0100

Komponente "input" umgestellt auf eine Klasse.

Diffstat:
themes/default/include/html/input/Input.class.php | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
themes/default/include/html/input/input-begin.inc.php | 14--------------
2 files changed, 107 insertions(+), 14 deletions(-)

diff --git a/themes/default/include/html/input/Input.class.php b/themes/default/include/html/input/Input.class.php @@ -0,0 +1,106 @@ +<?php + +class InputComponent extends Component +{ + + public $class = 'text'; + + public $default; + + public $type = 'text'; + + public $index; + + public $name; + + public $prefix; + + public $value; + + public $size; + + public $maxlength = 256; + + public $onchange; + + public $readonly = false; + + public $hint; + + public $icon; + + public function begin() + { + if(!$this->type == 'hidden') + { + // Verstecktes Feld. + $this->outputHiddenField(); + } + else + { + echo '<div class="inputholder">'; + echo '<input'; + if(isset($this->readonly)) + echo '<?php if ('.$this->value($this->readonly).') '."echo ' disabled=\"true\"' ?>"; + if (isset($this->hint)) + echo ' data-hint="'.$this->htmlvalue($this->hint).'"'; + + echo ' id="'.'<?php echo REQUEST_ID ?>_'.$this->htmlvalue($this->name).'"'; + + // Attribute name="..." + echo ' name="'; + echo $this->htmlvalue($this->name); + if(isset($this->readonly)) + echo '<?php if ('.$this->value($this->readonly).') '."echo '_disabled' ?>"; + echo '"'; + + echo ' type="'.$this->htmlvalue($this->type).'"'; + echo ' maxlength="'.$this->htmlvalue($this->maxlength).'"'; + echo ' class="'.$this->htmlvalue($this->class).'"'; + + echo ' value="<?php echo Text::encodeHtml('; + if (isset($this->default)) + echo $this->value($this->default); + else + echo '@$'.$this->varname($this->name); + echo ') ?>"'; + + echo ' />'; + + if(isset($this->readonly)) + { + + echo '<?php if ('.$this->value($this->readonly).') { ?>'; + $this->outputHiddenField(); + echo '<?php } ?>'; + } + + + if(isset($this->icon)) + echo '<img src="/themes/default/images/icon_'.$this->htmlvalue($this->icon).'<?php echo IMG_ICON_EXT ?>" width="16" height="16" />'; + + echo '</div>'; + + } + } + + private function outputHiddenField() + { + echo '<input'; + echo ' type="hidden"'; + echo ' name="'.$this->htmlvalue($this->name).'"'; + + echo ' value="<?php '; + + if(isset($this->default)) + echo $this->value($this->default); + else + echo '$'.$this->varname($this->name); + + echo ' ?>"'; + echo '/>'; + + } +} + +?>+ \ No newline at end of file diff --git a/themes/default/include/html/input/input-begin.inc.php b/themes/default/include/html/input/input-begin.inc.php @@ -1,13 +0,0 @@ -<?php if ($this->isEditable() && !$this->isEditMode()) $attr_readonly=true; - if ($attr_readonly && empty($$attr_name)) $$attr_name = '- '.lang('EMPTY').' -'; - if(!isset($attr_default)) $attr_default=''; -// $tmp_value = htmlentities(isset($$attr_name)?$$attr_name:$attr_default,ENT_COMPAT,'UTF-8'); - $tmp_value = Text::encodeHtml(isset($$attr_name)?$$attr_name:$attr_default); - -?><?php if (!$attr_readonly || $attr_type=='hidden') { - /* Feld editieren */ -?><div class="<?php echo $attr_type!='hidden'?'inputholder':'inputhidden' ?>"><input<?php if ($attr_readonly) echo ' disabled="true"' ?><?php if ($attr_hint) echo ' data-hint="'.$attr_hint.'"'; ?> id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?><?php if ($attr_readonly) echo '_disabled' ?>" name="<?php echo $attr_name ?><?php if ($attr_readonly) echo '_disabled' ?>" type="<?php echo $attr_type ?>" maxlength="<?php echo $attr_maxlength ?>" class="<?php echo str_replace(',',' ',$attr_class) ?>" value="<?php echo $tmp_value ?>" /><?php if ($attr_icon) echo '<img src="'.$image_dir.'icon_'.$attr_icon.IMG_ICON_EXT.'" width="16" height="16" />'; ?></div><?php -if ($attr_readonly) { - /* Nur anzeigen */ -?><input type="hidden" id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" value="<?php echo $tmp_value ?>" /><?php - } } else { ?><a title="<?php echo langHtml('EDIT') ?>" href="<?php echo Html::url($actionName,$subActionName,0,array('mode'=>'edit')) ?>"><span class="<?php echo $attr_class ?>"><?php echo $tmp_value ?></span></a><?php } ?>- \ No newline at end of file