@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $event |
22 | 22 | * @param boolean $multiple |
23 | 23 | */ |
24 | - public function __construct($table,$class="active",$event="click",$multiple=false){ |
|
24 | + public function __construct($table, $class="active", $event="click", $multiple=false) { |
|
25 | 25 | $this->table=$table; |
26 | 26 | $this->class=$class; |
27 | 27 | $this->event=$event; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
58 | - public function compile(){ |
|
58 | + public function compile() { |
|
59 | 59 | $multiple=""; |
60 | - if(!$this->multiple){ |
|
60 | + if (!$this->multiple) { |
|
61 | 61 | $multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');"; |
62 | 62 | } |
63 | - $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false); |
|
63 | + $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | * @author jc |
8 | 8 | * @property HtmlTable $_self |
9 | 9 | */ |
10 | -trait TableTrait{ |
|
10 | +trait TableTrait { |
|
11 | 11 | |
12 | 12 | abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
13 | 13 | abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
14 | 14 | |
15 | - protected function addToPropertyTable($property,$value){ |
|
15 | + protected function addToPropertyTable($property, $value) { |
|
16 | 16 | return $this->_self->addToProperty($property, $value); |
17 | 17 | } |
18 | 18 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | public function setBasic($very=false) { |
24 | 24 | $table=$this->_self; |
25 | 25 | if ($very) |
26 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
27 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
26 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
27 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setCompact($very=false) { |
31 | 31 | $table=$this->_self; |
32 | 32 | if ($very) |
33 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
34 | - return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
|
33 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
34 | + return $table->addToPropertyCtrl("class", "compact", array("compact")); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function setCollapsing() { |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | return $this->addToPropertyTable("class", "striped"); |
71 | 71 | } |
72 | 72 | |
73 | - public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){ |
|
74 | - $this->onRowClick($jsCode,$stopPropagation,$preventDefault); |
|
73 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
74 | + $this->onRowClick($jsCode, $stopPropagation, $preventDefault); |
|
75 | 75 | } |
76 | 76 | |
77 | - public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){ |
|
78 | - $this->_self->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault); |
|
77 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
78 | + $this->_self->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
79 | 79 | } |
80 | 80 | |
81 | - public function getOnRow($event, $url, $responseElement="", $parameters=array()){ |
|
82 | - $parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]); |
|
83 | - return $this->_self->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters); |
|
81 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
82 | + $parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]); |
|
83 | + return $this->_self->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters); |
|
84 | 84 | } |
85 | 85 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlLabeledIconMenu extends HtmlMenu{ |
|
15 | +class HtmlLabeledIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "labeled icon"); |
25 | 25 | } |
26 | 26 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | protected function createItem($value) { |
32 | 32 | $text=""; |
33 | 33 | $v=$value; |
34 | - if(\is_array($value)){ |
|
34 | + if (\is_array($value)) { |
|
35 | 35 | $v=@$value[0]; |
36 | 36 | $text=@$value[1]; |
37 | 37 | } |
38 | 38 | $count=\sizeof($this->content); |
39 | 39 | $value=new HtmlIcon("icon-".$count, $v); |
40 | - $value->wrap("",$text); |
|
41 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
40 | + $value->wrap("", $text); |
|
41 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
42 | 42 | return $itemO->setClass("item"); |
43 | 43 | } |
44 | 44 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlIconMenu extends HtmlMenu{ |
|
15 | +class HtmlIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "icon"); |
25 | 25 | } |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | protected function createItem($value) { |
33 | 33 | $count=\sizeof($this->content); |
34 | 34 | $value=new HtmlIcon("icon-".$count, $value); |
35 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
35 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
36 | 36 | return $itemO->setClass("item"); |
37 | 37 | } |
38 | 38 | } |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * @return \Ajax\semantic\html\collections\HtmlMenu |
41 | 41 | */ |
42 | 42 | public function setType($type="") { |
43 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
43 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function setActiveItem($index) { |
47 | 47 | $item=$this->getItem($index); |
48 | - if ($item !== null) { |
|
48 | + if ($item!==null) { |
|
49 | 49 | $item->addToProperty("class", "active"); |
50 | 50 | } |
51 | 51 | return $this; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | private function getItemToInsert($item) { |
55 | 55 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) { |
56 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
56 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
57 | 57 | $item=$itemO; |
58 | 58 | } |
59 | 59 | return $item; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | private function afterInsert($item) { |
63 | 63 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
64 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
64 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
65 | 65 | else { |
66 | 66 | $this->setSecondary(); |
67 | 67 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function addItem($item) { |
78 | 78 | $number=$item; |
79 | 79 | $item=parent::addItem($this->getItemToInsert($item)); |
80 | - if(\is_int($number)) |
|
80 | + if (\is_int($number)) |
|
81 | 81 | $item->setProperty("data-page", $number); |
82 | 82 | return $this->afterInsert($item); |
83 | 83 | } |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | |
96 | 96 | public function generateMenuAsItem($menu, $header=null) { |
97 | 97 | $count=$this->count(); |
98 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
98 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
99 | 99 | if (isset($header)) { |
100 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
100 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
101 | 101 | $headerItem->setContent($header); |
102 | 102 | $item->addContent($headerItem); |
103 | 103 | $this->_itemHeader=$headerItem; |
104 | 104 | } |
105 | - if(\is_array($menu)){ |
|
106 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
105 | + if (\is_array($menu)) { |
|
106 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
107 | 107 | } |
108 | 108 | $menu->setClass("menu"); |
109 | 109 | $item->addContent($menu); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
119 | 119 | $value->addContent(new HtmlIcon("", "dropdown")); |
120 | 120 | $value=$this->addItem($value); |
121 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
121 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
122 | 122 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
123 | 123 | $this->wrap("", $popup); |
124 | 124 | return $popup; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function addDropdownAsItem($value, $items=NULL) { |
128 | 128 | $dd=$value; |
129 | 129 | if (\is_string($value)) { |
130 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
130 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
131 | 131 | } |
132 | 132 | $this->addItem($dd); |
133 | 133 | return $dd; |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
141 | 141 | */ |
142 | 142 | protected function createItem($value) { |
143 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
143 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
144 | 144 | $itemO->setTagName("a"); |
145 | 145 | $itemO->setContent($value); |
146 | 146 | return $itemO; |
147 | 147 | } |
148 | 148 | |
149 | 149 | public function setSecondary($value=true) { |
150 | - if($value) |
|
150 | + if ($value) |
|
151 | 151 | $this->addToProperty("class", "secondary"); |
152 | 152 | else |
153 | 153 | $this->removePropertyValue("class", "secondary"); |
@@ -155,28 +155,28 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function setVertical() { |
158 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
158 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function setPosition($value="right") { |
162 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
162 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | public function setPointing($value=Direction::NONE) { |
166 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
166 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | public function asTab($vertical=false) { |
170 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
170 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
171 | 171 | $item->setTagName("a"); |
172 | 172 | }); |
173 | - if ($vertical === true) |
|
173 | + if ($vertical===true) |
|
174 | 174 | $this->setVertical(); |
175 | 175 | return $this->addToProperty("class", "tabular"); |
176 | 176 | } |
177 | 177 | |
178 | 178 | public function asPagination() { |
179 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
179 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
180 | 180 | $item->setTagName("a"); |
181 | 181 | }); |
182 | 182 | return $this->addToProperty("class", "pagination"); |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function setWidth($width) { |
215 | 215 | if (\is_int($width)) { |
216 | - $width=Wide::getConstants()["W" . $width]; |
|
216 | + $width=Wide::getConstants()["W".$width]; |
|
217 | 217 | } |
218 | 218 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
219 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
219 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | public function addImage($identifier, $src="", $alt="") { |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | return $this->_itemHeader; |
232 | 232 | } |
233 | 233 | |
234 | - public function setHasContainer(){ |
|
235 | - return $this->wrapContent("<div class='ui container'>","</div>"); |
|
234 | + public function setHasContainer() { |
|
235 | + return $this->wrapContent("<div class='ui container'>", "</div>"); |
|
236 | 236 | } |
237 | 237 | |
238 | - public function run(JsUtils $js){ |
|
239 | - if($this->identifier!=="" && !isset($this->_bsComponent)) |
|
240 | - $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false); |
|
241 | - $result= parent::run($js); |
|
238 | + public function run(JsUtils $js) { |
|
239 | + if ($this->identifier!=="" && !isset($this->_bsComponent)) |
|
240 | + $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}', false, false); |
|
241 | + $result=parent::run($js); |
|
242 | 242 | return $result->setItemSelector(".item"); |
243 | 243 | } |
244 | 244 | } |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\content\HtmlAccordionMenuItem; |
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | -class HtmlAccordionMenu extends HtmlMenu{ |
|
9 | +class HtmlAccordionMenu extends HtmlMenu { |
|
10 | 10 | protected $params=array(); |
11 | 11 | |
12 | - public function __construct( $identifier, $items=array() ){ |
|
13 | - parent::__construct( $identifier, $items); |
|
12 | + public function __construct($identifier, $items=array()) { |
|
13 | + parent::__construct($identifier, $items); |
|
14 | 14 | $this->addToProperty("class", "accordion"); |
15 | 15 | $this->setVertical(); |
16 | 16 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | protected function createItem($value) { |
23 | 23 | $title=$value; |
24 | 24 | $content=""; |
25 | - if(\is_array($value)){ |
|
26 | - $title=@$value[0];$content=@$value[1]; |
|
25 | + if (\is_array($value)) { |
|
26 | + $title=@$value[0]; $content=@$value[1]; |
|
27 | 27 | } |
28 | 28 | $itemO=new HtmlAccordionMenuItem("item-".$this->identifier."-".$this->count(), $title, $content); |
29 | 29 | return $itemO->setClass("item"); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @see BaseHtml::run() |
35 | 35 | */ |
36 | 36 | public function run(JsUtils $js) { |
37 | - if(isset($this->_bsComponent)===false) |
|
38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
37 | + if (isset($this->_bsComponent)===false) |
|
38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
39 | 39 | $this->addEventsOnRun($js); |
40 | 40 | return $this->_bsComponent; |
41 | 41 | } |
42 | 42 | |
43 | - public function setExclusive($value){ |
|
43 | + public function setExclusive($value) { |
|
44 | 44 | $this->params["exclusive"]=$value; |
45 | 45 | } |
46 | 46 | } |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false,$associative=true) { |
|
11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false, $associative=true) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | 12 | $this->_identifier=$identifier; |
13 | 13 | } |
14 | 14 | |
15 | - public function setItems($items){ |
|
15 | + public function setItems($items) { |
|
16 | 16 | return $this->getField()->setItems($items); |
17 | 17 | } |
18 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
19 | - return $this->getField()->addItem($item,$value,$image); |
|
18 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
19 | + return $this->getField()->addItem($item, $value, $image); |
|
20 | 20 | } |
21 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$associative=true){ |
|
22 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
21 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $associative=true) { |
|
22 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function getDataField(){ |
|
25 | + public function getDataField() { |
|
26 | 26 | return $this->getField()->getInput(); |
27 | 27 | } |
28 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
29 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
28 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
29 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | } |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | class HtmlFormTextarea extends HtmlFormField { |
10 | 10 | use TextFieldsTrait; |
11 | 11 | |
12 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
13 | - if(!isset($placeholder)) |
|
12 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
13 | + if (!isset($placeholder)) |
|
14 | 14 | $placeholder=$label; |
15 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
15 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
16 | 16 | $this->_identifier=$identifier; |
17 | 17 | } |
18 | 18 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * Defines the textarea row count |
21 | 21 | * @param int $count |
22 | 22 | */ |
23 | - public function setRows($count){ |
|
23 | + public function setRows($count) { |
|
24 | 24 | $this->getField()->setRows($count); |
25 | 25 | } |
26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return $this->content["field"]; |
29 | 29 | } |
30 | 30 | |
31 | - public function setName($name){ |
|
32 | - $this->getDataField()->setProperty("name",$name); |
|
31 | + public function setName($name) { |
|
32 | + $this->getDataField()->setProperty("name", $name); |
|
33 | 33 | } |
34 | 34 | } |
@@ -13,27 +13,27 @@ discard block |
||
13 | 13 | * @author jc |
14 | 14 | * |
15 | 15 | */ |
16 | -trait FormTrait{ |
|
16 | +trait FormTrait { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @return HtmlForm |
20 | 20 | */ |
21 | 21 | abstract protected function getForm(); |
22 | 22 | |
23 | - protected function addCompoValidation($compo,$field){ |
|
23 | + protected function addCompoValidation($compo, $field) { |
|
24 | 24 | $validation=$field->getValidation(); |
25 | - if(isset($validation)){ |
|
25 | + if (isset($validation)) { |
|
26 | 26 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
27 | 27 | $compo->addFieldValidation($validation); |
28 | 28 | } |
29 | 29 | return $compo; |
30 | 30 | } |
31 | 31 | |
32 | - protected function _runValidationParams(&$compo,JsUtils $js=NULL){ |
|
32 | + protected function _runValidationParams(&$compo, JsUtils $js=NULL) { |
|
33 | 33 | $form=$this->getForm(); |
34 | 34 | $params=$form->getValidationParams(); |
35 | - if(isset($params["_ajaxSubmit"])){ |
|
36 | - $compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js); |
|
35 | + if (isset($params["_ajaxSubmit"])) { |
|
36 | + $compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js); |
|
37 | 37 | $this->onSuccess($compilation); |
38 | 38 | $form->removeValidationParam("_ajaxSubmit"); |
39 | 39 | } |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | $form->addEventsOnRun($js); |
43 | 43 | } |
44 | 44 | |
45 | - protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){ |
|
45 | + protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) { |
|
46 | 46 | $compilation=""; |
47 | - if(\is_array($ajaxSubmit)){ |
|
48 | - foreach ($ajaxSubmit as $ajaxSubmitItem){ |
|
47 | + if (\is_array($ajaxSubmit)) { |
|
48 | + foreach ($ajaxSubmit as $ajaxSubmitItem) { |
|
49 | 49 | $compilation.=$ajaxSubmitItem->compile($js); |
50 | 50 | } |
51 | - }elseif($ajaxSubmit instanceof AjaxCall){ |
|
51 | + }elseif ($ajaxSubmit instanceof AjaxCall) { |
|
52 | 52 | $compilation=$ajaxSubmit->compile($js); |
53 | 53 | } |
54 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
54 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
55 | 55 | return $compilation; |
56 | 56 | } |
57 | 57 | |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | return $this; |
65 | 65 | } |
66 | 66 | |
67 | - public function setAttached($value=true){ |
|
67 | + public function setAttached($value=true) { |
|
68 | 68 | $form=$this->getForm(); |
69 | - if($value) |
|
70 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
69 | + if ($value) |
|
70 | + $form->addToPropertyCtrl("class", "attached", array("attached")); |
|
71 | 71 | return $form; |
72 | 72 | } |
73 | 73 | |
74 | - public function addErrorMessage(){ |
|
74 | + public function addErrorMessage() { |
|
75 | 75 | return $this->getForm()->addContent((new HtmlMessage(""))->setError()); |
76 | 76 | } |
77 | 77 | |
@@ -87,47 +87,47 @@ discard block |
||
87 | 87 | * @param array $parameters |
88 | 88 | * @return HtmlForm |
89 | 89 | */ |
90 | - public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
|
90 | + public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) { |
|
91 | 91 | $form=$this->getForm(); |
92 | - if($identifierOrElement instanceof BaseHtml) |
|
92 | + if ($identifierOrElement instanceof BaseHtml) |
|
93 | 93 | $elem=$identifierOrElement; |
94 | 94 | else |
95 | 95 | $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
96 | - if(isset($elem)){ |
|
97 | - $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
|
96 | + if (isset($elem)) { |
|
97 | + $this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters); |
|
98 | 98 | } |
99 | 99 | return $form; |
100 | 100 | } |
101 | 101 | |
102 | - public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){ |
|
103 | - return $this->submitOn("click", $identifier, $url, $responseElement,$parameters); |
|
102 | + public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) { |
|
103 | + return $this->submitOn("click", $identifier, $url, $responseElement, $parameters); |
|
104 | 104 | } |
105 | 105 | |
106 | - public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
107 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
108 | - return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters); |
|
106 | + public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
107 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
108 | + return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters); |
|
109 | 109 | } |
110 | 110 | |
111 | - protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){ |
|
111 | + protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) { |
|
112 | 112 | $form=$this->getForm(); |
113 | - if(isset($url) && isset($responseElement)){ |
|
114 | - $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
|
115 | - $this->setSubmitParams($url,$responseElement,$parameters); |
|
113 | + if (isset($url) && isset($responseElement)) { |
|
114 | + $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true); |
|
115 | + $this->setSubmitParams($url, $responseElement, $parameters); |
|
116 | 116 | } |
117 | 117 | return $button; |
118 | 118 | } |
119 | 119 | |
120 | - public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){ |
|
120 | + public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) { |
|
121 | 121 | $form=$this->getForm(); |
122 | - $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
|
123 | - if(\is_array($parameters)) |
|
124 | - $params=\array_merge($params,$parameters); |
|
122 | + $params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true]; |
|
123 | + if (\is_array($parameters)) |
|
124 | + $params=\array_merge($params, $parameters); |
|
125 | 125 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
126 | 126 | return $this; |
127 | 127 | } |
128 | 128 | |
129 | - public function addReset($identifier,$value,$cssStyle=NULL){ |
|
130 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
129 | + public function addReset($identifier, $value, $cssStyle=NULL) { |
|
130 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
131 | 131 | $bt->setProperty("type", "reset"); |
132 | 132 | return $bt; |
133 | 133 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param string $jsCode |
138 | 138 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
139 | 139 | */ |
140 | - public function onValid($jsCode){ |
|
140 | + public function onValid($jsCode) { |
|
141 | 141 | $form=$this->getForm(); |
142 | 142 | $form->addValidationParam("onValid", "%function(){".$jsCode."}%"); |
143 | 143 | return $form; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param string $jsCode can use event and fields parameters |
149 | 149 | * @return HtmlForm |
150 | 150 | */ |
151 | - public function onSuccess($jsCode){ |
|
151 | + public function onSuccess($jsCode) { |
|
152 | 152 | $form=$this->getForm(); |
153 | - $form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%"); |
|
153 | + $form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%"); |
|
154 | 154 | return $form; |
155 | 155 | } |
156 | 156 | } |