@@ -32,6 +32,10 @@ discard block |
||
32 | 32 | protected $_targetSelector; |
33 | 33 | |
34 | 34 | |
35 | + /** |
|
36 | + * @param string $identifier |
|
37 | + * @param string $model |
|
38 | + */ |
|
35 | 39 | public function __construct($identifier,$model,$modelInstance=NULL) { |
36 | 40 | parent::__construct($identifier, $model,$modelInstance); |
37 | 41 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false); |
@@ -55,6 +59,9 @@ discard block |
||
55 | 59 | |
56 | 60 | |
57 | 61 | |
62 | + /** |
|
63 | + * @param string $op |
|
64 | + */ |
|
58 | 65 | protected function _generateBehavior($op,$params,JsUtils $js){ |
59 | 66 | if(isset($this->_urls[$op])){ |
60 | 67 | $params=\array_merge($params,["attr"=>"data-ajax"]); |
@@ -184,6 +191,9 @@ discard block |
||
184 | 191 | return $this; |
185 | 192 | } |
186 | 193 | |
194 | + /** |
|
195 | + * @param PositionInTable $part |
|
196 | + */ |
|
187 | 197 | private function addToolbarRow($part,$table,$captions){ |
188 | 198 | $hasPart=$table->hasPart($part); |
189 | 199 | if($hasPart){ |
@@ -46,10 +46,12 @@ discard block |
||
46 | 46 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
47 | 47 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
48 | 48 | } |
49 | - if(\is_array($this->_deleteBehavior)) |
|
50 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
51 | - if(\is_array($this->_editBehavior)) |
|
52 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
49 | + if(\is_array($this->_deleteBehavior)) { |
|
50 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
51 | + } |
|
52 | + if(\is_array($this->_editBehavior)) { |
|
53 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
54 | + } |
|
53 | 55 | return parent::run($js); |
54 | 56 | } |
55 | 57 | |
@@ -84,12 +86,14 @@ discard block |
||
84 | 86 | |
85 | 87 | $table->setRowCount(0, \sizeof($captions)); |
86 | 88 | $table->setHeaderValues($captions); |
87 | - if(isset($this->_compileParts)) |
|
88 | - $table->setCompileParts($this->_compileParts); |
|
89 | + if(isset($this->_compileParts)) { |
|
90 | + $table->setCompileParts($this->_compileParts); |
|
91 | + } |
|
89 | 92 | |
90 | 93 | if(isset($this->_searchField) && isset($js)){ |
91 | - if(isset($this->_urls["refresh"])) |
|
92 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
94 | + if(isset($this->_urls["refresh"])) { |
|
95 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
96 | + } |
|
93 | 97 | } |
94 | 98 | |
95 | 99 | $this->_generateContent($table); |
@@ -144,8 +148,9 @@ discard block |
||
144 | 148 | $menu->floatRight(); |
145 | 149 | $menu->setActiveItem($this->_pagination->getPage()-1); |
146 | 150 | $footer->setValues($menu); |
147 | - if(isset($this->_urls["refresh"])) |
|
148 | - $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
151 | + if(isset($this->_urls["refresh"])) { |
|
152 | + $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
153 | + } |
|
149 | 154 | } |
150 | 155 | |
151 | 156 | protected function _getFieldName($index){ |
@@ -188,7 +193,7 @@ discard block |
||
188 | 193 | $hasPart=$table->hasPart($part); |
189 | 194 | if($hasPart){ |
190 | 195 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
191 | - }else{ |
|
196 | + } else{ |
|
192 | 197 | $row=$table->getPart($part)->getRow(0); |
193 | 198 | } |
194 | 199 | $row->mergeCol(); |
@@ -213,7 +218,7 @@ discard block |
||
213 | 218 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
214 | 219 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
215 | 220 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
216 | - }else{ |
|
221 | + } else{ |
|
217 | 222 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
218 | 223 | } |
219 | 224 | return $this; |
@@ -262,8 +267,9 @@ discard block |
||
262 | 267 | |
263 | 268 | protected function getTargetSelector() { |
264 | 269 | $result=$this->_targetSelector; |
265 | - if(!isset($result)) |
|
266 | - $result="#".$this->identifier; |
|
270 | + if(!isset($result)) { |
|
271 | + $result="#".$this->identifier; |
|
272 | + } |
|
267 | 273 | return $result; |
268 | 274 | } |
269 | 275 |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | protected function _generateMainCheckbox(&$captions){ |
43 | 43 | $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
44 | 44 | $checkedMessageCall=""; |
45 | - if($this->_hasCheckedMessage) |
|
46 | - $checkedMessageCall="updateChecked();"; |
|
45 | + if($this->_hasCheckedMessage) { |
|
46 | + $checkedMessageCall="updateChecked();"; |
|
47 | + } |
|
47 | 48 | |
48 | 49 | $ck->setOnChecked($this->_setAllChecked("true").$checkedMessageCall); |
49 | 50 | $ck->setOnUnchecked($this->_setAllChecked("false").$checkedMessageCall); |
@@ -91,8 +92,9 @@ discard block |
||
91 | 92 | * @param callable $callback |
92 | 93 | */ |
93 | 94 | public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){ |
94 | - if(isset($checkedMessage)) |
|
95 | - $this->_checkedMessage=$checkedMessage; |
|
95 | + if(isset($checkedMessage)) { |
|
96 | + $this->_checkedMessage=$checkedMessage; |
|
97 | + } |
|
96 | 98 | $checkedMessage=$this->getCheckedMessage(); |
97 | 99 | $this->_hasCheckboxes=true; |
98 | 100 | $this->_hasCheckedMessage=true; |