@@ -108,6 +108,10 @@ discard block |
||
| 108 | 108 | return true; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | + /** |
|
| 112 | + * @param string $propertyName |
|
| 113 | + * @param string $value |
|
| 114 | + */ |
|
| 111 | 115 | protected function propertyContains($propertyName,$value){ |
| 112 | 116 | $values=$this->getProperty($propertyName); |
| 113 | 117 | if(isset($values)){ |
@@ -137,17 +141,28 @@ discard block |
||
| 137 | 141 | return $this; |
| 138 | 142 | } |
| 139 | 143 | |
| 144 | + /** |
|
| 145 | + * @param string $name |
|
| 146 | + * @param string $value |
|
| 147 | + */ |
|
| 140 | 148 | protected function removePropertyValue($name,$value){ |
| 141 | 149 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 142 | 150 | return $this; |
| 143 | 151 | } |
| 144 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $name |
|
| 155 | + */ |
|
| 145 | 156 | protected function removeProperty($name){ |
| 146 | 157 | if(\array_key_exists($name, $this->properties)) |
| 147 | 158 | unset($this->properties[$name]); |
| 148 | 159 | return $this; |
| 149 | 160 | } |
| 150 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $name |
|
| 164 | + * @param string[] $typeCtrl |
|
| 165 | + */ |
|
| 151 | 166 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 152 | 167 | if ($this->ctrl($name, $value, $typeCtrl)===true) { |
| 153 | 168 | if (is_array($typeCtrl)) { |
@@ -172,6 +187,9 @@ discard block |
||
| 172 | 187 | return $this->addToProperty($name, $value); |
| 173 | 188 | } |
| 174 | 189 | |
| 190 | + /** |
|
| 191 | + * @param string $name |
|
| 192 | + */ |
|
| 175 | 193 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 176 | 194 | // if($this->ctrl($name, $value, $typeCtrl)===true){ |
| 177 | 195 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
@@ -239,6 +257,9 @@ discard block |
||
| 239 | 257 | |
| 240 | 258 | } |
| 241 | 259 | |
| 260 | + /** |
|
| 261 | + * @param string $before |
|
| 262 | + */ |
|
| 242 | 263 | public function wrap($before, $after="") { |
| 243 | 264 | if(isset($before)){ |
| 244 | 265 | $this->wrapBefore.=$before; |
@@ -307,6 +328,9 @@ discard block |
||
| 307 | 328 | } |
| 308 | 329 | } |
| 309 | 330 | |
| 331 | + /** |
|
| 332 | + * @param string $operation |
|
| 333 | + */ |
|
| 310 | 334 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 311 | 335 | $params=array ( |
| 312 | 336 | "url" => $url, |
@@ -317,14 +341,23 @@ discard block |
||
| 317 | 341 | return $this; |
| 318 | 342 | } |
| 319 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $event |
|
| 346 | + */ |
|
| 320 | 347 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
| 321 | 348 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
| 322 | 349 | } |
| 323 | 350 | |
| 351 | + /** |
|
| 352 | + * @param string $url |
|
| 353 | + */ |
|
| 324 | 354 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
| 325 | 355 | return $this->getOn("click", $url, $responseElement, $parameters); |
| 326 | 356 | } |
| 327 | 357 | |
| 358 | + /** |
|
| 359 | + * @param string $event |
|
| 360 | + */ |
|
| 328 | 361 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 329 | 362 | $parameters ["params"]=$params; |
| 330 | 363 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -334,6 +367,9 @@ discard block |
||
| 334 | 367 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
| 335 | 368 | } |
| 336 | 369 | |
| 370 | + /** |
|
| 371 | + * @param string $event |
|
| 372 | + */ |
|
| 337 | 373 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
| 338 | 374 | $parameters ["form"]=$form; |
| 339 | 375 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -383,6 +419,9 @@ discard block |
||
| 383 | 419 | return $value; |
| 384 | 420 | } |
| 385 | 421 | |
| 422 | + /** |
|
| 423 | + * @param string $jqueryCall |
|
| 424 | + */ |
|
| 386 | 425 | public function jsDoJquery($jqueryCall, $param=""){ |
| 387 | 426 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
| 388 | 427 | } |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | protected $_tabsType="tabs"; |
| 21 | 21 | protected $stacked=""; |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $identifier |
|
| 25 | + */ |
|
| 23 | 26 | public function __construct($identifier, $tagName="ul") { |
| 24 | 27 | parent::__construct($identifier, $tagName); |
| 25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * Sets the menu type |
| 27 | 27 | * @param string $type one of text,item |
| 28 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
| 28 | + * @return HtmlMenu |
|
| 29 | 29 | */ |
| 30 | 30 | public function setType($type=""){ |
| 31 | 31 | return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | protected $_tabsType="tabs"; |
| 21 | 21 | protected $stacked=""; |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $identifier |
|
| 25 | + */ |
|
| 23 | 26 | public function __construct($identifier, $tagName="ul") { |
| 24 | 27 | parent::__construct($identifier, $tagName); |
| 25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | protected $_tabsType="tabs"; |
| 21 | 21 | protected $stacked=""; |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $identifier |
|
| 25 | + */ |
|
| 23 | 26 | public function __construct($identifier, $tagName="ul") { |
| 24 | 27 | parent::__construct($identifier, $tagName); |
| 25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @param string $element |
| 209 | 209 | * @param array $options |
| 210 | - * @return void |
|
| 210 | + * @return string |
|
| 211 | 211 | */ |
| 212 | 212 | public function sortable($element, $options=array()) { |
| 213 | 213 | if (count($options)>0) { |
@@ -351,6 +351,7 @@ discard block |
||
| 351 | 351 | /** |
| 352 | 352 | * A wrapper for writing document.ready() |
| 353 | 353 | * |
| 354 | + * @param string $js |
|
| 354 | 355 | * @return string |
| 355 | 356 | */ |
| 356 | 357 | public function _document_ready($js) { |
@@ -420,6 +421,9 @@ discard block |
||
| 420 | 421 | return $speed; |
| 421 | 422 | } |
| 422 | 423 | |
| 424 | + /** |
|
| 425 | + * @param string $input |
|
| 426 | + */ |
|
| 423 | 427 | private function minify($input) { |
| 424 | 428 | if(trim($input) === "") return $input; |
| 425 | 429 | return preg_replace( |
@@ -93,7 +93,6 @@ |
||
| 93 | 93 | /** |
| 94 | 94 | * Return a new Semantic Html Breadcrumb |
| 95 | 95 | * @param string $identifier |
| 96 | - * @param array $elements |
|
| 97 | 96 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true |
| 98 | 97 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 99 | 98 | * @return HtmlBreadcrumb |
@@ -9,7 +9,17 @@ discard block |
||
| 9 | 9 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
| 10 | 10 | |
| 11 | 11 | public abstract function _prep_value($value); |
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @param string $element |
|
| 15 | + * @param string $js |
|
| 16 | + * @param string $event |
|
| 17 | + */ |
|
| 12 | 18 | public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * @param string $retour |
|
| 22 | + */ |
|
| 13 | 23 | protected function addLoading(&$retour, $responseElement) { |
| 14 | 24 | $loading_notifier='<div class="ajax-loader">'; |
| 15 | 25 | if ($this->ajaxLoader=='') { |
@@ -22,13 +32,23 @@ discard block |
||
| 22 | 32 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 23 | 33 | } |
| 24 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $url |
|
| 37 | + */ |
|
| 25 | 38 | public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 26 | 39 | return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 27 | 40 | } |
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @param string $url |
|
| 44 | + */ |
|
| 28 | 45 | public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 29 | 46 | return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 30 | 47 | } |
| 31 | 48 | |
| 49 | + /** |
|
| 50 | + * @param string $method |
|
| 51 | + */ |
|
| 32 | 52 | protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 33 | 53 | if(JString::isNull($params)){$params="{}";} |
| 34 | 54 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
@@ -45,6 +65,9 @@ discard block |
||
| 45 | 65 | return $retour; |
| 46 | 66 | } |
| 47 | 67 | |
| 68 | + /** |
|
| 69 | + * @param string $attr |
|
| 70 | + */ |
|
| 48 | 71 | protected function _getAjaxUrl($url,$attr){ |
| 49 | 72 | $url=$this->_correctAjaxUrl($url); |
| 50 | 73 | $retour="url='".$url."';\n"; |
@@ -176,6 +199,11 @@ discard block |
||
| 176 | 199 | return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
| 177 | 200 | } |
| 178 | 201 | |
| 202 | + /** |
|
| 203 | + * @param string $url |
|
| 204 | + * @param string $form |
|
| 205 | + * @param string $responseElement |
|
| 206 | + */ |
|
| 179 | 207 | public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 180 | 208 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 181 | 209 | $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 | /** |