@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
13 | 13 | private $_params; |
14 | 14 | private $_container; |
15 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
15 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
16 | 16 | parent::__construct($identifier, "div"); |
17 | 17 | $this->_container=$container; |
18 | 18 | $this->setClass("ui popup"); |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | $this->_params=array("on"=>"hover"); |
21 | 21 | } |
22 | 22 | |
23 | - public function addList($items=array(),$header=NULL){ |
|
24 | - if(!$this->content instanceof HtmlGrid){ |
|
25 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
23 | + public function addList($items=array(), $header=NULL) { |
|
24 | + if (!$this->content instanceof HtmlGrid) { |
|
25 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
26 | 26 | } |
27 | 27 | $grid=$this->content; |
28 | 28 | |
29 | 29 | $colCount=$grid->colCount(); |
30 | 30 | $grid->setColsCount(++$colCount); |
31 | 31 | |
32 | - $list=new HtmlList("",$items); |
|
32 | + $list=new HtmlList("", $items); |
|
33 | 33 | $list->asLink(); |
34 | - if(isset($header)){ |
|
35 | - $list->addHeader(4,$header); |
|
34 | + if (isset($header)) { |
|
35 | + $list->addHeader(4, $header); |
|
36 | 36 | } |
37 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
37 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
38 | 38 | $grid->setDivided()->setRelaxed(true); |
39 | 39 | return $list; |
40 | 40 | } |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * A popup can have no maximum width and continue to flow to fit its content |
44 | 44 | */ |
45 | - public function setFlowing(){ |
|
45 | + public function setFlowing() { |
|
46 | 46 | return $this->addToProperty("class", "flowing"); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * A popup can provide more basic formatting |
51 | 51 | */ |
52 | - public function setBasic(){ |
|
52 | + public function setBasic() { |
|
53 | 53 | return $this->addToProperty("class", "basic"); |
54 | 54 | } |
55 | 55 | |
@@ -57,22 +57,22 @@ discard block |
||
57 | 57 | * {@inheritDoc} |
58 | 58 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
59 | 59 | */ |
60 | - public function run(JsUtils $js){ |
|
60 | + public function run(JsUtils $js) { |
|
61 | 61 | $this->_params["popup"]="#".$this->identifier; |
62 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
62 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
63 | 63 | } |
64 | 64 | |
65 | - public function setOn($event="click"){ |
|
65 | + public function setOn($event="click") { |
|
66 | 66 | $this->_params["on"]=$event; |
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - public function setInline($value=true){ |
|
70 | + public function setInline($value=true) { |
|
71 | 71 | $this->_params["inline"]=$value; |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function setPosition($position){ |
|
75 | + public function setPosition($position) { |
|
76 | 76 | $this->_params["position"]=$position; |
77 | 77 | return $this; |
78 | 78 | } |
@@ -10,6 +10,9 @@ discard block |
||
10 | 10 | class HtmlList extends HtmlSemCollection{ |
11 | 11 | protected $_hasCheckedList; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $identifier |
|
15 | + */ |
|
13 | 16 | public function __construct( $identifier, $items=array()){ |
14 | 17 | parent::__construct( $identifier, "div", "ui list"); |
15 | 18 | $this->addItems($items); |
@@ -27,6 +30,9 @@ discard block |
||
27 | 30 | return $item; |
28 | 31 | } |
29 | 32 | |
33 | + /** |
|
34 | + * @param integer $niveau |
|
35 | + */ |
|
30 | 36 | public function addHeader($niveau,$content){ |
31 | 37 | return $this->wrap(new HtmlHeader("header-".$this->identifier,$niveau,$content,"page")); |
32 | 38 | } |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | protected function createItem($value) { |
20 | 20 | $count=$this->count(); |
21 | 21 | if (\is_array($value)) { |
22 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value[0]); |
|
22 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
|
23 | 23 | $item->addIcon($value[1]); |
24 | - } else |
|
25 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
24 | + }else |
|
25 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
26 | 26 | return $item; |
27 | 27 | } |
28 | 28 | |
29 | 29 | public function addHeader($niveau, $content) { |
30 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
30 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
31 | 31 | $this->wrap($header); |
32 | 32 | return $header; |
33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | public function asLink() { |
40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
41 | 41 | return $this->contentAs("a"); |
42 | 42 | } |
43 | 43 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | public function run(JsUtils $js) { |
55 | - if ($this->_hasCheckedList === true) { |
|
56 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
57 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
55 | + if ($this->_hasCheckedList===true) { |
|
56 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
57 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
58 | 58 | $this->executeOnRun($jsCode); |
59 | 59 | } |
60 | 60 | return parent::run($js); |
@@ -70,28 +70,28 @@ discard block |
||
70 | 70 | |
71 | 71 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
72 | 72 | $count=$this->count(); |
73 | - $identifier=$this->identifier . "-" . $count; |
|
73 | + $identifier=$this->identifier."-".$count; |
|
74 | 74 | if (isset($masterItem)) { |
75 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
75 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
76 | 76 | $masterO->getField()->addToProperty("class", "master"); |
77 | 77 | $masterO->setClass("item"); |
78 | 78 | $this->addItem($masterO); |
79 | 79 | } |
80 | - $fields=array (); |
|
80 | + $fields=array(); |
|
81 | 81 | $i=0; |
82 | - foreach ( $items as $val => $caption ) { |
|
83 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
84 | - if (\array_search($val, $values) !== false) { |
|
82 | + foreach ($items as $val => $caption) { |
|
83 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
84 | + if (\array_search($val, $values)!==false) { |
|
85 | 85 | $itemO->getField()->getField()->setProperty("checked", ""); |
86 | 86 | } |
87 | 87 | $itemO->setClass("item"); |
88 | 88 | $fields[]=$itemO; |
89 | 89 | } |
90 | - if (isset($masterO) === true) { |
|
90 | + if (isset($masterO)===true) { |
|
91 | 91 | $list=new HtmlList("", $fields); |
92 | 92 | $list->setClass("list"); |
93 | 93 | $masterO->addContent($list); |
94 | - } else { |
|
94 | + }else { |
|
95 | 95 | $this->addList($fields); |
96 | 96 | } |
97 | 97 | $this->_hasCheckedList=true; |
@@ -21,8 +21,9 @@ |
||
21 | 21 | if (\is_array($value)) { |
22 | 22 | $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value[0]); |
23 | 23 | $item->addIcon($value[1]); |
24 | - } else |
|
25 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
24 | + } else { |
|
25 | + $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
26 | + } |
|
26 | 27 | return $item; |
27 | 28 | } |
28 | 29 |
@@ -10,64 +10,64 @@ |
||
10 | 10 | |
11 | 11 | class HtmlReveal extends HtmlSemDoubleElement { |
12 | 12 | |
13 | - public function __construct($identifier, $visibleContent,$hiddenContent,$type=RevealType::FADE,$attributeType=NULL) { |
|
13 | + public function __construct($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) { |
|
14 | 14 | parent::__construct($identifier, "div", "ui reveal"); |
15 | 15 | $this->setElement(0, $visibleContent); |
16 | 16 | $this->setElement(1, $hiddenContent); |
17 | - $this->setType($type,$attributeType); |
|
17 | + $this->setType($type, $attributeType); |
|
18 | 18 | } |
19 | 19 | |
20 | - private function setElement($index,$content){ |
|
21 | - if(!$content instanceof HtmlSingleElement){ |
|
22 | - $content=new HtmlLabel("",$content); |
|
20 | + private function setElement($index, $content) { |
|
21 | + if (!$content instanceof HtmlSingleElement) { |
|
22 | + $content=new HtmlLabel("", $content); |
|
23 | 23 | } |
24 | - if($content instanceof HtmlSemDoubleElement){ |
|
25 | - $content=new HtmlSemDoubleElement($this->identifier."-".$index,"div","",$content); |
|
26 | - }elseif ($content instanceof HtmlImg){ |
|
24 | + if ($content instanceof HtmlSemDoubleElement) { |
|
25 | + $content=new HtmlSemDoubleElement($this->identifier."-".$index, "div", "", $content); |
|
26 | + }elseif ($content instanceof HtmlImg) { |
|
27 | 27 | $this->addToPropertyCtrl("class", "image", array("image")); |
28 | 28 | } |
29 | - $content->addToProperty("class",(($index===0)?"visible":"hidden")." content"); |
|
29 | + $content->addToProperty("class", (($index===0) ? "visible" : "hidden")." content"); |
|
30 | 30 | $this->content[$index]=$content; |
31 | 31 | return $this; |
32 | 32 | } |
33 | 33 | |
34 | - public function setVisibleContent($visibleContent){ |
|
34 | + public function setVisibleContent($visibleContent) { |
|
35 | 35 | return $this->setElement(0, $visibleContent); |
36 | 36 | } |
37 | 37 | |
38 | - public function setHiddenContent($hiddenContent){ |
|
38 | + public function setHiddenContent($hiddenContent) { |
|
39 | 39 | return $this->setElement(1, $hiddenContent); |
40 | 40 | } |
41 | 41 | |
42 | - public function getVisibleContent(){ |
|
42 | + public function getVisibleContent() { |
|
43 | 43 | return $this->content[0]; |
44 | 44 | } |
45 | 45 | |
46 | - public function getHiddenContent(){ |
|
46 | + public function getHiddenContent() { |
|
47 | 47 | return $this->content[1]; |
48 | 48 | } |
49 | 49 | |
50 | - public function setType($type,$attribute=NULL){ |
|
50 | + public function setType($type, $attribute=NULL) { |
|
51 | 51 | $this->addToPropertyCtrl("class", $type, RevealType::getConstants()); |
52 | - if(isset($attribute)){ |
|
52 | + if (isset($attribute)) { |
|
53 | 53 | $this->addToPropertyCtrl("class", $attribute, Direction::getConstants()); |
54 | 54 | } |
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
58 | - public function setFade($attribute=NULL){ |
|
59 | - return $this->setType(RevealType::FADE,$attribute); |
|
58 | + public function setFade($attribute=NULL) { |
|
59 | + return $this->setType(RevealType::FADE, $attribute); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function setMove($attribute=NULL){ |
|
63 | - return $this->setType(RevealType::MOVE,$attribute); |
|
62 | + public function setMove($attribute=NULL) { |
|
63 | + return $this->setType(RevealType::MOVE, $attribute); |
|
64 | 64 | } |
65 | 65 | |
66 | - public function setRotate($attribute=NULL){ |
|
67 | - return $this->setType(RevealType::ROTATE,$attribute); |
|
66 | + public function setRotate($attribute=NULL) { |
|
67 | + return $this->setType(RevealType::ROTATE, $attribute); |
|
68 | 68 | } |
69 | 69 | |
70 | - public function setCircular(){ |
|
70 | + public function setCircular() { |
|
71 | 71 | return $this->addToProperty("class", "circular"); |
72 | 72 | } |
73 | 73 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | } |
24 | 24 | if($content instanceof HtmlSemDoubleElement){ |
25 | 25 | $content=new HtmlSemDoubleElement($this->identifier."-".$index,"div","",$content); |
26 | - }elseif ($content instanceof HtmlImg){ |
|
26 | + } elseif ($content instanceof HtmlImg){ |
|
27 | 27 | $this->addToPropertyCtrl("class", "image", array("image")); |
28 | 28 | } |
29 | 29 | $content->addToProperty("class",(($index===0)?"visible":"hidden")." content"); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | use Ajax\common\html\HtmlDoubleElement; |
10 | 10 | use Ajax\semantic\html\base\constants\Side; |
11 | 11 | |
12 | -class HtmlStep extends HtmlSemCollection{ |
|
12 | +class HtmlStep extends HtmlSemCollection { |
|
13 | 13 | protected $_activeStep; |
14 | 14 | |
15 | - public function __construct( $identifier,$steps=array()){ |
|
16 | - parent::__construct( $identifier,"div", "ui steps"); |
|
15 | + public function __construct($identifier, $steps=array()) { |
|
16 | + parent::__construct($identifier, "div", "ui steps"); |
|
17 | 17 | $this->addItems($steps); |
18 | 18 | } |
19 | 19 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
24 | 24 | */ |
25 | 25 | protected function createItem($value) { |
26 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
26 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
27 | 27 | return $itemO; |
28 | 28 | } |
29 | 29 | |
@@ -31,50 +31,50 @@ discard block |
||
31 | 31 | * @param string|array $step |
32 | 32 | * @return HtmlStepItem |
33 | 33 | */ |
34 | - public function addStep($step){ |
|
34 | + public function addStep($step) { |
|
35 | 35 | return $this->addItem($step); |
36 | 36 | } |
37 | 37 | |
38 | - public function setOrdered(){ |
|
38 | + public function setOrdered() { |
|
39 | 39 | return $this->addToProperty("class", "ordered"); |
40 | 40 | } |
41 | 41 | |
42 | - public function isOrdered(){ |
|
42 | + public function isOrdered() { |
|
43 | 43 | return $this->propertyContains("class", "ordered"); |
44 | 44 | } |
45 | 45 | |
46 | - public function setVertical(){ |
|
46 | + public function setVertical() { |
|
47 | 47 | return $this->addToProperty("class", "vertical"); |
48 | 48 | } |
49 | 49 | |
50 | - protected function defineActiveStep(){ |
|
50 | + protected function defineActiveStep() { |
|
51 | 51 | $activestep=$this->_activeStep; |
52 | 52 | $count=$this->count(); |
53 | - if($this->isOrdered()){ |
|
54 | - for($i=0;$i<$count;$i++){ |
|
53 | + if ($this->isOrdered()) { |
|
54 | + for ($i=0; $i<$count; $i++) { |
|
55 | 55 | $step=$this->content[$i]; |
56 | 56 | $step->removeStatus(); |
57 | - if($i<$activestep) |
|
57 | + if ($i<$activestep) |
|
58 | 58 | $step->setCompleted(); |
59 | 59 | elseif ($i===$activestep) |
60 | 60 | $step->setActive(); |
61 | 61 | else |
62 | 62 | $step->setDisabled(); |
63 | 63 | } |
64 | - }else{ |
|
65 | - foreach ($this->content as $step){ |
|
64 | + }else { |
|
65 | + foreach ($this->content as $step) { |
|
66 | 66 | $step->removeStatus(); |
67 | 67 | } |
68 | - if($activestep<$count) |
|
68 | + if ($activestep<$count) |
|
69 | 69 | $this->content[$activestep]->setActive(); |
70 | 70 | } |
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | 74 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
75 | - if(isset($this->_activeStep)===true && \is_numeric($this->_activeStep)) |
|
75 | + if (isset($this->_activeStep)===true && \is_numeric($this->_activeStep)) |
|
76 | 76 | $this->defineActiveStep(); |
77 | - return parent::compile($js,$view); |
|
77 | + return parent::compile($js, $view); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public function setActiveStep($_activeStep) { |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | return $this; |
83 | 83 | } |
84 | 84 | |
85 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
86 | - if(isset($toElement)){ |
|
87 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
85 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
86 | + if (isset($toElement)) { |
|
87 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
88 | 88 | } |
89 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
89 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
90 | 90 | } |
91 | 91 | |
92 | - public function asLink(){ |
|
93 | - foreach ($this->content as $step){ |
|
92 | + public function asLink() { |
|
93 | + foreach ($this->content as $step) { |
|
94 | 94 | $step->asLink(); |
95 | 95 | } |
96 | 96 | return $this; |
@@ -54,26 +54,29 @@ |
||
54 | 54 | for($i=0;$i<$count;$i++){ |
55 | 55 | $step=$this->content[$i]; |
56 | 56 | $step->removeStatus(); |
57 | - if($i<$activestep) |
|
58 | - $step->setCompleted(); |
|
59 | - elseif ($i===$activestep) |
|
60 | - $step->setActive(); |
|
61 | - else |
|
62 | - $step->setDisabled(); |
|
57 | + if($i<$activestep) { |
|
58 | + $step->setCompleted(); |
|
59 | + } elseif ($i===$activestep) { |
|
60 | + $step->setActive(); |
|
61 | + } else { |
|
62 | + $step->setDisabled(); |
|
63 | + } |
|
63 | 64 | } |
64 | - }else{ |
|
65 | + } else{ |
|
65 | 66 | foreach ($this->content as $step){ |
66 | 67 | $step->removeStatus(); |
67 | 68 | } |
68 | - if($activestep<$count) |
|
69 | - $this->content[$activestep]->setActive(); |
|
69 | + if($activestep<$count) { |
|
70 | + $this->content[$activestep]->setActive(); |
|
71 | + } |
|
70 | 72 | } |
71 | 73 | return $this; |
72 | 74 | } |
73 | 75 | |
74 | 76 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
75 | - if(isset($this->_activeStep)===true && \is_numeric($this->_activeStep)) |
|
76 | - $this->defineActiveStep(); |
|
77 | + if(isset($this->_activeStep)===true && \is_numeric($this->_activeStep)) { |
|
78 | + $this->defineActiveStep(); |
|
79 | + } |
|
77 | 80 | return parent::compile($js,$view); |
78 | 81 | } |
79 | 82 |
@@ -13,8 +13,9 @@ |
||
13 | 13 | public function __construct($identifier,$caption="",$icon=NULL,$tagName="div") { |
14 | 14 | parent::__construct($identifier,$tagName,"ui label"); |
15 | 15 | $this->content=$caption; |
16 | - if(isset($icon)) |
|
17 | - $this->addIcon($icon); |
|
16 | + if(isset($icon)) { |
|
17 | + $this->addIcon($icon); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | /** |
@@ -10,6 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | class HtmlLabel extends HtmlSemDoubleElement { |
12 | 12 | use LabeledIconTrait; |
13 | + |
|
14 | + /** |
|
15 | + * @param string $icon |
|
16 | + */ |
|
13 | 17 | public function __construct($identifier,$caption="",$icon=NULL,$tagName="div") { |
14 | 18 | parent::__construct($identifier,$tagName,"ui label"); |
15 | 19 | $this->content=$caption; |
@@ -18,7 +22,6 @@ discard block |
||
18 | 22 | } |
19 | 23 | |
20 | 24 | /** |
21 | - * @param string $side |
|
22 | 25 | * @return \Ajax\semantic\html\elements\HtmlLabel |
23 | 26 | */ |
24 | 27 | public function setPointing($value=Direction::NONE){ |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | class HtmlLabel extends HtmlSemDoubleElement { |
12 | 12 | use LabeledIconTrait; |
13 | - public function __construct($identifier,$caption="",$icon=NULL,$tagName="div") { |
|
14 | - parent::__construct($identifier,$tagName,"ui label"); |
|
13 | + public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
|
14 | + parent::__construct($identifier, $tagName, "ui label"); |
|
15 | 15 | $this->content=$caption; |
16 | - if(isset($icon)) |
|
16 | + if (isset($icon)) |
|
17 | 17 | $this->addIcon($icon); |
18 | 18 | } |
19 | 19 | |
@@ -21,33 +21,33 @@ discard block |
||
21 | 21 | * @param string $side |
22 | 22 | * @return \Ajax\semantic\html\elements\HtmlLabel |
23 | 23 | */ |
24 | - public function setPointing($value=Direction::NONE){ |
|
25 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
24 | + public function setPointing($value=Direction::NONE) { |
|
25 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @param string $side |
30 | 30 | * @return \Ajax\semantic\html\elements\HtmlLabel |
31 | 31 | */ |
32 | - public function toCorner($side="left"){ |
|
33 | - return $this->addToPropertyCtrl("class", $side." corner",array("right corner","left corner")); |
|
32 | + public function toCorner($side="left") { |
|
33 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @return \Ajax\semantic\html\elements\HtmlLabel |
38 | 38 | */ |
39 | - public function asTag(){ |
|
39 | + public function asTag() { |
|
40 | 40 | return $this->addToProperty("class", "tag"); |
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @return \Ajax\semantic\html\elements\HtmlLabel |
45 | 45 | */ |
46 | - public function asLink(){ |
|
46 | + public function asLink() { |
|
47 | 47 | return $this->setTagName("a"); |
48 | 48 | } |
49 | 49 | |
50 | - public function setBasic(){ |
|
50 | + public function setBasic() { |
|
51 | 51 | return $this->addToProperty("class", "basic"); |
52 | 52 | } |
53 | 53 | |
@@ -58,28 +58,28 @@ discard block |
||
58 | 58 | * @param string $before |
59 | 59 | * @return \Ajax\semantic\html\elements\HtmlLabel |
60 | 60 | */ |
61 | - public function addImage($src,$alt="",$before=true){ |
|
61 | + public function addImage($src, $alt="", $before=true) { |
|
62 | 62 | $this->addToProperty("class", "image"); |
63 | - return $this->addContent(new HtmlImg("image-".$this->identifier,$src,$alt),$before); |
|
63 | + return $this->addContent(new HtmlImg("image-".$this->identifier, $src, $alt), $before); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @param string $detail |
68 | 68 | * @return \Ajax\common\html\HtmlDoubleElement |
69 | 69 | */ |
70 | - public function addDetail($detail){ |
|
71 | - $div=new HtmlDoubleElement("detail-".$this->identifier,$this->tagName); |
|
70 | + public function addDetail($detail) { |
|
71 | + $div=new HtmlDoubleElement("detail-".$this->identifier, $this->tagName); |
|
72 | 72 | $div->setClass("detail"); |
73 | 73 | $div->setContent($detail); |
74 | 74 | $this->addContent($div); |
75 | 75 | return $div; |
76 | 76 | } |
77 | 77 | |
78 | - public function asRibbon(){ |
|
78 | + public function asRibbon() { |
|
79 | 79 | return $this->addToPropertyCtrl("class", "ribbon", array("ribbon")); |
80 | 80 | } |
81 | 81 | |
82 | - public static function ribbon($identifier,$caption){ |
|
83 | - return (new HtmlLabel($identifier,$caption))->asRibbon(); |
|
82 | + public static function ribbon($identifier, $caption) { |
|
83 | + return (new HtmlLabel($identifier, $caption))->asRibbon(); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class StepStatus extends BaseEnum { |
8 | - const ACTIVE="active",COMPLETED="completed",DISABLED="disabled",NONE=""; |
|
8 | + const ACTIVE="active", COMPLETED="completed", DISABLED="disabled", NONE=""; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base\constants; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Direction extends BaseEnum { |
5 | - const RIGHT="right", LEFT="left",DOWN="down",UP="up",NONE=""; |
|
5 | + const RIGHT="right", LEFT="left", DOWN="down", UP="up", NONE=""; |
|
6 | 6 | } |
7 | 7 | \ No newline at end of file |
@@ -12,70 +12,70 @@ |
||
12 | 12 | public function __construct($identifier, $content) { |
13 | 13 | parent::__construct($identifier, "div", "step"); |
14 | 14 | $this->content=array(); |
15 | - if(\is_array($content)){ |
|
16 | - if(JArray::isAssociative($content)===false){ |
|
17 | - $icon=JArray::getValue($content, "icon",0); |
|
18 | - $title=JArray::getValue($content, "title",1); |
|
19 | - $desc=JArray::getValue($content, "description",2); |
|
20 | - $status=JArray::getValue($content, "status",3); |
|
21 | - }else{ |
|
15 | + if (\is_array($content)) { |
|
16 | + if (JArray::isAssociative($content)===false) { |
|
17 | + $icon=JArray::getValue($content, "icon", 0); |
|
18 | + $title=JArray::getValue($content, "title", 1); |
|
19 | + $desc=JArray::getValue($content, "description", 2); |
|
20 | + $status=JArray::getValue($content, "status", 3); |
|
21 | + }else { |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
25 | 25 | $status=@$content["status"]; |
26 | 26 | } |
27 | - if(isset($icon)===true){ |
|
27 | + if (isset($icon)===true) { |
|
28 | 28 | $this->setIcon($icon); |
29 | 29 | } |
30 | - if(isset($status)===true){ |
|
30 | + if (isset($status)===true) { |
|
31 | 31 | $this->setStatus($status); |
32 | 32 | } |
33 | - if(isset($title)===true){ |
|
34 | - $this->setTitle($title,$desc); |
|
33 | + if (isset($title)===true) { |
|
34 | + $this->setTitle($title, $desc); |
|
35 | 35 | } |
36 | - }else{ |
|
36 | + }else { |
|
37 | 37 | $this->setContent($content); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | - public function setIcon($icon){ |
|
41 | + public function setIcon($icon) { |
|
42 | 42 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
43 | 43 | } |
44 | 44 | |
45 | - private function createContent(){ |
|
46 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
45 | + private function createContent() { |
|
46 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
47 | 47 | return $this->content["content"]; |
48 | 48 | } |
49 | 49 | |
50 | - public function setTitle($title,$description=NULL){ |
|
51 | - $title=new HtmlSemDoubleElement("","div","title",$title); |
|
52 | - if(\array_key_exists("content", $this->content)===false){ |
|
50 | + public function setTitle($title, $description=NULL) { |
|
51 | + $title=new HtmlSemDoubleElement("", "div", "title", $title); |
|
52 | + if (\array_key_exists("content", $this->content)===false) { |
|
53 | 53 | $this->createContent(); |
54 | 54 | } |
55 | 55 | $this->content["content"]->addContent($title); |
56 | - if(isset($description)){ |
|
57 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
56 | + if (isset($description)) { |
|
57 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
58 | 58 | $this->content["content"]->addContent($description); |
59 | 59 | } |
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 | |
63 | - public function setActive(){ |
|
63 | + public function setActive() { |
|
64 | 64 | return $this->setStatus(StepStatus::ACTIVE); |
65 | 65 | } |
66 | 66 | |
67 | - public function setCompleted(){ |
|
67 | + public function setCompleted() { |
|
68 | 68 | return $this->setStatus(StepStatus::COMPLETED); |
69 | 69 | } |
70 | 70 | |
71 | - public function setStatus($status){ |
|
71 | + public function setStatus($status) { |
|
72 | 72 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
73 | 73 | } |
74 | 74 | |
75 | - public function asLink(){ |
|
75 | + public function asLink() { |
|
76 | 76 | return $this->setTagName("a"); |
77 | 77 | } |
78 | - public function removeStatus(){ |
|
78 | + public function removeStatus() { |
|
79 | 79 | $this->removePropertyValues("class", StepStatus::getConstants()); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $title=JArray::getValue($content, "title",1); |
19 | 19 | $desc=JArray::getValue($content, "description",2); |
20 | 20 | $status=JArray::getValue($content, "status",3); |
21 | - }else{ |
|
21 | + } else{ |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if(isset($title)===true){ |
34 | 34 | $this->setTitle($title,$desc); |
35 | 35 | } |
36 | - }else{ |
|
36 | + } else{ |
|
37 | 37 | $this->setContent($content); |
38 | 38 | } |
39 | 39 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * Sets the menu type |
33 | 33 | * @param string $type one of text,item |
34 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
34 | + * @return HtmlMenu |
|
35 | 35 | */ |
36 | 36 | public function setType($type=""){ |
37 | 37 | return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
@@ -73,6 +73,7 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * {@inheritDoc} |
75 | 75 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
76 | + * @param HtmlIcon $item |
|
76 | 77 | */ |
77 | 78 | public function insertItem($item,$position=0){ |
78 | 79 | $item=parent::insertItem($this->getItemToInsert($item),$position); |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | * @return \Ajax\semantic\html\collections\HtmlMenu |
35 | 35 | */ |
36 | 36 | public function setType($type="") { |
37 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
37 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActiveItem($index) { |
41 | 41 | $item=$this->getItem($index); |
42 | - if ($item !== null) { |
|
42 | + if ($item!==null) { |
|
43 | 43 | $item->addToProperty("class", "active"); |
44 | 44 | } |
45 | 45 | return $this; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | private function getItemToInsert($item) { |
49 | 49 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon) { |
50 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
50 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
51 | 51 | $itemO->setContent($item); |
52 | 52 | $item=$itemO; |
53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | private function afterInsert($item) { |
58 | 58 | if (!$item instanceof HtmlMenu) |
59 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
59 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
60 | 60 | else { |
61 | 61 | $this->setSecondary(); |
62 | 62 | } |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | public function generateMenuAsItem($menu, $header=null) { |
89 | 89 | $count=$this->count(); |
90 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
90 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
91 | 91 | if (isset($header)) { |
92 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
92 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
93 | 93 | $headerItem->setContent($header); |
94 | 94 | $item->addContent($headerItem); |
95 | 95 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
107 | 107 | $value->addContent(new HtmlIcon("", "dropdown")); |
108 | 108 | $value=$this->addItem($value); |
109 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
109 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
110 | 110 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
111 | 111 | $this->wrap("", $popup); |
112 | 112 | return $popup; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function addDropdownAsItem($value, $items=NULL) { |
116 | 116 | $dd=$value; |
117 | 117 | if (\is_string($value)) { |
118 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
118 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
119 | 119 | } |
120 | 120 | return $this->addItem($dd); |
121 | 121 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
128 | 128 | */ |
129 | 129 | protected function createItem($value) { |
130 | - $itemO=new HtmlLink("item-" . \sizeof($this->content), "", $value); |
|
130 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
131 | 131 | return $itemO->setClass("item"); |
132 | 132 | } |
133 | 133 | |
@@ -140,28 +140,28 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | public function setVertical() { |
143 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
143 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | public function setPosition($value="right") { |
147 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
147 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | public function setPointing($value=Direction::NONE) { |
151 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
151 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | public function asTab($vertical=false) { |
155 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
155 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
156 | 156 | $item->setTagName("a"); |
157 | 157 | }); |
158 | - if ($vertical === true) |
|
158 | + if ($vertical===true) |
|
159 | 159 | $this->setVertical(); |
160 | 160 | return $this->addToProperty("class", "tabular"); |
161 | 161 | } |
162 | 162 | |
163 | 163 | public function asPagination() { |
164 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
164 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
165 | 165 | $item->setTagName("a"); |
166 | 166 | }); |
167 | 167 | return $this->addToProperty("class", "pagination"); |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function setWidth($width) { |
200 | 200 | if (\is_int($width)) { |
201 | - $width=Wide::getConstants()["W" . $width]; |
|
201 | + $width=Wide::getConstants()["W".$width]; |
|
202 | 202 | } |
203 | 203 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
204 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
204 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | public function addImage($identifier, $src="", $alt="") { |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | private function afterInsert($item) { |
58 | - if (!$item instanceof HtmlMenu) |
|
59 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
60 | - else { |
|
58 | + if (!$item instanceof HtmlMenu) { |
|
59 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
60 | + } else { |
|
61 | 61 | $this->setSecondary(); |
62 | 62 | } |
63 | 63 | return $item; |
@@ -155,8 +155,9 @@ discard block |
||
155 | 155 | $this->apply(function (HtmlDoubleElement &$item) { |
156 | 156 | $item->setTagName("a"); |
157 | 157 | }); |
158 | - if ($vertical === true) |
|
159 | - $this->setVertical(); |
|
158 | + if ($vertical === true) { |
|
159 | + $this->setVertical(); |
|
160 | + } |
|
160 | 161 | return $this->addToProperty("class", "tabular"); |
161 | 162 | } |
162 | 163 | |
@@ -185,10 +186,11 @@ discard block |
||
185 | 186 | */ |
186 | 187 | public function fromDatabaseObject($object, $function) { |
187 | 188 | $return=$function($object); |
188 | - if (\is_array($return)) |
|
189 | - $this->addItems($return); |
|
190 | - else |
|
191 | - $this->addItem($return); |
|
189 | + if (\is_array($return)) { |
|
190 | + $this->addItems($return); |
|
191 | + } else { |
|
192 | + $this->addItem($return); |
|
193 | + } |
|
192 | 194 | } |
193 | 195 | |
194 | 196 | /** |