@@ -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) { |
@@ -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; |
@@ -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 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct($identifier, $rowCount, $colCount) { |
29 | 29 | parent::__construct($identifier, "table", "ui table"); |
30 | - $this->content=array (); |
|
30 | + $this->content=array(); |
|
31 | 31 | $this->setRowCount($rowCount, $colCount); |
32 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
33 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
32 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
33 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
34 | 34 | $this->_afterCompileEvents=[]; |
35 | 35 | } |
36 | 36 | |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | * @return HtmlTableContent |
41 | 41 | */ |
42 | 42 | public function getPart($key) { |
43 | - if (\array_key_exists($key, $this->content) === false) { |
|
43 | + if (\array_key_exists($key, $this->content)===false) { |
|
44 | 44 | $this->content[$key]=new HtmlTableContent("", $key); |
45 | - if ($key !== "tbody") { |
|
45 | + if ($key!=="tbody") { |
|
46 | 46 | $this->content[$key]->setRowCount(1, $this->_colCount); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | return $this->content[$key]; |
50 | 50 | } |
51 | 51 | |
52 | - protected function _getFirstPart(){ |
|
53 | - if(isset($this->content["thead"])){ |
|
52 | + protected function _getFirstPart() { |
|
53 | + if (isset($this->content["thead"])) { |
|
54 | 54 | return $this->content["thead"]; |
55 | 55 | } |
56 | 56 | return $this->content["tbody"]; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return boolean |
96 | 96 | */ |
97 | 97 | public function hasPart($key) { |
98 | - return \array_key_exists($key, $this->content) === true; |
|
98 | + return \array_key_exists($key, $this->content)===true; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | private function colAlign($colIndex, $function) { |
232 | 232 | if (\is_array($colIndex)) { |
233 | - foreach ( $colIndex as $cIndex ) { |
|
233 | + foreach ($colIndex as $cIndex) { |
|
234 | 234 | $this->colAlign($cIndex, $function); |
235 | 235 | } |
236 | 236 | } else { |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @see HtmlSemDoubleElement::compile() |
292 | 292 | */ |
293 | 293 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
294 | - if(\sizeof($this->_compileParts)<3){ |
|
294 | + if (\sizeof($this->_compileParts)<3) { |
|
295 | 295 | $this->_template="%content%"; |
296 | 296 | $this->refresh(); |
297 | 297 | } |
@@ -300,11 +300,11 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
303 | - parent::compile_once($js,$view); |
|
303 | + parent::compile_once($js, $view); |
|
304 | 304 | if ($this->propertyContains("class", "sortable")) { |
305 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
305 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
306 | 306 | } |
307 | - if(isset($this->_activeRowSelector)){ |
|
307 | + if (isset($this->_activeRowSelector)) { |
|
308 | 308 | $this->_activeRowSelector->compile(); |
309 | 309 | } |
310 | 310 | } |
@@ -318,13 +318,13 @@ discard block |
||
318 | 318 | public function fromDatabaseObject($object, $function) { |
319 | 319 | $result=$function($object); |
320 | 320 | if (\is_array($result)) { |
321 | - $result= $this->addRow($function($object)); |
|
321 | + $result=$this->addRow($function($object)); |
|
322 | 322 | } else { |
323 | - $result= $this->getBody()->_addRow($result); |
|
323 | + $result=$this->getBody()->_addRow($result); |
|
324 | 324 | } |
325 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
326 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
327 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
325 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
326 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
327 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
328 | 328 | } |
329 | 329 | return $result; |
330 | 330 | } |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | return $this; |
340 | 340 | } |
341 | 341 | |
342 | - public function refresh(){ |
|
342 | + public function refresh() { |
|
343 | 343 | $this->_footer=$this->getFooter(); |
344 | 344 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
345 | 345 | } |
346 | 346 | |
347 | - public function run(JsUtils $js){ |
|
348 | - $result= parent::run($js); |
|
349 | - if(isset($this->_footer)) |
|
347 | + public function run(JsUtils $js) { |
|
348 | + $result=parent::run($js); |
|
349 | + if (isset($this->_footer)) |
|
350 | 350 | $this->_footer->run($js); |
351 | 351 | return $result; |
352 | 352 | } |
@@ -369,38 +369,38 @@ discard block |
||
369 | 369 | * @param boolean $multiple |
370 | 370 | * @return HtmlTable |
371 | 371 | */ |
372 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
373 | - $this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple); |
|
372 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
373 | + $this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple); |
|
374 | 374 | return $this; |
375 | 375 | } |
376 | 376 | |
377 | - public function hideColumn($colIndex){ |
|
378 | - if(isset($this->content["thead"])){ |
|
377 | + public function hideColumn($colIndex) { |
|
378 | + if (isset($this->content["thead"])) { |
|
379 | 379 | $this->content["thead"]->hideColumn($colIndex); |
380 | 380 | } |
381 | 381 | $this->content["tbody"]->hideColumn($colIndex); |
382 | - if(isset($this->content["tfoot"])){ |
|
382 | + if (isset($this->content["tfoot"])) { |
|
383 | 383 | $this->content["tfoot"]->hideColumn($colIndex); |
384 | 384 | } |
385 | 385 | return $this; |
386 | 386 | } |
387 | 387 | |
388 | - public function setColWidth($colIndex,$width){ |
|
388 | + public function setColWidth($colIndex, $width) { |
|
389 | 389 | $part=$this->_getFirstPart(); |
390 | - if($part!==null && $part->count()>0) |
|
390 | + if ($part!==null && $part->count()>0) |
|
391 | 391 | $part->getCell(0, $colIndex)->setWidth($width); |
392 | 392 | return $this; |
393 | 393 | } |
394 | 394 | |
395 | - public function setColWidths($widths){ |
|
395 | + public function setColWidths($widths) { |
|
396 | 396 | $part=$this->_getFirstPart(); |
397 | - if($part!==null && $part->count()>0){ |
|
397 | + if ($part!==null && $part->count()>0) { |
|
398 | 398 | $count=$part->getColCount(); |
399 | - if(!\is_array($widths)){ |
|
399 | + if (!\is_array($widths)) { |
|
400 | 400 | $widths=\array_fill(0, $count, $widths); |
401 | 401 | } |
402 | - $max=\min(\sizeof($widths),$count); |
|
403 | - for($i=0;$i<$max;$i++){ |
|
402 | + $max=\min(\sizeof($widths), $count); |
|
403 | + for ($i=0; $i<$max; $i++) { |
|
404 | 404 | $part->getCell(0, $i)->setWidth($widths[$i]); |
405 | 405 | } |
406 | 406 | } |
@@ -8,11 +8,11 @@ |
||
8 | 8 | class HtmlCardGroups extends HtmlViewGroups { |
9 | 9 | |
10 | 10 | public function __construct($identifier, $cards=array()) { |
11 | - parent::__construct($identifier, "ui cards",$cards); |
|
11 | + parent::__construct($identifier, "ui cards", $cards); |
|
12 | 12 | } |
13 | 13 | |
14 | - protected function createElement(){ |
|
15 | - return new HtmlCard("card-" . $this->count()); |
|
14 | + protected function createElement() { |
|
15 | + return new HtmlCard("card-".$this->count()); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function newItem($identifier) { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | abstract class HtmlViewGroups extends HtmlSemCollection { |
10 | 10 | |
11 | - public function __construct($identifier, $uiClass,$items=array()) { |
|
11 | + public function __construct($identifier, $uiClass, $items=array()) { |
|
12 | 12 | parent::__construct($identifier, "div", $uiClass); |
13 | 13 | $this->addItems($items); |
14 | 14 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param int $wide |
41 | 41 | */ |
42 | 42 | public function setWide($wide) { |
43 | - $wide=Wide::getConstants()["W" . $wide]; |
|
43 | + $wide=Wide::getConstants()["W".$wide]; |
|
44 | 44 | return $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
45 | 45 | } |
46 | 46 |
@@ -9,11 +9,11 @@ |
||
9 | 9 | class HtmlItems extends HtmlViewGroups { |
10 | 10 | |
11 | 11 | public function __construct($identifier, $items=[]) { |
12 | - parent::__construct($identifier, "ui items",$items); |
|
12 | + parent::__construct($identifier, "ui items", $items); |
|
13 | 13 | } |
14 | 14 | |
15 | - protected function createElement(){ |
|
16 | - return new HtmlItem("item-" . $this->count()); |
|
15 | + protected function createElement() { |
|
16 | + return new HtmlItem("item-".$this->count()); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function newItem($identifier) { |
@@ -3,25 +3,25 @@ discard block |
||
3 | 3 | namespace Ajax\service; |
4 | 4 | |
5 | 5 | class JReflection { |
6 | - public static function shortClassName($object){ |
|
7 | - $classNameWithNamespace = get_class($object); |
|
6 | + public static function shortClassName($object) { |
|
7 | + $classNameWithNamespace=get_class($object); |
|
8 | 8 | return substr($classNameWithNamespace, strrpos($classNameWithNamespace, '\\')+1); |
9 | 9 | } |
10 | 10 | |
11 | - public static function jsonObject($classname){ |
|
11 | + public static function jsonObject($classname) { |
|
12 | 12 | $object=new $classname(); |
13 | - $class = new \ReflectionClass($classname); |
|
13 | + $class=new \ReflectionClass($classname); |
|
14 | 14 | $methods=$class->getMethods(\ReflectionMethod::IS_PUBLIC); |
15 | - foreach ($methods as $method){ |
|
15 | + foreach ($methods as $method) { |
|
16 | 16 | $name=$method->getName(); |
17 | - if(JString::startswith($name, "set")){ |
|
17 | + if (JString::startswith($name, "set")) { |
|
18 | 18 | $property=\lcfirst(JString::replaceAtFirst($name, "set", "")); |
19 | 19 | $value="__".$property."__"; |
20 | - try{ |
|
21 | - if($class->getProperty($property)!==null){ |
|
22 | - \call_user_func_array([$object,$name],[$value]); |
|
20 | + try { |
|
21 | + if ($class->getProperty($property)!==null) { |
|
22 | + \call_user_func_array([$object, $name], [$value]); |
|
23 | 23 | } |
24 | - }catch(\Exception $e){ |
|
24 | + }catch (\Exception $e) { |
|
25 | 25 | //Nothing to do |
26 | 26 | } |
27 | 27 | } |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | return $object; |
30 | 30 | } |
31 | 31 | |
32 | - public static function callMethod($object,$callback,array $values){ |
|
33 | - return \call_user_func_array([$object,$callback],$values); |
|
32 | + public static function callMethod($object, $callback, array $values) { |
|
33 | + return \call_user_func_array([$object, $callback], $values); |
|
34 | 34 | } |
35 | 35 | |
36 | - public static function getterName($propertyName,$prefix="get"){ |
|
36 | + public static function getterName($propertyName, $prefix="get") { |
|
37 | 37 | return $prefix.\ucfirst($propertyName); |
38 | 38 | } |
39 | 39 | |
40 | - public static function callMethodFromAssociativeArray($object,$array,$methodPrefix="add"){ |
|
41 | - foreach ($array as $key=>$value){ |
|
42 | - if(\method_exists($object, $methodPrefix.\ucfirst($key))){ |
|
43 | - \call_user_func([$object,$methodPrefix.\ucfirst($key)],$value); |
|
40 | + public static function callMethodFromAssociativeArray($object, $array, $methodPrefix="add") { |
|
41 | + foreach ($array as $key=>$value) { |
|
42 | + if (\method_exists($object, $methodPrefix.\ucfirst($key))) { |
|
43 | + \call_user_func([$object, $methodPrefix.\ucfirst($key)], $value); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |