@@ -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 | public 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 | } |
@@ -4,6 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | trait HtmlLinkTrait { |
| 6 | 6 | |
| 7 | + /** |
|
| 8 | + * @param string $value |
|
| 9 | + */ |
|
| 7 | 10 | public function setHref($value) { |
| 8 | 11 | $this->setProperty("href", $value); |
| 9 | 12 | } |
@@ -84,6 +84,9 @@ discard block |
||
| 84 | 84 | return $this; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @param integer $index |
|
| 89 | + */ |
|
| 87 | 90 | public function removeItem($index){ |
| 88 | 91 | return array_splice($this->content, $index, 1); |
| 89 | 92 | } |
@@ -99,6 +102,9 @@ discard block |
||
| 99 | 102 | return $this->addItem($function($object)); |
| 100 | 103 | } |
| 101 | 104 | |
| 105 | + /** |
|
| 106 | + * @param \Closure $callBack |
|
| 107 | + */ |
|
| 102 | 108 | public function apply($callBack){ |
| 103 | 109 | foreach ($this->content as $item){ |
| 104 | 110 | $callBack($item); |
@@ -3,7 +3,17 @@ discard block |
||
| 3 | 3 | namespace Ajax\common\traits; |
| 4 | 4 | |
| 5 | 5 | trait JqueryActionsTrait { |
| 6 | + |
|
| 7 | + /** |
|
| 8 | + * @param string $element |
|
| 9 | + * @param string $js |
|
| 10 | + * @param string $event |
|
| 11 | + */ |
|
| 6 | 12 | public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * @param string $element |
|
| 16 | + */ |
|
| 7 | 17 | public abstract function _prep_element($element); |
| 8 | 18 | public abstract function _prep_value($value); |
| 9 | 19 | |
@@ -384,7 +394,7 @@ discard block |
||
| 384 | 394 | |
| 385 | 395 | /** |
| 386 | 396 | * Ensures the speed parameter is valid for jQuery |
| 387 | - * @param string|int $speed |
|
| 397 | + * @param string $speed |
|
| 388 | 398 | * @return string |
| 389 | 399 | */ |
| 390 | 400 | private function _validate_speed($speed) { |
@@ -10,7 +10,17 @@ discard block |
||
| 10 | 10 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
| 11 | 11 | |
| 12 | 12 | public abstract function _prep_value($value); |
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * @param string $element |
|
| 16 | + * @param string $js |
|
| 17 | + * @param string $event |
|
| 18 | + */ |
|
| 13 | 19 | public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * @param string $retour |
|
| 23 | + */ |
|
| 14 | 24 | protected function addLoading(&$retour, $responseElement) { |
| 15 | 25 | $loading_notifier='<div class="ajax-loader">'; |
| 16 | 26 | if ($this->ajaxLoader=='') { |
@@ -23,13 +33,23 @@ discard block |
||
| 23 | 33 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 24 | 34 | } |
| 25 | 35 | |
| 36 | + /** |
|
| 37 | + * @param string $url |
|
| 38 | + */ |
|
| 26 | 39 | public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 27 | 40 | return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 28 | 41 | } |
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @param string $url |
|
| 45 | + */ |
|
| 29 | 46 | public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 30 | 47 | return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 31 | 48 | } |
| 32 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $method |
|
| 52 | + */ |
|
| 33 | 53 | protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 34 | 54 | if(JString::isNull($params)){$params="{}";} |
| 35 | 55 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
@@ -46,6 +66,9 @@ discard block |
||
| 46 | 66 | return $retour; |
| 47 | 67 | } |
| 48 | 68 | |
| 69 | + /** |
|
| 70 | + * @param string $attr |
|
| 71 | + */ |
|
| 49 | 72 | protected function _getAjaxUrl($url,$attr){ |
| 50 | 73 | $url=$this->_correctAjaxUrl($url); |
| 51 | 74 | $retour="url='".$url."';\n"; |
@@ -177,6 +200,11 @@ discard block |
||
| 177 | 200 | return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
| 178 | 201 | } |
| 179 | 202 | |
| 203 | + /** |
|
| 204 | + * @param string $url |
|
| 205 | + * @param string $form |
|
| 206 | + * @param string $responseElement |
|
| 207 | + */ |
|
| 180 | 208 | public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 181 | 209 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 182 | 210 | $retour=$this->_getAjaxUrl($url, $attr); |
@@ -3,7 +3,16 @@ |
||
| 3 | 3 | namespace Ajax\common\traits; |
| 4 | 4 | |
| 5 | 5 | trait JqueryEventsTrait { |
| 6 | + |
|
| 7 | + /** |
|
| 8 | + * @param string $element |
|
| 9 | + */ |
|
| 6 | 10 | public abstract function _prep_element($element); |
| 11 | + |
|
| 12 | + /** |
|
| 13 | + * @param string $element |
|
| 14 | + * @param string $event |
|
| 15 | + */ |
|
| 7 | 16 | public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
| 8 | 17 | |
| 9 | 18 | /** |
@@ -429,7 +429,7 @@ |
||
| 429 | 429 | * |
| 430 | 430 | * @access public |
| 431 | 431 | * @param array an associative array of key/values |
| 432 | - * @return array |
|
| 432 | + * @return string |
|
| 433 | 433 | * |
| 434 | 434 | */ |
| 435 | 435 | function assoc_to_uri($array) { |
@@ -22,6 +22,11 @@ discard block |
||
| 22 | 22 | protected $_contentSeparator=""; |
| 23 | 23 | |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + * @param string $tagName |
|
| 28 | + * @param string $baseClass |
|
| 29 | + */ |
|
| 25 | 30 | public function __construct($identifier,$tagName,$baseClass){ |
| 26 | 31 | parent::__construct($identifier,$tagName,$baseClass); |
| 27 | 32 | $this->root=""; |
@@ -31,7 +36,7 @@ discard block |
||
| 31 | 36 | /** |
| 32 | 37 | * Associate an ajax get to the elements, displayed in $targetSelector |
| 33 | 38 | * @param string $targetSelector the target of the get |
| 34 | - * @return HtmlNavElement |
|
| 39 | + * @return HtmlSemNavElement |
|
| 35 | 40 | */ |
| 36 | 41 | public function autoGetOnClick($targetSelector){ |
| 37 | 42 | return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
@@ -63,7 +68,7 @@ discard block |
||
| 63 | 68 | /** |
| 64 | 69 | * Define the html attribute for each element url in ajax |
| 65 | 70 | * @param string $attr html attribute |
| 66 | - * @return HtmlNavElement |
|
| 71 | + * @return HtmlSemNavElement |
|
| 67 | 72 | */ |
| 68 | 73 | public function setAttr($attr) { |
| 69 | 74 | $this->attr = $attr; |
@@ -103,6 +108,9 @@ discard block |
||
| 103 | 108 | return $this; |
| 104 | 109 | } |
| 105 | 110 | |
| 111 | + /** |
|
| 112 | + * @param integer $index |
|
| 113 | + */ |
|
| 106 | 114 | protected function getContentDivider($index){ |
| 107 | 115 | if(\is_array($this->_contentSeparator)===true){ |
| 108 | 116 | return @$this->_contentSeparator[$index]; |
@@ -12,12 +12,24 @@ |
||
| 12 | 12 | protected $_states=[ ]; |
| 13 | 13 | protected $_baseClass; |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $name |
|
| 17 | + */ |
|
| 15 | 18 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
| 16 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $name |
|
| 22 | + */ |
|
| 17 | 23 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
| 18 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $name |
|
| 27 | + */ |
|
| 19 | 28 | protected abstract function addToPropertyCtrlCheck($name, $value, $typeCtrl); |
| 20 | 29 | |
| 30 | + /** |
|
| 31 | + * @param string $name |
|
| 32 | + */ |
|
| 21 | 33 | public abstract function addToProperty($name, $value, $separator=" "); |
| 22 | 34 | |
| 23 | 35 | public function addVariation($variation) { |