@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function __construct($identifier, $rowCount, $colCount) { |
| 27 | 27 | parent::__construct($identifier, "table", "ui table"); |
| 28 | - $this->content=array (); |
|
| 28 | + $this->content=array(); |
|
| 29 | 29 | $this->setRowCount($rowCount, $colCount); |
| 30 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 31 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
| 30 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 31 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
| 32 | 32 | $this->_afterCompileEvents=[]; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * @return HtmlTableContent |
| 47 | 47 | */ |
| 48 | 48 | public function getPart($key) { |
| 49 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 49 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 50 | 50 | $this->content[$key]=new HtmlTableContent("", $key); |
| 51 | - if ($key !== "tbody") { |
|
| 51 | + if ($key!=="tbody") { |
|
| 52 | 52 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @return boolean |
| 86 | 86 | */ |
| 87 | 87 | public function hasPart($key) { |
| 88 | - return \array_key_exists($key, $this->content) === true; |
|
| 88 | + return \array_key_exists($key, $this->content)===true; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | private function colAlign($colIndex, $function) { |
| 192 | 192 | if (\is_array($colIndex)) { |
| 193 | - foreach ( $colIndex as $cIndex ) { |
|
| 193 | + foreach ($colIndex as $cIndex) { |
|
| 194 | 194 | $this->colAlign($cIndex, $function); |
| 195 | 195 | } |
| 196 | 196 | } else { |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 230 | 230 | */ |
| 231 | 231 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 232 | - if(\sizeof($this->_compileParts)<3){ |
|
| 232 | + if (\sizeof($this->_compileParts)<3) { |
|
| 233 | 233 | $this->_template="%content%"; |
| 234 | 234 | $this->refresh(); |
| 235 | - }else{ |
|
| 235 | + } else { |
|
| 236 | 236 | if ($this->propertyContains("class", "sortable")) { |
| 237 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
| 237 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | $this->content=JArray::sortAssociative($this->content, $this->_compileParts); |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | public function fromDatabaseObject($object, $function) { |
| 251 | 251 | $result=$function($object); |
| 252 | 252 | if (\is_array($result)) { |
| 253 | - $result= $this->addRow($function($object)); |
|
| 253 | + $result=$this->addRow($function($object)); |
|
| 254 | 254 | } else { |
| 255 | - $result= $this->getBody()->_addRow($result); |
|
| 255 | + $result=$this->getBody()->_addRow($result); |
|
| 256 | 256 | } |
| 257 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
| 258 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 259 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 257 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
| 258 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 259 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
| 260 | 260 | } |
| 261 | 261 | return $result; |
| 262 | 262 | } |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | return $this; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - public function refresh(){ |
|
| 273 | + public function refresh() { |
|
| 274 | 274 | $this->_footer=$this->getFooter(); |
| 275 | 275 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public function run(JsUtils $js){ |
|
| 279 | - $result= parent::run($js); |
|
| 280 | - if(isset($this->_footer)) |
|
| 278 | + public function run(JsUtils $js) { |
|
| 279 | + $result=parent::run($js); |
|
| 280 | + if (isset($this->_footer)) |
|
| 281 | 281 | $this->_footer->run($js); |
| 282 | 282 | return $result; |
| 283 | 283 | } |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Ajax\semantic\html\collections\table\traits; |
| 3 | 3 | |
| 4 | -trait TableTrait{ |
|
| 4 | +trait TableTrait { |
|
| 5 | 5 | /** |
| 6 | 6 | * @return HtmlTable |
| 7 | 7 | */ |
| 8 | 8 | abstract protected function getTable(); |
| 9 | 9 | |
| 10 | - protected function addToPropertyTable($property,$value){ |
|
| 10 | + protected function addToPropertyTable($property, $value) { |
|
| 11 | 11 | return $this->getTable()->addToProperty($property, $value); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | public function setBasic($very=false) { |
| 19 | 19 | $table=$this->getTable(); |
| 20 | 20 | if ($very) |
| 21 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 22 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 21 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 22 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function setCollapsing() { |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | protected $_hasCheckboxes; |
| 31 | 31 | protected $_compileParts; |
| 32 | 32 | |
| 33 | - public function run(JsUtils $js){ |
|
| 34 | - if($this->_hasCheckboxes && isset($js)){ |
|
| 33 | + public function run(JsUtils $js) { |
|
| 34 | + if ($this->_hasCheckboxes && isset($js)) { |
|
| 35 | 35 | $js->execOn("change", "#".$this->identifier." [name='selection[]']", " |
| 36 | 36 | var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true; |
| 37 | 37 | \$checkbox.each(function() {if($(this).prop('checked')){allUnchecked = false;}else{allChecked = false;}}); |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | parent::run($js); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
| 44 | - parent::__construct($identifier, $model,$modelInstance); |
|
| 43 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 44 | + parent::__construct($identifier, $model, $modelInstance); |
|
| 45 | 45 | $this->_instanceViewer=new InstanceViewer($identifier); |
| 46 | - $this->content=["table"=>new HtmlTable($identifier, 0,0)]; |
|
| 46 | + $this->content=["table"=>new HtmlTable($identifier, 0, 0)]; |
|
| 47 | 47 | $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 59 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 60 | 60 | $this->_instanceViewer->setInstance($this->_model); |
| 61 | 61 | $captions=$this->_instanceViewer->getCaptions(); |
| 62 | 62 | |
| 63 | 63 | $table=$this->content["table"]; |
| 64 | 64 | |
| 65 | - if($this->_hasCheckboxes){ |
|
| 66 | - $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
|
| 65 | + if ($this->_hasCheckboxes) { |
|
| 66 | + $ck=new HtmlCheckbox("main-ck-".$this->identifier, ""); |
|
| 67 | 67 | $ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);"); |
| 68 | 68 | $ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);"); |
| 69 | 69 | \array_unshift($captions, $ck); |
@@ -71,44 +71,44 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $table->setRowCount(0, \sizeof($captions)); |
| 73 | 73 | $table->setHeaderValues($captions); |
| 74 | - if(isset($this->_compileParts)) |
|
| 74 | + if (isset($this->_compileParts)) |
|
| 75 | 75 | $table->setCompileParts($this->_compileParts); |
| 76 | - if(isset($this->_searchField)){ |
|
| 77 | - if(isset($js)) |
|
| 78 | - $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 76 | + if (isset($this->_searchField)) { |
|
| 77 | + if (isset($js)) |
|
| 78 | + $this->_searchField->postOn("change", $this->_urls, "{'s':$(this).val()}", "-#".$this->identifier." tbody", ["preventDefault"=>false]); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $this->_generateContent($table); |
| 82 | 82 | |
| 83 | - if($this->_hasCheckboxes){ |
|
| 84 | - if($table->hasPart("thead")) |
|
| 85 | - $table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort"); |
|
| 83 | + if ($this->_hasCheckboxes) { |
|
| 84 | + if ($table->hasPart("thead")) |
|
| 85 | + $table->getHeader()->getCell(0, 0)->addToProperty("class", "no-sort"); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
|
| 88 | + if (isset($this->_pagination) && $this->_pagination->getVisible()) { |
|
| 89 | 89 | $this->_generatePagination($table); |
| 90 | 90 | } |
| 91 | - if(isset($this->_toolbar)){ |
|
| 91 | + if (isset($this->_toolbar)) { |
|
| 92 | 92 | $this->_setToolbarPosition($table, $captions); |
| 93 | 93 | } |
| 94 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
| 95 | - return parent::compile($js,$view); |
|
| 94 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
| 95 | + return parent::compile($js, $view); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - protected function _generateContent($table){ |
|
| 98 | + protected function _generateContent($table) { |
|
| 99 | 99 | $objects=$this->_modelInstance; |
| 100 | - if(isset($this->_pagination)){ |
|
| 100 | + if (isset($this->_pagination)) { |
|
| 101 | 101 | $objects=$this->_pagination->getObjects($this->_modelInstance); |
| 102 | 102 | } |
| 103 | 103 | InstanceViewer::setIndex(0); |
| 104 | - $table->fromDatabaseObjects($objects, function($instance){ |
|
| 104 | + $table->fromDatabaseObjects($objects, function($instance) { |
|
| 105 | 105 | $this->_instanceViewer->setInstance($instance); |
| 106 | 106 | InstanceViewer::$index++; |
| 107 | - $result= $this->_instanceViewer->getValues(); |
|
| 108 | - if($this->_hasCheckboxes){ |
|
| 109 | - $ck=new HtmlCheckbox("ck-".$this->identifier,""); |
|
| 107 | + $result=$this->_instanceViewer->getValues(); |
|
| 108 | + if ($this->_hasCheckboxes) { |
|
| 109 | + $ck=new HtmlCheckbox("ck-".$this->identifier, ""); |
|
| 110 | 110 | $field=$ck->getField(); |
| 111 | - $field->setProperty("value",$this->_instanceViewer->getIdentifier()); |
|
| 111 | + $field->setProperty("value", $this->_instanceViewer->getIdentifier()); |
|
| 112 | 112 | $field->setProperty("name", "selection[]"); |
| 113 | 113 | \array_unshift($result, $ck); |
| 114 | 114 | } |
@@ -116,25 +116,25 @@ discard block |
||
| 116 | 116 | }); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - private function _generatePagination($table){ |
|
| 119 | + private function _generatePagination($table) { |
|
| 120 | 120 | $footer=$table->getFooter(); |
| 121 | 121 | $footer->mergeCol(); |
| 122 | - $menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers()); |
|
| 122 | + $menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers()); |
|
| 123 | 123 | $menu->floatRight(); |
| 124 | 124 | $menu->setActiveItem($this->_pagination->getPage()-1); |
| 125 | 125 | $footer->setValues($menu); |
| 126 | - $menu->postOnClick($this->_urls,"{'p':$(this).attr('data-page')}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 126 | + $menu->postOnClick($this->_urls, "{'p':$(this).attr('data-page')}", "-#".$this->identifier." tbody", ["preventDefault"=>false]); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - protected function _setToolbarPosition($table,$captions=NULL){ |
|
| 130 | - switch ($this->_toolbarPosition){ |
|
| 129 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
| 130 | + switch ($this->_toolbarPosition) { |
|
| 131 | 131 | case PositionInTable::BEFORETABLE:case PositionInTable::AFTERTABLE: |
| 132 | - if(isset($this->_compileParts)===false){ |
|
| 132 | + if (isset($this->_compileParts)===false) { |
|
| 133 | 133 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
| 134 | 134 | } |
| 135 | 135 | break; |
| 136 | 136 | case PositionInTable::HEADER:case PositionInTable::FOOTER: case PositionInTable::BODY: |
| 137 | - $this->addToolbarRow($this->_toolbarPosition,$table, $captions); |
|
| 137 | + $this->addToolbarRow($this->_toolbarPosition, $table, $captions); |
|
| 138 | 138 | break; |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -146,18 +146,18 @@ discard block |
||
| 146 | 146 | * @param callable $callback function called after the field compilation |
| 147 | 147 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 148 | 148 | */ |
| 149 | - public function afterCompile($index,$callback){ |
|
| 150 | - $this->_instanceViewer->afterCompile($index,$callback); |
|
| 149 | + public function afterCompile($index, $callback) { |
|
| 150 | + $this->_instanceViewer->afterCompile($index, $callback); |
|
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - private function addToolbarRow($part,$table,$captions){ |
|
| 154 | + private function addToolbarRow($part, $table, $captions) { |
|
| 155 | 155 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 156 | 156 | $row->mergeCol(); |
| 157 | 157 | $row->setValues([$this->_toolbar]); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function getHtmlComponent(){ |
|
| 160 | + public function getHtmlComponent() { |
|
| 161 | 161 | return $this->content["table"]; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | return $this; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - public function paginate($items_per_page=10,$page=1){ |
|
| 174 | - $this->_pagination=new Pagination($items_per_page,4,$page); |
|
| 173 | + public function paginate($items_per_page=10, $page=1) { |
|
| 174 | + $this->_pagination=new Pagination($items_per_page, 4, $page); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function getHasCheckboxes() { |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | return $this; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - public function refresh($compileParts=["tbody"]){ |
|
| 186 | + public function refresh($compileParts=["tbody"]) { |
|
| 187 | 187 | $this->_compileParts=$compileParts; |
| 188 | 188 | return $this; |
| 189 | 189 | } |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | * @param callable $callback |
| 193 | 193 | * @return callable |
| 194 | 194 | */ |
| 195 | - private function getFieldButtonCallable($caption,$callback=null){ |
|
| 196 | - return $this->getCallable("getFieldButton",[$caption],$callback); |
|
| 195 | + private function getFieldButtonCallable($caption, $callback=null) { |
|
| 196 | + return $this->getCallable("getFieldButton", [$caption], $callback); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -201,16 +201,16 @@ discard block |
||
| 201 | 201 | * @param callable $callback |
| 202 | 202 | * @return callable |
| 203 | 203 | */ |
| 204 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
| 205 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
| 206 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
| 207 | - if(isset($callback)){ |
|
| 208 | - if(\is_callable($callback)){ |
|
| 209 | - $callback($object,$instance); |
|
| 204 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
| 205 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
| 206 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
| 207 | + if (isset($callback)) { |
|
| 208 | + if (\is_callable($callback)) { |
|
| 209 | + $callback($object, $instance); |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | - if($object instanceof HtmlSemDoubleElement){ |
|
| 213 | - $object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier()); |
|
| 212 | + if ($object instanceof HtmlSemDoubleElement) { |
|
| 213 | + $object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier()); |
|
| 214 | 214 | } |
| 215 | 215 | return $object; |
| 216 | 216 | }; |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | * @param string $caption |
| 222 | 222 | * @return HtmlButton |
| 223 | 223 | */ |
| 224 | - private function getFieldButton($caption){ |
|
| 225 | - return new HtmlButton("",$caption); |
|
| 224 | + private function getFieldButton($caption) { |
|
| 225 | + return new HtmlButton("", $caption); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | * @param callable $callback |
| 232 | 232 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 233 | 233 | */ |
| 234 | - public function addFieldButton($caption,$callback=null){ |
|
| 235 | - $this->addField($this->getCallable("getFieldButton",[$caption],$callback)); |
|
| 234 | + public function addFieldButton($caption, $callback=null) { |
|
| 235 | + $this->addField($this->getCallable("getFieldButton", [$caption], $callback)); |
|
| 236 | 236 | return $this; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | * @param callable $callback |
| 244 | 244 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 245 | 245 | */ |
| 246 | - public function insertFieldButton($index,$caption,$callback=null){ |
|
| 247 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 246 | + public function insertFieldButton($index, $caption, $callback=null) { |
|
| 247 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 248 | 248 | return $this; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -255,60 +255,60 @@ discard block |
||
| 255 | 255 | * @param callable $callback |
| 256 | 256 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 257 | 257 | */ |
| 258 | - public function insertInFieldButton($index,$caption,$callback=null){ |
|
| 259 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 258 | + public function insertInFieldButton($index, $caption, $callback=null) { |
|
| 259 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 260 | 260 | return $this; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - private function addDefaultButton($icon,$class=null,$callback=null){ |
|
| 264 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 263 | + private function addDefaultButton($icon, $class=null, $callback=null) { |
|
| 264 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 265 | 265 | return $this; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){ |
|
| 269 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 268 | + private function insertDefaultButtonIn($index, $icon, $class=null, $callback=null) { |
|
| 269 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 270 | 270 | return $this; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - private function getDefaultButton($icon,$class=null){ |
|
| 273 | + private function getDefaultButton($icon, $class=null) { |
|
| 274 | 274 | $bt=$this->getFieldButton(""); |
| 275 | 275 | $bt->asIcon($icon); |
| 276 | - if(isset($class)) |
|
| 276 | + if (isset($class)) |
|
| 277 | 277 | $bt->addToProperty("class", $class); |
| 278 | 278 | return $bt; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - public function addDeleteButton($callback=null){ |
|
| 282 | - return $this->addDefaultButton("remove","delete red basic",$callback); |
|
| 281 | + public function addDeleteButton($callback=null) { |
|
| 282 | + return $this->addDefaultButton("remove", "delete red basic", $callback); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - public function addEditButton($callback=null){ |
|
| 286 | - return $this->addDefaultButton("edit","edit basic",$callback); |
|
| 285 | + public function addEditButton($callback=null) { |
|
| 286 | + return $this->addDefaultButton("edit", "edit basic", $callback); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - public function addEditDeleteButtons($callbackEdit=null,$callbackDelete=null){ |
|
| 289 | + public function addEditDeleteButtons($callbackEdit=null, $callbackDelete=null) { |
|
| 290 | 290 | $this->addEditButton($callbackEdit); |
| 291 | 291 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
| 292 | - $this->insertDeleteButtonIn($index,$callbackDelete); |
|
| 292 | + $this->insertDeleteButtonIn($index, $callbackDelete); |
|
| 293 | 293 | return $this; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - public function insertDeleteButtonIn($index,$callback=null){ |
|
| 297 | - return $this->insertDefaultButtonIn($index,"remove","delete red basic",$callback); |
|
| 296 | + public function insertDeleteButtonIn($index, $callback=null) { |
|
| 297 | + return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $callback); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - public function insertEditButtonIn($index,$callback=null){ |
|
| 301 | - return $this->insertDefaultButtonIn($index,"edit","edit basic",$callback); |
|
| 300 | + public function insertEditButtonIn($index, $callback=null) { |
|
| 301 | + return $this->insertDefaultButtonIn($index, "edit", "edit basic", $callback); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - public function addSearchInToolbar($position=Direction::RIGHT){ |
|
| 304 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
| 305 | 305 | return $this->addInToolbar($this->getSearchField())->setPosition($position); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - public function getSearchField(){ |
|
| 309 | - if(isset($this->_searchField)===false){ |
|
| 310 | - $this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search..."); |
|
| 311 | - $this->_searchField->addIcon("search",Direction::RIGHT); |
|
| 308 | + public function getSearchField() { |
|
| 309 | + if (isset($this->_searchField)===false) { |
|
| 310 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
| 311 | + $this->_searchField->addIcon("search", Direction::RIGHT); |
|
| 312 | 312 | } |
| 313 | 313 | return $this->_searchField; |
| 314 | 314 | } |