@@ -8,16 +8,16 @@ |
||
| 8 | 8 | class HtmlFormInput extends HtmlFormField { |
| 9 | 9 | use TextFieldsTrait; |
| 10 | 10 | |
| 11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 12 | - if(!isset($placeholder) && $type==="text") |
|
| 11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 12 | + if (!isset($placeholder) && $type==="text") |
|
| 13 | 13 | $placeholder=$label; |
| 14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
| 14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
| 15 | 15 | $this->_identifier=$identifier; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function getDataField(){ |
|
| 19 | - $field= $this->getField(); |
|
| 20 | - if($field instanceof HtmlInput) |
|
| 18 | + public function getDataField() { |
|
| 19 | + $field=$this->getField(); |
|
| 20 | + if ($field instanceof HtmlInput) |
|
| 21 | 21 | $field=$field->getDataField(); |
| 22 | 22 | return $field; |
| 23 | 23 | } |
@@ -15,113 +15,113 @@ discard block |
||
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | 17 | public function __construct($identifier, $header="", $content="", $actions=null) { |
| 18 | - parent::__construct($identifier, "div","ui modal"); |
|
| 19 | - if(isset($header)){ |
|
| 18 | + parent::__construct($identifier, "div", "ui modal"); |
|
| 19 | + if (isset($header)) { |
|
| 20 | 20 | $this->setHeader($header); |
| 21 | 21 | } |
| 22 | - if(isset($content)){ |
|
| 22 | + if (isset($content)) { |
|
| 23 | 23 | $this->setContent($content); |
| 24 | 24 | } |
| 25 | - if(isset($actions)){ |
|
| 25 | + if (isset($actions)) { |
|
| 26 | 26 | $this->setActions($actions); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setHeader($value) { |
| 31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
| 31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function setContent($value) { |
| 36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
| 36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setActions($actions) { |
| 41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
| 42 | - if(\is_array($actions)){ |
|
| 43 | - foreach ($actions as $action){ |
|
| 41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
| 42 | + if (\is_array($actions)) { |
|
| 43 | + foreach ($actions as $action) { |
|
| 44 | 44 | $this->addAction($action); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - else{ |
|
| 47 | + else { |
|
| 48 | 48 | $this->addAction($actions); |
| 49 | 49 | } |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function addAction($action){ |
|
| 54 | - if(!$action instanceof BaseHtml){ |
|
| 53 | + public function addAction($action) { |
|
| 54 | + if (!$action instanceof BaseHtml) { |
|
| 55 | 55 | $class=""; |
| 56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
| 56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
| 57 | 57 | $class="approve"; |
| 58 | 58 | } |
| 59 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
| 59 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
| 60 | 60 | $class="cancel"; |
| 61 | 61 | } |
| 62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
| 63 | - if($class!=="") |
|
| 62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
| 63 | + if ($class!=="") |
|
| 64 | 64 | $action->addToProperty("class", $class); |
| 65 | 65 | } |
| 66 | 66 | return $this->addElementInPart($action, "actions"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function addContent($content,$before=false){ |
|
| 70 | - $this->content["content"]->addContent($content,$before); |
|
| 69 | + public function addContent($content, $before=false) { |
|
| 70 | + $this->content["content"]->addContent($content, $before); |
|
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function addImageContent($image,$description=NULL){ |
|
| 74 | + public function addImageContent($image, $description=NULL) { |
|
| 75 | 75 | $content=$this->content["content"]; |
| 76 | - if(isset($description)){ |
|
| 77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 78 | - $content->addContent($description,true); |
|
| 76 | + if (isset($description)) { |
|
| 77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 78 | + $content->addContent($description, true); |
|
| 79 | 79 | } |
| 80 | - if($image!==""){ |
|
| 81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 82 | - $content->addContent($img,true); |
|
| 83 | - $content->addToProperty("class","image"); |
|
| 80 | + if ($image!=="") { |
|
| 81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 82 | + $content->addContent($img, true); |
|
| 83 | + $content->addToProperty("class", "image"); |
|
| 84 | 84 | } |
| 85 | 85 | return $this; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function addIconContent($icon,$description=NULL){ |
|
| 88 | + public function addIconContent($icon, $description=NULL) { |
|
| 89 | 89 | $content=$this->content["content"]; |
| 90 | - if(isset($description)){ |
|
| 91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 92 | - $content->addContent($description,true); |
|
| 90 | + if (isset($description)) { |
|
| 91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 92 | + $content->addContent($description, true); |
|
| 93 | 93 | } |
| 94 | - if($icon!==""){ |
|
| 95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 96 | - $content->addContent($img,true); |
|
| 97 | - $content->addToProperty("class","image"); |
|
| 94 | + if ($icon!=="") { |
|
| 95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 96 | + $content->addContent($img, true); |
|
| 97 | + $content->addToProperty("class", "image"); |
|
| 98 | 98 | } |
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - private function addElementInPart($element,$part) { |
|
| 102 | + private function addElementInPart($element, $part) { |
|
| 103 | 103 | $this->content[$part]->addContent($element); |
| 104 | 104 | return $element; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function showDimmer($value){ |
|
| 108 | - $value=$value?"show":"hide"; |
|
| 107 | + public function showDimmer($value) { |
|
| 108 | + $value=$value ? "show" : "hide"; |
|
| 109 | 109 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 110 | 110 | return $this; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function setInverted($recursive=true){ |
|
| 113 | + public function setInverted($recursive=true) { |
|
| 114 | 114 | $this->_params["inverted"]=true; |
| 115 | 115 | return $this; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function setBasic(){ |
|
| 118 | + public function setBasic() { |
|
| 119 | 119 | return $this->addToProperty("class", "basic"); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | - public function setTransition($value){ |
|
| 124 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 123 | + public function setTransition($value) { |
|
| 124 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | * @param string $viewName |
| 132 | 132 | * @param $params The parameters to pass to the view |
| 133 | 133 | */ |
| 134 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 135 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 134 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 135 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @param string $actionName the action name |
| 144 | 144 | * @param array $params |
| 145 | 145 | */ |
| 146 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 147 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 146 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 147 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 155 | 155 | */ |
| 156 | 156 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 157 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 157 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 158 | 158 | return parent::compile($js, $view); |
| 159 | 159 | } |
| 160 | 160 | /* |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | * @see BaseHtml::run() |
| 163 | 163 | */ |
| 164 | 164 | public function run(JsUtils $js) { |
| 165 | - if(isset($this->_bsComponent)===false) |
|
| 166 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 165 | + if (isset($this->_bsComponent)===false) |
|
| 166 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 167 | 167 | $this->addEventsOnRun($js); |
| 168 | 168 | return $this->_bsComponent; |
| 169 | 169 | } |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 43 | 43 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 44 | 44 | */ |
| 45 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 46 | - parent::__construct($identifier,"ol"); |
|
| 45 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 46 | + parent::__construct($identifier, "ol"); |
|
| 47 | 47 | $this->startIndex=$startIndex; |
| 48 | 48 | $this->setProperty("class", "breadcrumb"); |
| 49 | 49 | $this->content=array(); |
| 50 | 50 | $this->autoActive=$autoActive; |
| 51 | 51 | $this->absolutePaths; |
| 52 | - $this->_hrefFunction=function (HtmlDoubleElement $e){return $e->getContent();}; |
|
| 53 | - if(isset($hrefFunction)){ |
|
| 52 | + $this->_hrefFunction=function(HtmlDoubleElement $e) {return $e->getContent(); }; |
|
| 53 | + if (isset($hrefFunction)) { |
|
| 54 | 54 | $this->_hrefFunction=$hrefFunction; |
| 55 | 55 | } |
| 56 | 56 | $this->addElements($elements); |
@@ -61,43 +61,43 @@ discard block |
||
| 61 | 61 | * @param string $href |
| 62 | 62 | * @return \Ajax\bootstrap\html\HtmlLink |
| 63 | 63 | */ |
| 64 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 64 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 65 | 65 | $size=sizeof($this->content); |
| 66 | - if(\is_array($element)){ |
|
| 66 | + if (\is_array($element)) { |
|
| 67 | 67 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 68 | 68 | $elm->fromArray($element); |
| 69 | - }else if($element instanceof HtmlLink){ |
|
| 69 | + } else if ($element instanceof HtmlLink) { |
|
| 70 | 70 | $elm=$element; |
| 71 | - }else{ |
|
| 72 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 73 | - if(isset($glyph)){ |
|
| 71 | + } else { |
|
| 72 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 73 | + if (isset($glyph)) { |
|
| 74 | 74 | $elm->wrapContentWithGlyph($glyph); |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | - $elm->wrap("<li>","</li>"); |
|
| 77 | + $elm->wrap("<li>", "</li>"); |
|
| 78 | 78 | $this->content[]=$elm; |
| 79 | 79 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 80 | 80 | return $elm; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function setActive($index=null){ |
|
| 84 | - if(!isset($index)){ |
|
| 83 | + public function setActive($index=null) { |
|
| 84 | + if (!isset($index)) { |
|
| 85 | 85 | $index=sizeof($this->content)-1; |
| 86 | 86 | } |
| 87 | - $li=new HtmlBsDoubleElement("","li"); |
|
| 87 | + $li=new HtmlBsDoubleElement("", "li"); |
|
| 88 | 88 | $li->setClass("active"); |
| 89 | 89 | $li->setContent($this->content[$index]->getContent()); |
| 90 | 90 | $this->content[$index]=$li; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function addElements($elements){ |
|
| 94 | - foreach ( $elements as $element ) { |
|
| 93 | + public function addElements($elements) { |
|
| 94 | + foreach ($elements as $element) { |
|
| 95 | 95 | $this->addElement($element); |
| 96 | 96 | } |
| 97 | 97 | return $this; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function fromArray($array){ |
|
| 100 | + public function fromArray($array) { |
|
| 101 | 101 | $array=parent::fromArray($array); |
| 102 | 102 | $this->addElements($array); |
| 103 | 103 | return $array; |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | * @param string $separator |
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | - public function getHref($index=null,$separator="/"){ |
|
| 113 | - if(!isset($index)){ |
|
| 112 | + public function getHref($index=null, $separator="/") { |
|
| 113 | + if (!isset($index)) { |
|
| 114 | 114 | $index=sizeof($this->content); |
| 115 | 115 | } |
| 116 | - if($this->absolutePaths===true){ |
|
| 116 | + if ($this->absolutePaths===true) { |
|
| 117 | 117 | return $this->_hrefFunction($this->content[$index]); |
| 118 | - }else{ |
|
| 119 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 118 | + } else { |
|
| 119 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 126 | 126 | */ |
| 127 | 127 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 128 | - if($this->autoActive){ |
|
| 128 | + if ($this->autoActive) { |
|
| 129 | 129 | $this->setActive(); |
| 130 | 130 | } |
| 131 | 131 | return parent::compile($js, $view); |
@@ -143,19 +143,19 @@ discard block |
||
| 143 | 143 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 144 | 144 | */ |
| 145 | 145 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 146 | - foreach ($this->content as $element){ |
|
| 147 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 146 | + foreach ($this->content as $element) { |
|
| 147 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 148 | 148 | } |
| 149 | 149 | return $this; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public function setAutoActive($autoActive) { |
| 153 | - $this->autoActive = $autoActive; |
|
| 153 | + $this->autoActive=$autoActive; |
|
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 158 | - foreach ($this->content as $element){ |
|
| 158 | + foreach ($this->content as $element) { |
|
| 159 | 159 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 160 | 160 | } |
| 161 | 161 | return $this; |
@@ -167,18 +167,18 @@ discard block |
||
| 167 | 167 | * @param string $targetSelector the target of the get |
| 168 | 168 | * @return HtmlBreadcrumbs |
| 169 | 169 | */ |
| 170 | - public function autoGetOnClick($targetSelector){ |
|
| 171 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 170 | + public function autoGetOnClick($targetSelector) { |
|
| 171 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function contentAsString(){ |
|
| 175 | - if($this->autoActive){ |
|
| 174 | + public function contentAsString() { |
|
| 175 | + if ($this->autoActive) { |
|
| 176 | 176 | $this->setActive(); |
| 177 | 177 | } |
| 178 | 178 | return parent::contentAsString(); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function getElement($index){ |
|
| 181 | + public function getElement($index) { |
|
| 182 | 182 | return $this->content[$index]; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param mixed $glyph |
| 188 | 188 | * @param int $index |
| 189 | 189 | */ |
| 190 | - public function addGlyph($glyph,$index=0){ |
|
| 190 | + public function addGlyph($glyph, $index=0) { |
|
| 191 | 191 | $elm=$this->getElement($index); |
| 192 | 192 | return $elm->wrapContentWithGlyph($glyph); |
| 193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @param Dispatcher $dispatcher the request dispatcher |
| 199 | 199 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 200 | 200 | */ |
| 201 | - public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){ |
|
| 201 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 202 | 202 | $this->startIndex=$startIndex; |
| 203 | 203 | return $this->addElements($js->fromDispatcher($dispatcher)); |
| 204 | 204 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 211 | 211 | */ |
| 212 | 212 | public function setHrefFunction($_hrefFunction) { |
| 213 | - $this->_hrefFunction = $_hrefFunction; |
|
| 213 | + $this->_hrefFunction=$_hrefFunction; |
|
| 214 | 214 | return $this; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * @return $this |
| 51 | 51 | */ |
| 52 | 52 | public function setSource($source) { |
| 53 | - $source=str_ireplace(array ( |
|
| 53 | + $source=str_ireplace(array( |
|
| 54 | 54 | "\"", |
| 55 | 55 | "'" |
| 56 | 56 | ), "%quote%", $source); |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | return $this; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function showDimmer(){ |
|
| 19 | + public function showDimmer() { |
|
| 20 | 20 | return $this->setBehavior("hide dimmer"); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setInverted(){ |
|
| 23 | + public function setInverted() { |
|
| 24 | 24 | $this->params["inverted"]=true; |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -20,19 +20,19 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function __construct($identifier) { |
| 22 | 22 | parent::__construct($identifier, "tr", ""); |
| 23 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
| 23 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function setColCount($colCount) { |
| 27 | 27 | $count=$this->count(); |
| 28 | - for($i=$count; $i < $colCount; $i++) { |
|
| 28 | + for ($i=$count; $i<$colCount; $i++) { |
|
| 29 | 29 | $item=$this->addItem(NULL); |
| 30 | 30 | $item->setTagName($this->_tdTagName); |
| 31 | 31 | } |
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function getColCount(){ |
|
| 35 | + public function getColCount() { |
|
| 36 | 36 | return $this->count(); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param mixed $values |
| 69 | 69 | */ |
| 70 | 70 | public function setValues($values=array()) { |
| 71 | - return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);}); |
|
| 71 | + return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {$cell->setValue($value); }); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -76,27 +76,27 @@ discard block |
||
| 76 | 76 | * @param mixed $values |
| 77 | 77 | */ |
| 78 | 78 | public function addValues($values=array()) { |
| 79 | - return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->addValue($value);}); |
|
| 79 | + return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {$cell->addValue($value); }); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Sets or adds values to the row cols |
| 84 | 84 | * @param mixed $values |
| 85 | 85 | */ |
| 86 | - protected function _addOrSetValues($values,$callback) { |
|
| 86 | + protected function _addOrSetValues($values, $callback) { |
|
| 87 | 87 | $count=$this->count(); |
| 88 | 88 | if (!\is_array($values)) { |
| 89 | 89 | $values=\array_fill(0, $count, $values); |
| 90 | 90 | } else { |
| 91 | - if (JArray::isAssociative($values) === true) { |
|
| 91 | + if (JArray::isAssociative($values)===true) { |
|
| 92 | 92 | $values=\array_values($values); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | $count=\min(\sizeof($values), $count); |
| 96 | 96 | |
| 97 | - for($i=0; $i < $count; $i++) { |
|
| 97 | + for ($i=0; $i<$count; $i++) { |
|
| 98 | 98 | $cell=$this->content[$i]; |
| 99 | - $callback($cell,$values[$i]); |
|
| 99 | + $callback($cell, $values[$i]); |
|
| 100 | 100 | } |
| 101 | 101 | return $this; |
| 102 | 102 | } |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | public function getColPosition($colIndex) { |
| 123 | 123 | $pos=0; |
| 124 | 124 | $rows=$this->_container->getContent(); |
| 125 | - for($i=0; $i < $this->_row; $i++) { |
|
| 125 | + for ($i=0; $i<$this->_row; $i++) { |
|
| 126 | 126 | $max=\min($colIndex, $rows[$i]->count()); |
| 127 | - for($j=0; $j < $max; $j++) { |
|
| 127 | + for ($j=0; $j<$max; $j++) { |
|
| 128 | 128 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
| 129 | - if ($rowspan + $i > $this->_row) |
|
| 129 | + if ($rowspan+$i>$this->_row) |
|
| 130 | 130 | $pos++; |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | - if ($pos > $colIndex) |
|
| 133 | + if ($pos>$colIndex) |
|
| 134 | 134 | return NULL; |
| 135 | 135 | $count=$this->count(); |
| 136 | - for($i=0; $i < $count; $i++) { |
|
| 136 | + for ($i=0; $i<$count; $i++) { |
|
| 137 | 137 | $pos+=$this->content[$i]->getColspan(); |
| 138 | - if ($pos >= $colIndex + 1) |
|
| 138 | + if ($pos>=$colIndex+1) |
|
| 139 | 139 | return $i; |
| 140 | 140 | } |
| 141 | 141 | return null; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | public function conditionalCellFormat($callback, $format) { |
| 145 | 145 | $cells=$this->content; |
| 146 | - foreach ( $cells as $cell ) { |
|
| 146 | + foreach ($cells as $cell) { |
|
| 147 | 147 | $cell->conditionalCellFormat($callback, $format); |
| 148 | 148 | } |
| 149 | 149 | return $this; |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | public function containsStr($needle) { |
| 160 | 160 | $cells=$this->content; |
| 161 | - foreach ( $cells as $cell ) { |
|
| 162 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
| 161 | + foreach ($cells as $cell) { |
|
| 162 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
| 163 | 163 | return true; |
| 164 | 164 | } |
| 165 | 165 | return false; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | public function applyCells($callback) { |
| 174 | 174 | $cells=$this->content; |
| 175 | - foreach ( $cells as $cell ) { |
|
| 175 | + foreach ($cells as $cell) { |
|
| 176 | 176 | $cell->apply($callback); |
| 177 | 177 | } |
| 178 | 178 | return $this; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | 13 | class HtmlTableContent extends HtmlSemCollection { |
| 14 | - protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ]; |
|
| 14 | + protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function setRowCount($rowCount, $colCount) { |
| 36 | 36 | $count=$this->count(); |
| 37 | - for($i=$count; $i < $rowCount; $i++) { |
|
| 37 | + for ($i=$count; $i<$rowCount; $i++) { |
|
| 38 | 38 | $this->addItem($colCount); |
| 39 | 39 | } |
| 40 | 40 | return $this; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $tr=new HtmlTR("", $value); |
| 57 | 57 | $tr->setContainer($this, $count); |
| 58 | 58 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
| 59 | - if (isset($value) === true) { |
|
| 59 | + if (isset($value)===true) { |
|
| 60 | 60 | $tr->setColCount($value); |
| 61 | 61 | } |
| 62 | 62 | return $tr; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function setCellValue($row, $col, $value="") { |
| 116 | 116 | $cell=$this->getCell($row, $col); |
| 117 | - if (isset($cell) === true) { |
|
| 117 | + if (isset($cell)===true) { |
|
| 118 | 118 | $cell->setValue($value); |
| 119 | 119 | } |
| 120 | 120 | return $this; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param mixed $values |
| 126 | 126 | */ |
| 127 | 127 | public function setValues($values=array()) { |
| 128 | - return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);}); |
|
| 128 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->setValues($_values); }); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @param mixed $values |
| 134 | 134 | */ |
| 135 | 135 | public function addValues($values=array()) { |
| 136 | - return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);}); |
|
| 136 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->addValues($_values); }); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -141,21 +141,21 @@ discard block |
||
| 141 | 141 | * @param mixed $values |
| 142 | 142 | * @param callable $callback |
| 143 | 143 | */ |
| 144 | - protected function _addOrSetValues($values,$callback) { |
|
| 144 | + protected function _addOrSetValues($values, $callback) { |
|
| 145 | 145 | $count=$this->count(); |
| 146 | 146 | $isArray=true; |
| 147 | 147 | if (!\is_array($values)) { |
| 148 | 148 | $values=\array_fill(0, $count, $values); |
| 149 | 149 | $isArray=false; |
| 150 | 150 | } |
| 151 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 152 | - $values=[ $values ]; |
|
| 151 | + if (JArray::dimension($values)==1 && $isArray) |
|
| 152 | + $values=[$values]; |
|
| 153 | 153 | |
| 154 | 154 | $count=\min(\sizeof($values), $count); |
| 155 | 155 | |
| 156 | - for($i=0; $i < $count; $i++) { |
|
| 156 | + for ($i=0; $i<$count; $i++) { |
|
| 157 | 157 | $row=$this->content[$i]; |
| 158 | - $callback($row,$values[$i]); |
|
| 158 | + $callback($row, $values[$i]); |
|
| 159 | 159 | } |
| 160 | 160 | return $this; |
| 161 | 161 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $values=\array_fill(0, $count, $values); |
| 167 | 167 | } |
| 168 | 168 | $count=\min(\sizeof($values), $count); |
| 169 | - for($i=0; $i < $count; $i++) { |
|
| 169 | + for ($i=0; $i<$count; $i++) { |
|
| 170 | 170 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
| 171 | 171 | } |
| 172 | 172 | return $this; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | public function addColVariations($colIndex, $variations=array()) { |
| 176 | 176 | $count=$this->count(); |
| 177 | - for($i=0; $i < $count; $i++) { |
|
| 177 | + for ($i=0; $i<$count; $i++) { |
|
| 178 | 178 | $this->getCell($i, $colIndex)->addVariations($variations); |
| 179 | 179 | } |
| 180 | 180 | return $this; |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | private function colAlign($colIndex, $function) { |
| 193 | 193 | $count=$this->count(); |
| 194 | - for($i=0; $i < $count; $i++) { |
|
| 194 | + for ($i=0; $i<$count; $i++) { |
|
| 195 | 195 | $index=$this->content[$i]->getColPosition($colIndex); |
| 196 | - if ($index !== NULL) |
|
| 196 | + if ($index!==NULL) |
|
| 197 | 197 | $this->getCell($i, $index)->$function(); |
| 198 | 198 | } |
| 199 | 199 | return $this; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function getColCount() { |
| 227 | 227 | $result=0; |
| 228 | - if ($this->count() > 0) |
|
| 228 | + if ($this->count()>0) |
|
| 229 | 229 | $result=$this->getItem(0)->count(); |
| 230 | 230 | return $result; |
| 231 | 231 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | public function delete($rowIndex, $colIndex=NULL) { |
| 240 | 240 | if (isset($colIndex)) { |
| 241 | 241 | $row=$this->getItem($rowIndex); |
| 242 | - if (isset($row) === true) { |
|
| 242 | + if (isset($row)===true) { |
|
| 243 | 243 | $row->delete($colIndex); |
| 244 | 244 | } |
| 245 | 245 | } else { |
@@ -272,17 +272,17 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function conditionalCellFormat($callback, $format) { |
| 274 | 274 | $rows=$this->content; |
| 275 | - foreach ( $rows as $row ) { |
|
| 275 | + foreach ($rows as $row) { |
|
| 276 | 276 | $row->conditionalCellFormat($callback, $format); |
| 277 | 277 | } |
| 278 | 278 | return $this; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - public function conditionalColFormat($colIndex,$callback,$format){ |
|
| 281 | + public function conditionalColFormat($colIndex, $callback, $format) { |
|
| 282 | 282 | $rows=$this->content; |
| 283 | - foreach ( $rows as $row ) { |
|
| 283 | + foreach ($rows as $row) { |
|
| 284 | 284 | $cell=$row->getItem($colIndex); |
| 285 | - $cell->conditionnalCellFormat($callback,$format); |
|
| 285 | + $cell->conditionnalCellFormat($callback, $format); |
|
| 286 | 286 | } |
| 287 | 287 | return $this; |
| 288 | 288 | } |
@@ -294,17 +294,17 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function conditionalRowFormat($callback, $format) { |
| 296 | 296 | $rows=$this->content; |
| 297 | - foreach ( $rows as $row ) { |
|
| 297 | + foreach ($rows as $row) { |
|
| 298 | 298 | $row->conditionalRowFormat($callback, $format); |
| 299 | 299 | } |
| 300 | 300 | return $this; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - public function hideColumn($colIndex){ |
|
| 303 | + public function hideColumn($colIndex) { |
|
| 304 | 304 | $rows=$this->content; |
| 305 | - foreach ( $rows as $row ) { |
|
| 305 | + foreach ($rows as $row) { |
|
| 306 | 306 | $cell=$row->getItem($colIndex); |
| 307 | - $cell->addToProperty("style","display:none;"); |
|
| 307 | + $cell->addToProperty("style", "display:none;"); |
|
| 308 | 308 | } |
| 309 | 309 | return $this; |
| 310 | 310 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | public function applyCells($callback) { |
| 317 | 317 | $rows=$this->content; |
| 318 | - foreach ( $rows as $row ) { |
|
| 318 | + foreach ($rows as $row) { |
|
| 319 | 319 | $row->applyCells($callback); |
| 320 | 320 | } |
| 321 | 321 | return $this; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | public function applyRows($callback) { |
| 329 | 329 | $rows=$this->content; |
| 330 | - foreach ( $rows as $row ) { |
|
| 330 | + foreach ($rows as $row) { |
|
| 331 | 331 | $row->apply($callback); |
| 332 | 332 | } |
| 333 | 333 | return $this; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->startIndex=$startIndex; |
| 53 | 53 | $this->autoActive=$autoActive; |
| 54 | 54 | $this->_contentSeparator="<div class='divider'> / </div>"; |
| 55 | - $this->_hrefFunction=function (HtmlSemDoubleElement $e) { |
|
| 55 | + $this->_hrefFunction=function(HtmlSemDoubleElement $e) { |
|
| 56 | 56 | return $e->getContent(); |
| 57 | 57 | }; |
| 58 | 58 | 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() { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function setActive($index=null) { |
| 85 | 85 | if (!isset($index)) { |
| 86 | - $index=sizeof($this->content) - 1; |
|
| 86 | + $index=sizeof($this->content)-1; |
|
| 87 | 87 | } |
| 88 | 88 | $activeItem=$this->content[$index]; |
| 89 | 89 | $activeItem->addToProperty("class", "active"); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param Dispatcher $dispatcher the request dispatcher |
| 97 | 97 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 98 | 98 | */ |
| 99 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
| 99 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 100 | 100 | return $this->addItems($js->fromDispatcher($dispatcher)); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | if (!isset($index)) { |
| 111 | 111 | $index=sizeof($this->content); |
| 112 | 112 | } |
| 113 | - if ($this->absolutePaths === true) { |
|
| 113 | + if ($this->absolutePaths===true) { |
|
| 114 | 114 | return $this->_hrefFunction($this->content[$index]); |
| 115 | 115 | } else { |
| 116 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
| 116 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
| 117 | 117 | return $this->_hrefFunction($e); |
| 118 | - }, $this->content), $this->startIndex, $index + 1)); |
|
| 118 | + }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | $this->setActive(); |
| 150 | 150 | } |
| 151 | 151 | $count=$this->count(); |
| 152 | - for($i=1; $i < $count; $i++) { |
|
| 153 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
| 152 | + for ($i=1; $i<$count; $i++) { |
|
| 153 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
| 154 | 154 | } |
| 155 | 155 | return parent::compile($js, $view); |
| 156 | 156 | } |
@@ -160,15 +160,15 @@ discard block |
||
| 160 | 160 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 161 | 161 | */ |
| 162 | 162 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 163 | - foreach ( $this->content as $element ) { |
|
| 163 | + foreach ($this->content as $element) { |
|
| 164 | 164 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 165 | 165 | } |
| 166 | 166 | return $this; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 170 | - foreach ( $this->content as $element ) { |
|
| 171 | - if ($element->getProperty($this->attr) != NULL){ |
|
| 170 | + foreach ($this->content as $element) { |
|
| 171 | + if ($element->getProperty($this->attr)!=NULL) { |
|
| 172 | 172 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | protected function createItem($value) { |
| 185 | 185 | $count=$this->count(); |
| 186 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
| 186 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
| 187 | 187 | if (\is_array($value)) |
| 188 | 188 | $itemO->fromArray($value); |
| 189 | 189 | else { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | public function addIconAt($icon, $index) { |
| 196 | 196 | $item=$this->getItem($index); |
| 197 | 197 | if (isset($item)) { |
| 198 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 198 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 199 | 199 | $item->wrapContent($icon); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | public function addItem($item) { |
| 204 | 204 | $count=$this->count(); |
| 205 | 205 | $itemO=parent::addItem($item); |
| 206 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
| 206 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
| 207 | 207 | $itemO->setProperty($this->attr, $this->getHref($count)); |
| 208 | 208 | return $itemO; |
| 209 | 209 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function setAbsolutePaths($absolutePaths) { |
| 220 | 220 | $this->absolutePaths=$absolutePaths; |
| 221 | 221 | $size=\sizeof($this->content); |
| 222 | - for($i=0;$i<$size;$i++){ |
|
| 222 | + for ($i=0; $i<$size; $i++) { |
|
| 223 | 223 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
| 224 | 224 | } |
| 225 | 225 | return $this; |
@@ -14,27 +14,27 @@ discard block |
||
| 14 | 14 | * @author jc |
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | -trait FormTrait{ |
|
| 17 | +trait FormTrait { |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @return HtmlForm |
| 21 | 21 | */ |
| 22 | 22 | abstract protected function getForm(); |
| 23 | 23 | |
| 24 | - protected function addCompoValidation(Form $compo,HtmlFormField $field){ |
|
| 24 | + protected function addCompoValidation(Form $compo, HtmlFormField $field) { |
|
| 25 | 25 | $validation=$field->getValidation(); |
| 26 | - if(isset($validation)){ |
|
| 26 | + if (isset($validation)) { |
|
| 27 | 27 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
| 28 | 28 | $compo->addFieldValidation($validation); |
| 29 | 29 | } |
| 30 | 30 | return $compo; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - protected function _runValidationParams(Form &$compo,JsUtils $js=NULL){ |
|
| 33 | + protected function _runValidationParams(Form&$compo, JsUtils $js=NULL) { |
|
| 34 | 34 | $form=$this->getForm(); |
| 35 | 35 | $params=$form->getValidationParams(); |
| 36 | - if(isset($params["_ajaxSubmit"])){ |
|
| 37 | - $compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js); |
|
| 36 | + if (isset($params["_ajaxSubmit"])) { |
|
| 37 | + $compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js); |
|
| 38 | 38 | $this->onSuccess($compilation); |
| 39 | 39 | $form->removeValidationParam("_ajaxSubmit"); |
| 40 | 40 | } |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | $form->addEventsOnRun($js); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){ |
|
| 46 | + protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) { |
|
| 47 | 47 | $compilation=""; |
| 48 | - if(\is_array($ajaxSubmit)){ |
|
| 49 | - foreach ($ajaxSubmit as $ajaxSubmitItem){ |
|
| 48 | + if (\is_array($ajaxSubmit)) { |
|
| 49 | + foreach ($ajaxSubmit as $ajaxSubmitItem) { |
|
| 50 | 50 | $compilation.=$ajaxSubmitItem->compile($js); |
| 51 | 51 | } |
| 52 | - }elseif($ajaxSubmit instanceof AjaxCall){ |
|
| 52 | + }elseif ($ajaxSubmit instanceof AjaxCall) { |
|
| 53 | 53 | $compilation=$ajaxSubmit->compile($js); |
| 54 | 54 | } |
| 55 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
| 55 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
| 56 | 56 | return $compilation; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function setAttached($value=true){ |
|
| 68 | + public function setAttached($value=true) { |
|
| 69 | 69 | $form=$this->getForm(); |
| 70 | - if($value) |
|
| 71 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 70 | + if ($value) |
|
| 71 | + $form->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 72 | 72 | return $form; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addErrorMessage(){ |
|
| 75 | + public function addErrorMessage() { |
|
| 76 | 76 | return $this->getForm()->addContent((new HtmlMessage(""))->setError()); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -88,47 +88,47 @@ discard block |
||
| 88 | 88 | * @param array $parameters |
| 89 | 89 | * @return HtmlForm |
| 90 | 90 | */ |
| 91 | - public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
|
| 91 | + public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) { |
|
| 92 | 92 | $form=$this->getForm(); |
| 93 | - if($identifierOrElement instanceof BaseHtml) |
|
| 93 | + if ($identifierOrElement instanceof BaseHtml) |
|
| 94 | 94 | $elem=$identifierOrElement; |
| 95 | 95 | else |
| 96 | 96 | $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
| 97 | - if(isset($elem)){ |
|
| 98 | - $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
|
| 97 | + if (isset($elem)) { |
|
| 98 | + $this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters); |
|
| 99 | 99 | } |
| 100 | 100 | return $form; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){ |
|
| 104 | - return $this->submitOn("click", $identifier, $url, $responseElement,$parameters); |
|
| 103 | + public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) { |
|
| 104 | + return $this->submitOn("click", $identifier, $url, $responseElement, $parameters); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
| 108 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
| 109 | - return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters); |
|
| 107 | + public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
| 108 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
| 109 | + return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){ |
|
| 112 | + protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) { |
|
| 113 | 113 | $form=$this->getForm(); |
| 114 | - if(isset($url) && isset($responseElement)){ |
|
| 115 | - $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
|
| 116 | - $this->setSubmitParams($url,$responseElement,$parameters); |
|
| 114 | + if (isset($url) && isset($responseElement)) { |
|
| 115 | + $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true); |
|
| 116 | + $this->setSubmitParams($url, $responseElement, $parameters); |
|
| 117 | 117 | } |
| 118 | 118 | return $button; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){ |
|
| 121 | + public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) { |
|
| 122 | 122 | $form=$this->getForm(); |
| 123 | - $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
|
| 124 | - if(\is_array($parameters)) |
|
| 125 | - $params=\array_merge($params,$parameters); |
|
| 123 | + $params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true]; |
|
| 124 | + if (\is_array($parameters)) |
|
| 125 | + $params=\array_merge($params, $parameters); |
|
| 126 | 126 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
| 127 | 127 | return $this; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function addReset($identifier,$value,$cssStyle=NULL){ |
|
| 131 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
| 130 | + public function addReset($identifier, $value, $cssStyle=NULL) { |
|
| 131 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
| 132 | 132 | $bt->setProperty("type", "reset"); |
| 133 | 133 | return $bt; |
| 134 | 134 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param string $jsCode |
| 139 | 139 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 140 | 140 | */ |
| 141 | - public function onValid($jsCode){ |
|
| 141 | + public function onValid($jsCode) { |
|
| 142 | 142 | $form=$this->getForm(); |
| 143 | 143 | $form->addValidationParam("onValid", "%function(){".$jsCode."}%"); |
| 144 | 144 | return $form; |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | * @param string $jsCode can use event and fields parameters |
| 150 | 150 | * @return HtmlForm |
| 151 | 151 | */ |
| 152 | - public function onSuccess($jsCode){ |
|
| 152 | + public function onSuccess($jsCode) { |
|
| 153 | 153 | $form=$this->getForm(); |
| 154 | - $form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%"); |
|
| 154 | + $form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%"); |
|
| 155 | 155 | return $form; |
| 156 | 156 | } |
| 157 | 157 | } |