phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlStep.php
Go to the documentation of this file.
1<?php
2
4
8
12
14 protected $_activeStep;
15 protected $_startStep;
16
17 public function __construct( $identifier,$steps=array()){
18 parent::__construct( $identifier,"div", "ui steps");
19 $this->addItems($steps);
20 }
21
22
27 protected function createItem($value) {
28 $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value);
29 return $itemO;
30 }
31
36 public function addStep($step){
37 return $this->addItem($step);
38 }
39
40 public function setOrdered(){
41 return $this->addToProperty("class", "ordered");
42 }
43
44 public function isOrdered(){
45 return $this->propertyContains("class", "ordered");
46 }
47
48 public function setVertical(){
49 return $this->addToProperty("class", "vertical");
50 }
51
52 protected function defineActiveStep(){
53 $activestep=$this->_activeStep;
54 $count=$this->count();
55 if(!$this->isOrdered()){
56 for($i=$this->_startStep;$i<$count;$i++){
57 $step=$this->content[$i];
58 $step->removeStatus();
59 if($i<$activestep)
60 $step->setCompleted();
61 elseif ($i===$activestep)
62 $step->setActive();
63 else
64 $step->setDisabled();
65 }
66 }else{
67 foreach ($this->content as $step){
68 $step->removeStatus();
69 }
70 if($activestep<$count)
71 $this->content[$activestep]->setActive();
72 }
73 return $this;
74 }
75
76 public function compile(JsUtils $js=NULL, &$view=NULL) {
77 if(isset($this->_activeStep) && \is_numeric($this->_activeStep))
78 $this->defineActiveStep();
79 return parent::compile($js,$view);
80 }
81
82 public function setActiveStep($_activeStep) {
83 $this->_activeStep=$_activeStep;
84 return $this;
85 }
86
87 public function setAttached($side="",HtmlDoubleElement $toElement=NULL){
88 if(isset($toElement)){
89 $toElement->addToPropertyCtrl("class", "attached",array("attached"));
90 }
91 return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
92 }
93
94 public function setStartStep($_startStep) {
95 $this->_startStep=$_startStep;
96 return $this;
97 }
98
99}
JQuery PHP library.
Definition JsUtils.php:23
Base class for Html collections.
addItem($item)
adds and returns an item
Base class for Semantic Html collections.
addToProperty($name, $value, $separator=" ")
addToPropertyCtrl($name, $value, $typeCtrl)
createItem($value)
The item factory.
Definition HtmlStep.php:27
setAttached($side="", HtmlDoubleElement $toElement=NULL)
Definition HtmlStep.php:87
__construct( $identifier, $steps=array())
Definition HtmlStep.php:17
compile(JsUtils $js=NULL, &$view=NULL)
Definition HtmlStep.php:76