| 1: | <?php
|
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: |
|
| 7: | namespace Sphp\comp\html{
|
| 8: |
|
| 9: |
|
| 10: | class ForLoop extends \Sphp\tools\Control{
|
| 11: | public $counterMin = 0;
|
| 12: | public $counterStep = 1;
|
| 13: | public $counterMax = 0;
|
| 14: | public $strFormat = '';
|
| 15: |
|
| 16: | public function __construct($name='',$fieldName='',$tableName='') {
|
| 17: | $this->init($name,'','');
|
| 18: | $this->unsetrenderTag();
|
| 19: | }
|
| 20: |
|
| 21: | public function setLoopFrom($val){
|
| 22: | $this->counterMin = $val;
|
| 23: | }
|
| 24: | public function setLoopTo($val){
|
| 25: | $this->counterMax = $val;
|
| 26: | }
|
| 27: | public function setStep($val){
|
| 28: | $this->counterStep = $val;
|
| 29: | }
|
| 30: |
|
| 31: | private function genrender(){
|
| 32: | $stro = executePHPCode('<?php
|
| 33: | for($index = $'. $this->name .'->counterMin;$index <= $'. $this->name .'->counterMax;$index += $'. $this->name .'->counterStep ){
|
| 34: | ?>'.$this->strFormat.'<?php
|
| 35: | } ?>');
|
| 36: | return $stro;
|
| 37: |
|
| 38: | }
|
| 39: |
|
| 40: |
|
| 41: | public function onrender(){
|
| 42: | $this->strFormat = $this->innerHTML;
|
| 43: | $this->innerHTML = $this->genrender();
|
| 44: | }
|
| 45: |
|
| 46: |
|
| 47: | }
|
| 48: | }
|
| 49: | |