Button.class.php (985B)
1 <?php 2 3 namespace template_engine\components; 4 5 class ButtonComponent extends Component 6 { 7 8 public $type = 'submit'; 9 public $class = 'ok'; 10 public $src; 11 public $text = 'button_ok'; 12 public $value = 'ok'; 13 14 private $tmp_src; 15 16 protected function begin() 17 { 18 echo <<<'HTML' 19 <div class="invisible"> 20 HTML; 21 22 if ($this->type == 'ok') 23 $this->type = 'submit'; 24 25 if (! empty($this->src)) 26 { 27 $this->type = 'image'; 28 $this->tmp_src = $image_dir . 'icon_' . $this->src . IMG_ICON_EXT; 29 } 30 else 31 { 32 $this->tmp_src = ''; 33 } 34 35 if (! empty($this->type)) 36 { 37 ?> 38 <input type="<?php echo $this->type ?>" <?php if(isset($this->src)) { ?> 39 src="<?php $this->tmp_src ?>" <?php } ?> 40 name="<?php echo $this->value ?>" class="%class%" 41 title="<?php echo lang($this->text.'_DESC') ?>" 42 value=" <?php echo langHtml($this->text) ?> " /><?php unset($this->src); ?> 43 <?php 44 45 } 46 } 47 48 protected function end() 49 { 50 echo "</div>"; 51 } 52 } 53 54 ?>