@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base\constants; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Social extends BaseEnum { |
5 | - const FACEBOOK="facebook", TWITTER="twitter",GOOGLEPLUS="google plus",VK="vk",LINKEDIN="linkedin",INSTAGRAM="instagram",YOUTUBE="youtube"; |
|
5 | + const FACEBOOK="facebook", TWITTER="twitter", GOOGLEPLUS="google plus", VK="vk", LINKEDIN="linkedin", INSTAGRAM="instagram", YOUTUBE="youtube"; |
|
6 | 6 | } |
7 | 7 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
10 | 10 | * @author jc |
11 | 11 | * @version 1.001 |
12 | 12 | */ |
13 | -abstract class HtmlSemCollection extends HtmlCollection{ |
|
13 | +abstract class HtmlSemCollection extends HtmlCollection { |
|
14 | 14 | use BaseTrait; |
15 | - public function __construct( $identifier, $tagName="div",$baseClass=""){ |
|
16 | - parent::__construct( $identifier, $tagName); |
|
15 | + public function __construct($identifier, $tagName="div", $baseClass="") { |
|
16 | + parent::__construct($identifier, $tagName); |
|
17 | 17 | $this->_baseClass=$baseClass; |
18 | 18 | $this->setClass($baseClass); |
19 | 19 | } |
@@ -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,9 +20,9 @@ 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 | |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | $colCount++; |
31 | 31 | $grid->setColsCount($colCount); |
32 | 32 | |
33 | - $list=new HtmlList("",$items); |
|
33 | + $list=new HtmlList("", $items); |
|
34 | 34 | $list->asLink(); |
35 | - if(isset($header)){ |
|
36 | - $list->addHeader(4,$header); |
|
35 | + if (isset($header)) { |
|
36 | + $list->addHeader(4, $header); |
|
37 | 37 | } |
38 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
38 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
39 | 39 | $grid->setDivided()->setRelaxed(true); |
40 | 40 | return $list; |
41 | 41 | } |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * A popup can have no maximum width and continue to flow to fit its content |
45 | 45 | */ |
46 | - public function setFlowing(){ |
|
46 | + public function setFlowing() { |
|
47 | 47 | return $this->addToProperty("class", "flowing"); |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * A popup can provide more basic formatting |
52 | 52 | */ |
53 | - public function setBasic(){ |
|
53 | + public function setBasic() { |
|
54 | 54 | return $this->addToProperty("class", "basic"); |
55 | 55 | } |
56 | 56 | |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | * {@inheritDoc} |
59 | 59 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
60 | 60 | */ |
61 | - public function run(JsUtils $js){ |
|
61 | + public function run(JsUtils $js) { |
|
62 | 62 | $this->_params["popup"]="#".$this->identifier; |
63 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
63 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
64 | 64 | } |
65 | 65 | |
66 | - public function setOn($event="click"){ |
|
66 | + public function setOn($event="click") { |
|
67 | 67 | $this->_params["on"]=$event; |
68 | 68 | return $this; |
69 | 69 | } |
70 | 70 | |
71 | - public function setInline($value=true){ |
|
71 | + public function setInline($value=true) { |
|
72 | 72 | $this->_params["inline"]=$value; |
73 | 73 | return $this; |
74 | 74 | } |
75 | 75 | |
76 | - public function setPosition($position){ |
|
76 | + public function setPosition($position) { |
|
77 | 77 | $this->_params["position"]=$position; |
78 | 78 | return $this; |
79 | 79 | } |
@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | } |
18 | 18 | protected $mClass="menu"; |
19 | 19 | protected $mTagName="div"; |
20 | - protected $items=array (); |
|
21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
20 | + protected $items=array(); |
|
21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
22 | 22 | protected $input; |
23 | 23 | |
24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
25 | 25 | parent::__construct($identifier, "div"); |
26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
27 | 27 | $this->setProperty("class", "ui dropdown"); |
28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
29 | 29 | $content->setClass("text"); |
30 | 30 | $content->setContent($value); |
31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
32 | 32 | $this->content=array($content); |
33 | 33 | $this->tagName="div"; |
34 | 34 | $this->addItems($items); |
35 | 35 | } |
36 | 36 | |
37 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
38 | - $itemO=$this->beforeAddItem($item,$value,$image); |
|
37 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
38 | + $itemO=$this->beforeAddItem($item, $value, $image); |
|
39 | 39 | $this->items[]=$itemO; |
40 | 40 | return $itemO; |
41 | 41 | } |
42 | 42 | |
43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
44 | - $this->addIconP($icon,$before,$labeled); |
|
43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
44 | + $this->addIconP($icon, $before, $labeled); |
|
45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
46 | 46 | } |
47 | 47 | /** |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | * @param number $position |
51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
52 | 52 | */ |
53 | - public function insertItem($item,$position=0){ |
|
53 | + public function insertItem($item, $position=0) { |
|
54 | 54 | $itemO=$this->beforeAddItem($item); |
55 | - $start = array_slice($this->items, 0, $position); |
|
56 | - $end = array_slice($this->items, $position); |
|
57 | - $start[] = $item; |
|
55 | + $start=array_slice($this->items, 0, $position); |
|
56 | + $end=array_slice($this->items, $position); |
|
57 | + $start[]=$item; |
|
58 | 58 | $this->items=array_merge($start, $end); |
59 | 59 | return $itemO; |
60 | 60 | } |
61 | 61 | |
62 | - protected function beforeAddItem($item,$value=NULL,$image=NULL){ |
|
62 | + protected function beforeAddItem($item, $value=NULL, $image=NULL) { |
|
63 | 63 | $itemO=$item; |
64 | - if(\is_array($item)){ |
|
64 | + if (\is_array($item)) { |
|
65 | 65 | $value=JArray::getValue($item, "value", 1); |
66 | 66 | $image=JArray::getValue($item, "image", 2); |
67 | 67 | $item=JArray::getValue($item, "item", 0); |
68 | 68 | } |
69 | - if(!$item instanceof HtmlDropdownItem){ |
|
70 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
69 | + if (!$item instanceof HtmlDropdownItem) { |
|
70 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
71 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
72 | 72 | $this->addToProperty("class", "vertical"); |
73 | 73 | } |
74 | 74 | return $itemO; |
@@ -81,76 +81,76 @@ discard block |
||
81 | 81 | $this->addItem($function($object)); |
82 | 82 | } |
83 | 83 | |
84 | - public function addInput($name){ |
|
85 | - if(!isset($name)) |
|
84 | + public function addInput($name) { |
|
85 | + if (!isset($name)) |
|
86 | 86 | $name="input-".$this->identifier; |
87 | 87 | $this->setAction("activate"); |
88 | - $this->input=new HtmlInput($name,"hidden"); |
|
88 | + $this->input=new HtmlInput($name, "hidden"); |
|
89 | 89 | } |
90 | 90 | |
91 | - public function addItems($items){ |
|
92 | - if(JArray::isAssociative($items)){ |
|
93 | - foreach ($items as $k=>$v){ |
|
91 | + public function addItems($items) { |
|
92 | + if (JArray::isAssociative($items)) { |
|
93 | + foreach ($items as $k=>$v) { |
|
94 | 94 | $this->addItem($v)->setData($k); |
95 | 95 | } |
96 | - }else{ |
|
97 | - foreach ($items as $item){ |
|
96 | + } else { |
|
97 | + foreach ($items as $item) { |
|
98 | 98 | $this->addItem($item); |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - public function count(){ |
|
103 | + public function count() { |
|
104 | 104 | return \sizeof($this->items); |
105 | 105 | } |
106 | 106 | /** |
107 | 107 | * @param boolean $dropdown |
108 | 108 | */ |
109 | - public function asDropdown($dropdown){ |
|
110 | - if($dropdown===false){ |
|
109 | + public function asDropdown($dropdown) { |
|
110 | + if ($dropdown===false) { |
|
111 | 111 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
112 | 112 | $dropdown="menu"; |
113 | - }else{ |
|
113 | + } else { |
|
114 | 114 | $dropdown="dropdown"; |
115 | 115 | $this->mClass="menu"; |
116 | 116 | } |
117 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
117 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
118 | 118 | } |
119 | 119 | |
120 | - public function setVertical(){ |
|
121 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
120 | + public function setVertical() { |
|
121 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
122 | 122 | } |
123 | 123 | |
124 | - public function setSimple(){ |
|
125 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
124 | + public function setSimple() { |
|
125 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
126 | 126 | } |
127 | 127 | |
128 | - public function asButton($floating=false){ |
|
129 | - if($floating) |
|
128 | + public function asButton($floating=false) { |
|
129 | + if ($floating) |
|
130 | 130 | $this->addToProperty("class", "floating"); |
131 | 131 | return $this->addToProperty("class", "button"); |
132 | 132 | } |
133 | 133 | |
134 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
135 | - if(isset($name)) |
|
134 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
135 | + if (isset($name)) |
|
136 | 136 | $this->addInput($name); |
137 | - if($multiple) |
|
137 | + if ($multiple) |
|
138 | 138 | $this->addToProperty("class", "multiple"); |
139 | 139 | if ($selection) |
140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
140 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
141 | 141 | return $this; |
142 | 142 | } |
143 | 143 | |
144 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
145 | - $this->asSelect($name,$multiple,$selection); |
|
144 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
145 | + $this->asSelect($name, $multiple, $selection); |
|
146 | 146 | return $this->addToProperty("class", "search"); |
147 | 147 | } |
148 | 148 | |
149 | - public function setSelect($name=NULL,$multiple=false){ |
|
150 | - if(!isset($name)) |
|
149 | + public function setSelect($name=NULL, $multiple=false) { |
|
150 | + if (!isset($name)) |
|
151 | 151 | $name="select-".$this->identifier; |
152 | 152 | $this->input=null; |
153 | - if($multiple){ |
|
153 | + if ($multiple) { |
|
154 | 154 | $this->setProperty("multiple", true); |
155 | 155 | $this->addToProperty("class", "multiple"); |
156 | 156 | } |
@@ -158,32 +158,32 @@ discard block |
||
158 | 158 | $this->tagName="select"; |
159 | 159 | $this->setProperty("name", $name); |
160 | 160 | $this->content=null; |
161 | - foreach ($this->items as $item){ |
|
161 | + foreach ($this->items as $item) { |
|
162 | 162 | $item->asOption(); |
163 | 163 | } |
164 | 164 | return $this; |
165 | 165 | } |
166 | 166 | |
167 | - public function asSubmenu($pointing=NULL){ |
|
167 | + public function asSubmenu($pointing=NULL) { |
|
168 | 168 | $this->setClass("ui dropdown link item"); |
169 | - if(isset($pointing)){ |
|
169 | + if (isset($pointing)) { |
|
170 | 170 | $this->setPointing($pointing); |
171 | 171 | } |
172 | 172 | return $this; |
173 | 173 | } |
174 | 174 | |
175 | - public function setPointing($value=Direction::NONE){ |
|
176 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
175 | + public function setPointing($value=Direction::NONE) { |
|
176 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
177 | 177 | } |
178 | 178 | |
179 | - public function setValue($value){ |
|
180 | - if(isset($this->input)){ |
|
179 | + public function setValue($value) { |
|
180 | + if (isset($this->input)) { |
|
181 | 181 | $this->input->setProperty("value", $value); |
182 | - }else{ |
|
182 | + } else { |
|
183 | 183 | $this->setProperty("value", $value); |
184 | 184 | } |
185 | 185 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
186 | - if(isset($textElement)) |
|
186 | + if (isset($textElement)) |
|
187 | 187 | $textElement->setContent($value); |
188 | 188 | return $this; |
189 | 189 | } |
@@ -193,23 +193,23 @@ discard block |
||
193 | 193 | * @see BaseHtml::run() |
194 | 194 | */ |
195 | 195 | public function run(JsUtils $js) { |
196 | - if($this->propertyContains("class", "simple")===false){ |
|
197 | - if(isset($this->_bsComponent)===false) |
|
198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
196 | + if ($this->propertyContains("class", "simple")===false) { |
|
197 | + if (isset($this->_bsComponent)===false) |
|
198 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
199 | 199 | $this->addEventsOnRun($js); |
200 | 200 | return $this->_bsComponent; |
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - public function setCompact(){ |
|
204 | + public function setCompact() { |
|
205 | 205 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
206 | 206 | } |
207 | 207 | |
208 | - public function setAction($action){ |
|
208 | + public function setAction($action) { |
|
209 | 209 | $this->_params["action"]=$action; |
210 | 210 | } |
211 | 211 | |
212 | - public function setFullTextSearch($value){ |
|
212 | + public function setFullTextSearch($value) { |
|
213 | 213 | $this->_params["fullTextSearch"]=$value; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | \ No newline at end of file |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | if(!$item instanceof HtmlDropdownItem){ |
70 | 70 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
71 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
72 | 72 | $this->addToProperty("class", "vertical"); |
73 | 73 | } |
74 | 74 | return $itemO; |
@@ -82,8 +82,9 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | public function addInput($name){ |
85 | - if(!isset($name)) |
|
86 | - $name="input-".$this->identifier; |
|
85 | + if(!isset($name)) { |
|
86 | + $name="input-".$this->identifier; |
|
87 | + } |
|
87 | 88 | $this->setAction("activate"); |
88 | 89 | $this->input=new HtmlInput($name,"hidden"); |
89 | 90 | } |
@@ -93,7 +94,7 @@ discard block |
||
93 | 94 | foreach ($items as $k=>$v){ |
94 | 95 | $this->addItem($v)->setData($k); |
95 | 96 | } |
96 | - }else{ |
|
97 | + } else{ |
|
97 | 98 | foreach ($items as $item){ |
98 | 99 | $this->addItem($item); |
99 | 100 | } |
@@ -110,7 +111,7 @@ discard block |
||
110 | 111 | if($dropdown===false){ |
111 | 112 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
112 | 113 | $dropdown="menu"; |
113 | - }else{ |
|
114 | + } else{ |
|
114 | 115 | $dropdown="dropdown"; |
115 | 116 | $this->mClass="menu"; |
116 | 117 | } |
@@ -126,18 +127,22 @@ discard block |
||
126 | 127 | } |
127 | 128 | |
128 | 129 | public function asButton($floating=false){ |
129 | - if($floating) |
|
130 | - $this->addToProperty("class", "floating"); |
|
130 | + if($floating) { |
|
131 | + $this->addToProperty("class", "floating"); |
|
132 | + } |
|
131 | 133 | return $this->addToProperty("class", "button"); |
132 | 134 | } |
133 | 135 | |
134 | 136 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
135 | - if(isset($name)) |
|
136 | - $this->addInput($name); |
|
137 | - if($multiple) |
|
138 | - $this->addToProperty("class", "multiple"); |
|
139 | - if ($selection) |
|
140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
137 | + if(isset($name)) { |
|
138 | + $this->addInput($name); |
|
139 | + } |
|
140 | + if($multiple) { |
|
141 | + $this->addToProperty("class", "multiple"); |
|
142 | + } |
|
143 | + if ($selection) { |
|
144 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
145 | + } |
|
141 | 146 | return $this; |
142 | 147 | } |
143 | 148 | |
@@ -147,8 +152,9 @@ discard block |
||
147 | 152 | } |
148 | 153 | |
149 | 154 | public function setSelect($name=NULL,$multiple=false){ |
150 | - if(!isset($name)) |
|
151 | - $name="select-".$this->identifier; |
|
155 | + if(!isset($name)) { |
|
156 | + $name="select-".$this->identifier; |
|
157 | + } |
|
152 | 158 | $this->input=null; |
153 | 159 | if($multiple){ |
154 | 160 | $this->setProperty("multiple", true); |
@@ -179,12 +185,13 @@ discard block |
||
179 | 185 | public function setValue($value){ |
180 | 186 | if(isset($this->input)){ |
181 | 187 | $this->input->setProperty("value", $value); |
182 | - }else{ |
|
188 | + } else{ |
|
183 | 189 | $this->setProperty("value", $value); |
184 | 190 | } |
185 | 191 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
186 | - if(isset($textElement)) |
|
187 | - $textElement->setContent($value); |
|
192 | + if(isset($textElement)) { |
|
193 | + $textElement->setContent($value); |
|
194 | + } |
|
188 | 195 | return $this; |
189 | 196 | } |
190 | 197 | |
@@ -194,8 +201,9 @@ discard block |
||
194 | 201 | */ |
195 | 202 | public function run(JsUtils $js) { |
196 | 203 | if($this->propertyContains("class", "simple")===false){ |
197 | - if(isset($this->_bsComponent)===false) |
|
198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
204 | + if(isset($this->_bsComponent)===false) { |
|
205 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
206 | + } |
|
199 | 207 | $this->addEventsOnRun($js); |
200 | 208 | return $this->_bsComponent; |
201 | 209 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @param int $max |
14 | 14 | * @param string $icon star or heart |
15 | 15 | */ |
16 | - public function __construct($identifier, $value,$max=5,$icon="") { |
|
16 | + public function __construct($identifier, $value, $max=5, $icon="") { |
|
17 | 17 | parent::__construct($identifier, "div", "ui {$icon} rating"); |
18 | 18 | $this->setValue($value); |
19 | 19 | $this->setMax($max); |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \Ajax\common\html\HtmlDoubleElement::setValue() |
25 | 25 | */ |
26 | - public function setValue($value){ |
|
26 | + public function setValue($value) { |
|
27 | 27 | $this->setProperty("data-rating", $value); |
28 | 28 | } |
29 | 29 | |
30 | - public function setMax($max){ |
|
30 | + public function setMax($max) { |
|
31 | 31 | $this->setProperty("data-max-rating", $max); |
32 | 32 | } |
33 | 33 | |
@@ -35,20 +35,20 @@ discard block |
||
35 | 35 | * {@inheritDoc} |
36 | 36 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
37 | 37 | */ |
38 | - public function run(JsUtils $js){ |
|
38 | + public function run(JsUtils $js) { |
|
39 | 39 | parent::run($js); |
40 | - return $js->semantic()->rating("#".$this->identifier,$this->_params); |
|
40 | + return $js->semantic()->rating("#".$this->identifier, $this->_params); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function asStar(){ |
|
43 | + public function asStar() { |
|
44 | 44 | return $this->setIcon(); |
45 | 45 | } |
46 | 46 | |
47 | - public function asHeart(){ |
|
47 | + public function asHeart() { |
|
48 | 48 | return $this->setIcon("heart"); |
49 | 49 | } |
50 | 50 | |
51 | - public function setIcon($icon="star"){ |
|
52 | - return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]); |
|
51 | + public function setIcon($icon="star") { |
|
52 | + return $this->addToPropertyCtrl("class", $icon, ["star", "heart", ""]); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
7 | 7 | |
8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
9 | - protected $_params=array (); |
|
9 | + protected $_params=array(); |
|
10 | 10 | |
11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
74 | 74 | */ |
75 | 75 | public function attachEvent($selector, $action=NULL) { |
76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
78 | 78 | } else { |
79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function attachEvents($events=array()) { |
91 | 91 | if (\is_array($events)) { |
92 | - foreach ( $events as $action => $selector ) { |
|
92 | + foreach ($events as $action => $selector) { |
|
93 | 93 | $this->attachEvent($selector, $action); |
94 | 94 | } |
95 | 95 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
14 | 14 | $field->setProperty("name", $name); |
15 | 15 | $this->setField($field); |
16 | - if (isset($label)) |
|
17 | - $this->setLabel($label); |
|
16 | + if (isset($label)) { |
|
17 | + $this->setLabel($label); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | public function setType($checkboxType) { |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | * @return mixed |
41 | 42 | */ |
42 | 43 | public function getLabel() { |
43 | - if (\array_key_exists("label", $this->content)) |
|
44 | - return $this->content["label"]; |
|
44 | + if (\array_key_exists("label", $this->content)) { |
|
45 | + return $this->content["label"]; |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | |
47 | 49 | /** |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | class HtmlDimmer extends HtmlSemDoubleElement { |
11 | 11 | private $_container; |
12 | - private $_params=array (); |
|
12 | + private $_params=array(); |
|
13 | 13 | private $_inverted; |
14 | 14 | |
15 | 15 | public function __construct($identifier, $content=NULL) { |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setContent($content) { |
22 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
22 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function asIcon($icon, $title, $subHeader=NULL) { |
27 | - $header=new HtmlHeader("header-" . $this->identifier); |
|
27 | + $header=new HtmlHeader("header-".$this->identifier); |
|
28 | 28 | $header->asIcon($icon, $title, $subHeader); |
29 | - if ($this->_inverted === false) |
|
29 | + if ($this->_inverted===false) |
|
30 | 30 | $header->setInverted(); |
31 | 31 | return $this->setContent($header); |
32 | 32 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | public function run(JsUtils $js) { |
45 | 45 | if ($this->_container instanceof HtmlSingleElement) |
46 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
46 | + $this->_bsComponent=$js->semantic()->dimmer("#".$this->_container->getIdentifier(), $this->_params); |
|
47 | 47 | return parent::run($js); |
48 | 48 | } |
49 | 49 | |
50 | 50 | public function jsShow() { |
51 | - if (isset($this->_container) === true) |
|
52 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
51 | + if (isset($this->_container)===true) |
|
52 | + return '$("#.'.$this->_container->getIdentifier().').dimmer("show");'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setBlurring() { |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | public function asIcon($icon, $title, $subHeader=NULL) { |
27 | 27 | $header=new HtmlHeader("header-" . $this->identifier); |
28 | 28 | $header->asIcon($icon, $title, $subHeader); |
29 | - if ($this->_inverted === false) |
|
30 | - $header->setInverted(); |
|
29 | + if ($this->_inverted === false) { |
|
30 | + $header->setInverted(); |
|
31 | + } |
|
31 | 32 | return $this->setContent($header); |
32 | 33 | } |
33 | 34 | |
@@ -42,14 +43,16 @@ discard block |
||
42 | 43 | } |
43 | 44 | |
44 | 45 | public function run(JsUtils $js) { |
45 | - if ($this->_container instanceof HtmlSingleElement) |
|
46 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
46 | + if ($this->_container instanceof HtmlSingleElement) { |
|
47 | + $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
48 | + } |
|
47 | 49 | return parent::run($js); |
48 | 50 | } |
49 | 51 | |
50 | 52 | public function jsShow() { |
51 | - if (isset($this->_container) === true) |
|
52 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
53 | + if (isset($this->_container) === true) { |
|
54 | + return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
55 | + } |
|
53 | 56 | } |
54 | 57 | |
55 | 58 | public function setBlurring() { |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | class HtmlSticky extends HtmlSemDoubleElement { |
9 | 9 | private $_params=array(); |
10 | 10 | |
11 | - public function __construct($identifier,$context=NULL,$content=NULL) { |
|
11 | + public function __construct($identifier, $context=NULL, $content=NULL) { |
|
12 | 12 | parent::__construct($identifier, "div", "ui sticky", $content); |
13 | - if(isset($content)) |
|
13 | + if (isset($content)) |
|
14 | 14 | $this->setContext($context); |
15 | 15 | } |
16 | 16 | |
17 | - public function setContext($context){ |
|
17 | + public function setContext($context) { |
|
18 | 18 | $this->_params["context"]=$context; |
19 | 19 | return $this; |
20 | 20 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
25 | 25 | */ |
26 | - public function run(JsUtils $js){ |
|
26 | + public function run(JsUtils $js) { |
|
27 | 27 | parent::run($js); |
28 | - return $js->semantic()->sticky("#".$this->identifier,$this->_params); |
|
28 | + return $js->semantic()->sticky("#".$this->identifier, $this->_params); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -10,8 +10,9 @@ |
||
10 | 10 | |
11 | 11 | public function __construct($identifier,$context=NULL,$content=NULL) { |
12 | 12 | parent::__construct($identifier, "div", "ui sticky", $content); |
13 | - if(isset($content)) |
|
14 | - $this->setContext($context); |
|
13 | + if(isset($content)) { |
|
14 | + $this->setContext($context); |
|
15 | + } |
|
15 | 16 | } |
16 | 17 | |
17 | 18 | public function setContext($context){ |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | use Ajax\semantic\html\base\constants\Direction; |
9 | 9 | |
10 | 10 | class HtmlSearch extends HtmlSemDoubleElement { |
11 | - private $_elements=array (); |
|
12 | - private $_params=array (); |
|
13 | - private $_searchFields=array ("title" ); |
|
11 | + private $_elements=array(); |
|
12 | + private $_params=array(); |
|
13 | + private $_searchFields=array("title"); |
|
14 | 14 | private $_local=false; |
15 | 15 | |
16 | 16 | public function __construct($identifier, $placeholder=NULL, $icon=NULL) { |
17 | - parent::__construct("search-" . $identifier, "div", "ui search", array ()); |
|
17 | + parent::__construct("search-".$identifier, "div", "ui search", array()); |
|
18 | 18 | $this->createField($placeholder, $icon); |
19 | 19 | $this->createResult(); |
20 | 20 | $this->_params["type"]="standard"; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | private function createField($placeholder=NULL, $icon=NULL) { |
24 | 24 | $field=new HtmlInput($this->identifier); |
25 | - if (isset($placeholder) === true) |
|
25 | + if (isset($placeholder)===true) |
|
26 | 26 | $field->setPlaceholder($placeholder); |
27 | - if (isset($icon) === true) |
|
27 | + if (isset($icon)===true) |
|
28 | 28 | $field->addIcon($icon, Direction::RIGHT); |
29 | 29 | $field->getField()->setClass("prompt"); |
30 | 30 | $this->content["field"]=$field; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | private function createResult() { |
35 | - $this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results"); |
|
35 | + $this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results"); |
|
36 | 36 | return $this->content["result"]; |
37 | 37 | } |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function setUrl($url) { |
52 | - $this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%"; |
|
52 | + $this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%"; |
|
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | public function run(JsUtils $js) { |
75 | - $this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
75 | + $this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
76 | 76 | $searchFields=\json_encode($this->_searchFields); |
77 | 77 | $searchFields=str_ireplace("\"", "%quote%", $searchFields); |
78 | - $this->_params["searchFields"]="%" . $searchFields . "%"; |
|
79 | - if ($this->_local === true) { |
|
78 | + $this->_params["searchFields"]="%".$searchFields."%"; |
|
79 | + if ($this->_local===true) { |
|
80 | 80 | $this->_params["source"]="%content%"; |
81 | - $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";"); |
|
81 | + $this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";"); |
|
82 | 82 | } |
83 | - if (isset($this->_bsComponent) === false) { |
|
84 | - $this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params); |
|
83 | + if (isset($this->_bsComponent)===false) { |
|
84 | + $this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params); |
|
85 | 85 | } |
86 | 86 | $this->addEventsOnRun($js); |
87 | 87 | return $this->_bsComponent; |
@@ -22,10 +22,12 @@ |
||
22 | 22 | |
23 | 23 | private function createField($placeholder=NULL, $icon=NULL) { |
24 | 24 | $field=new HtmlInput($this->identifier); |
25 | - if (isset($placeholder) === true) |
|
26 | - $field->setPlaceholder($placeholder); |
|
27 | - if (isset($icon) === true) |
|
28 | - $field->addIcon($icon, Direction::RIGHT); |
|
25 | + if (isset($placeholder) === true) { |
|
26 | + $field->setPlaceholder($placeholder); |
|
27 | + } |
|
28 | + if (isset($icon) === true) { |
|
29 | + $field->addIcon($icon, Direction::RIGHT); |
|
30 | + } |
|
29 | 31 | $field->getField()->setClass("prompt"); |
30 | 32 | $this->content["field"]=$field; |
31 | 33 | return $field; |