@@ -12,36 +12,36 @@ discard block |
||
12 | 12 | */ |
13 | 13 | abstract class HtmlCollection extends HtmlDoubleElement { |
14 | 14 | |
15 | - public function __construct($identifier,$tagName="div"){ |
|
16 | - parent::__construct($identifier,$tagName); |
|
15 | + public function __construct($identifier, $tagName="div") { |
|
16 | + parent::__construct($identifier, $tagName); |
|
17 | 17 | $this->content=array(); |
18 | 18 | } |
19 | 19 | |
20 | - public function addItems($items){ |
|
21 | - if(JArray::isAssociative($items)){ |
|
22 | - foreach ($items as $k=>$v){ |
|
23 | - $this->addItem([$k,$v]); |
|
20 | + public function addItems($items) { |
|
21 | + if (JArray::isAssociative($items)) { |
|
22 | + foreach ($items as $k=>$v) { |
|
23 | + $this->addItem([$k, $v]); |
|
24 | 24 | } |
25 | - }else{ |
|
26 | - foreach ($items as $item){ |
|
25 | + } else { |
|
26 | + foreach ($items as $item) { |
|
27 | 27 | $this->addItem($item); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public function setItems($items){ |
|
33 | + public function setItems($items) { |
|
34 | 34 | $this->content=$items; |
35 | 35 | return $this; |
36 | 36 | } |
37 | 37 | |
38 | - public function getItems(){ |
|
38 | + public function getItems() { |
|
39 | 39 | return $this->content; |
40 | 40 | } |
41 | 41 | |
42 | - protected function getItemToAdd($item){ |
|
42 | + protected function getItemToAdd($item) { |
|
43 | 43 | $itemO=$item; |
44 | - if($this->createCondition($item)===true){ |
|
44 | + if ($this->createCondition($item)===true) { |
|
45 | 45 | $itemO=$this->createItem($item); |
46 | 46 | } |
47 | 47 | return $itemO; |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | * @param HtmlDoubleElement|string $item |
53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
54 | 54 | */ |
55 | - public function addItem($item){ |
|
55 | + public function addItem($item) { |
|
56 | 56 | $itemO=$this->getItemToAdd($item); |
57 | 57 | $this->addContent($itemO); |
58 | 58 | return $itemO; |
59 | 59 | } |
60 | 60 | |
61 | - public function insertItem($item,$position=0){ |
|
61 | + public function insertItem($item, $position=0) { |
|
62 | 62 | $itemO=$this->getItemToAdd($item); |
63 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
63 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
64 | 64 | return $itemO; |
65 | 65 | } |
66 | 66 | |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - public function removeItem($index){ |
|
86 | + public function removeItem($index) { |
|
87 | 87 | return array_splice($this->content, $index, 1); |
88 | 88 | } |
89 | 89 | |
90 | - public function count(){ |
|
90 | + public function count() { |
|
91 | 91 | return \sizeof($this->content); |
92 | 92 | } |
93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | return $this->addItem($function($object)); |
99 | 99 | } |
100 | 100 | |
101 | - public function apply($callBack){ |
|
102 | - foreach ($this->content as $item){ |
|
101 | + public function apply($callBack) { |
|
102 | + foreach ($this->content as $item) { |
|
103 | 103 | $callBack($item); |
104 | 104 | } |
105 | 105 | return $this; |
@@ -119,40 +119,40 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected abstract function createItem($value); |
121 | 121 | |
122 | - protected function createCondition($value){ |
|
122 | + protected function createCondition($value) { |
|
123 | 123 | return \is_object($value)===false; |
124 | 124 | } |
125 | 125 | |
126 | - protected function contentAs($tagName){ |
|
127 | - foreach ($this->content as $item){ |
|
126 | + protected function contentAs($tagName) { |
|
127 | + foreach ($this->content as $item) { |
|
128 | 128 | $item->setTagName($tagName); |
129 | 129 | } |
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
133 | - public function setProperties($properties){ |
|
133 | + public function setProperties($properties) { |
|
134 | 134 | $i=0; |
135 | - foreach ($properties as $k=>$v){ |
|
135 | + foreach ($properties as $k=>$v) { |
|
136 | 136 | $c=$this->content[$i++]; |
137 | - if(isset($c)) |
|
138 | - $c->setProperty($k,$v); |
|
137 | + if (isset($c)) |
|
138 | + $c->setProperty($k, $v); |
|
139 | 139 | else |
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | return $this; |
143 | 143 | } |
144 | 144 | |
145 | - public function setPropertyValues($property,$values){ |
|
145 | + public function setPropertyValues($property, $values) { |
|
146 | 146 | $i=0; |
147 | - if(\is_array($values)===false){ |
|
148 | - $values=\array_fill(0, $this->count(),$values); |
|
147 | + if (\is_array($values)===false) { |
|
148 | + $values=\array_fill(0, $this->count(), $values); |
|
149 | 149 | } |
150 | - foreach ($values as $value){ |
|
150 | + foreach ($values as $value) { |
|
151 | 151 | $c=$this->content[$i++]; |
152 | - if(isset($c)===true){ |
|
153 | - $c->setProperty($property,$value); |
|
152 | + if (isset($c)===true) { |
|
153 | + $c->setProperty($property, $value); |
|
154 | 154 | } |
155 | - else{ |
|
155 | + else { |
|
156 | 156 | return $this; |
157 | 157 | } |
158 | 158 | } |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
8 | 8 | |
9 | 9 | |
10 | -class HtmlShape extends HtmlSemCollection{ |
|
10 | +class HtmlShape extends HtmlSemCollection { |
|
11 | 11 | |
12 | 12 | protected $_params=array(); |
13 | 13 | protected $_autoActive=true; |
14 | 14 | |
15 | - public function __construct( $identifier, $sides){ |
|
16 | - parent::__construct( $identifier, "div", "ui shape"); |
|
15 | + public function __construct($identifier, $sides) { |
|
16 | + parent::__construct($identifier, "div", "ui shape"); |
|
17 | 17 | $this->_template="<%tagName% id='%identifier%' %properties%><div class='sides'>%wrapContentBefore%%content%%wrapContentAfter%</div></%tagName%>"; |
18 | 18 | $this->addItems($sides); |
19 | 19 | } |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * {@inheritDoc} |
23 | 23 | * @see \Ajax\common\html\HtmlCollection::createItem() |
24 | 24 | */ |
25 | - protected function createItem($value){ |
|
26 | - if(\is_object($value)===false){ |
|
27 | - $value=new HtmlSemDoubleElement("","div","content",$value); |
|
25 | + protected function createItem($value) { |
|
26 | + if (\is_object($value)===false) { |
|
27 | + $value=new HtmlSemDoubleElement("", "div", "content", $value); |
|
28 | 28 | } |
29 | 29 | return new HtmlShapeItem("side-".$this->identifier."-".$this->count(), $value); |
30 | 30 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * {@inheritDoc} |
34 | 34 | * @see \Ajax\common\html\HtmlCollection::createCondition() |
35 | 35 | */ |
36 | - protected function createCondition($value){ |
|
36 | + protected function createCondition($value) { |
|
37 | 37 | return ($value instanceof HtmlShapeItem)===false; |
38 | 38 | } |
39 | 39 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param int $index |
42 | 42 | * @return \Ajax\semantic\html\content\HtmlShapeItem |
43 | 43 | */ |
44 | - public function getSide($index){ |
|
44 | + public function getSide($index) { |
|
45 | 45 | return $this->getItem($index); |
46 | 46 | } |
47 | 47 | |
@@ -49,34 +49,34 @@ discard block |
||
49 | 49 | * @param int $index |
50 | 50 | * @return mixed|NULL |
51 | 51 | */ |
52 | - public function getSideContent($index){ |
|
53 | - $item= $this->getItem($index); |
|
54 | - if(isset($item)) |
|
52 | + public function getSideContent($index) { |
|
53 | + $item=$this->getItem($index); |
|
54 | + if (isset($item)) |
|
55 | 55 | return $item->getContent(); |
56 | 56 | return null; |
57 | 57 | } |
58 | 58 | |
59 | - public function jsDo($action){ |
|
59 | + public function jsDo($action) { |
|
60 | 60 | return "$('#".$this->identifier."').shape('".$action."');"; |
61 | 61 | } |
62 | 62 | |
63 | - public function jsFlipleft(){ |
|
63 | + public function jsFlipleft() { |
|
64 | 64 | return $this->jsDo("flip left"); |
65 | 65 | } |
66 | 66 | |
67 | - public function setActiveSide($index){ |
|
67 | + public function setActiveSide($index) { |
|
68 | 68 | $side=$this->getSide($index); |
69 | - if(isset($side)){ |
|
69 | + if (isset($side)) { |
|
70 | 70 | $side->setActive(true); |
71 | 71 | } |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function asCube(){ |
|
75 | + public function asCube() { |
|
76 | 76 | return $this->addToPropertyCtrl("class", "cube", ["cube"]); |
77 | 77 | } |
78 | 78 | |
79 | - public function asText(){ |
|
79 | + public function asText() { |
|
80 | 80 | return $this->addToPropertyCtrl("class", "text", ["text"]); |
81 | 81 | } |
82 | 82 | |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | * @see BaseHtml::run() |
86 | 86 | */ |
87 | 87 | public function run(JsUtils $js) { |
88 | - if (isset($this->_bsComponent) === false) |
|
89 | - $this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params); |
|
88 | + if (isset($this->_bsComponent)===false) |
|
89 | + $this->_bsComponent=$js->semantic()->shape("#".$this->identifier, $this->_params); |
|
90 | 90 | $this->addEventsOnRun($js); |
91 | 91 | return $this->_bsComponent; |
92 | 92 | } |
93 | 93 | |
94 | 94 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
95 | - if($this->_autoActive) |
|
95 | + if ($this->_autoActive) |
|
96 | 96 | $this->setActiveSide(0); |
97 | - return parent::compile($js,$view); |
|
97 | + return parent::compile($js, $view); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | \ No newline at end of file |
@@ -15,33 +15,33 @@ discard block |
||
15 | 15 | |
16 | 16 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
17 | 17 | parent::__construct($identifier, "div", "ui buttons"); |
18 | - if ($asIcons === true) |
|
18 | + if ($asIcons===true) |
|
19 | 19 | $this->asIcons(); |
20 | 20 | $this->addElements($elements, $asIcons); |
21 | 21 | } |
22 | - protected function createItem($value){ |
|
23 | - return new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $value); |
|
22 | + protected function createItem($value) { |
|
23 | + return new HtmlButton("button-".$this->identifier."-".\sizeof($this->content), $value); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | public function addElement($element, $asIcon=false) { |
28 | 28 | $item=$this->addItem($element); |
29 | - if($asIcon) |
|
29 | + if ($asIcon) |
|
30 | 30 | $item->asIcon($element); |
31 | 31 | return $item; |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function addElements($elements, $asIcons=false) { |
35 | - foreach ( $elements as $element ) { |
|
35 | + foreach ($elements as $element) { |
|
36 | 36 | $this->addElement($element, $asIcons); |
37 | 37 | } |
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function insertOr($aferIndex=0, $or="or") { |
42 | - $orElement=new HtmlSemDoubleElement("or-" . $this->identifier, "div", "or"); |
|
42 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
43 | 43 | $orElement->setProperty("data-text", $or); |
44 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
44 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
45 | 45 | return $this; |
46 | 46 | } |
47 | 47 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | public function asIcons() { |
57 | - foreach ( $this->content as $item ) { |
|
58 | - if($item instanceof HtmlButton) |
|
57 | + foreach ($this->content as $item) { |
|
58 | + if ($item instanceof HtmlButton) |
|
59 | 59 | $item->asIcon($item->getContent()); |
60 | 60 | } |
61 | 61 | return $this->addToProperty("class", "icons"); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
89 | 89 | */ |
90 | 90 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
91 | - foreach ( $this->content as $element ) { |
|
91 | + foreach ($this->content as $element) { |
|
92 | 92 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
93 | 93 | } |
94 | 94 | return $this; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | public function addClasses($classes=array()) { |
102 | 102 | $i=0; |
103 | - foreach ( $this->content as $button ) { |
|
103 | + foreach ($this->content as $button) { |
|
104 | 104 | $button->addToProperty("class", $classes[$i++]); |
105 | 105 | } |
106 | 106 | return $this; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return \Ajax\semantic\html\elements\HtmlDivider |
23 | 23 | */ |
24 | 24 | public function setVertical() { |
25 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical","horizontal" )); |
|
25 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical", "horizontal")); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return \Ajax\semantic\html\elements\HtmlDivider |
31 | 31 | */ |
32 | 32 | public function setHorizontal() { |
33 | - return $this->addToPropertyCtrl("class", "horizontal", array ("vertical","horizontal" )); |
|
33 | + return $this->addToPropertyCtrl("class", "horizontal", array("vertical", "horizontal")); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | return $this->addToProperty("class", "inverted"); |
66 | 66 | } |
67 | 67 | |
68 | - public function setIgnored(){ |
|
68 | + public function setIgnored() { |
|
69 | 69 | return $this->addToProperty("class", "ignored"); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -5,13 +5,13 @@ |
||
5 | 5 | |
6 | 6 | class HtmlShapeItem extends HtmlSemDoubleElement { |
7 | 7 | public function __construct($identifier, $content) { |
8 | - parent::__construct($identifier,"div","side",$content); |
|
8 | + parent::__construct($identifier, "div", "side", $content); |
|
9 | 9 | } |
10 | 10 | |
11 | - public function setActive($value=true){ |
|
12 | - if($value){ |
|
11 | + public function setActive($value=true) { |
|
12 | + if ($value) { |
|
13 | 13 | $this->addToPropertyCtrl("class", "active", ["active"]); |
14 | - }else{ |
|
14 | + } else { |
|
15 | 15 | $this->removePropertyValue("class", "active"); |
16 | 16 | } |
17 | 17 | return $this; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
13 | 13 | |
14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
15 | 15 | parent::__construct($identifier, "div", $baseClass); |
16 | 16 | $this->content=array(); |
17 | 17 | $this->initContent($content); |
@@ -19,53 +19,53 @@ discard block |
||
19 | 19 | |
20 | 20 | protected abstract function initContent($content); |
21 | 21 | |
22 | - public function setIcon($icon){ |
|
22 | + public function setIcon($icon) { |
|
23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
24 | 24 | } |
25 | 25 | |
26 | - public function setImage($image){ |
|
26 | + public function setImage($image) { |
|
27 | 27 | $image=new HtmlImg("icon-".$this->identifier, $image); |
28 | 28 | $image->asAvatar(); |
29 | 29 | $this->content["image"]=$image; |
30 | 30 | } |
31 | 31 | |
32 | - private function createContent(){ |
|
33 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
32 | + private function createContent() { |
|
33 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
34 | 34 | return $this->content["content"]; |
35 | 35 | } |
36 | 36 | |
37 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
38 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
39 | - if(\array_key_exists("content", $this->content)===false){ |
|
37 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
38 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
39 | + if (\array_key_exists("content", $this->content)===false) { |
|
40 | 40 | $this->createContent(); |
41 | 41 | } |
42 | 42 | $this->content["content"]->addContent($title); |
43 | - if(isset($description)){ |
|
44 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
43 | + if (isset($description)) { |
|
44 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
45 | 45 | $this->content["content"]->addContent($description); |
46 | 46 | } |
47 | 47 | return $this; |
48 | 48 | } |
49 | 49 | |
50 | - public function getPart($partName="header"){ |
|
51 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
50 | + public function getPart($partName="header") { |
|
51 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
52 | 52 | return $this->getElementByPropertyValue("class", $partName, $content); |
53 | 53 | } |
54 | 54 | |
55 | - public function setActive($value=true){ |
|
56 | - if($value){ |
|
55 | + public function setActive($value=true) { |
|
56 | + if ($value) { |
|
57 | 57 | $this->setTagName("div"); |
58 | 58 | $this->removeProperty("href"); |
59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
60 | - }else{ |
|
60 | + } else { |
|
61 | 61 | $this->removePropertyValue("class", "active"); |
62 | 62 | } |
63 | 63 | return $this; |
64 | 64 | } |
65 | 65 | |
66 | - public function asLink($href=NULL,$part=NULL){ |
|
66 | + public function asLink($href=NULL, $part=NULL) { |
|
67 | 67 | $this->setTagName("a"); |
68 | - if(isset($href)) |
|
68 | + if (isset($href)) |
|
69 | 69 | $this->setProperty("href", $href); |
70 | 70 | return $this; |
71 | 71 | } |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
78 | 78 | */ |
79 | 79 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
80 | - if(\is_array($this->content)) |
|
81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
80 | + if (\is_array($this->content)) |
|
81 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
82 | 82 | return parent::compile($js, $view); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | \ No newline at end of file |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @param string|array $params |
127 | 127 | * @return Modal |
128 | 128 | */ |
129 | - public function modal($attachTo=NULL, $params=NULL,$paramsParts=NULL) { |
|
130 | - $result= $this->addComponent(new Modal($this->js), $attachTo, $params); |
|
129 | + public function modal($attachTo=NULL, $params=NULL, $paramsParts=NULL) { |
|
130 | + $result=$this->addComponent(new Modal($this->js), $attachTo, $params); |
|
131 | 131 | $result->setParamParts($paramsParts); |
132 | 132 | return $result; |
133 | 133 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return Tab |
139 | 139 | */ |
140 | 140 | public function tab($attachTo=NULL, $params=NULL) { |
141 | - $result= $this->addComponent(new Tab($this->js), $attachTo, $params); |
|
141 | + $result=$this->addComponent(new Tab($this->js), $attachTo, $params); |
|
142 | 142 | return $result; |
143 | 143 | } |
144 | 144 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return Shape |
149 | 149 | */ |
150 | 150 | public function shape($attachTo=NULL, $params=NULL) { |
151 | - $result= $this->addComponent(new Shape($this->js), $attachTo, $params); |
|
151 | + $result=$this->addComponent(new Shape($this->js), $attachTo, $params); |
|
152 | 152 | return $result; |
153 | 153 | } |
154 | 154 | } |
155 | 155 | \ No newline at end of file |