@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function __construct($identifier, $rowCount, $colCount) { |
| 25 | 25 | parent::__construct($identifier, "table", "ui table"); |
| 26 | - $this->content=array (); |
|
| 26 | + $this->content=array(); |
|
| 27 | 27 | $this->setRowCount($rowCount, $colCount); |
| 28 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 29 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
| 28 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 29 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
| 30 | 30 | $this->_afterCompileEvents=[]; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * @return HtmlTableContent |
| 37 | 37 | */ |
| 38 | 38 | public function getPart($key) { |
| 39 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 39 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 40 | 40 | $this->content[$key]=new HtmlTableContent("", $key); |
| 41 | - if ($key !== "tbody") { |
|
| 41 | + if ($key!=="tbody") { |
|
| 42 | 42 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @return boolean |
| 76 | 76 | */ |
| 77 | 77 | public function hasPart($key) { |
| 78 | - return \array_key_exists($key, $this->content) === true; |
|
| 78 | + return \array_key_exists($key, $this->content)===true; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | private function colAlign($colIndex, $function) { |
| 182 | 182 | if (\is_array($colIndex)) { |
| 183 | - foreach ( $colIndex as $cIndex ) { |
|
| 183 | + foreach ($colIndex as $cIndex) { |
|
| 184 | 184 | $this->colAlign($cIndex, $function); |
| 185 | 185 | } |
| 186 | 186 | } else { |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | public function setBasic($very=false) { |
| 200 | 200 | if ($very) |
| 201 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 202 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 201 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
| 202 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | public function setCollapsing() { |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 261 | 261 | */ |
| 262 | 262 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 263 | - if(\sizeof($this->_compileParts)<3){ |
|
| 263 | + if (\sizeof($this->_compileParts)<3) { |
|
| 264 | 264 | $this->_template="%content%"; |
| 265 | 265 | $this->refresh(); |
| 266 | - }else{ |
|
| 266 | + } else { |
|
| 267 | 267 | if ($this->propertyContains("class", "sortable")) { |
| 268 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
| 268 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | $this->content=JArray::sortAssociative($this->content, $this->_compileParts); |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | public function fromDatabaseObject($object, $function) { |
| 282 | 282 | $result=$function($object); |
| 283 | 283 | if (\is_array($result)) { |
| 284 | - $result= $this->addRow($function($object)); |
|
| 284 | + $result=$this->addRow($function($object)); |
|
| 285 | 285 | } else { |
| 286 | - $result= $this->getBody()->_addRow($result); |
|
| 286 | + $result=$this->getBody()->_addRow($result); |
|
| 287 | 287 | } |
| 288 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
| 289 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 290 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 288 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
| 289 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 290 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
| 291 | 291 | } |
| 292 | 292 | return $result; |
| 293 | 293 | } |
@@ -301,14 +301,14 @@ discard block |
||
| 301 | 301 | return $this; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - public function refresh(){ |
|
| 304 | + public function refresh() { |
|
| 305 | 305 | $this->_footer=$this->getFooter(); |
| 306 | 306 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - public function run(JsUtils $js){ |
|
| 310 | - $result= parent::run($js); |
|
| 311 | - if(isset($this->_footer)) |
|
| 309 | + public function run(JsUtils $js) { |
|
| 310 | + $result=parent::run($js); |
|
| 311 | + if (isset($this->_footer)) |
|
| 312 | 312 | $this->_footer->run($js); |
| 313 | 313 | return $result; |
| 314 | 314 | } |
@@ -197,8 +197,9 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | public function setBasic($very=false) { |
| 200 | - if ($very) |
|
| 201 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 200 | + if ($very) { |
|
| 201 | + $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 202 | + } |
|
| 202 | 203 | return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
| 203 | 204 | } |
| 204 | 205 | |
@@ -263,7 +264,7 @@ discard block |
||
| 263 | 264 | if(\sizeof($this->_compileParts)<3){ |
| 264 | 265 | $this->_template="%content%"; |
| 265 | 266 | $this->refresh(); |
| 266 | - }else{ |
|
| 267 | + } else{ |
|
| 267 | 268 | if ($this->propertyContains("class", "sortable")) { |
| 268 | 269 | $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
| 269 | 270 | } |
@@ -286,8 +287,9 @@ discard block |
||
| 286 | 287 | $result= $this->getBody()->_addRow($result); |
| 287 | 288 | } |
| 288 | 289 | if(isset($this->_afterCompileEvents["onNewRow"])){ |
| 289 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 290 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 290 | + if(\is_callable($this->_afterCompileEvents["onNewRow"])) { |
|
| 291 | + $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 292 | + } |
|
| 291 | 293 | } |
| 292 | 294 | return $result; |
| 293 | 295 | } |
@@ -308,8 +310,9 @@ discard block |
||
| 308 | 310 | |
| 309 | 311 | public function run(JsUtils $js){ |
| 310 | 312 | $result= parent::run($js); |
| 311 | - if(isset($this->_footer)) |
|
| 312 | - $this->_footer->run($js); |
|
| 313 | + if(isset($this->_footer)) { |
|
| 314 | + $this->_footer->run($js); |
|
| 315 | + } |
|
| 313 | 316 | return $result; |
| 314 | 317 | } |
| 315 | 318 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | protected $_compileParts; |
| 32 | 32 | protected $_toolbarPosition; |
| 33 | 33 | |
| 34 | - public function run(JsUtils $js){ |
|
| 35 | - if($this->_hasCheckboxes && isset($js)){ |
|
| 34 | + public function run(JsUtils $js) { |
|
| 35 | + if ($this->_hasCheckboxes && isset($js)) { |
|
| 36 | 36 | $js->execOn("change", "#".$this->identifier." [name='selection[]']", " |
| 37 | 37 | var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true; |
| 38 | 38 | \$checkbox.each(function() {if($(this).prop('checked')){allUnchecked = false;}else{allChecked = false;}}); |
@@ -41,21 +41,21 @@ discard block |
||
| 41 | 41 | parent::run($js); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
| 45 | - parent::__construct($identifier, $model,$modelInstance); |
|
| 44 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 45 | + parent::__construct($identifier, $model, $modelInstance); |
|
| 46 | 46 | $this->_instanceViewer=new InstanceViewer(); |
| 47 | - $this->content=["table"=>new HtmlTable($identifier, 0,0)]; |
|
| 47 | + $this->content=["table"=>new HtmlTable($identifier, 0, 0)]; |
|
| 48 | 48 | $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 51 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 52 | 52 | $this->_instanceViewer->setInstance($this->_model); |
| 53 | 53 | $captions=$this->_instanceViewer->getCaptions(); |
| 54 | 54 | |
| 55 | 55 | $table=$this->content["table"]; |
| 56 | 56 | |
| 57 | - if($this->_hasCheckboxes){ |
|
| 58 | - $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
|
| 57 | + if ($this->_hasCheckboxes) { |
|
| 58 | + $ck=new HtmlCheckbox("main-ck-".$this->identifier, ""); |
|
| 59 | 59 | $ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);"); |
| 60 | 60 | $ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);"); |
| 61 | 61 | \array_unshift($captions, $ck); |
@@ -63,44 +63,44 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $table->setRowCount(0, \sizeof($captions)); |
| 65 | 65 | $table->setHeaderValues($captions); |
| 66 | - if(isset($this->_compileParts)) |
|
| 66 | + if (isset($this->_compileParts)) |
|
| 67 | 67 | $table->setCompileParts($this->_compileParts); |
| 68 | - if(isset($this->_searchField)){ |
|
| 69 | - if(isset($js)) |
|
| 70 | - $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 68 | + if (isset($this->_searchField)) { |
|
| 69 | + if (isset($js)) |
|
| 70 | + $this->_searchField->postOn("change", $this->_urls, "{'s':$(this).val()}", "-#".$this->identifier." tbody", ["preventDefault"=>false]); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $this->_generateContent($table); |
| 74 | 74 | |
| 75 | - if($this->_hasCheckboxes){ |
|
| 76 | - if($table->hasPart("thead")) |
|
| 77 | - $table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort"); |
|
| 75 | + if ($this->_hasCheckboxes) { |
|
| 76 | + if ($table->hasPart("thead")) |
|
| 77 | + $table->getHeader()->getCell(0, 0)->addToProperty("class", "no-sort"); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
|
| 80 | + if (isset($this->_pagination) && $this->_pagination->getVisible()) { |
|
| 81 | 81 | $this->_generatePagination($table); |
| 82 | 82 | } |
| 83 | - if(isset($this->_toolbar)){ |
|
| 83 | + if (isset($this->_toolbar)) { |
|
| 84 | 84 | $this->_setToolbarPosition($table, $captions); |
| 85 | 85 | } |
| 86 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
| 87 | - return parent::compile($js,$view); |
|
| 86 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
| 87 | + return parent::compile($js, $view); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - private function _generateContent($table){ |
|
| 90 | + private function _generateContent($table) { |
|
| 91 | 91 | $objects=$this->_modelInstance; |
| 92 | - if(isset($this->_pagination)){ |
|
| 92 | + if (isset($this->_pagination)) { |
|
| 93 | 93 | $objects=$this->_pagination->getObjects($this->_modelInstance); |
| 94 | 94 | } |
| 95 | 95 | InstanceViewer::setIndex(0); |
| 96 | - $table->fromDatabaseObjects($objects, function($instance){ |
|
| 96 | + $table->fromDatabaseObjects($objects, function($instance) { |
|
| 97 | 97 | $this->_instanceViewer->setInstance($instance); |
| 98 | 98 | InstanceViewer::$index++; |
| 99 | - $result= $this->_instanceViewer->getValues(); |
|
| 100 | - if($this->_hasCheckboxes){ |
|
| 101 | - $ck=new HtmlCheckbox("ck-".$this->identifier,""); |
|
| 99 | + $result=$this->_instanceViewer->getValues(); |
|
| 100 | + if ($this->_hasCheckboxes) { |
|
| 101 | + $ck=new HtmlCheckbox("ck-".$this->identifier, ""); |
|
| 102 | 102 | $field=$ck->getField(); |
| 103 | - $field->setProperty("value",$this->_instanceViewer->getIdentifier()); |
|
| 103 | + $field->setProperty("value", $this->_instanceViewer->getIdentifier()); |
|
| 104 | 104 | $field->setProperty("name", "selection[]"); |
| 105 | 105 | \array_unshift($result, $ck); |
| 106 | 106 | } |
@@ -108,25 +108,25 @@ discard block |
||
| 108 | 108 | }); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - private function _generatePagination($table){ |
|
| 111 | + private function _generatePagination($table) { |
|
| 112 | 112 | $footer=$table->getFooter(); |
| 113 | 113 | $footer->mergeCol(); |
| 114 | - $menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers()); |
|
| 114 | + $menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers()); |
|
| 115 | 115 | $menu->floatRight(); |
| 116 | 116 | $menu->setActiveItem($this->_pagination->getPage()-1); |
| 117 | 117 | $footer->setValues($menu); |
| 118 | - $menu->postOnClick($this->_urls,"{'p':$(this).attr('data-page')}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 118 | + $menu->postOnClick($this->_urls, "{'p':$(this).attr('data-page')}", "-#".$this->identifier." tbody", ["preventDefault"=>false]); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - private function _setToolbarPosition($table,$captions){ |
|
| 122 | - switch ($this->_toolbarPosition){ |
|
| 121 | + private function _setToolbarPosition($table, $captions) { |
|
| 122 | + switch ($this->_toolbarPosition) { |
|
| 123 | 123 | case PositionInTable::BEFORETABLE:case PositionInTable::AFTERTABLE: |
| 124 | - if(isset($this->_compileParts)===false){ |
|
| 124 | + if (isset($this->_compileParts)===false) { |
|
| 125 | 125 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
| 126 | 126 | } |
| 127 | 127 | break; |
| 128 | 128 | case PositionInTable::HEADER:case PositionInTable::FOOTER: case PositionInTable::BODY: |
| 129 | - $this->addToolbarRow($this->_toolbarPosition,$table, $captions); |
|
| 129 | + $this->addToolbarRow($this->_toolbarPosition, $table, $captions); |
|
| 130 | 130 | break; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | * @param callable $callback function called after the field compilation |
| 139 | 139 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 140 | 140 | */ |
| 141 | - public function afterCompile($index,$callback){ |
|
| 142 | - $this->_instanceViewer->afterCompile($index,$callback); |
|
| 141 | + public function afterCompile($index, $callback) { |
|
| 142 | + $this->_instanceViewer->afterCompile($index, $callback); |
|
| 143 | 143 | return $this; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - private function addToolbarRow($part,$table,$captions){ |
|
| 146 | + private function addToolbarRow($part, $table, $captions) { |
|
| 147 | 147 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 148 | 148 | $row->mergeCol(); |
| 149 | 149 | $row->setValues([$this->_toolbar]); |
@@ -158,42 +158,42 @@ discard block |
||
| 158 | 158 | return $this; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - public function setCaptions($captions){ |
|
| 161 | + public function setCaptions($captions) { |
|
| 162 | 162 | $this->_instanceViewer->setCaptions($captions); |
| 163 | 163 | return $this; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - public function setFields($fields){ |
|
| 166 | + public function setFields($fields) { |
|
| 167 | 167 | $this->_instanceViewer->setVisibleProperties($fields); |
| 168 | 168 | return $this; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function addField($field){ |
|
| 171 | + public function addField($field) { |
|
| 172 | 172 | $this->_instanceViewer->addField($field); |
| 173 | 173 | return $this; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function insertField($index,$field){ |
|
| 176 | + public function insertField($index, $field) { |
|
| 177 | 177 | $this->_instanceViewer->insertField($index, $field); |
| 178 | 178 | return $this; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function insertInField($index,$field){ |
|
| 181 | + public function insertInField($index, $field) { |
|
| 182 | 182 | $this->_instanceViewer->insertInField($index, $field); |
| 183 | 183 | return $this; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - public function setValueFunction($index,$callback){ |
|
| 186 | + public function setValueFunction($index, $callback) { |
|
| 187 | 187 | $this->_instanceViewer->setValueFunction($index, $callback); |
| 188 | 188 | return $this; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - public function setIdentifierFunction($callback){ |
|
| 191 | + public function setIdentifierFunction($callback) { |
|
| 192 | 192 | $this->_instanceViewer->setIdentifierFunction($callback); |
| 193 | 193 | return $this; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - public function getHtmlComponent(){ |
|
| 196 | + public function getHtmlComponent() { |
|
| 197 | 197 | return $this->content["table"]; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | return $this; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function paginate($items_per_page=10,$page=1){ |
|
| 210 | - $this->_pagination=new Pagination($items_per_page,4,$page); |
|
| 209 | + public function paginate($items_per_page=10, $page=1) { |
|
| 210 | + $this->_pagination=new Pagination($items_per_page, 4, $page); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | public function getHasCheckboxes() { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | return $this; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - public function refresh($compileParts=["tbody"]){ |
|
| 222 | + public function refresh($compileParts=["tbody"]) { |
|
| 223 | 223 | $this->_compileParts=$compileParts; |
| 224 | 224 | return $this; |
| 225 | 225 | } |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | * @param callable $callback |
| 229 | 229 | * @return callable |
| 230 | 230 | */ |
| 231 | - private function getFieldButtonCallable($caption,$callback=null){ |
|
| 232 | - return $this->getCallable("getFieldButton",[$caption],$callback); |
|
| 231 | + private function getFieldButtonCallable($caption, $callback=null) { |
|
| 232 | + return $this->getCallable("getFieldButton", [$caption], $callback); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -237,16 +237,16 @@ discard block |
||
| 237 | 237 | * @param callable $callback |
| 238 | 238 | * @return callable |
| 239 | 239 | */ |
| 240 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
| 241 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
| 242 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
| 243 | - if(isset($callback)){ |
|
| 244 | - if(\is_callable($callback)){ |
|
| 245 | - $callback($object,$instance); |
|
| 240 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
| 241 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
| 242 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
| 243 | + if (isset($callback)) { |
|
| 244 | + if (\is_callable($callback)) { |
|
| 245 | + $callback($object, $instance); |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - if($object instanceof HtmlSemDoubleElement){ |
|
| 249 | - $object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier()); |
|
| 248 | + if ($object instanceof HtmlSemDoubleElement) { |
|
| 249 | + $object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier()); |
|
| 250 | 250 | } |
| 251 | 251 | return $object; |
| 252 | 252 | }; |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | * @param string $caption |
| 258 | 258 | * @return HtmlButton |
| 259 | 259 | */ |
| 260 | - private function getFieldButton($caption){ |
|
| 261 | - return new HtmlButton("",$caption); |
|
| 260 | + private function getFieldButton($caption) { |
|
| 261 | + return new HtmlButton("", $caption); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | * @param callable $callback |
| 268 | 268 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 269 | 269 | */ |
| 270 | - public function addFieldButton($caption,$callback=null){ |
|
| 271 | - $this->addField($this->getCallable("getFieldButton",[$caption],$callback)); |
|
| 270 | + public function addFieldButton($caption, $callback=null) { |
|
| 271 | + $this->addField($this->getCallable("getFieldButton", [$caption], $callback)); |
|
| 272 | 272 | return $this; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | * @param callable $callback |
| 280 | 280 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 281 | 281 | */ |
| 282 | - public function insertFieldButton($index,$caption,$callback=null){ |
|
| 283 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 282 | + public function insertFieldButton($index, $caption, $callback=null) { |
|
| 283 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 284 | 284 | return $this; |
| 285 | 285 | } |
| 286 | 286 | |
@@ -291,53 +291,53 @@ discard block |
||
| 291 | 291 | * @param callable $callback |
| 292 | 292 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 293 | 293 | */ |
| 294 | - public function insertInFieldButton($index,$caption,$callback=null){ |
|
| 295 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 294 | + public function insertInFieldButton($index, $caption, $callback=null) { |
|
| 295 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 296 | 296 | return $this; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - private function addDefaultButton($icon,$class=null,$callback=null){ |
|
| 300 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 299 | + private function addDefaultButton($icon, $class=null, $callback=null) { |
|
| 300 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 301 | 301 | return $this; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){ |
|
| 305 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 304 | + private function insertDefaultButtonIn($index, $icon, $class=null, $callback=null) { |
|
| 305 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 306 | 306 | return $this; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - private function getDefaultButton($icon,$class=null){ |
|
| 309 | + private function getDefaultButton($icon, $class=null) { |
|
| 310 | 310 | $bt=$this->getFieldButton(""); |
| 311 | 311 | $bt->asIcon($icon); |
| 312 | - if(isset($class)) |
|
| 312 | + if (isset($class)) |
|
| 313 | 313 | $bt->addToProperty("class", $class); |
| 314 | 314 | return $bt; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - public function addDeleteButton($callback=null){ |
|
| 318 | - return $this->addDefaultButton("remove","delete red basic",$callback); |
|
| 317 | + public function addDeleteButton($callback=null) { |
|
| 318 | + return $this->addDefaultButton("remove", "delete red basic", $callback); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - public function addEditButton($callback=null){ |
|
| 322 | - return $this->addDefaultButton("edit","edit basic",$callback); |
|
| 321 | + public function addEditButton($callback=null) { |
|
| 322 | + return $this->addDefaultButton("edit", "edit basic", $callback); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - public function addEditDeleteButtons($callbackEdit=null,$callbackDelete=null){ |
|
| 325 | + public function addEditDeleteButtons($callbackEdit=null, $callbackDelete=null) { |
|
| 326 | 326 | $this->addEditButton($callbackEdit); |
| 327 | 327 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
| 328 | - $this->insertDeleteButtonIn($index,$callbackDelete); |
|
| 328 | + $this->insertDeleteButtonIn($index, $callbackDelete); |
|
| 329 | 329 | return $this; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - public function insertDeleteButtonIn($index,$callback=null){ |
|
| 333 | - return $this->insertDefaultButtonIn($index,"remove","delete red basic",$callback); |
|
| 332 | + public function insertDeleteButtonIn($index, $callback=null) { |
|
| 333 | + return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $callback); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - public function insertEditButtonIn($index,$callback=null){ |
|
| 337 | - return $this->insertDefaultButtonIn($index,"edit","edit basic",$callback); |
|
| 336 | + public function insertEditButtonIn($index, $callback=null) { |
|
| 337 | + return $this->insertDefaultButtonIn($index, "edit", "edit basic", $callback); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - public function setSelectable(){ |
|
| 340 | + public function setSelectable() { |
|
| 341 | 341 | $this->content["table"]->setSelectable(); |
| 342 | 342 | return $this; |
| 343 | 343 | } |
@@ -345,8 +345,8 @@ discard block |
||
| 345 | 345 | /** |
| 346 | 346 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
| 347 | 347 | */ |
| 348 | - public function getToolbar(){ |
|
| 349 | - if(isset($this->_toolbar)===false){ |
|
| 348 | + public function getToolbar() { |
|
| 349 | + if (isset($this->_toolbar)===false) { |
|
| 350 | 350 | $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
| 351 | 351 | $this->_toolbar->setSecondary(); |
| 352 | 352 | } |
@@ -358,37 +358,37 @@ discard block |
||
| 358 | 358 | * @param mixed $element |
| 359 | 359 | * @return \Ajax\common\html\HtmlDoubleElement |
| 360 | 360 | */ |
| 361 | - public function addInToolbar($element){ |
|
| 361 | + public function addInToolbar($element) { |
|
| 362 | 362 | $tb=$this->getToolbar(); |
| 363 | 363 | return $tb->addItem($element); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - public function addItemInToolbar($caption,$icon=NULL){ |
|
| 366 | + public function addItemInToolbar($caption, $icon=NULL) { |
|
| 367 | 367 | $result=$this->addInToolbar($caption); |
| 368 | 368 | $result->addIcon($icon); |
| 369 | 369 | return $result; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - public function addButtonInToolbar($caption){ |
|
| 373 | - $bt=new HtmlButton("",$caption); |
|
| 372 | + public function addButtonInToolbar($caption) { |
|
| 373 | + $bt=new HtmlButton("", $caption); |
|
| 374 | 374 | return $this->addInToolbar($bt); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){ |
|
| 378 | - $bt=new HtmlButton("",$caption); |
|
| 379 | - $bt->addIcon($icon,$before,$labeled); |
|
| 377 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
| 378 | + $bt=new HtmlButton("", $caption); |
|
| 379 | + $bt->addIcon($icon, $before, $labeled); |
|
| 380 | 380 | return $this->addInToolbar($bt); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | |
| 384 | - public function addSearchInToolbar(){ |
|
| 384 | + public function addSearchInToolbar() { |
|
| 385 | 385 | return $this->addInToolbar($this->getSearchField())->setPosition("right"); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - public function getSearchField(){ |
|
| 389 | - if(isset($this->_searchField)===false){ |
|
| 390 | - $this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search..."); |
|
| 391 | - $this->_searchField->addIcon("search",Direction::RIGHT); |
|
| 388 | + public function getSearchField() { |
|
| 389 | + if (isset($this->_searchField)===false) { |
|
| 390 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
| 391 | + $this->_searchField->addIcon("search", Direction::RIGHT); |
|
| 392 | 392 | } |
| 393 | 393 | return $this->_searchField; |
| 394 | 394 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | return $this; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - protected function _getFieldIdentifier($prefix){ |
|
| 401 | + protected function _getFieldIdentifier($prefix) { |
|
| 402 | 402 | return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
| 403 | 403 | } |
| 404 | 404 | |