@@ -22,6 +22,11 @@ discard block |
||
22 | 22 | protected $_contentSeparator=""; |
23 | 23 | |
24 | 24 | |
25 | + /** |
|
26 | + * @param string $identifier |
|
27 | + * @param string $tagName |
|
28 | + * @param string $baseClass |
|
29 | + */ |
|
25 | 30 | public function __construct($identifier,$tagName,$baseClass){ |
26 | 31 | parent::__construct($identifier,$tagName,$baseClass); |
27 | 32 | $this->root=""; |
@@ -31,7 +36,7 @@ discard block |
||
31 | 36 | /** |
32 | 37 | * Associate an ajax get to the elements, displayed in $targetSelector |
33 | 38 | * @param string $targetSelector the target of the get |
34 | - * @return HtmlNavElement |
|
39 | + * @return HtmlSemNavElement |
|
35 | 40 | */ |
36 | 41 | public function autoGetOnClick($targetSelector){ |
37 | 42 | return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
@@ -63,7 +68,7 @@ discard block |
||
63 | 68 | /** |
64 | 69 | * Define the html attribute for each element url in ajax |
65 | 70 | * @param string $attr html attribute |
66 | - * @return HtmlNavElement |
|
71 | + * @return HtmlSemNavElement |
|
67 | 72 | */ |
68 | 73 | public function setAttr($attr) { |
69 | 74 | $this->attr = $attr; |
@@ -103,6 +108,9 @@ discard block |
||
103 | 108 | return $this; |
104 | 109 | } |
105 | 110 | |
111 | + /** |
|
112 | + * @param integer $index |
|
113 | + */ |
|
106 | 114 | protected function getContentDivider($index){ |
107 | 115 | if(\is_array($this->_contentSeparator)===true){ |
108 | 116 | return @$this->_contentSeparator[$index]; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | protected $_contentSeparator=""; |
23 | 23 | |
24 | 24 | |
25 | - public function __construct($identifier,$tagName,$baseClass){ |
|
26 | - parent::__construct($identifier,$tagName,$baseClass); |
|
25 | + public function __construct($identifier, $tagName, $baseClass) { |
|
26 | + parent::__construct($identifier, $tagName, $baseClass); |
|
27 | 27 | $this->root=""; |
28 | 28 | $this->attr="data-ajax"; |
29 | 29 | } |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | * @param string $targetSelector the target of the get |
34 | 34 | * @return HtmlNavElement |
35 | 35 | */ |
36 | - public function autoGetOnClick($targetSelector){ |
|
37 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
36 | + public function autoGetOnClick($targetSelector) { |
|
37 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
38 | 38 | } |
39 | 39 | |
40 | - public function contentAsString(){ |
|
40 | + public function contentAsString() { |
|
41 | 41 | return JArray::implode($this->_contentSeparator, $this->content); |
42 | 42 | } |
43 | 43 | |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | * Generate the jquery script to set the elements to the HtmlNavElement |
46 | 46 | * @param JsUtils $jsUtils |
47 | 47 | */ |
48 | - public function jsSetContent(JsUtils $jsUtils){ |
|
49 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
48 | + public function jsSetContent(JsUtils $jsUtils) { |
|
49 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getRoot() { |
53 | 53 | return $this->root; |
54 | 54 | } |
55 | 55 | public function setRoot($root) { |
56 | - $this->root = $root; |
|
56 | + $this->root=$root; |
|
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 | public function getAttr() { |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @return HtmlNavElement |
67 | 67 | */ |
68 | 68 | public function setAttr($attr) { |
69 | - $this->attr = $attr; |
|
69 | + $this->attr=$attr; |
|
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | 73 | public function __call($method, $args) { |
74 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
74 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
75 | 75 | return call_user_func_array( |
76 | 76 | $this->$method, |
77 | 77 | $args |
@@ -79,32 +79,32 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | - public abstract function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0); |
|
82 | + public abstract function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
83 | 83 | |
84 | 84 | |
85 | - public function setContentDivider($divider,$index=NULL) { |
|
85 | + public function setContentDivider($divider, $index=NULL) { |
|
86 | 86 | $divider="<div class='divider'> {$divider} </div>"; |
87 | 87 | return $this->setDivider($divider, $index); |
88 | 88 | } |
89 | 89 | |
90 | - public function setIconContentDivider($iconContentDivider,$index=NULL) { |
|
90 | + public function setIconContentDivider($iconContentDivider, $index=NULL) { |
|
91 | 91 | $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
92 | 92 | return $this->setDivider($contentDivider, $index); |
93 | 93 | } |
94 | 94 | |
95 | - protected function setDivider($divider,$index){ |
|
96 | - if(isset($index)){ |
|
97 | - if(\is_array($this->_contentSeparator)===false) |
|
98 | - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
95 | + protected function setDivider($divider, $index) { |
|
96 | + if (isset($index)) { |
|
97 | + if (\is_array($this->_contentSeparator)===false) |
|
98 | + $this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator); |
|
99 | 99 | $this->_contentSeparator[$index]=$divider; |
100 | - }else{ |
|
100 | + } else { |
|
101 | 101 | $this->_contentSeparator=$divider; |
102 | 102 | } |
103 | 103 | return $this; |
104 | 104 | } |
105 | 105 | |
106 | - protected function getContentDivider($index){ |
|
107 | - if(\is_array($this->_contentSeparator)===true){ |
|
106 | + protected function getContentDivider($index) { |
|
107 | + if (\is_array($this->_contentSeparator)===true) { |
|
108 | 108 | return @$this->_contentSeparator[$index]; |
109 | 109 | } |
110 | 110 | return $this->_contentSeparator; |
@@ -94,10 +94,11 @@ |
||
94 | 94 | |
95 | 95 | protected function setDivider($divider,$index){ |
96 | 96 | if(isset($index)){ |
97 | - if(\is_array($this->_contentSeparator)===false) |
|
98 | - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
97 | + if(\is_array($this->_contentSeparator)===false) { |
|
98 | + $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
99 | + } |
|
99 | 100 | $this->_contentSeparator[$index]=$divider; |
100 | - }else{ |
|
101 | + } else{ |
|
101 | 102 | $this->_contentSeparator=$divider; |
102 | 103 | } |
103 | 104 | return $this; |
@@ -12,12 +12,24 @@ |
||
12 | 12 | protected $_states=[ ]; |
13 | 13 | protected $_baseClass; |
14 | 14 | |
15 | + /** |
|
16 | + * @param string $name |
|
17 | + */ |
|
15 | 18 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
16 | 19 | |
20 | + /** |
|
21 | + * @param string $name |
|
22 | + */ |
|
17 | 23 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
18 | 24 | |
25 | + /** |
|
26 | + * @param string $name |
|
27 | + */ |
|
19 | 28 | protected abstract function addToPropertyCtrlCheck($name, $value, $typeCtrl); |
20 | 29 | |
30 | + /** |
|
31 | + * @param string $name |
|
32 | + */ |
|
21 | 33 | public abstract function addToProperty($name, $value, $separator=" "); |
22 | 34 | |
23 | 35 | public function addVariation($variation) { |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 9 | |
10 | 10 | trait BaseTrait { |
11 | - protected $_variations=[ ]; |
|
12 | - protected $_states=[ ]; |
|
11 | + protected $_variations=[]; |
|
12 | + protected $_states=[]; |
|
13 | 13 | protected $_baseClass; |
14 | 14 | |
15 | 15 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->setProperty("class", $this->_baseClass); |
38 | 38 | if (\is_string($variations)) |
39 | 39 | $variations=\explode(" ", $variations); |
40 | - foreach ( $variations as $variation ) { |
|
40 | + foreach ($variations as $variation) { |
|
41 | 41 | $this->addVariation($variation); |
42 | 42 | } |
43 | 43 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function addVariations($variations=array()) { |
52 | 52 | if (\is_string($variations)) |
53 | 53 | $variations=\explode(" ", $variations); |
54 | - foreach ( $variations as $variation ) { |
|
54 | + foreach ($variations as $variation) { |
|
55 | 55 | $this->addVariation($variation); |
56 | 56 | } |
57 | 57 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function addStates($states=array()) { |
61 | 61 | if (\is_string($states)) |
62 | 62 | $states=\explode(" ", $states); |
63 | - foreach ( $states as $state ) { |
|
63 | + foreach ($states as $state) { |
|
64 | 64 | $this->addState($state); |
65 | 65 | } |
66 | 66 | return $this; |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | $this->setProperty("class", $this->_baseClass); |
71 | 71 | if (\is_string($states)) |
72 | 72 | $states=\explode(" ", $states); |
73 | - foreach ( $states as $state ) { |
|
73 | + foreach ($states as $state) { |
|
74 | 74 | $this->addState($state); |
75 | 75 | } |
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addIcon($icon, $before=true) { |
80 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
80 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | public function setFloated($direction="right") { |
130 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
130 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function floatRight() { |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | |
36 | 36 | public function setVariations($variations) { |
37 | 37 | $this->setProperty("class", $this->_baseClass); |
38 | - if (\is_string($variations)) |
|
39 | - $variations=\explode(" ", $variations); |
|
38 | + if (\is_string($variations)) { |
|
39 | + $variations=\explode(" ", $variations); |
|
40 | + } |
|
40 | 41 | foreach ( $variations as $variation ) { |
41 | 42 | $this->addVariation($variation); |
42 | 43 | } |
@@ -49,8 +50,9 @@ discard block |
||
49 | 50 | } |
50 | 51 | |
51 | 52 | public function addVariations($variations=array()) { |
52 | - if (\is_string($variations)) |
|
53 | - $variations=\explode(" ", $variations); |
|
53 | + if (\is_string($variations)) { |
|
54 | + $variations=\explode(" ", $variations); |
|
55 | + } |
|
54 | 56 | foreach ( $variations as $variation ) { |
55 | 57 | $this->addVariation($variation); |
56 | 58 | } |
@@ -58,8 +60,9 @@ discard block |
||
58 | 60 | } |
59 | 61 | |
60 | 62 | public function addStates($states=array()) { |
61 | - if (\is_string($states)) |
|
62 | - $states=\explode(" ", $states); |
|
63 | + if (\is_string($states)) { |
|
64 | + $states=\explode(" ", $states); |
|
65 | + } |
|
63 | 66 | foreach ( $states as $state ) { |
64 | 67 | $this->addState($state); |
65 | 68 | } |
@@ -68,8 +71,9 @@ discard block |
||
68 | 71 | |
69 | 72 | public function setStates($states) { |
70 | 73 | $this->setProperty("class", $this->_baseClass); |
71 | - if (\is_string($states)) |
|
72 | - $states=\explode(" ", $states); |
|
74 | + if (\is_string($states)) { |
|
75 | + $states=\explode(" ", $states); |
|
76 | + } |
|
73 | 77 | foreach ( $states as $state ) { |
74 | 78 | $this->addState($state); |
75 | 79 | } |
@@ -7,6 +7,10 @@ |
||
7 | 7 | trait IconTrait { |
8 | 8 | private $_hasIcon=false; |
9 | 9 | |
10 | + /** |
|
11 | + * @param string $name |
|
12 | + * @param string $value |
|
13 | + */ |
|
10 | 14 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
11 | 15 | public abstract function addContent($content,$before=false); |
12 | 16 |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | private $_hasIcon=false; |
9 | 9 | |
10 | 10 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
11 | - public abstract function addContent($content,$before=false); |
|
11 | + public abstract function addContent($content, $before=false); |
|
12 | 12 | |
13 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
14 | - if($this->_hasIcon===false){ |
|
13 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
14 | + if ($this->_hasIcon===false) { |
|
15 | 15 | $iconO=$icon; |
16 | - if(\is_string($icon)){ |
|
16 | + if (\is_string($icon)) { |
|
17 | 17 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
18 | 18 | } |
19 | 19 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
20 | - $this->addContent($iconO,false); |
|
20 | + $this->addContent($iconO, false); |
|
21 | 21 | $this->_hasIcon=true; |
22 | - }else{ |
|
22 | + } else { |
|
23 | 23 | $iconO=$this->getIcon(); |
24 | 24 | $iconO->setIcon($icon); |
25 | 25 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | return $iconO; |
28 | 28 | } |
29 | 29 | |
30 | - public function getIcon(){ |
|
31 | - if(\is_array($this->content)){ |
|
32 | - foreach ($this->content as $item){ |
|
33 | - if($item instanceof HtmlIcon) |
|
30 | + public function getIcon() { |
|
31 | + if (\is_array($this->content)) { |
|
32 | + foreach ($this->content as $item) { |
|
33 | + if ($item instanceof HtmlIcon) |
|
34 | 34 | return $item; |
35 | 35 | } |
36 | 36 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
20 | 20 | $this->addContent($iconO,false); |
21 | 21 | $this->_hasIcon=true; |
22 | - }else{ |
|
22 | + } else{ |
|
23 | 23 | $iconO=$this->getIcon(); |
24 | 24 | $iconO->setIcon($icon); |
25 | 25 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -30,8 +30,9 @@ discard block |
||
30 | 30 | public function getIcon(){ |
31 | 31 | if(\is_array($this->content)){ |
32 | 32 | foreach ($this->content as $item){ |
33 | - if($item instanceof HtmlIcon) |
|
34 | - return $item; |
|
33 | + if($item instanceof HtmlIcon) { |
|
34 | + return $item; |
|
35 | + } |
|
35 | 36 | } |
36 | 37 | } |
37 | 38 | } |
@@ -6,6 +6,9 @@ |
||
6 | 6 | |
7 | 7 | trait CheckboxTrait { |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $name |
|
11 | + */ |
|
9 | 12 | public abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
10 | 13 | |
11 | 14 | public function setType($checkboxType) { |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | * Associate an ajax get to the breadcrumb elements, displayed in $targetSelector |
65 | 65 | * $attr member is used to build each element url |
66 | 66 | * @param string $targetSelector the target of the get |
67 | - * @param string $attr the html attribute used to build the elements url |
|
68 | - * @return HtmlBreadcrumbs |
|
67 | + * @return HtmlBreadcrumb |
|
69 | 68 | */ |
70 | 69 | public function autoGetOnClick($targetSelector) { |
71 | 70 | return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
@@ -91,7 +90,7 @@ discard block |
||
91 | 90 | * Add new elements in breadcrumbs corresponding to request dispatcher : controllerName, actionName, parameters |
92 | 91 | * @param JsUtils $js |
93 | 92 | * @param Dispatcher $dispatcher the request dispatcher |
94 | - * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
|
93 | + * @return HtmlBreadcrumb |
|
95 | 94 | */ |
96 | 95 | public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
97 | 96 | return $this->addItems($js->fromDispatcher($dispatcher)); |
@@ -120,7 +119,7 @@ discard block |
||
120 | 119 | * sets the function who generates the href elements. |
121 | 120 | * default : function($element){return $element->getContent()} |
122 | 121 | * @param function $_hrefFunction |
123 | - * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
|
122 | + * @return HtmlBreadcrumb |
|
124 | 123 | */ |
125 | 124 | public function setHrefFunction($_hrefFunction) { |
126 | 125 | $this->_hrefFunction=$_hrefFunction; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->startIndex=$startIndex; |
52 | 52 | $this->autoActive=$autoActive; |
53 | 53 | $this->_contentSeparator="<div class='divider'> / </div>"; |
54 | - $this->_hrefFunction=function ($e) { |
|
54 | + $this->_hrefFunction=function($e) { |
|
55 | 55 | return $e->getContent(); |
56 | 56 | }; |
57 | 57 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumbs |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function setActive($index=null) { |
82 | 82 | if (!isset($index)) { |
83 | - $index=sizeof($this->content) - 1; |
|
83 | + $index=sizeof($this->content)-1; |
|
84 | 84 | } |
85 | 85 | $activeItem=$this->content[$index]; |
86 | 86 | $activeItem->addToProperty("class", "active"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param Dispatcher $dispatcher the request dispatcher |
94 | 94 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
95 | 95 | */ |
96 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
96 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
97 | 97 | return $this->addItems($js->fromDispatcher($dispatcher)); |
98 | 98 | } |
99 | 99 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | if (!isset($index)) { |
108 | 108 | $index=sizeof($this->content); |
109 | 109 | } |
110 | - if ($this->absolutePaths === true) { |
|
110 | + if ($this->absolutePaths===true) { |
|
111 | 111 | return $this->_hrefFunction($this->content[$index]); |
112 | 112 | } else { |
113 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
113 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
114 | 114 | return $this->_hrefFunction($e); |
115 | - }, $this->content), $this->startIndex, $index + 1)); |
|
115 | + }, $this->content), $this->startIndex, $index+1)); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $this->setActive(); |
147 | 147 | } |
148 | 148 | $count=$this->count(); |
149 | - for($i=1; $i < $count; $i++) { |
|
150 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
149 | + for ($i=1; $i<$count; $i++) { |
|
150 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
151 | 151 | } |
152 | 152 | return parent::compile($js, $view); |
153 | 153 | } |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
158 | 158 | */ |
159 | 159 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
160 | - foreach ( $this->content as $element ) { |
|
160 | + foreach ($this->content as $element) { |
|
161 | 161 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
162 | 162 | } |
163 | 163 | return $this; |
164 | 164 | } |
165 | 165 | |
166 | 166 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
167 | - foreach ( $this->content as $element ) { |
|
168 | - if ($element->getProperty($this->attr) != NULL){ |
|
167 | + foreach ($this->content as $element) { |
|
168 | + if ($element->getProperty($this->attr)!=NULL) { |
|
169 | 169 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
170 | 170 | } |
171 | 171 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function createItem($value) { |
182 | 182 | $count=$this->count(); |
183 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
183 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
184 | 184 | if (\is_array($value)) |
185 | 185 | $itemO->fromArray($value); |
186 | 186 | else { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public function addIconAt($icon, $index) { |
193 | 193 | $item=$this->getItem($index); |
194 | 194 | if (isset($item)) { |
195 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
195 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
196 | 196 | $item->wrapContent($icon); |
197 | 197 | } |
198 | 198 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | public function addItem($item) { |
201 | 201 | $count=$this->count(); |
202 | 202 | $itemO=parent::addItem($item); |
203 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
203 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
204 | 204 | $itemO->setProperty($this->attr, $this->getHref($count)); |
205 | 205 | return $itemO; |
206 | 206 | } |
@@ -181,9 +181,9 @@ |
||
181 | 181 | protected function createItem($value) { |
182 | 182 | $count=$this->count(); |
183 | 183 | $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
184 | - if (\is_array($value)) |
|
185 | - $itemO->fromArray($value); |
|
186 | - else { |
|
184 | + if (\is_array($value)) { |
|
185 | + $itemO->fromArray($value); |
|
186 | + } else { |
|
187 | 187 | $itemO->setContent($value); |
188 | 188 | } |
189 | 189 | return $itemO; |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\service\JArray; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\constants\State; |
10 | 9 | |
11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -22,6 +22,9 @@ discard block |
||
22 | 22 | private $_colSizing=true; |
23 | 23 | private $_implicitRows=false; |
24 | 24 | |
25 | + /** |
|
26 | + * @param string $identifier |
|
27 | + */ |
|
25 | 28 | public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
26 | 29 | parent::__construct($identifier, "div", "ui grid"); |
27 | 30 | $this->_implicitRows=$implicitRows; |
@@ -158,7 +161,7 @@ discard block |
||
158 | 161 | /** |
159 | 162 | * return the row at $index |
160 | 163 | * @param int $index |
161 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
164 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
162 | 165 | */ |
163 | 166 | public function getRow($index) { |
164 | 167 | return $this->getItem($index); |
@@ -297,7 +300,7 @@ discard block |
||
297 | 300 | |
298 | 301 | /** |
299 | 302 | * stretch the row contents to take up the entire column height |
300 | - * @return \Ajax\semantic\html\content\HtmlGridRow |
|
303 | + * @return HtmlGrid |
|
301 | 304 | */ |
302 | 305 | public function setStretched() { |
303 | 306 | return $this->addToProperty("class", "stretched"); |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | public function asSegment() { |
39 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
39 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function asContainer() { |
43 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
43 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * @param int $wide |
49 | 49 | */ |
50 | 50 | public function setWide($wide) { |
51 | - $wide=Wide::getConstants()["W" . $wide]; |
|
51 | + $wide=Wide::getConstants()["W".$wide]; |
|
52 | 52 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
53 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
53 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @return mixed |
69 | 69 | */ |
70 | 70 | public function addRow($colsCount=NULL) { |
71 | - $rowCount=$this->rowCount() + 1; |
|
71 | + $rowCount=$this->rowCount()+1; |
|
72 | 72 | $this->setRowsCount($rowCount, $colsCount, true); |
73 | - return $this->content[$rowCount - 1]; |
|
73 | + return $this->content[$rowCount-1]; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
80 | 80 | */ |
81 | 81 | public function addCol($width=NULL) { |
82 | - $colCount=$this->colCount() + 1; |
|
82 | + $colCount=$this->colCount()+1; |
|
83 | 83 | $this->setColsCount($colCount, true, $width); |
84 | 84 | if ($this->hasOnlyCols($this->count())) |
85 | - return $this->content[$colCount - 1]; |
|
85 | + return $this->content[$colCount-1]; |
|
86 | 86 | return $this; |
87 | 87 | } |
88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return \Ajax\semantic\html\collections\HtmlGrid |
93 | 93 | */ |
94 | 94 | public function addCols($sizes=array()) { |
95 | - foreach ( $sizes as $size ) { |
|
95 | + foreach ($sizes as $size) { |
|
96 | 96 | $this->addCol($size); |
97 | 97 | } |
98 | 98 | return $this; |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
108 | 108 | $count=$this->count(); |
109 | - if ($rowsCount < 2 && $force === false) { |
|
110 | - for($i=$count; $i < $colsCount; $i++) { |
|
111 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
109 | + if ($rowsCount<2 && $force===false) { |
|
110 | + for ($i=$count; $i<$colsCount; $i++) { |
|
111 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
112 | 112 | } |
113 | 113 | } else { |
114 | 114 | if ($this->hasOnlyCols($count)) { |
115 | 115 | $tmpContent=$this->content; |
116 | 116 | $item=$this->addItem($colsCount); |
117 | 117 | $item->setContent($tmpContent); |
118 | - $this->content=array (); |
|
118 | + $this->content=array(); |
|
119 | 119 | $count=1; |
120 | 120 | } |
121 | - for($i=$count; $i < $rowsCount; $i++) { |
|
121 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
122 | 122 | $this->addItem($colsCount); |
123 | 123 | } |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | protected function hasOnlyCols($count) { |
129 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
129 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | /*if (isset($width)==false) { |
141 | 141 | $this->setWide($numCols); |
142 | 142 | }*/ |
143 | - if ($toCreate == true) { |
|
143 | + if ($toCreate==true) { |
|
144 | 144 | $count=$this->count(); |
145 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
146 | - for($i=$count; $i < $numCols; $i++) { |
|
147 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
145 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
146 | + for ($i=$count; $i<$numCols; $i++) { |
|
147 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
148 | 148 | } |
149 | 149 | } else { |
150 | - for($i=0; $i < $count; $i++) { |
|
150 | + for ($i=0; $i<$count; $i++) { |
|
151 | 151 | $this->getItem($i)->setColsCount($numCols); |
152 | 152 | } |
153 | 153 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $count=$this->count(); |
184 | 184 | if ($this->hasOnlyCols($count)) |
185 | 185 | return $count; |
186 | - if ($count > 0) |
|
186 | + if ($count>0) |
|
187 | 187 | return $this->getItem(0)->count(); |
188 | 188 | return 0; |
189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
196 | 196 | */ |
197 | 197 | public function getCell($row, $col) { |
198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
198 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
199 | 199 | return $this->getItem($col); |
200 | 200 | $row=$this->getItem($row); |
201 | 201 | if (isset($row)) { |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * @return \Ajax\semantic\html\collections\HtmlGrid |
211 | 211 | */ |
212 | 212 | public function setDivided($vertically=false) { |
213 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
214 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
213 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
214 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | * @return \Ajax\semantic\html\collections\HtmlGrid |
221 | 221 | */ |
222 | 222 | public function setCelled($internally=false) { |
223 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
224 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
223 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
224 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
228 | 228 | * A grid can have its columns centered |
229 | 229 | */ |
230 | 230 | public function setCentered() { |
231 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
231 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function setPadded($value=NULL) { |
248 | 248 | if (isset($value)) |
249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
249 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
250 | 250 | return $this->addToProperty("class", "padded"); |
251 | 251 | } |
252 | 252 | |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | * @return \Ajax\semantic\html\collections\HtmlGrid |
257 | 257 | */ |
258 | 258 | public function setRelaxed($very=false) { |
259 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
260 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
259 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
260 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
264 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
264 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | * @see \Ajax\common\html\HtmlCollection::createItem() |
272 | 272 | */ |
273 | 273 | protected function createItem($value) { |
274 | - if ($this->_createCols === false) |
|
274 | + if ($this->_createCols===false) |
|
275 | 275 | $value=null; |
276 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
276 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
277 | 277 | return $item; |
278 | 278 | } |
279 | 279 | |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function setValues($values, $force=true) { |
285 | 285 | $count=$this->count(); |
286 | - if ($this->_createCols === false || $force === true) { |
|
287 | - for($i=$count; $i < \sizeof($values); $i++) { |
|
286 | + if ($this->_createCols===false || $force===true) { |
|
287 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
288 | 288 | $colSize=\sizeof($values[$i]); |
289 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
289 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
290 | 290 | } |
291 | 291 | } |
292 | - $count=\min(array ($this->count(),\sizeof($values) )); |
|
293 | - for($i=0; $i < $count; $i++) { |
|
294 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
292 | + $count=\min(array($this->count(), \sizeof($values))); |
|
293 | + for ($i=0; $i<$count; $i++) { |
|
294 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | public function addCol($width=NULL) { |
82 | 82 | $colCount=$this->colCount() + 1; |
83 | 83 | $this->setColsCount($colCount, true, $width); |
84 | - if ($this->hasOnlyCols($this->count())) |
|
85 | - return $this->content[$colCount - 1]; |
|
84 | + if ($this->hasOnlyCols($this->count())) { |
|
85 | + return $this->content[$colCount - 1]; |
|
86 | + } |
|
86 | 87 | return $this; |
87 | 88 | } |
88 | 89 | |
@@ -170,8 +171,9 @@ discard block |
||
170 | 171 | */ |
171 | 172 | public function rowCount() { |
172 | 173 | $count=$this->count(); |
173 | - if ($this->hasOnlyCols($count)) |
|
174 | - return 0; |
|
174 | + if ($this->hasOnlyCols($count)) { |
|
175 | + return 0; |
|
176 | + } |
|
175 | 177 | return $count; |
176 | 178 | } |
177 | 179 | |
@@ -181,10 +183,12 @@ discard block |
||
181 | 183 | */ |
182 | 184 | public function colCount() { |
183 | 185 | $count=$this->count(); |
184 | - if ($this->hasOnlyCols($count)) |
|
185 | - return $count; |
|
186 | - if ($count > 0) |
|
187 | - return $this->getItem(0)->count(); |
|
186 | + if ($this->hasOnlyCols($count)) { |
|
187 | + return $count; |
|
188 | + } |
|
189 | + if ($count > 0) { |
|
190 | + return $this->getItem(0)->count(); |
|
191 | + } |
|
188 | 192 | return 0; |
189 | 193 | } |
190 | 194 | |
@@ -195,8 +199,9 @@ discard block |
||
195 | 199 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
196 | 200 | */ |
197 | 201 | public function getCell($row, $col) { |
198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
199 | - return $this->getItem($col); |
|
202 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
203 | + return $this->getItem($col); |
|
204 | + } |
|
200 | 205 | $row=$this->getItem($row); |
201 | 206 | if (isset($row)) { |
202 | 207 | $col=$row->getItem($col); |
@@ -245,8 +250,9 @@ discard block |
||
245 | 250 | * @return \Ajax\semantic\html\collections\HtmlGrid |
246 | 251 | */ |
247 | 252 | public function setPadded($value=NULL) { |
248 | - if (isset($value)) |
|
249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
253 | + if (isset($value)) { |
|
254 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
255 | + } |
|
250 | 256 | return $this->addToProperty("class", "padded"); |
251 | 257 | } |
252 | 258 | |
@@ -271,8 +277,9 @@ discard block |
||
271 | 277 | * @see \Ajax\common\html\HtmlCollection::createItem() |
272 | 278 | */ |
273 | 279 | protected function createItem($value) { |
274 | - if ($this->_createCols === false) |
|
275 | - $value=null; |
|
280 | + if ($this->_createCols === false) { |
|
281 | + $value=null; |
|
282 | + } |
|
276 | 283 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
277 | 284 | return $item; |
278 | 285 | } |
@@ -17,6 +17,11 @@ discard block |
||
17 | 17 | class HtmlTable extends HtmlSemDoubleElement { |
18 | 18 | private $_colCount; |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $identifier |
|
22 | + * @param integer $rowCount |
|
23 | + * @param integer $colCount |
|
24 | + */ |
|
20 | 25 | public function __construct($identifier, $rowCount, $colCount) { |
21 | 26 | parent::__construct($identifier, "table", "ui table"); |
22 | 27 | $this->content=array (); |
@@ -96,7 +101,7 @@ discard block |
||
96 | 101 | /** |
97 | 102 | * Retuns the row at $rowIndex |
98 | 103 | * @param int $rowIndex |
99 | - * @return \Ajax\semantic\html\content\HtmlTR |
|
104 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
100 | 105 | */ |
101 | 106 | public function getRow($rowIndex) { |
102 | 107 | return $this->getBody()->getRow($rowIndex); |
@@ -172,6 +177,9 @@ discard block |
||
172 | 177 | return $this->colAlign($colIndex, "colLeft"); |
173 | 178 | } |
174 | 179 | |
180 | + /** |
|
181 | + * @param string $function |
|
182 | + */ |
|
175 | 183 | private function colAlign($colIndex, $function) { |
176 | 184 | if (\is_array($colIndex)) { |
177 | 185 | foreach ( $colIndex as $cIndex ) { |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public function __construct($identifier, $rowCount, $colCount) { |
21 | 21 | parent::__construct($identifier, "table", "ui table"); |
22 | - $this->content=array (); |
|
22 | + $this->content=array(); |
|
23 | 23 | $this->setRowCount($rowCount, $colCount); |
24 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
24 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @return HtmlTableContent |
31 | 31 | */ |
32 | 32 | private function getPart($key) { |
33 | - if (\array_key_exists($key, $this->content) === false) { |
|
33 | + if (\array_key_exists($key, $this->content)===false) { |
|
34 | 34 | $this->content[$key]=new HtmlTableContent("", $key); |
35 | - if ($key !== "tbody") { |
|
35 | + if ($key!=="tbody") { |
|
36 | 36 | $this->content[$key]->setRowCount(1, $this->_colCount); |
37 | 37 | } |
38 | 38 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return boolean |
70 | 70 | */ |
71 | 71 | public function hasPart($key) { |
72 | - return \array_key_exists($key, $this->content) === true; |
|
72 | + return \array_key_exists($key, $this->content)===true; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | private function colAlign($colIndex, $function) { |
176 | 176 | if (\is_array($colIndex)) { |
177 | - foreach ( $colIndex as $cIndex ) { |
|
177 | + foreach ($colIndex as $cIndex) { |
|
178 | 178 | $this->colAlign($cIndex, $function); |
179 | 179 | } |
180 | 180 | } else { |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | |
193 | 193 | public function setBasic($very=false) { |
194 | 194 | if ($very) |
195 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
196 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
195 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
196 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | public function setCollapsing() { |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
255 | 255 | */ |
256 | 256 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
257 | - $this->content=JArray::sortAssociative($this->content, [ "thead","tbody","tfoot" ]); |
|
257 | + $this->content=JArray::sortAssociative($this->content, ["thead", "tbody", "tfoot"]); |
|
258 | 258 | if ($this->propertyContains("class", "sortable")) { |
259 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
259 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
260 | 260 | } |
261 | 261 | return parent::compile($js, $view); |
262 | 262 | } |
@@ -191,8 +191,9 @@ |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | public function setBasic($very=false) { |
194 | - if ($very) |
|
195 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
194 | + if ($very) { |
|
195 | + $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
196 | + } |
|
196 | 197 | return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
197 | 198 | } |
198 | 199 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\service\JArray; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\constants\State; |
10 | 9 | |
11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Sets the menu type |
35 | 35 | * @param string $type one of text,item |
36 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
36 | + * @return HtmlMenu |
|
37 | 37 | */ |
38 | 38 | public function setType($type="") { |
39 | 39 | return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
@@ -81,6 +81,7 @@ discard block |
||
81 | 81 | * {@inheritDoc} |
82 | 82 | * |
83 | 83 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
84 | + * @param HtmlIcon $item |
|
84 | 85 | */ |
85 | 86 | public function insertItem($item, $position=0) { |
86 | 87 | $item=parent::insertItem($this->getItemToInsert($item), $position); |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @return \Ajax\semantic\html\collections\HtmlMenu |
37 | 37 | */ |
38 | 38 | public function setType($type="") { |
39 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
39 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function setActiveItem($index) { |
43 | 43 | $item=$this->getItem($index); |
44 | - if ($item !== null) { |
|
44 | + if ($item!==null) { |
|
45 | 45 | $item->addToProperty("class", "active"); |
46 | 46 | } |
47 | 47 | return $this; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | private function getItemToInsert($item) { |
51 | 51 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
52 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
52 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
53 | 53 | $itemO->setContent($item); |
54 | 54 | $item=$itemO; |
55 | 55 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | private function afterInsert($item) { |
60 | 60 | if (!$item instanceof HtmlMenu) |
61 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
61 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
62 | 62 | else { |
63 | 63 | $this->setSecondary(); |
64 | 64 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | public function generateMenuAsItem($menu, $header=null) { |
91 | 91 | $count=$this->count(); |
92 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
92 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
93 | 93 | if (isset($header)) { |
94 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
94 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
95 | 95 | $headerItem->setContent($header); |
96 | 96 | $item->addContent($headerItem); |
97 | 97 | $this->_itemHeader=$headerItem; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
110 | 110 | $value->addContent(new HtmlIcon("", "dropdown")); |
111 | 111 | $value=$this->addItem($value); |
112 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
112 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
113 | 113 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
114 | 114 | $this->wrap("", $popup); |
115 | 115 | return $popup; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function addDropdownAsItem($value, $items=NULL) { |
119 | 119 | $dd=$value; |
120 | 120 | if (\is_string($value)) { |
121 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
121 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
122 | 122 | } |
123 | 123 | return $this->addItem($dd); |
124 | 124 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
131 | 131 | */ |
132 | 132 | protected function createItem($value) { |
133 | - $itemO=new HtmlLink("item-" . \sizeof($this->content), "", $value); |
|
133 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
134 | 134 | return $itemO->setClass("item"); |
135 | 135 | } |
136 | 136 | |
@@ -143,28 +143,28 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | public function setVertical() { |
146 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
146 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public function setPosition($value="right") { |
150 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
150 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public function setPointing($value=Direction::NONE) { |
154 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
154 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public function asTab($vertical=false) { |
158 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
158 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
159 | 159 | $item->setTagName("a"); |
160 | 160 | }); |
161 | - if ($vertical === true) |
|
161 | + if ($vertical===true) |
|
162 | 162 | $this->setVertical(); |
163 | 163 | return $this->addToProperty("class", "tabular"); |
164 | 164 | } |
165 | 165 | |
166 | 166 | public function asPagination() { |
167 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
167 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
168 | 168 | $item->setTagName("a"); |
169 | 169 | }); |
170 | 170 | return $this->addToProperty("class", "pagination"); |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function setWidth($width) { |
203 | 203 | if (\is_int($width)) { |
204 | - $width=Wide::getConstants()["W" . $width]; |
|
204 | + $width=Wide::getConstants()["W".$width]; |
|
205 | 205 | } |
206 | 206 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
207 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
207 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | public function addImage($identifier, $src="", $alt="") { |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | private function afterInsert($item) { |
60 | - if (!$item instanceof HtmlMenu) |
|
61 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
62 | - else { |
|
60 | + if (!$item instanceof HtmlMenu) { |
|
61 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
62 | + } else { |
|
63 | 63 | $this->setSecondary(); |
64 | 64 | } |
65 | 65 | return $item; |
@@ -158,8 +158,9 @@ discard block |
||
158 | 158 | $this->apply(function (HtmlDoubleElement &$item) { |
159 | 159 | $item->setTagName("a"); |
160 | 160 | }); |
161 | - if ($vertical === true) |
|
162 | - $this->setVertical(); |
|
161 | + if ($vertical === true) { |
|
162 | + $this->setVertical(); |
|
163 | + } |
|
163 | 164 | return $this->addToProperty("class", "tabular"); |
164 | 165 | } |
165 | 166 | |
@@ -188,10 +189,11 @@ discard block |
||
188 | 189 | */ |
189 | 190 | public function fromDatabaseObject($object, $function) { |
190 | 191 | $return=$function($object); |
191 | - if (\is_array($return)) |
|
192 | - $this->addItems($return); |
|
193 | - else |
|
194 | - $this->addItem($return); |
|
192 | + if (\is_array($return)) { |
|
193 | + $this->addItems($return); |
|
194 | + } else { |
|
195 | + $this->addItem($return); |
|
196 | + } |
|
195 | 197 | } |
196 | 198 | |
197 | 199 | /** |
@@ -11,6 +11,9 @@ |
||
11 | 11 | |
12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
13 | 13 | |
14 | + /** |
|
15 | + * @param string $baseClass |
|
16 | + */ |
|
14 | 17 | public function __construct($identifier, $baseClass,$content=NULL) { |
15 | 18 | parent::__construct($identifier, "div", $baseClass); |
16 | 19 | $this->content=array(); |
@@ -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,48 +19,48 @@ 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(){ |
|
55 | + public function setActive() { |
|
56 | 56 | $this->setTagName("div"); |
57 | 57 | $this->removeProperty("href"); |
58 | 58 | return $this->addToPropertyCtrl("class", "active", array("active")); |
59 | 59 | } |
60 | 60 | |
61 | - public function asLink($href=NULL,$part=NULL){ |
|
61 | + public function asLink($href=NULL, $part=NULL) { |
|
62 | 62 | $this->setTagName("a"); |
63 | - if(isset($href)) |
|
63 | + if (isset($href)) |
|
64 | 64 | $this->setProperty("href", $href); |
65 | 65 | return $this; |
66 | 66 | } |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
73 | 73 | */ |
74 | 74 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
75 | - if(\is_array($this->content)) |
|
76 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
75 | + if (\is_array($this->content)) |
|
76 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
77 | 77 | return parent::compile($js, $view); |
78 | 78 | } |
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | public function asLink($href=NULL,$part=NULL){ |
62 | 62 | $this->setTagName("a"); |
63 | - if(isset($href)) |
|
64 | - $this->setProperty("href", $href); |
|
63 | + if(isset($href)) { |
|
64 | + $this->setProperty("href", $href); |
|
65 | + } |
|
65 | 66 | return $this; |
66 | 67 | } |
67 | 68 | |
@@ -72,8 +73,9 @@ discard block |
||
72 | 73 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
73 | 74 | */ |
74 | 75 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
75 | - if(\is_array($this->content)) |
|
76 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
76 | + if(\is_array($this->content)) { |
|
77 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
78 | + } |
|
77 | 79 | return parent::compile($js, $view); |
78 | 80 | } |
79 | 81 | } |
80 | 82 | \ No newline at end of file |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\service\JArray; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\constants\State; |
10 | 9 | |
11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |