@@ -6,19 +6,19 @@ |
||
6 | 6 | |
7 | 7 | abstract public function getDataField(); |
8 | 8 | abstract public function addToProperty($name, $value, $separator=" "); |
9 | - public function setPlaceholder($value){ |
|
9 | + public function setPlaceholder($value) { |
|
10 | 10 | $this->getDataField()->setPlaceholder($value); |
11 | 11 | return $this; |
12 | 12 | } |
13 | 13 | |
14 | - public function setValue($value){ |
|
14 | + public function setValue($value) { |
|
15 | 15 | $this->getDataField()->setValue($value); |
16 | 16 | return $this; |
17 | 17 | } |
18 | 18 | |
19 | - public function setInputType($type){ |
|
20 | - if($type==="hidden") |
|
21 | - $this->addToProperty("style","display:none;"); |
|
19 | + public function setInputType($type) { |
|
20 | + if ($type==="hidden") |
|
21 | + $this->addToProperty("style", "display:none;"); |
|
22 | 22 | $this->getDataField()->setInputType($type); |
23 | 23 | return $this; |
24 | 24 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return HtmlModal |
87 | 87 | */ |
88 | 88 | public function htmlModal($identifier, $header="", $content="", $actions=array()) { |
89 | - return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); |
|
89 | + return $this->addHtmlComponent(new HtmlModal($identifier, $header, $content, $actions)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @param boolean $associative |
118 | 118 | * @return HtmlDropdown |
119 | 119 | */ |
120 | - public function htmlDropdown($identifier, $value="", $items=array(),$associative=true) { |
|
121 | - return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items,$associative)); |
|
120 | + public function htmlDropdown($identifier, $value="", $items=array(), $associative=true) { |
|
121 | + return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items, $associative)); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -9,27 +9,27 @@ |
||
9 | 9 | class HtmlMenuItem extends HtmlSemDoubleElement { |
10 | 10 | use MenuItemTrait; |
11 | 11 | public function __construct($identifier, $content) { |
12 | - parent::__construct($identifier,"div","item",$content); |
|
12 | + parent::__construct($identifier, "div", "item", $content); |
|
13 | 13 | } |
14 | 14 | |
15 | - protected function initContent($content){ |
|
16 | - if(\is_array($content)){ |
|
17 | - if(JArray::isAssociative($content)===false){ |
|
15 | + protected function initContent($content) { |
|
16 | + if (\is_array($content)) { |
|
17 | + if (JArray::isAssociative($content)===false) { |
|
18 | 18 | $icon=@$content[0]; |
19 | 19 | $title=@$content[1]; |
20 | 20 | $desc=@$content[2]; |
21 | - }else{ |
|
21 | + } else { |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
25 | 25 | } |
26 | - if(isset($icon)){ |
|
26 | + if (isset($icon)) { |
|
27 | 27 | $this->addIcon($icon); |
28 | 28 | } |
29 | - if(isset($title)){ |
|
30 | - $this->setTitle($title,$desc); |
|
29 | + if (isset($title)) { |
|
30 | + $this->setTitle($title, $desc); |
|
31 | 31 | } |
32 | - }else{ |
|
32 | + } else { |
|
33 | 33 | $this->setContent($content); |
34 | 34 | } |
35 | 35 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | trait HtmlLinkTrait { |
6 | 6 | |
7 | - abstract public function setProperty($name,$value); |
|
7 | + abstract public function setProperty($name, $value); |
|
8 | 8 | abstract public function getProperty($name); |
9 | 9 | |
10 | 10 | public function setHref($value) { |
@@ -14,89 +14,89 @@ |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
16 | 16 | private $cols; |
17 | - public function __construct($identifier,$numCols=NULL){ |
|
18 | - parent::__construct($identifier,"div"); |
|
17 | + public function __construct($identifier, $numCols=NULL) { |
|
18 | + parent::__construct($identifier, "div"); |
|
19 | 19 | $this->setProperty("class", "row"); |
20 | 20 | $this->cols=array(); |
21 | - if(isset($numCols)){ |
|
22 | - $numCols=min(12,$numCols); |
|
23 | - $numCols=max(1,$numCols); |
|
21 | + if (isset($numCols)) { |
|
22 | + $numCols=min(12, $numCols); |
|
23 | + $numCols=max(1, $numCols); |
|
24 | 24 | $width=12/$numCols; |
25 | - for ($i=0;$i<$numCols;$i++){ |
|
26 | - $this->addCol(CssSize::SIZE_MD,$width); |
|
25 | + for ($i=0; $i<$numCols; $i++) { |
|
26 | + $this->addCol(CssSize::SIZE_MD, $width); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - public function addCol($size=CssSize::SIZE_MD,$width=1){ |
|
32 | - $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1),$size,$width); |
|
31 | + public function addCol($size=CssSize::SIZE_MD, $width=1) { |
|
32 | + $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1), $size, $width); |
|
33 | 33 | $this->cols[]=$col; |
34 | 34 | return $col; |
35 | 35 | } |
36 | 36 | |
37 | - public function addColAt($size=CssSize::SIZE_MD,$width=1,$offset=1){ |
|
38 | - $col=$this->addCol($size,$width); |
|
39 | - return $col->setOffset($size, max($offset,sizeof($this->cols)+1)); |
|
37 | + public function addColAt($size=CssSize::SIZE_MD, $width=1, $offset=1) { |
|
38 | + $col=$this->addCol($size, $width); |
|
39 | + return $col->setOffset($size, max($offset, sizeof($this->cols)+1)); |
|
40 | 40 | } |
41 | 41 | |
42 | - public function getCol($index,$force=true){ |
|
42 | + public function getCol($index, $force=true) { |
|
43 | 43 | $result=null; |
44 | - if($index<sizeof($this->cols)+1){ |
|
44 | + if ($index<sizeof($this->cols)+1) { |
|
45 | 45 | $result=$this->cols[$index-1]; |
46 | - }else if ($force){ |
|
47 | - $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
|
46 | + } else if ($force) { |
|
47 | + $result=$this->addColAt(CssSize::SIZE_MD, 1, $index); |
|
48 | 48 | } |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - public function getColAt($offset,$force=true){ |
|
52 | + public function getColAt($offset, $force=true) { |
|
53 | 53 | $result=null; |
54 | - foreach ($this->cols as $col){ |
|
54 | + foreach ($this->cols as $col) { |
|
55 | 55 | $offsets=$col->getOffsets(); |
56 | - if($result=array_search($offset, $offsets)){ |
|
56 | + if ($result=array_search($offset, $offsets)) { |
|
57 | 57 | break; |
58 | 58 | } |
59 | 59 | } |
60 | - if(!$result || isset($result)===false){ |
|
61 | - $result=$this->getCol($offset,$force); |
|
60 | + if (!$result || isset($result)===false) { |
|
61 | + $result=$this->getCol($offset, $force); |
|
62 | 62 | } |
63 | 63 | return $result; |
64 | 64 | } |
65 | 65 | |
66 | 66 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
67 | 67 | |
68 | - foreach ($this->cols as $col){ |
|
68 | + foreach ($this->cols as $col) { |
|
69 | 69 | $this->addContent($col); |
70 | 70 | } |
71 | - return parent::compile($js,$view); |
|
71 | + return parent::compile($js, $view); |
|
72 | 72 | } |
73 | 73 | public function getCols() { |
74 | 74 | return $this->cols; |
75 | 75 | } |
76 | 76 | |
77 | - public function setContentForAll($content){ |
|
78 | - foreach ($this->cols as $col){ |
|
77 | + public function setContentForAll($content) { |
|
78 | + foreach ($this->cols as $col) { |
|
79 | 79 | $col->setContent($content); |
80 | 80 | } |
81 | 81 | } |
82 | - public function merge($size=CssSize::SIZE_MD,$start,$width){ |
|
83 | - $col=$this->getColAt($start,false); |
|
84 | - if(isset($col)){ |
|
85 | - $col->setWidth($size,$width+1); |
|
86 | - $this->delete($size,$start+1, $width); |
|
82 | + public function merge($size=CssSize::SIZE_MD, $start, $width) { |
|
83 | + $col=$this->getColAt($start, false); |
|
84 | + if (isset($col)) { |
|
85 | + $col->setWidth($size, $width+1); |
|
86 | + $this->delete($size, $start+1, $width); |
|
87 | 87 | } |
88 | 88 | } |
89 | - public function delete($size=CssSize::SIZE_MD,$start,$width){ |
|
90 | - while($start<sizeof($this->cols)+1 && $width>0){ |
|
91 | - $col=$this->getColAt($start,false); |
|
92 | - if(isset($col)){ |
|
89 | + public function delete($size=CssSize::SIZE_MD, $start, $width) { |
|
90 | + while ($start<sizeof($this->cols)+1 && $width>0) { |
|
91 | + $col=$this->getColAt($start, false); |
|
92 | + if (isset($col)) { |
|
93 | 93 | $widthCol=$col->getWidth($size); |
94 | - if($widthCol<=$width){ |
|
94 | + if ($widthCol<=$width) { |
|
95 | 95 | unset($this->cols[$start-1]); |
96 | - $this->cols = array_values($this->cols); |
|
96 | + $this->cols=array_values($this->cols); |
|
97 | 97 | $width=$width-$widthCol; |
98 | 98 | } |
99 | - }else{ |
|
99 | + } else { |
|
100 | 100 | $width=0; |
101 | 101 | } |
102 | 102 | } |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | public function setContent($content) { |
21 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
21 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
22 | 22 | return $this; |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function asIcon($icon, $title, $subHeader=NULL) { |
26 | - $header=new HtmlHeader("header-" . $this->identifier); |
|
26 | + $header=new HtmlHeader("header-".$this->identifier); |
|
27 | 27 | $header->asIcon($icon, $title, $subHeader); |
28 | - if ($this->_inverted === false) |
|
28 | + if ($this->_inverted===false) |
|
29 | 29 | $header->setInverted(); |
30 | 30 | return $this->setContent($header); |
31 | 31 | } |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function run(JsUtils $js) { |
44 | 44 | if ($this->_container instanceof HtmlSingleElement) |
45 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
45 | + $this->_bsComponent=$js->semantic()->dimmer("#".$this->_container->getIdentifier(), $this->_params); |
|
46 | 46 | return parent::run($js); |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function jsShow() { |
50 | 50 | if (isset($this->_container)) |
51 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
51 | + return '$("#.'.$this->_container->getIdentifier().').dimmer("show");'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function setBlurring() { |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | private $_hasIcon=false; |
16 | 16 | |
17 | 17 | abstract protected function addToPropertyCtrl($name, $value, $typeCtrl); |
18 | - abstract public function addContent($content,$before=false); |
|
18 | + abstract public function addContent($content, $before=false); |
|
19 | 19 | |
20 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
21 | - if($this->_hasIcon===false){ |
|
20 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
21 | + if ($this->_hasIcon===false) { |
|
22 | 22 | $iconO=$icon; |
23 | - if(\is_string($icon)){ |
|
23 | + if (\is_string($icon)) { |
|
24 | 24 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
25 | 25 | } |
26 | 26 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
27 | - $this->addContent($iconO,$direction===Direction::LEFT); |
|
27 | + $this->addContent($iconO, $direction===Direction::LEFT); |
|
28 | 28 | $this->_hasIcon=true; |
29 | - }else{ |
|
29 | + } else { |
|
30 | 30 | $iconO=$this->getIcon(); |
31 | 31 | $iconO->setIcon($icon); |
32 | 32 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | return $iconO; |
35 | 35 | } |
36 | 36 | |
37 | - public function getIcon(){ |
|
38 | - if(\is_array($this->content)){ |
|
39 | - foreach ($this->content as $item){ |
|
40 | - if($item instanceof HtmlIcon) |
|
37 | + public function getIcon() { |
|
38 | + if (\is_array($this->content)) { |
|
39 | + foreach ($this->content as $item) { |
|
40 | + if ($item instanceof HtmlIcon) |
|
41 | 41 | return $item; |
42 | 42 | } |
43 | 43 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | public function setDisabled($disable=true) { |
28 | - if($disable) |
|
28 | + if ($disable) |
|
29 | 29 | $this->addState(State::DISABLED); |
30 | 30 | return $this; |
31 | 31 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | class HtmlTabs extends HtmlBsDoubleElement { |
19 | - protected $tabs=array (); |
|
19 | + protected $tabs=array(); |
|
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function addTab_($tab, $index=null) { |
30 | - if($tab instanceof HtmlDropdown){ |
|
30 | + if ($tab instanceof HtmlDropdown) { |
|
31 | 31 | $tab->setMTagName("li"); |
32 | 32 | } |
33 | 33 | if (isset($index)) { |
34 | - $inserted=array ( |
|
34 | + $inserted=array( |
|
35 | 35 | $tab |
36 | 36 | ); |
37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | $this->tabs []=$tab; |
40 | 40 | } |
41 | 41 | |
42 | - public function setActive($index){ |
|
42 | + public function setActive($index) { |
|
43 | 43 | $size=\sizeof($this->tabs); |
44 | - for ($i=0;$i<$size;$i++){ |
|
44 | + for ($i=0; $i<$size; $i++) { |
|
45 | 45 | $this->tabs[$i]->setActive($i==$index); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - public function disable($index){ |
|
49 | + public function disable($index) { |
|
50 | 50 | $this->tabs[$index]->disable(); |
51 | 51 | } |
52 | 52 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addTabs($tabs) { |
80 | - foreach ( $tabs as $tab ) { |
|
80 | + foreach ($tabs as $tab) { |
|
81 | 81 | $this->addTab($tab); |
82 | 82 | } |
83 | 83 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function run(JsUtils $js) { |
109 | 109 | $this->_bsComponent=new Tabs($js); |
110 | - foreach ( $this->tabs as $tab ) { |
|
110 | + foreach ($this->tabs as $tab) { |
|
111 | 111 | $this->_bsComponent->addTab($tab->run($js)); |
112 | 112 | } |
113 | 113 | $this->addEventsOnRun($js); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | |
117 | 117 | public function createTabContents() { |
118 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
119 | - foreach ( $this->tabs as $tab ) { |
|
119 | + foreach ($this->tabs as $tab) { |
|
120 | 120 | if ($tab instanceof HtmlTabItem) |
121 | 121 | $tabContent->addTabItem($tab->getHref()); |
122 | 122 | elseif ($tab instanceof HtmlDropdown) { |
123 | - foreach ( $tab->getItems() as $dropdownItem ) { |
|
123 | + foreach ($tab->getItems() as $dropdownItem) { |
|
124 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
125 | 125 | } |
126 | 126 | } |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | if (sizeof($this->content->getTabItems())>0) { |
156 | 156 | $this->content->getTabItem(0)->addToProperty("class", "fade in"); |
157 | 157 | $size=sizeof($this->tabs); |
158 | - for($index=0; $index<$size; $index++) { |
|
158 | + for ($index=0; $index<$size; $index++) { |
|
159 | 159 | $this->content->getTabItem($index)->addToProperty("class", "fade"); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - public function on($event, $jsCode,$stopPropagation=false,$preventDefault=false){ |
|
165 | - foreach ($this->tabs as $tab){ |
|
166 | - $tab->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
164 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
165 | + foreach ($this->tabs as $tab) { |
|
166 | + $tab->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
167 | 167 | } |
168 | 168 | return $this; |
169 | 169 | } |
170 | 170 | |
171 | - public function setStacked($stacked=true){ |
|
172 | - if($stacked) |
|
171 | + public function setStacked($stacked=true) { |
|
172 | + if ($stacked) |
|
173 | 173 | $this->stacked="nav-stacked"; |
174 | 174 | else $this->stacked=""; |
175 | 175 | } |