@@ -23,24 +23,24 @@ discard block |
||
| 23 | 23 | $this->_rowClass="_json"; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - protected function _generateContent($table){ |
|
| 26 | + protected function _generateContent($table) { |
|
| 27 | 27 | $this->_addRowModel($table); |
| 28 | 28 | parent::_generateContent($table); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - protected function _addRowModel($table){ |
|
| 31 | + protected function _addRowModel($table) { |
|
| 32 | 32 | $row=$this->_createRow($table, $this->_modelClass); |
| 33 | - $row->addToProperty("style","display:none;"); |
|
| 33 | + $row->addToProperty("style", "display:none;"); |
|
| 34 | 34 | $table->getBody()->_addRow($row); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - protected function _createRow($table,$rowClass){ |
|
| 37 | + protected function _createRow($table, $rowClass) { |
|
| 38 | 38 | $object=JReflection::jsonObject($this->_model); |
| 39 | - if(isset($this->_rowModelCallback)){ |
|
| 39 | + if (isset($this->_rowModelCallback)) { |
|
| 40 | 40 | $callback=$this->_rowModelCallback; |
| 41 | 41 | $callback($object); |
| 42 | 42 | } |
| 43 | - $row=$this->_generateRow($object, $table,"_jsonArrayChecked"); |
|
| 43 | + $row=$this->_generateRow($object, $table, "_jsonArrayChecked"); |
|
| 44 | 44 | $row->setClass($rowClass); |
| 45 | 45 | return $row; |
| 46 | 46 | } |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | * {@inheritDoc} |
| 50 | 50 | * @see DataTable::_associatePaginationBehavior() |
| 51 | 51 | */ |
| 52 | - protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){ |
|
| 52 | + protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) { |
|
| 53 | 53 | $callback=null; |
| 54 | - if(isset($js)){ |
|
| 54 | + if (isset($js)) { |
|
| 55 | 55 | $id=$this->identifier; |
| 56 | 56 | $offset=$js->scriptCount(); |
| 57 | 57 | $this->run($js); |
| 58 | 58 | $callback=$js->getScript($offset); |
| 59 | - $callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
| 59 | + $callback.=$js->trigger("#".$id." [name='selection[]']", "change", false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
| 60 | 60 | $callback.=";var page=parseInt($(self).attr('data-page')); |
| 61 | 61 | $('#pagination-{$id} .item').removeClass('active'); |
| 62 | 62 | $('#pagination-{$id} [data-page='+page+']:not(.no-active)').addClass('active'); |
| 63 | 63 | $('#pagination-{$id} ._firstPage').attr('data-page',Math.max(1,page-1)); |
| 64 | 64 | var lastPage=$('#pagination-{$id} ._lastPage');lastPage.attr('data-page',Math.min(lastPage.attr('data-max'),page+1));"; |
| 65 | 65 | } |
| 66 | - if(isset($this->_urls["refresh"])) |
|
| 67 | - $this->jsonArrayOnClick($menu, $this->_urls["refresh"],"post","{'p':$(this).attr('data-page')}",$callback); |
|
| 66 | + if (isset($this->_urls["refresh"])) |
|
| 67 | + $this->jsonArrayOnClick($menu, $this->_urls["refresh"], "post", "{'p':$(this).attr('data-page')}", $callback); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -75,29 +75,29 @@ discard block |
||
| 75 | 75 | * @param string $jsCallback |
| 76 | 76 | * @return AjaxCall |
| 77 | 77 | */ |
| 78 | - public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
| 79 | - $parameters=\array_merge($parameters,["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass,"url"=>$url,"method"=>$method,"params"=>$params,"jsCallback"=>$jsCallback]); |
|
| 78 | + public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
| 79 | + $parameters=\array_merge($parameters, ["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass, "url"=>$url, "method"=>$method, "params"=>$params, "jsCallback"=>$jsCallback]); |
|
| 80 | 80 | return new AjaxCall("jsonArray", $parameters); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function jsClear(){ |
|
| 83 | + public function jsClear() { |
|
| 84 | 84 | return "$('#{$this->identifier} tbody').find('._json').remove();"; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function clearOn(BaseHtml $element,$event, $stopPropagation=false, $preventDefault=false){ |
|
| 88 | - return $element->addEvent($event, $this->jsClear(),$stopPropagation,$preventDefault); |
|
| 87 | + public function clearOn(BaseHtml $element, $event, $stopPropagation=false, $preventDefault=false) { |
|
| 88 | + return $element->addEvent($event, $this->jsClear(), $stopPropagation, $preventDefault); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function clearOnClick(BaseHtml $element,$stopPropagation=false, $preventDefault=false){ |
|
| 92 | - return $this->clearOn($element, "click",$stopPropagation,$preventDefault); |
|
| 91 | + public function clearOnClick(BaseHtml $element, $stopPropagation=false, $preventDefault=false) { |
|
| 92 | + return $this->clearOn($element, "click", $stopPropagation, $preventDefault); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function jsonArrayOn(BaseHtml $element,$event,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
| 96 | - return $element->_addEvent($event, $this->jsJsonArray($url,$method,$params,$jsCallback,$parameters)); |
|
| 95 | + public function jsonArrayOn(BaseHtml $element, $event, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
| 96 | + return $element->_addEvent($event, $this->jsJsonArray($url, $method, $params, $jsCallback, $parameters)); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function jsonArrayOnClick(BaseHtml $element,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
| 100 | - return $this->jsonArrayOn($element, "click", $url,$method,$params,$jsCallback,$parameters); |
|
| 99 | + public function jsonArrayOnClick(BaseHtml $element, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
| 100 | + return $this->jsonArrayOn($element, "click", $url, $method, $params, $jsCallback, $parameters); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | * @param number $pages_visibles The number of visible pages in the Pagination component |
| 109 | 109 | * @return DataTable |
| 110 | 110 | */ |
| 111 | - public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){ |
|
| 112 | - return parent::paginate($page, $total_rowcount,$items_per_page,null); |
|
| 111 | + public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
| 112 | + return parent::paginate($page, $total_rowcount, $items_per_page, null); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function setRowModelCallback($_rowModelCallback) { |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 26 | 26 | * @param string|callable $ajaxTransition |
| 27 | 27 | */ |
| 28 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 29 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
| 28 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 29 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | * @param string $jsCallback javascript code to execute after the request |
| 38 | 38 | * @param boolean $immediatly |
| 39 | 39 | */ |
| 40 | - public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 41 | - return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly); |
|
| 40 | + public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 41 | + return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * @param string $url the request address |
| 49 | 49 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 50 | 50 | */ |
| 51 | - public function jsonOn($event,$element, $url,$parameters=array()) { |
|
| 52 | - return $this->js->_jsonOn($event, $element, $url,$parameters); |
|
| 51 | + public function jsonOn($event, $element, $url, $parameters=array()) { |
|
| 52 | + return $this->js->_jsonOn($event, $element, $url, $parameters); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * @param string $jsCallback javascript code to execute after the request |
| 72 | 72 | * @param string $rowClass the css class for the new element |
| 73 | 73 | */ |
| 74 | - public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") { |
|
| 75 | - return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL,$rowClass,true); |
|
| 74 | + public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") { |
|
| 75 | + return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, true); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * @param string $jsCallback javascript code to execute after the request |
| 85 | 85 | * @param string $rowClass the css class for the new element |
| 86 | 86 | */ |
| 87 | - public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") { |
|
| 88 | - return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL, $rowClass,false); |
|
| 87 | + public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") { |
|
| 88 | + return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, false); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | * @param string $url the request url |
| 96 | 96 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true) |
| 97 | 97 | */ |
| 98 | - public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) { |
|
| 99 | - return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters); |
|
| 98 | + public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 99 | + return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 111 | 111 | * @param string|callable $ajaxTransition |
| 112 | 112 | */ |
| 113 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) { |
|
| 114 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false,$jqueryDone,$ajaxTransition); |
|
| 113 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) { |
|
| 114 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 151 | 151 | * @param string|callable $ajaxTransition |
| 152 | 152 | */ |
| 153 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 154 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
| 153 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 154 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 167 | 167 | * @param string|callable $ajaxTransition |
| 168 | 168 | */ |
| 169 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 170 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false); |
|
| 169 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 170 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null) |
| 182 | 182 | */ |
| 183 | 183 | public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 184 | - return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 184 | + return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 208 | 208 | * @param string|callable $ajaxTransition |
| 209 | 209 | */ |
| 210 | - public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 211 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
| 210 | + public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 211 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 224 | 224 | * @param string|callable $ajaxTransition |
| 225 | 225 | */ |
| 226 | - public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 227 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false); |
|
| 226 | + public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 227 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null) |
| 239 | 239 | */ |
| 240 | 240 | public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
| 241 | - return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters); |
|
| 241 | + return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -29,27 +29,27 @@ |
||
| 29 | 29 | $rowClass="_json"; |
| 30 | 30 | extract($this->parameters); |
| 31 | 31 | $result=$this->_eventPreparing($preventDefault, $stopPropagation); |
| 32 | - switch($this->method) { |
|
| 32 | + switch ($this->method) { |
|
| 33 | 33 | case "get": |
| 34 | - $result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr,$jqueryDone,$ajaxTransition); |
|
| 34 | + $result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr, $jqueryDone, $ajaxTransition); |
|
| 35 | 35 | break; |
| 36 | 36 | case "post": |
| 37 | - $result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition); |
|
| 37 | + $result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition); |
|
| 38 | 38 | break; |
| 39 | 39 | case "postForm": |
| 40 | - $result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition); |
|
| 40 | + $result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition); |
|
| 41 | 41 | break; |
| 42 | 42 | case "json": |
| 43 | - $result.=$js->jsonDeferred($url,$method,$params,$jsCallback); |
|
| 43 | + $result.=$js->jsonDeferred($url, $method, $params, $jsCallback); |
|
| 44 | 44 | break; |
| 45 | 45 | case "jsonArray": |
| 46 | - $result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$params,$jsCallback,$rowClass); |
|
| 46 | + $result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $params, $jsCallback, $rowClass); |
|
| 47 | 47 | break; |
| 48 | 48 | } |
| 49 | 49 | return $result; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - protected function _eventPreparing($preventDefault,$stopPropagation){ |
|
| 52 | + protected function _eventPreparing($preventDefault, $stopPropagation) { |
|
| 53 | 53 | $result=""; |
| 54 | 54 | if ($preventDefault===true) { |
| 55 | 55 | $result.=Javascript::$preventDefault; |
@@ -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(&$cell,$value){$cell->setValue($value);}); |
|
| 71 | + return $this->_addOrSetValues($values, function(&$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(&$cell,$value){$cell->addValue($value);}); |
|
| 79 | + return $this->_addOrSetValues($values, function(&$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; |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function createItem($value) { |
| 20 | 20 | $count=$this->count(); |
| 21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 22 | 22 | return $item; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addHeader($niveau, $content) { |
| 26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 27 | 27 | $this->wrap($header); |
| 28 | 28 | return $header; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function getItemPart($index,$partName="header"){ |
|
| 31 | + public function getItemPart($index, $partName="header") { |
|
| 32 | 32 | return $this->getItem($index)->getPart($partName); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function asLink() { |
| 40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 41 | 41 | return $this->contentAs("a"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function run(JsUtils $js) { |
| 63 | - if ($this->_hasCheckedList === true) { |
|
| 64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 63 | + if ($this->_hasCheckedList===true) { |
|
| 64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 66 | 66 | $this->executeOnRun($jsCode); |
| 67 | 67 | } |
| 68 | 68 | return parent::run($js); |
@@ -86,24 +86,24 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
| 88 | 88 | $count=$this->count(); |
| 89 | - $identifier=$this->identifier . "-" . $count; |
|
| 89 | + $identifier=$this->identifier."-".$count; |
|
| 90 | 90 | if (isset($masterItem)) { |
| 91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 92 | 92 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
| 93 | 93 | $masterO->setClass("item"); |
| 94 | 94 | $this->addItem($masterO); |
| 95 | 95 | } |
| 96 | - $fields=array (); |
|
| 96 | + $fields=array(); |
|
| 97 | 97 | $i=0; |
| 98 | - foreach ( $items as $val => $caption ) { |
|
| 99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 100 | - if (\array_search($val, $values) !== false) { |
|
| 98 | + foreach ($items as $val => $caption) { |
|
| 99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 100 | + if (\array_search($val, $values)!==false) { |
|
| 101 | 101 | $itemO->getField()->setProperty("checked", ""); |
| 102 | 102 | } |
| 103 | 103 | $itemO->setClass("item"); |
| 104 | 104 | $fields[]=$itemO; |
| 105 | 105 | } |
| 106 | - if (isset($masterO) === true) { |
|
| 106 | + if (isset($masterO)===true) { |
|
| 107 | 107 | $list=new HtmlList("", $fields); |
| 108 | 108 | $list->setClass("list"); |
| 109 | 109 | $masterO->addContent($list); |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setIcons($icons){ |
|
| 118 | - if(!\is_array($icons)){ |
|
| 117 | + public function setIcons($icons) { |
|
| 118 | + if (!\is_array($icons)) { |
|
| 119 | 119 | $icons=\array_fill(0, \sizeof($this->content), $icons); |
| 120 | 120 | } |
| 121 | - $max=\min(\sizeof($icons),\sizeof($this->content)); |
|
| 122 | - for($i=0;$i<$max;$i++){ |
|
| 121 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
| 122 | + for ($i=0; $i<$max; $i++) { |
|
| 123 | 123 | $this->content[$i]->addIcon($icons[$i]); |
| 124 | 124 | } |
| 125 | 125 | return $this; |
@@ -19,56 +19,56 @@ discard block |
||
| 19 | 19 | protected $_colWidths; |
| 20 | 20 | |
| 21 | 21 | public function __construct($identifier, $modelInstance=NULL) { |
| 22 | - parent::__construct($identifier, null,$modelInstance); |
|
| 23 | - $this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0,2), false); |
|
| 22 | + parent::__construct($identifier, null, $modelInstance); |
|
| 23 | + $this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 2), false); |
|
| 24 | 24 | $this->content["table"]->setDefinition(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 28 | - if(!$this->_generated){ |
|
| 27 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 28 | + if (!$this->_generated) { |
|
| 29 | 29 | $this->_instanceViewer->setInstance($this->_modelInstance); |
| 30 | 30 | |
| 31 | 31 | $table=$this->content["table"]; |
| 32 | 32 | $this->_generateContent($table); |
| 33 | 33 | |
| 34 | - if(isset($this->_toolbar)){ |
|
| 34 | + if (isset($this->_toolbar)) { |
|
| 35 | 35 | $this->_setToolbarPosition($table); |
| 36 | 36 | } |
| 37 | - if(isset($this->_colWidths)){ |
|
| 37 | + if (isset($this->_colWidths)) { |
|
| 38 | 38 | $this->_applyStyleAttributes($table); |
| 39 | 39 | } |
| 40 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
| 40 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
| 41 | 41 | $this->_compileForm(); |
| 42 | 42 | $this->_generated=true; |
| 43 | 43 | } |
| 44 | - return parent::compile($js,$view); |
|
| 44 | + return parent::compile($js, $view); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @param HtmlTable $table |
| 49 | 49 | */ |
| 50 | - protected function _generateContent($table){ |
|
| 51 | - $values= $this->_instanceViewer->getValues(); |
|
| 50 | + protected function _generateContent($table) { |
|
| 51 | + $values=$this->_instanceViewer->getValues(); |
|
| 52 | 52 | $captions=$this->_instanceViewer->getCaptions(); |
| 53 | 53 | $count=$this->_instanceViewer->count(); |
| 54 | 54 | |
| 55 | - for($i=0;$i<$count;$i++){ |
|
| 56 | - $table->addRow([$captions[$i],$values[$i]]); |
|
| 55 | + for ($i=0; $i<$count; $i++) { |
|
| 56 | + $table->addRow([$captions[$i], $values[$i]]); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - protected function _applyStyleAttributes(HtmlTable $table){ |
|
| 60 | + protected function _applyStyleAttributes(HtmlTable $table) { |
|
| 61 | 61 | $table->setColWidths($this->_colWidths); |
| 62 | 62 | } |
| 63 | - protected function _getFieldName($index){ |
|
| 63 | + protected function _getFieldName($index) { |
|
| 64 | 64 | return $this->_instanceViewer->getFieldName($index); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - protected function _getFieldCaption($index){ |
|
| 67 | + protected function _getFieldCaption($index) { |
|
| 68 | 68 | return null; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
| 71 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
| 72 | 72 | return $this->identifier."-{$prefix}-".$name; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | return $this; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function asForm(){ |
|
| 103 | + public function asForm() { |
|
| 104 | 104 | return $this->getForm(); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function setColCaptionWidth($width){ |
|
| 107 | + public function setColCaptionWidth($width) { |
|
| 108 | 108 | $this->_colWidths[0]=$width; |
| 109 | 109 | return $this; |
| 110 | 110 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setColWidths($widths){ |
|
| 117 | + public function setColWidths($widths) { |
|
| 118 | 118 | $this->_colWidths=$widths; |
| 119 | 119 | return $this; |
| 120 | 120 | } |
@@ -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($row,$_values){$row->setValues($_values);}); |
|
| 128 | + return $this->_addOrSetValues($values, function($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($row,$_values){$row->addValues($_values);}); |
|
| 136 | + return $this->_addOrSetValues($values, function($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; |
@@ -15,117 +15,117 @@ 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 addContentInPart($content,$uiClass,$part) { |
|
| 103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
| 102 | + private function addContentInPart($content, $uiClass, $part) { |
|
| 103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - private function addElementInPart($element,$part) { |
|
| 106 | + private function addElementInPart($element, $part) { |
|
| 107 | 107 | $this->content[$part]->addContent($element); |
| 108 | 108 | return $element; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function showDimmer($value){ |
|
| 112 | - $value=$value?"show":"hide"; |
|
| 111 | + public function showDimmer($value) { |
|
| 112 | + $value=$value ? "show" : "hide"; |
|
| 113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setInverted($recursive=true){ |
|
| 117 | + public function setInverted($recursive=true) { |
|
| 118 | 118 | $this->_params["inverted"]=true; |
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setBasic(){ |
|
| 122 | + public function setBasic() { |
|
| 123 | 123 | return $this->addToProperty("class", "basic"); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | - public function setTransition($value){ |
|
| 128 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 127 | + public function setTransition($value) { |
|
| 128 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $viewName |
| 136 | 136 | * @param $params The parameters to pass to the view |
| 137 | 137 | */ |
| 138 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 139 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 138 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 139 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | * @param string $actionName the action name |
| 148 | 148 | * @param array $params |
| 149 | 149 | */ |
| 150 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 151 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 150 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 151 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 159 | 159 | */ |
| 160 | 160 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 161 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 161 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 162 | 162 | return parent::compile($js, $view); |
| 163 | 163 | } |
| 164 | 164 | /* |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | * @see BaseHtml::run() |
| 167 | 167 | */ |
| 168 | 168 | public function run(JsUtils $js) { |
| 169 | - if(isset($this->_bsComponent)===false) |
|
| 170 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 169 | + if (isset($this->_bsComponent)===false) |
|
| 170 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 171 | 171 | $this->addEventsOnRun($js); |
| 172 | 172 | return $this->_bsComponent; |
| 173 | 173 | } |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | * @property HtmlSemDoubleElement $_self |
| 16 | 16 | */ |
| 17 | 17 | trait BaseTrait { |
| 18 | - protected $_variations=[ ]; |
|
| 19 | - protected $_states=[ ]; |
|
| 18 | + protected $_variations=[]; |
|
| 19 | + protected $_states=[]; |
|
| 20 | 20 | protected $_baseClass; |
| 21 | 21 | |
| 22 | 22 | abstract protected function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | abstract public function setProperty($name, $value); |
| 31 | 31 | |
| 32 | - abstract public function addContent($content,$before=false); |
|
| 32 | + abstract public function addContent($content, $before=false); |
|
| 33 | 33 | |
| 34 | 34 | abstract public function onCreate($jsCode); |
| 35 | 35 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $this->_self->setProperty("class", $this->_self->_baseClass); |
| 51 | 51 | if (\is_string($variations)) |
| 52 | 52 | $variations=\explode(" ", $variations); |
| 53 | - foreach ( $variations as $variation ) { |
|
| 53 | + foreach ($variations as $variation) { |
|
| 54 | 54 | $this->_self->addVariation($variation); |
| 55 | 55 | } |
| 56 | 56 | return $this; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function addVariations($variations=array()) { |
| 65 | 65 | if (\is_string($variations)) |
| 66 | 66 | $variations=\explode(" ", $variations); |
| 67 | - foreach ( $variations as $variation ) { |
|
| 67 | + foreach ($variations as $variation) { |
|
| 68 | 68 | $this->_self->addVariation($variation); |
| 69 | 69 | } |
| 70 | 70 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function addStates($states=array()) { |
| 74 | 74 | if (\is_string($states)) |
| 75 | 75 | $states=\explode(" ", $states); |
| 76 | - foreach ( $states as $state ) { |
|
| 76 | + foreach ($states as $state) { |
|
| 77 | 77 | $this->_self->addState($state); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | $this->_self->setProperty("class", $this->_self->_baseClass); |
| 84 | 84 | if (\is_string($states)) |
| 85 | 85 | $states=\explode(" ", $states); |
| 86 | - foreach ( $states as $state ) { |
|
| 86 | + foreach ($states as $state) { |
|
| 87 | 87 | $this->_self->addState($state); |
| 88 | 88 | } |
| 89 | 89 | return $this; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function addIcon($icon, $before=true) { |
| 93 | - return $this->_self->addContent(new HtmlIcon("icon-" . $this->_self->identifier, $icon), $before); |
|
| 93 | + return $this->_self->addContent(new HtmlIcon("icon-".$this->_self->identifier, $icon), $before); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function addSticky($context="body"){ |
|
| 96 | + public function addSticky($context="body") { |
|
| 97 | 97 | $this->_self->onCreate("$('#".$this->_self->identifier."').sticky({ context: '".$context."'});"); |
| 98 | 98 | return $this; |
| 99 | 99 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return HtmlSemDoubleElement |
| 115 | 115 | */ |
| 116 | 116 | public function setDisabled($disable=true) { |
| 117 | - if($disable) |
|
| 117 | + if ($disable) |
|
| 118 | 118 | $this->_self->addToProperty("class", "disabled"); |
| 119 | 119 | return $this; |
| 120 | 120 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return HtmlSemDoubleElement |
| 142 | 142 | */ |
| 143 | - public function asHeader(){ |
|
| 143 | + public function asHeader() { |
|
| 144 | 144 | return $this->_self->addToProperty("class", "header"); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | * show it is currently the active user selection |
| 149 | 149 | * @return HtmlSemDoubleElement |
| 150 | 150 | */ |
| 151 | - public function setActive($value=true){ |
|
| 152 | - if($value) |
|
| 151 | + public function setActive($value=true) { |
|
| 152 | + if ($value) |
|
| 153 | 153 | $this->_self->addToProperty("class", "active"); |
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function setAttached($value=true){ |
|
| 158 | - if($value) |
|
| 159 | - $this->_self->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 157 | + public function setAttached($value=true) { |
|
| 158 | + if ($value) |
|
| 159 | + $this->_self->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 160 | 160 | return $this; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | * can be formatted to appear on dark backgrounds |
| 165 | 165 | */ |
| 166 | 166 | public function setInverted($recursive=true) { |
| 167 | - if($recursive===true){ |
|
| 167 | + if ($recursive===true) { |
|
| 168 | 168 | $content=$this->_self->getContent(); |
| 169 | - if($content instanceof HtmlSemDoubleElement) |
|
| 169 | + if ($content instanceof HtmlSemDoubleElement) |
|
| 170 | 170 | $content->setInverted($recursive); |
| 171 | - elseif(\is_array($content) || $content instanceof \Traversable){ |
|
| 172 | - foreach ($content as $elm){ |
|
| 173 | - if($elm instanceof HtmlSemDoubleElement){ |
|
| 171 | + elseif (\is_array($content) || $content instanceof \Traversable) { |
|
| 172 | + foreach ($content as $elm) { |
|
| 173 | + if ($elm instanceof HtmlSemDoubleElement) { |
|
| 174 | 174 | $elm->setInverted($recursive); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function setFloated($direction="right") { |
| 187 | - return $this->_self->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
| 187 | + return $this->_self->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | public function floatRight() { |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | return $this->_self->_baseClass; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - protected function addBehavior(&$array,$key,$value,$before="",$after=""){ |
|
| 203 | - if(\is_string($value)){ |
|
| 204 | - if(isset($array[$key])){ |
|
| 202 | + protected function addBehavior(&$array, $key, $value, $before="", $after="") { |
|
| 203 | + if (\is_string($value)) { |
|
| 204 | + if (isset($array[$key])) { |
|
| 205 | 205 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
| 206 | 206 | $array[$key]=$before.$p.$value.$after; |
| 207 | - }else |
|
| 207 | + } else |
|
| 208 | 208 | $array[$key]=$before.$value.$after; |
| 209 | - }else{ |
|
| 209 | + } else { |
|
| 210 | 210 | $array[$key]=$value; |
| 211 | 211 | } |
| 212 | 212 | return $this; |