@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | if(is_array($element)){ |
| 68 | 68 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 69 | 69 | $elm->fromArray($element); |
| 70 | - }else if($element instanceof HtmlLink){ |
|
| 70 | + } else if($element instanceof HtmlLink){ |
|
| 71 | 71 | $elm=$element; |
| 72 | - }else{ |
|
| 72 | + } else{ |
|
| 73 | 73 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
| 74 | 74 | if(isset($glyph)){ |
| 75 | 75 | $elm->wrapContentWithGlyph($glyph); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | if($this->absolutePaths===true){ |
| 118 | 118 | return $this->_hrefFunction($this->content[$index]); |
| 119 | - }else{ |
|
| 119 | + } else{ |
|
| 120 | 120 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),0,$index+1)); |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 42 | 42 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 43 | 43 | */ |
| 44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 45 | - parent::__construct($identifier,"ol"); |
|
| 44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 45 | + parent::__construct($identifier, "ol"); |
|
| 46 | 46 | $this->startIndex=$startIndex; |
| 47 | 47 | $this->setProperty("class", "breadcrumb"); |
| 48 | 48 | $this->content=array(); |
| 49 | 49 | $this->autoActive=$autoActive; |
| 50 | 50 | $this->absolutePaths; |
| 51 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
| 52 | - if(isset($hrefFunction)){ |
|
| 51 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
| 52 | + if (isset($hrefFunction)) { |
|
| 53 | 53 | $this->_hrefFunction=$hrefFunction; |
| 54 | 54 | } |
| 55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * @param string $href |
| 61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
| 62 | 62 | */ |
| 63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 64 | 64 | $size=sizeof($this->content); |
| 65 | - if(is_array($element)){ |
|
| 65 | + if (is_array($element)) { |
|
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + }else if ($element instanceof HtmlLink) { |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 72 | - if(isset($glyph)){ |
|
| 70 | + }else { |
|
| 71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 72 | + if (isset($glyph)) { |
|
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - $elm->wrap("<li>","</li>"); |
|
| 76 | + $elm->wrap("<li>", "</li>"); |
|
| 77 | 77 | $this->content[]=$elm; |
| 78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 79 | 79 | return $elm; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function setActive($index=null){ |
|
| 83 | - if(!isset($index)){ |
|
| 82 | + public function setActive($index=null) { |
|
| 83 | + if (!isset($index)) { |
|
| 84 | 84 | $index=sizeof($this->content)-1; |
| 85 | 85 | } |
| 86 | - $li=new HtmlBsDoubleElement("","li"); |
|
| 86 | + $li=new HtmlBsDoubleElement("", "li"); |
|
| 87 | 87 | $li->setClass("active"); |
| 88 | 88 | $li->setContent($this->content[$index]->getContent()); |
| 89 | 89 | $this->content[$index]=$li; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function addElements($elements){ |
|
| 93 | - foreach ( $elements as $element ) { |
|
| 92 | + public function addElements($elements) { |
|
| 93 | + foreach ($elements as $element) { |
|
| 94 | 94 | $this->addElement($element); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function fromArray($array){ |
|
| 99 | + public function fromArray($array) { |
|
| 100 | 100 | $array=parent::fromArray($array); |
| 101 | 101 | $this->addElements($array); |
| 102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * @param string $separator |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function getHref($index=null,$separator="/"){ |
|
| 112 | - if(!isset($index)){ |
|
| 111 | + public function getHref($index=null, $separator="/") { |
|
| 112 | + if (!isset($index)) { |
|
| 113 | 113 | $index=sizeof($this->content); |
| 114 | 114 | } |
| 115 | - if($this->absolutePaths===true){ |
|
| 115 | + if ($this->absolutePaths===true) { |
|
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 117 | + }else { |
|
| 118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 125 | 125 | */ |
| 126 | 126 | public function compile(JsUtils $js=NULL, $view=NULL) { |
| 127 | - if($this->autoActive){ |
|
| 127 | + if ($this->autoActive) { |
|
| 128 | 128 | $this->setActive(); |
| 129 | 129 | } |
| 130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 143 | 143 | */ |
| 144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 145 | - foreach ($this->content as $element){ |
|
| 146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 145 | + foreach ($this->content as $element) { |
|
| 146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 147 | 147 | } |
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function setAutoActive($autoActive) { |
| 152 | - $this->autoActive = $autoActive; |
|
| 152 | + $this->autoActive=$autoActive; |
|
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 157 | - foreach ($this->content as $element){ |
|
| 157 | + foreach ($this->content as $element) { |
|
| 158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 159 | 159 | } |
| 160 | 160 | return $this; |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | * @param string $targetSelector the target of the get |
| 167 | 167 | * @return HtmlBreadcrumbs |
| 168 | 168 | */ |
| 169 | - public function autoGetOnClick($targetSelector){ |
|
| 170 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 169 | + public function autoGetOnClick($targetSelector) { |
|
| 170 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - public function contentAsString(){ |
|
| 174 | - if($this->autoActive){ |
|
| 173 | + public function contentAsString() { |
|
| 174 | + if ($this->autoActive) { |
|
| 175 | 175 | $this->setActive(); |
| 176 | 176 | } |
| 177 | 177 | return parent::contentAsString(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function getElement($index){ |
|
| 180 | + public function getElement($index) { |
|
| 181 | 181 | return $this->content[$index]; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param mixed $glyph |
| 187 | 187 | * @param int $index |
| 188 | 188 | */ |
| 189 | - public function addGlyph($glyph,$index=0){ |
|
| 189 | + public function addGlyph($glyph, $index=0) { |
|
| 190 | 190 | $elm=$this->getElement($index); |
| 191 | 191 | return $elm->wrapContentWithGlyph($glyph); |
| 192 | 192 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param Dispatcher $dispatcher the request dispatcher |
| 198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 199 | 199 | */ |
| 200 | - public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){ |
|
| 200 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 201 | 201 | $this->startIndex=$startIndex; |
| 202 | 202 | return $this->addElements($js->fromDispatcher($dispatcher)); |
| 203 | 203 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 210 | 210 | */ |
| 211 | 211 | public function setHrefFunction($_hrefFunction) { |
| 212 | - $this->_hrefFunction = $_hrefFunction; |
|
| 212 | + $this->_hrefFunction=$_hrefFunction; |
|
| 213 | 213 | return $this; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Ajax\bootstrap\html\base\CssSize; |
| 5 | 5 | use Ajax\JsUtils; |
| 6 | - |
|
| 7 | 6 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
| 8 | 7 | |
| 9 | 8 | /** |
@@ -14,6 +14,9 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class HtmlAccordion extends HtmlBsDoubleElement { |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $identifier |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($identifier, $tagName="div") { |
| 18 | 21 | parent::__construct($identifier, $tagName); |
| 19 | 22 | $this->setClass("panel-group"); |
@@ -22,6 +25,9 @@ discard block |
||
| 22 | 25 | $this->content=array (); |
| 23 | 26 | } |
| 24 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $title |
|
| 30 | + */ |
|
| 25 | 31 | public function addPanel($title, $content) { |
| 26 | 32 | $nb=sizeof($this->content)+1; |
| 27 | 33 | $panel=new HtmlPanel("panel-".$this->identifier."-".$nb); |
@@ -40,7 +46,6 @@ discard block |
||
| 40 | 46 | /** |
| 41 | 47 | * render the content of an existing view : $controller/$action and set the response to a new panel |
| 42 | 48 | * @param string $title The panel title |
| 43 | - * @param Controller $initialController |
|
| 44 | 49 | * @param View $view |
| 45 | 50 | * @param string $controller a Phalcon controller |
| 46 | 51 | * @param string $action a Phalcon action |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $this->setClass("panel-group"); |
| 20 | 20 | $this->setRole("tablist"); |
| 21 | 21 | $this->setProperty("aria-multiselectable", "true"); |
| 22 | - $this->content=array (); |
|
| 22 | + $this->content=array(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addPanel($title, $content) { |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | * @param string $action a Phalcon action |
| 47 | 47 | * @param $params The parameters to pass to the view |
| 48 | 48 | */ |
| 49 | - public function renderContentPanel($title,JsUtils $js,$view, $controller, $action, $params=NULL) { |
|
| 50 | - return $this->addPanel($title, $initialController->jquery->renderContent($view, $controller, $action,$params)); |
|
| 49 | + public function renderContentPanel($title, JsUtils $js, $view, $controller, $action, $params=NULL) { |
|
| 50 | + return $this->addPanel($title, $initialController->jquery->renderContent($view, $controller, $action, $params)); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | * @param string $controller a Phalcon controller |
| 58 | 58 | * @param string $action a Phalcon action |
| 59 | 59 | */ |
| 60 | - public function forwardPanel($title,$initialController,$controller,$action){ |
|
| 60 | + public function forwardPanel($title, $initialController, $controller, $action) { |
|
| 61 | 61 | return $this->addPanel($title, $initialController->jquery->forward($initialController, $controller, $action)); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public function run(JsUtils $js) { |
| 65 | - foreach ( $this->content as $content ) { |
|
| 65 | + foreach ($this->content as $content) { |
|
| 66 | 66 | $content->run($js); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use Ajax\bootstrap\html\base\CssRef; |
| 8 | 8 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
| 9 | 9 | use Ajax\bootstrap\html\content\HtmlCarouselItem; |
| 10 | - |
|
| 11 | 10 | use Ajax\common\html\BaseHtml; |
| 12 | 11 | /** |
| 13 | 12 | * Composant Twitter Bootstrap Carousel |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | - |
|
| 8 | 7 | use Ajax\common\html\html5\HtmlSelect; |
| 9 | 8 | |
| 10 | 9 | class HtmlForm extends HtmlBsDoubleElement { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | - |
|
| 8 | 7 | use Ajax\bootstrap\html\base\CssRef; |
| 9 | 8 | use Ajax\service\JArray; |
| 10 | 9 | |
@@ -124,6 +124,10 @@ discard block |
||
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + /** |
|
| 128 | + * @param string $name |
|
| 129 | + * @param string[] $typeCtrl |
|
| 130 | + */ |
|
| 127 | 131 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 128 | 132 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
| 129 | 133 | return $name=$value; |
@@ -139,22 +143,35 @@ discard block |
||
| 139 | 143 | return $this; |
| 140 | 144 | } |
| 141 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $name |
|
| 148 | + */ |
|
| 142 | 149 | protected function removePropertyValue($name, $value) { |
| 143 | 150 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 144 | 151 | return $this; |
| 145 | 152 | } |
| 146 | 153 | |
| 154 | + /** |
|
| 155 | + * @param string $name |
|
| 156 | + */ |
|
| 147 | 157 | protected function removePropertyValues($name, $values) { |
| 148 | 158 | $this->removeOldValues($this->properties[$name], $values); |
| 149 | 159 | return $this; |
| 150 | 160 | } |
| 151 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $name |
|
| 164 | + */ |
|
| 152 | 165 | protected function removeProperty($name) { |
| 153 | 166 | if (\array_key_exists($name, $this->properties)) |
| 154 | 167 | unset($this->properties[$name]); |
| 155 | 168 | return $this; |
| 156 | 169 | } |
| 157 | 170 | |
| 171 | + /** |
|
| 172 | + * @param string $name |
|
| 173 | + * @param string[] $typeCtrl |
|
| 174 | + */ |
|
| 158 | 175 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 159 | 176 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
| 160 | 177 | if (is_array($typeCtrl)) { |
@@ -165,6 +182,9 @@ discard block |
||
| 165 | 182 | return $this; |
| 166 | 183 | } |
| 167 | 184 | |
| 185 | + /** |
|
| 186 | + * @param string $name |
|
| 187 | + */ |
|
| 168 | 188 | protected function addToMember(&$name, $value, $separator=" ") { |
| 169 | 189 | $name=str_ireplace($value, "", $name) . $separator . $value; |
| 170 | 190 | return $this; |
@@ -179,6 +199,9 @@ discard block |
||
| 179 | 199 | return $this->addToProperty($name, $value); |
| 180 | 200 | } |
| 181 | 201 | |
| 202 | + /** |
|
| 203 | + * @param string $name |
|
| 204 | + */ |
|
| 182 | 205 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 183 | 206 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
| 184 | 207 | } |
@@ -327,14 +350,23 @@ discard block |
||
| 327 | 350 | return $this; |
| 328 | 351 | } |
| 329 | 352 | |
| 353 | + /** |
|
| 354 | + * @param string $event |
|
| 355 | + */ |
|
| 330 | 356 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
| 331 | 357 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
| 332 | 358 | } |
| 333 | 359 | |
| 360 | + /** |
|
| 361 | + * @param string $url |
|
| 362 | + */ |
|
| 334 | 363 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
| 335 | 364 | return $this->getOn("click", $url, $responseElement, $parameters); |
| 336 | 365 | } |
| 337 | 366 | |
| 367 | + /** |
|
| 368 | + * @param string $event |
|
| 369 | + */ |
|
| 338 | 370 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 339 | 371 | $parameters["params"]=$params; |
| 340 | 372 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -344,6 +376,9 @@ discard block |
||
| 344 | 376 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
| 345 | 377 | } |
| 346 | 378 | |
| 379 | + /** |
|
| 380 | + * @param string $event |
|
| 381 | + */ |
|
| 347 | 382 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
| 348 | 383 | $parameters["form"]=$form; |
| 349 | 384 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -371,6 +406,10 @@ discard block |
||
| 371 | 406 | return null; |
| 372 | 407 | } |
| 373 | 408 | |
| 409 | + /** |
|
| 410 | + * @param string $propertyName |
|
| 411 | + * @param string $value |
|
| 412 | + */ |
|
| 374 | 413 | protected function getElementByPropertyValue($propertyName,$value, $elements) { |
| 375 | 414 | if (is_array($elements)) { |
| 376 | 415 | $flag=false; |
@@ -411,6 +450,9 @@ discard block |
||
| 411 | 450 | return $value; |
| 412 | 451 | } |
| 413 | 452 | |
| 453 | + /** |
|
| 454 | + * @param string $jqueryCall |
|
| 455 | + */ |
|
| 414 | 456 | public function jsDoJquery($jqueryCall, $param="") { |
| 415 | 457 | return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
| 416 | 458 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | abstract class BaseHtml extends BaseWidget { |
| 17 | 17 | protected $_template; |
| 18 | 18 | protected $tagName; |
| 19 | - protected $properties=array (); |
|
| 20 | - protected $_events=array (); |
|
| 21 | - protected $_wrapBefore=array (); |
|
| 22 | - protected $_wrapAfter=array (); |
|
| 19 | + protected $properties=array(); |
|
| 20 | + protected $_events=array(); |
|
| 21 | + protected $_wrapBefore=array(); |
|
| 22 | + protected $_wrapAfter=array(); |
|
| 23 | 23 | protected $_bsComponent; |
| 24 | 24 | |
| 25 | 25 | public function getBsComponent() { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function getTemplate(JsUtils $js=NULL) { |
| 35 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 35 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getProperties() { |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 58 | if (\is_array($value)) { |
| 59 | - foreach ( $value as $v ) { |
|
| 59 | + foreach ($value as $v) { |
|
| 60 | 60 | $this->addToProperty($name, $v, $separator); |
| 61 | 61 | } |
| 62 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
| 62 | + }else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
| 63 | 63 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 64 | + if (isset($v) && $v!=="") |
|
| 65 | + $v=$v.$separator.$value; |
|
| 66 | 66 | else |
| 67 | 67 | $v=$value; |
| 68 | 68 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function compile(JsUtils $js=NULL, $view=NULL) { |
| 80 | 80 | $result=$this->getTemplate($js); |
| 81 | - foreach ( $this as $key => $value ) { |
|
| 82 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
| 81 | + foreach ($this as $key => $value) { |
|
| 82 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
| 83 | 83 | if (is_array($value)) { |
| 84 | 84 | $v=PropertyWrapper::wrap($value, $js); |
| 85 | - } else { |
|
| 85 | + }else { |
|
| 86 | 86 | $v=$value; |
| 87 | 87 | } |
| 88 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
| 88 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | if (isset($js)===true) { |
| 92 | 92 | $this->run($js); |
| 93 | - if (isset($view) === true) { |
|
| 93 | + if (isset($view)===true) { |
|
| 94 | 94 | $js->addViewElement($this->identifier, $result, $view); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | protected function ctrl($name, $value, $typeCtrl) { |
| 101 | 101 | if (is_array($typeCtrl)) { |
| 102 | - if (array_search($value, $typeCtrl) === false) { |
|
| 103 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 102 | + if (array_search($value, $typeCtrl)===false) { |
|
| 103 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 104 | 104 | } |
| 105 | - } else { |
|
| 105 | + }else { |
|
| 106 | 106 | if (!$typeCtrl($value)) { |
| 107 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 107 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | return true; |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 122 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 123 | 123 | return $this->setProperty($name, $value); |
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 129 | 129 | return $name=$value; |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 135 | 135 | if (is_array($typeCtrl)) { |
| 136 | 136 | $this->removeOldValues($name, $typeCtrl); |
| 137 | - $name.=$separator . $value; |
|
| 137 | + $name.=$separator.$value; |
|
| 138 | 138 | } |
| 139 | 139 | return $this; |
| 140 | 140 | } |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 159 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 159 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 160 | 160 | if (is_array($typeCtrl)) { |
| 161 | 161 | $this->removeOldValues($name, $typeCtrl); |
| 162 | 162 | } |
| 163 | - $name.=$separator . $value; |
|
| 163 | + $name.=$separator.$value; |
|
| 164 | 164 | } |
| 165 | 165 | return $this; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | protected function addToMember(&$name, $value, $separator=" ") { |
| 169 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 169 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 170 | 170 | return $this; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 187 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 187 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 188 | 188 | return $this->addToProperty($name, $value); |
| 189 | 189 | } |
| 190 | 190 | return $this; |
@@ -212,28 +212,28 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function fromArray($array) { |
| 215 | - foreach ( $this as $key => $value ) { |
|
| 215 | + foreach ($this as $key => $value) { |
|
| 216 | 216 | if (array_key_exists($key, $array) && !JString::startswith($key, "_")) { |
| 217 | - $setter="set" . ucfirst($key); |
|
| 217 | + $setter="set".ucfirst($key); |
|
| 218 | 218 | $this->$setter($array[$key]); |
| 219 | 219 | unset($array[$key]); |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | - foreach ( $array as $key => $value ) { |
|
| 222 | + foreach ($array as $key => $value) { |
|
| 223 | 223 | if (method_exists($this, $key)) { |
| 224 | 224 | try { |
| 225 | 225 | $this->$key($value); |
| 226 | 226 | unset($array[$key]); |
| 227 | - } catch ( \Exception $e ) { |
|
| 227 | + } catch (\Exception $e) { |
|
| 228 | 228 | // Nothing to do |
| 229 | 229 | } |
| 230 | - } else { |
|
| 231 | - $setter="set" . ucfirst($key); |
|
| 230 | + }else { |
|
| 231 | + $setter="set".ucfirst($key); |
|
| 232 | 232 | if (method_exists($this, $setter)) { |
| 233 | 233 | try { |
| 234 | 234 | $this->$setter($value); |
| 235 | 235 | unset($array[$key]); |
| 236 | - } catch ( \Exception $e ) { |
|
| 236 | + } catch (\Exception $e) { |
|
| 237 | 237 | // Nothing to do |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | public function fromDatabaseObjects($objects, $function) { |
| 246 | 246 | if (isset($objects)) { |
| 247 | - foreach ( $objects as $object ) { |
|
| 247 | + foreach ($objects as $object) { |
|
| 248 | 248 | $this->fromDatabaseObject($object, $function); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 267 | - if ($stopPropagation === true) { |
|
| 268 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 267 | + if ($stopPropagation===true) { |
|
| 268 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 269 | 269 | } |
| 270 | - if ($preventDefault === true) { |
|
| 271 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 270 | + if ($preventDefault===true) { |
|
| 271 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 272 | 272 | } |
| 273 | 273 | return $this->_addEvent($event, $jsCode); |
| 274 | 274 | } |
@@ -277,10 +277,10 @@ discard block |
||
| 277 | 277 | if (array_key_exists($event, $this->_events)) { |
| 278 | 278 | if (is_array($this->_events[$event])) { |
| 279 | 279 | $this->_events[$event][]=$jsCode; |
| 280 | - } else { |
|
| 281 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 280 | + }else { |
|
| 281 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 282 | 282 | } |
| 283 | - } else { |
|
| 283 | + }else { |
|
| 284 | 284 | $this->_events[$event]=$jsCode; |
| 285 | 285 | } |
| 286 | 286 | return $this; |
@@ -300,15 +300,15 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | public function addEventsOnRun(JsUtils $js) { |
| 302 | 302 | if (isset($this->_bsComponent)) { |
| 303 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 303 | + foreach ($this->_events as $event => $jsCode) { |
|
| 304 | 304 | $code=$jsCode; |
| 305 | 305 | if (is_array($jsCode)) { |
| 306 | 306 | $code=""; |
| 307 | - foreach ( $jsCode as $jsC ) { |
|
| 307 | + foreach ($jsCode as $jsC) { |
|
| 308 | 308 | if ($jsC instanceof AjaxCall) { |
| 309 | - $code.="\n" . $jsC->compile($js); |
|
| 310 | - } else { |
|
| 311 | - $code.="\n" . $jsC; |
|
| 309 | + $code.="\n".$jsC->compile($js); |
|
| 310 | + }else { |
|
| 311 | + $code.="\n".$jsC; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | $this->_bsComponent->addEvent($event, $code); |
| 318 | 318 | } |
| 319 | - $this->_events=array (); |
|
| 319 | + $this->_events=array(); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 324 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 324 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 325 | 325 | $params=array_merge($params, $parameters); |
| 326 | 326 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 327 | 327 | return $this; |
@@ -357,33 +357,33 @@ discard block |
||
| 357 | 357 | if (is_array($elements)) { |
| 358 | 358 | $flag=false; |
| 359 | 359 | $index=0; |
| 360 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 360 | + while (!$flag && $index<sizeof($elements)) { |
|
| 361 | 361 | if ($elements[$index] instanceof BaseHtml) |
| 362 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 362 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
| 363 | 363 | $index++; |
| 364 | 364 | } |
| 365 | - if ($flag === true) |
|
| 366 | - return $elements[$index - 1]; |
|
| 365 | + if ($flag===true) |
|
| 366 | + return $elements[$index-1]; |
|
| 367 | 367 | } elseif ($elements instanceof BaseHtml) { |
| 368 | - if ($elements->getIdentifier() === $identifier) |
|
| 368 | + if ($elements->getIdentifier()===$identifier) |
|
| 369 | 369 | return $elements; |
| 370 | 370 | } |
| 371 | 371 | return null; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
| 374 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
| 375 | 375 | if (is_array($elements)) { |
| 376 | 376 | $flag=false; |
| 377 | 377 | $index=0; |
| 378 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 378 | + while (!$flag && $index<sizeof($elements)) { |
|
| 379 | 379 | if ($elements[$index] instanceof BaseHtml) |
| 380 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 380 | + $flag=($elements[$index]->propertyContains($propertyName, $value)===true); |
|
| 381 | 381 | $index++; |
| 382 | 382 | } |
| 383 | - if ($flag === true) |
|
| 384 | - return $elements[$index - 1]; |
|
| 383 | + if ($flag===true) |
|
| 384 | + return $elements[$index-1]; |
|
| 385 | 385 | } elseif ($elements instanceof BaseHtml) { |
| 386 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 386 | + if ($elements->propertyContains($propertyName, $value)===true) |
|
| 387 | 387 | return $elements; |
| 388 | 388 | } |
| 389 | 389 | return null; |
@@ -405,14 +405,14 @@ discard block |
||
| 405 | 405 | if (is_array($value)) { |
| 406 | 406 | $value=implode(",", $value); |
| 407 | 407 | } |
| 408 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
| 409 | - $value='"' . $value . '"'; |
|
| 408 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 409 | + $value='"'.$value.'"'; |
|
| 410 | 410 | } |
| 411 | 411 | return $value; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | public function jsDoJquery($jqueryCall, $param="") { |
| 415 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
| 415 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | public function executeOnRun($jsCode) { |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getProperty($name) { |
| 53 | - if (array_key_exists($name, $this->properties)) |
|
| 54 | - return $this->properties[$name]; |
|
| 53 | + if (array_key_exists($name, $this->properties)) { |
|
| 54 | + return $this->properties[$name]; |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
| 61 | 62 | } |
| 62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
| 63 | 64 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 66 | - else |
|
| 67 | - $v=$value; |
|
| 65 | + if (isset($v) && $v !== "") { |
|
| 66 | + $v=$v . $separator . $value; |
|
| 67 | + } else { |
|
| 68 | + $v=$value; |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | return $this->setProperty($name, $v); |
| 70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
| 119 | 121 | } |
| 120 | 122 | |
| 121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 123 | - return $this->setProperty($name, $value); |
|
| 124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 125 | + return $this->setProperty($name, $value); |
|
| 126 | + } |
|
| 124 | 127 | return $this; |
| 125 | 128 | } |
| 126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | protected function removeProperty($name) { |
| 153 | - if (\array_key_exists($name, $this->properties)) |
|
| 154 | - unset($this->properties[$name]); |
|
| 156 | + if (\array_key_exists($name, $this->properties)) { |
|
| 157 | + unset($this->properties[$name]); |
|
| 158 | + } |
|
| 155 | 159 | return $this; |
| 156 | 160 | } |
| 157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
| 171 | 175 | } |
| 172 | 176 | |
| 173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 174 | - if (@class_exists($typeCtrl, true)) |
|
| 175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 178 | + if (@class_exists($typeCtrl, true)) { |
|
| 179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 180 | + } |
|
| 176 | 181 | if (is_array($typeCtrl)) { |
| 177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
| 178 | 183 | } |
@@ -358,15 +363,18 @@ discard block |
||
| 358 | 363 | $flag=false; |
| 359 | 364 | $index=0; |
| 360 | 365 | while ( !$flag && $index < sizeof($elements) ) { |
| 361 | - if ($elements[$index] instanceof BaseHtml) |
|
| 362 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 366 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 367 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 368 | + } |
|
| 363 | 369 | $index++; |
| 364 | 370 | } |
| 365 | - if ($flag === true) |
|
| 366 | - return $elements[$index - 1]; |
|
| 371 | + if ($flag === true) { |
|
| 372 | + return $elements[$index - 1]; |
|
| 373 | + } |
|
| 367 | 374 | } elseif ($elements instanceof BaseHtml) { |
| 368 | - if ($elements->getIdentifier() === $identifier) |
|
| 369 | - return $elements; |
|
| 375 | + if ($elements->getIdentifier() === $identifier) { |
|
| 376 | + return $elements; |
|
| 377 | + } |
|
| 370 | 378 | } |
| 371 | 379 | return null; |
| 372 | 380 | } |
@@ -376,15 +384,18 @@ discard block |
||
| 376 | 384 | $flag=false; |
| 377 | 385 | $index=0; |
| 378 | 386 | while ( !$flag && $index < sizeof($elements) ) { |
| 379 | - if ($elements[$index] instanceof BaseHtml) |
|
| 380 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 387 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 388 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 389 | + } |
|
| 381 | 390 | $index++; |
| 382 | 391 | } |
| 383 | - if ($flag === true) |
|
| 384 | - return $elements[$index - 1]; |
|
| 392 | + if ($flag === true) { |
|
| 393 | + return $elements[$index - 1]; |
|
| 394 | + } |
|
| 385 | 395 | } elseif ($elements instanceof BaseHtml) { |
| 386 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 387 | - return $elements; |
|
| 396 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
| 397 | + return $elements; |
|
| 398 | + } |
|
| 388 | 399 | } |
| 389 | 400 | return null; |
| 390 | 401 | } |
@@ -55,6 +55,9 @@ discard block |
||
| 55 | 55 | return $this->_semantic; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param JsUtils $jsUtils |
|
| 60 | + */ |
|
| 58 | 61 | public function __construct($params,$jsUtils) { |
| 59 | 62 | $this->params=array(); |
| 60 | 63 | foreach ( $params as $key => $val ) { |
@@ -175,7 +178,7 @@ discard block |
||
| 175 | 178 | * |
| 176 | 179 | * @param string $element |
| 177 | 180 | * @param array $options |
| 178 | - * @return void |
|
| 181 | + * @return string |
|
| 179 | 182 | */ |
| 180 | 183 | public function sortable($element, $options=array()) { |
| 181 | 184 | if (count($options)>0) { |
@@ -306,6 +309,7 @@ discard block |
||
| 306 | 309 | |
| 307 | 310 | /** |
| 308 | 311 | * A wrapper for writing document.ready() |
| 312 | + * @param string $js |
|
| 309 | 313 | * @return string |
| 310 | 314 | */ |
| 311 | 315 | public function _document_ready($js) { |
@@ -353,6 +357,9 @@ discard block |
||
| 353 | 357 | return $value; |
| 354 | 358 | } |
| 355 | 359 | |
| 360 | + /** |
|
| 361 | + * @param string $input |
|
| 362 | + */ |
|
| 356 | 363 | private function minify($input) { |
| 357 | 364 | if(trim($input) === "") return $input; |
| 358 | 365 | return preg_replace( |
@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | * jQuery Class |
| 18 | 18 | */ |
| 19 | 19 | class Jquery { |
| 20 | - use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait; |
|
| 20 | + use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait; |
|
| 21 | 21 | protected $_ui; |
| 22 | 22 | protected $_bootstrap; |
| 23 | 23 | protected $_semantic; |
| 24 | 24 | protected $libraryFile; |
| 25 | 25 | protected $_javascript_folder='js'; |
| 26 | - protected $jquery_code_for_load=array (); |
|
| 27 | - protected $jquery_code_for_compile=array (); |
|
| 26 | + protected $jquery_code_for_load=array(); |
|
| 27 | + protected $jquery_code_for_compile=array(); |
|
| 28 | 28 | protected $jquery_corner_active=FALSE; |
| 29 | 29 | protected $jquery_table_sorter_active=FALSE; |
| 30 | 30 | protected $jquery_table_sorter_pager_active=FALSE; |
| 31 | 31 | protected $jsUtils; |
| 32 | 32 | |
| 33 | - protected $jquery_events=array ( |
|
| 34 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
| 33 | + protected $jquery_events=array( |
|
| 34 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | public function ui($ui=NULL) { |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | return $this->_semantic; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function __construct($params,$jsUtils) { |
|
| 58 | + public function __construct($params, $jsUtils) { |
|
| 59 | 59 | $this->params=array(); |
| 60 | - foreach ( $params as $key => $val ) { |
|
| 60 | + foreach ($params as $key => $val) { |
|
| 61 | 61 | $this->params[$key]=$params[$key]; |
| 62 | 62 | } |
| 63 | 63 | $this->jsUtils=$jsUtils; |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function _output($array_js='') { |
| 127 | 127 | if (!is_array($array_js)) { |
| 128 | - $array_js=array ( |
|
| 128 | + $array_js=array( |
|
| 129 | 129 | $array_js |
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - foreach ( $array_js as $js ) { |
|
| 133 | + foreach ($array_js as $js) { |
|
| 134 | 134 | $this->jquery_code_for_compile[]="\t$js\n"; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | * @param string $param |
| 143 | 143 | * @param boolean $immediatly delayed if false |
| 144 | 144 | */ |
| 145 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 145 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 146 | 146 | $element=$this->_prep_element($element); |
| 147 | 147 | if (isset($param)) { |
| 148 | 148 | $param=$this->_prep_value($param); |
| 149 | 149 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 150 | - } else |
|
| 150 | + }else |
|
| 151 | 151 | $str="$({$element}).{$jQueryCall}();"; |
| 152 | 152 | if ($immediatly) |
| 153 | 153 | $this->jquery_code_for_compile[]=$str; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param boolean $immediatly delayed if false |
| 162 | 162 | * @return string |
| 163 | 163 | */ |
| 164 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 164 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 165 | 165 | $to=$this->_prep_element($to); |
| 166 | 166 | $element=$this->_prep_element($element); |
| 167 | 167 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function sortable($element, $options=array()) { |
| 181 | 181 | if (count($options)>0) { |
| 182 | - $sort_options=array (); |
|
| 183 | - foreach ( $options as $k => $v ) { |
|
| 182 | + $sort_options=array(); |
|
| 183 | + foreach ($options as $k => $v) { |
|
| 184 | 184 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 185 | 185 | } |
| 186 | 186 | $sort_options=implode(",", $sort_options); |
| 187 | - } else { |
|
| 187 | + }else { |
|
| 188 | 188 | $sort_options=''; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
| 213 | 213 | * @return string |
| 214 | 214 | */ |
| 215 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
| 215 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
| 216 | 216 | if (is_array($js)) { |
| 217 | 217 | $js=implode("\n\t\t", $js); |
| 218 | 218 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
| 227 | 227 | else |
| 228 | 228 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
| 229 | - if($immediatly) |
|
| 229 | + if ($immediatly) |
|
| 230 | 230 | $this->jquery_code_for_compile[]=$event; |
| 231 | 231 | return $event; |
| 232 | 232 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // External references |
| 268 | 268 | $external_scripts=implode('', $this->jquery_code_for_load); |
| 269 | - extract(array ( |
|
| 269 | + extract(array( |
|
| 270 | 270 | 'library_src' => $external_scripts |
| 271 | 271 | )); |
| 272 | 272 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $script.='});'; |
| 282 | 282 | |
| 283 | 283 | $this->jquery_code_for_compile=array(); |
| 284 | - if($this->params["debug"]==false){ |
|
| 284 | + if ($this->params["debug"]==false) { |
|
| 285 | 285 | $script=$this->minify($script); |
| 286 | 286 | } |
| 287 | 287 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @return void |
| 302 | 302 | */ |
| 303 | 303 | public function _clear_compile() { |
| 304 | - $this->jquery_code_for_compile=array (); |
|
| 304 | + $this->jquery_code_for_compile=array(); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -310,12 +310,12 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function _document_ready($js) { |
| 312 | 312 | if (!is_array($js)) { |
| 313 | - $js=array ( |
|
| 313 | + $js=array( |
|
| 314 | 314 | $js |
| 315 | 315 | ); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - foreach ( $js as $script ) { |
|
| 318 | + foreach ($js as $script) { |
|
| 319 | 319 | $this->jquery_code_for_compile[]=$script; |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @return string |
| 330 | 330 | */ |
| 331 | 331 | public function _prep_element($element) { |
| 332 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
| 332 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
| 333 | 333 | $element='"'.addslashes($element).'"'; |
| 334 | 334 | } |
| 335 | 335 | return $element; |
@@ -347,14 +347,14 @@ discard block |
||
| 347 | 347 | if (is_array($value)) { |
| 348 | 348 | $value=implode(",", $value); |
| 349 | 349 | } |
| 350 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
| 350 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
| 351 | 351 | $value='"'.$value.'"'; |
| 352 | 352 | } |
| 353 | 353 | return $value; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | private function minify($input) { |
| 357 | - if(trim($input) === "") return $input; |
|
| 357 | + if (trim($input)==="") return $input; |
|
| 358 | 358 | return preg_replace( |
| 359 | 359 | array( |
| 360 | 360 | // Remove comment(s) |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 6 | 6 | use Ajax\semantic\html\base\constants\Wide; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 10 | 9 | use Ajax\semantic\html\collections\form\traits\FieldsTrait; |
| 11 | 10 | |