@@ -68,8 +68,9 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $table->setRowCount(0, \sizeof($captions)); |
| 70 | 70 | $table->setHeaderValues($captions); |
| 71 | - if(isset($this->_compileParts)) |
|
| 72 | - $table->setCompileParts($this->_compileParts); |
|
| 71 | + if(isset($this->_compileParts)) { |
|
| 72 | + $table->setCompileParts($this->_compileParts); |
|
| 73 | + } |
|
| 73 | 74 | if(isset($this->_searchField) && isset($js)){ |
| 74 | 75 | $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
| 75 | 76 | } |
@@ -275,8 +276,9 @@ discard block |
||
| 275 | 276 | private function getDefaultButton($icon,$class=null){ |
| 276 | 277 | $bt=$this->getFieldButton(""); |
| 277 | 278 | $bt->asIcon($icon); |
| 278 | - if(isset($class)) |
|
| 279 | - $bt->addToProperty("class", $class); |
|
| 279 | + if(isset($class)) { |
|
| 280 | + $bt->addToProperty("class", $class); |
|
| 281 | + } |
|
| 280 | 282 | return $bt; |
| 281 | 283 | } |
| 282 | 284 | |
@@ -40,6 +40,10 @@ discard block |
||
| 40 | 40 | parent::run($js); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $identifier |
|
| 45 | + * @param string $model |
|
| 46 | + */ |
|
| 43 | 47 | public function __construct($identifier,$model,$modelInstance=NULL) { |
| 44 | 48 | parent::__construct($identifier, $model,$modelInstance); |
| 45 | 49 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false); |
@@ -151,6 +155,9 @@ discard block |
||
| 151 | 155 | return $this; |
| 152 | 156 | } |
| 153 | 157 | |
| 158 | + /** |
|
| 159 | + * @param PositionInTable $part |
|
| 160 | + */ |
|
| 154 | 161 | private function addToolbarRow($part,$table,$captions){ |
| 155 | 162 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 156 | 163 | $row->mergeCol(); |
@@ -190,7 +197,7 @@ discard block |
||
| 190 | 197 | /** |
| 191 | 198 | * @param string $caption |
| 192 | 199 | * @param callable $callback |
| 193 | - * @return callable |
|
| 200 | + * @return \Closure |
|
| 194 | 201 | */ |
| 195 | 202 | private function getFieldButtonCallable($caption,$callback=null){ |
| 196 | 203 | return $this->getCallable("getFieldButton",[$caption],$callback); |
@@ -198,9 +205,9 @@ discard block |
||
| 198 | 205 | |
| 199 | 206 | /** |
| 200 | 207 | * @param callable $thisCallback |
| 201 | - * @param array $parameters |
|
| 208 | + * @param string[] $parameters |
|
| 202 | 209 | * @param callable $callback |
| 203 | - * @return callable |
|
| 210 | + * @return \Closure |
|
| 204 | 211 | */ |
| 205 | 212 | private function getCallable($thisCallback,$parameters,$callback=null){ |
| 206 | 213 | $result=function($instance) use($thisCallback,$parameters,$callback){ |
@@ -261,11 +268,19 @@ discard block |
||
| 261 | 268 | return $this; |
| 262 | 269 | } |
| 263 | 270 | |
| 271 | + /** |
|
| 272 | + * @param string $icon |
|
| 273 | + * @param string $class |
|
| 274 | + */ |
|
| 264 | 275 | private function addDefaultButton($icon,$class=null,$callback=null){ |
| 265 | 276 | $this->addField($this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
| 266 | 277 | return $this; |
| 267 | 278 | } |
| 268 | 279 | |
| 280 | + /** |
|
| 281 | + * @param string $icon |
|
| 282 | + * @param string $class |
|
| 283 | + */ |
|
| 269 | 284 | private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){ |
| 270 | 285 | $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
| 271 | 286 | return $this; |
@@ -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,9 +40,9 @@ 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); |
|
| 45 | - $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false); |
|
| 43 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 44 | + parent::__construct($identifier, $model, $modelInstance); |
|
| 45 | + $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -54,61 +54,61 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 57 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 58 | 58 | $this->_instanceViewer->setInstance($this->_model); |
| 59 | 59 | $captions=$this->_instanceViewer->getCaptions(); |
| 60 | 60 | |
| 61 | 61 | $table=$this->content["table"]; |
| 62 | 62 | |
| 63 | - if($this->_hasCheckboxes){ |
|
| 63 | + if ($this->_hasCheckboxes) { |
|
| 64 | 64 | $this->_generateMainCheckbox($captions); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $table->setRowCount(0, \sizeof($captions)); |
| 68 | 68 | $table->setHeaderValues($captions); |
| 69 | - if(isset($this->_compileParts)) |
|
| 69 | + if (isset($this->_compileParts)) |
|
| 70 | 70 | $table->setCompileParts($this->_compileParts); |
| 71 | - if(isset($this->_searchField) && isset($js)){ |
|
| 72 | - $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 71 | + if (isset($this->_searchField) && isset($js)) { |
|
| 72 | + $this->_searchField->postOn("change", $this->_urls, "{'s':$(this).val()}", "-#".$this->identifier." tbody", ["preventDefault"=>false]); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $this->_generateContent($table); |
| 76 | 76 | |
| 77 | - if($this->_hasCheckboxes && $table->hasPart("thead")){ |
|
| 78 | - $table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort"); |
|
| 77 | + if ($this->_hasCheckboxes && $table->hasPart("thead")) { |
|
| 78 | + $table->getHeader()->getCell(0, 0)->addToProperty("class", "no-sort"); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
|
| 81 | + if (isset($this->_pagination) && $this->_pagination->getVisible()) { |
|
| 82 | 82 | $this->_generatePagination($table); |
| 83 | 83 | } |
| 84 | - if(isset($this->_toolbar)){ |
|
| 84 | + if (isset($this->_toolbar)) { |
|
| 85 | 85 | $this->_setToolbarPosition($table, $captions); |
| 86 | 86 | } |
| 87 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
| 88 | - return parent::compile($js,$view); |
|
| 87 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
| 88 | + return parent::compile($js, $view); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - private function _generateMainCheckbox(&$captions){ |
|
| 92 | - $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
|
| 91 | + private function _generateMainCheckbox(&$captions) { |
|
| 92 | + $ck=new HtmlCheckbox("main-ck-".$this->identifier, ""); |
|
| 93 | 93 | $ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);"); |
| 94 | 94 | $ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);"); |
| 95 | 95 | \array_unshift($captions, $ck); |
| 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,28 +116,28 @@ 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: |
| 132 | 132 | case PositionInTable::AFTERTABLE: |
| 133 | - if(isset($this->_compileParts)===false){ |
|
| 133 | + if (isset($this->_compileParts)===false) { |
|
| 134 | 134 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
| 135 | 135 | } |
| 136 | 136 | break; |
| 137 | 137 | case PositionInTable::HEADER: |
| 138 | 138 | case PositionInTable::FOOTER: |
| 139 | 139 | case PositionInTable::BODY: |
| 140 | - $this->addToolbarRow($this->_toolbarPosition,$table, $captions); |
|
| 140 | + $this->addToolbarRow($this->_toolbarPosition, $table, $captions); |
|
| 141 | 141 | break; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -149,18 +149,18 @@ discard block |
||
| 149 | 149 | * @param callable $callback function called after the field compilation |
| 150 | 150 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 151 | 151 | */ |
| 152 | - public function afterCompile($index,$callback){ |
|
| 153 | - $this->_instanceViewer->afterCompile($index,$callback); |
|
| 152 | + public function afterCompile($index, $callback) { |
|
| 153 | + $this->_instanceViewer->afterCompile($index, $callback); |
|
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - private function addToolbarRow($part,$table,$captions){ |
|
| 157 | + private function addToolbarRow($part, $table, $captions) { |
|
| 158 | 158 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 159 | 159 | $row->mergeCol(); |
| 160 | 160 | $row->setValues([$this->_toolbar]); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - public function getHtmlComponent(){ |
|
| 163 | + public function getHtmlComponent() { |
|
| 164 | 164 | return $this->content["table"]; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | return $this; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function paginate($items_per_page=10,$page=1){ |
|
| 177 | - $this->_pagination=new Pagination($items_per_page,4,$page); |
|
| 176 | + public function paginate($items_per_page=10, $page=1) { |
|
| 177 | + $this->_pagination=new Pagination($items_per_page, 4, $page); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | public function getHasCheckboxes() { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | return $this; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - public function refresh($compileParts=["tbody"]){ |
|
| 189 | + public function refresh($compileParts=["tbody"]) { |
|
| 190 | 190 | $this->_compileParts=$compileParts; |
| 191 | 191 | return $this; |
| 192 | 192 | } |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | * @param callable $callback |
| 196 | 196 | * @return callable |
| 197 | 197 | */ |
| 198 | - private function getFieldButtonCallable($caption,$callback=null){ |
|
| 199 | - return $this->getCallable("getFieldButton",[$caption],$callback); |
|
| 198 | + private function getFieldButtonCallable($caption, $callback=null) { |
|
| 199 | + return $this->getCallable("getFieldButton", [$caption], $callback); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -205,16 +205,16 @@ discard block |
||
| 205 | 205 | * @param callable $callback |
| 206 | 206 | * @return callable |
| 207 | 207 | */ |
| 208 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
| 209 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
| 210 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
| 211 | - if(isset($callback)){ |
|
| 212 | - if(\is_callable($callback)){ |
|
| 213 | - $callback($object,$instance); |
|
| 208 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
| 209 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
| 210 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
| 211 | + if (isset($callback)) { |
|
| 212 | + if (\is_callable($callback)) { |
|
| 213 | + $callback($object, $instance); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | - if($object instanceof HtmlSemDoubleElement){ |
|
| 217 | - $object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier()); |
|
| 216 | + if ($object instanceof HtmlSemDoubleElement) { |
|
| 217 | + $object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier()); |
|
| 218 | 218 | } |
| 219 | 219 | return $object; |
| 220 | 220 | }; |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | * @param string $caption |
| 226 | 226 | * @return HtmlButton |
| 227 | 227 | */ |
| 228 | - private function getFieldButton($caption){ |
|
| 229 | - return new HtmlButton("",$caption); |
|
| 228 | + private function getFieldButton($caption) { |
|
| 229 | + return new HtmlButton("", $caption); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | * @param callable $callback |
| 236 | 236 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 237 | 237 | */ |
| 238 | - public function addFieldButton($caption,$callback=null){ |
|
| 239 | - $this->addField($this->getCallable("getFieldButton",[$caption],$callback)); |
|
| 238 | + public function addFieldButton($caption, $callback=null) { |
|
| 239 | + $this->addField($this->getCallable("getFieldButton", [$caption], $callback)); |
|
| 240 | 240 | return $this; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | * @param callable $callback |
| 248 | 248 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 249 | 249 | */ |
| 250 | - public function insertFieldButton($index,$caption,$callback=null){ |
|
| 251 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 250 | + public function insertFieldButton($index, $caption, $callback=null) { |
|
| 251 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 252 | 252 | return $this; |
| 253 | 253 | } |
| 254 | 254 | |
@@ -259,60 +259,60 @@ discard block |
||
| 259 | 259 | * @param callable $callback |
| 260 | 260 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 261 | 261 | */ |
| 262 | - public function insertInFieldButton($index,$caption,$callback=null){ |
|
| 263 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 262 | + public function insertInFieldButton($index, $caption, $callback=null) { |
|
| 263 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 264 | 264 | return $this; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - private function addDefaultButton($icon,$class=null,$callback=null){ |
|
| 268 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 267 | + private function addDefaultButton($icon, $class=null, $callback=null) { |
|
| 268 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 269 | 269 | return $this; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){ |
|
| 273 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 272 | + private function insertDefaultButtonIn($index, $icon, $class=null, $callback=null) { |
|
| 273 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 274 | 274 | return $this; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - private function getDefaultButton($icon,$class=null){ |
|
| 277 | + private function getDefaultButton($icon, $class=null) { |
|
| 278 | 278 | $bt=$this->getFieldButton(""); |
| 279 | 279 | $bt->asIcon($icon); |
| 280 | - if(isset($class)) |
|
| 280 | + if (isset($class)) |
|
| 281 | 281 | $bt->addToProperty("class", $class); |
| 282 | 282 | return $bt; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - public function addDeleteButton($callback=null){ |
|
| 286 | - return $this->addDefaultButton("remove","delete red basic",$callback); |
|
| 285 | + public function addDeleteButton($callback=null) { |
|
| 286 | + return $this->addDefaultButton("remove", "delete red basic", $callback); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - public function addEditButton($callback=null){ |
|
| 290 | - return $this->addDefaultButton("edit","edit basic",$callback); |
|
| 289 | + public function addEditButton($callback=null) { |
|
| 290 | + return $this->addDefaultButton("edit", "edit basic", $callback); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - public function addEditDeleteButtons($callbackEdit=null,$callbackDelete=null){ |
|
| 293 | + public function addEditDeleteButtons($callbackEdit=null, $callbackDelete=null) { |
|
| 294 | 294 | $this->addEditButton($callbackEdit); |
| 295 | 295 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
| 296 | - $this->insertDeleteButtonIn($index,$callbackDelete); |
|
| 296 | + $this->insertDeleteButtonIn($index, $callbackDelete); |
|
| 297 | 297 | return $this; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - public function insertDeleteButtonIn($index,$callback=null){ |
|
| 301 | - return $this->insertDefaultButtonIn($index,"remove","delete red basic",$callback); |
|
| 300 | + public function insertDeleteButtonIn($index, $callback=null) { |
|
| 301 | + return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $callback); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - public function insertEditButtonIn($index,$callback=null){ |
|
| 305 | - return $this->insertDefaultButtonIn($index,"edit","edit basic",$callback); |
|
| 304 | + public function insertEditButtonIn($index, $callback=null) { |
|
| 305 | + return $this->insertDefaultButtonIn($index, "edit", "edit basic", $callback); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - public function addSearchInToolbar($position=Direction::RIGHT){ |
|
| 308 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
| 309 | 309 | return $this->addInToolbar($this->getSearchField())->setPosition($position); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - public function getSearchField(){ |
|
| 313 | - if(isset($this->_searchField)===false){ |
|
| 314 | - $this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search..."); |
|
| 315 | - $this->_searchField->addIcon("search",Direction::RIGHT); |
|
| 312 | + public function getSearchField() { |
|
| 313 | + if (isset($this->_searchField)===false) { |
|
| 314 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
| 315 | + $this->_searchField->addIcon("search", Direction::RIGHT); |
|
| 316 | 316 | } |
| 317 | 317 | return $this->_searchField; |
| 318 | 318 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function onCreate($jsCode){ |
| 53 | 53 | if(isset($this->_events["_create"])){ |
| 54 | 54 | $this->_events["_create"][]=$jsCode; |
| 55 | - }else{ |
|
| 55 | + } else{ |
|
| 56 | 56 | $this->_events["_create"]=[$jsCode]; |
| 57 | 57 | } |
| 58 | 58 | return $this; |
@@ -87,8 +87,9 @@ discard block |
||
| 87 | 87 | if(\is_array($create)){ |
| 88 | 88 | $create=\implode("", $create); |
| 89 | 89 | } |
| 90 | - if(isset($js) && $create!=="") |
|
| 91 | - $js->exec($create,true); |
|
| 90 | + if(isset($js) && $create!=="") { |
|
| 91 | + $js->exec($create,true); |
|
| 92 | + } |
|
| 92 | 93 | unset($this->_events["_create"]); |
| 93 | 94 | } |
| 94 | 95 | } |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | * @property SimpleExtComponent $_bsComponent |
| 12 | 12 | * @property string identifier |
| 13 | 13 | */ |
| 14 | -trait BaseHtmlEventsTrait{ |
|
| 14 | +trait BaseHtmlEventsTrait { |
|
| 15 | 15 | |
| 16 | - protected $_events=array (); |
|
| 16 | + protected $_events=array(); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param string $event |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * @return \Ajax\common\html\BaseHtml |
| 24 | 24 | */ |
| 25 | 25 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 26 | - if ($stopPropagation === true) { |
|
| 27 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 26 | + if ($stopPropagation===true) { |
|
| 27 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 28 | 28 | } |
| 29 | - if ($preventDefault === true) { |
|
| 30 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 29 | + if ($preventDefault===true) { |
|
| 30 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 31 | 31 | } |
| 32 | 32 | return $this->_addEvent($event, $jsCode); |
| 33 | 33 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (\is_array($this->_events[$event])) { |
| 43 | 43 | $this->_events[$event][]=$jsCode; |
| 44 | 44 | } else { |
| 45 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 45 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 46 | 46 | } |
| 47 | 47 | } else { |
| 48 | 48 | $this->_events[$event]=$jsCode; |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | return $this->onClick($jsCode); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function onCreate($jsCode){ |
|
| 73 | - if(isset($this->_events["_create"])){ |
|
| 72 | + public function onCreate($jsCode) { |
|
| 73 | + if (isset($this->_events["_create"])) { |
|
| 74 | 74 | $this->_events["_create"][]=$jsCode; |
| 75 | - }else{ |
|
| 75 | + } else { |
|
| 76 | 76 | $this->_events["_create"]=[$jsCode]; |
| 77 | 77 | } |
| 78 | 78 | return $this; |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | public function addEventsOnRun(JsUtils $js=NULL) { |
| 82 | 82 | $this->_eventsOnCreate($js); |
| 83 | 83 | if (isset($this->_bsComponent)) { |
| 84 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 84 | + foreach ($this->_events as $event => $jsCode) { |
|
| 85 | 85 | $code=$jsCode; |
| 86 | 86 | if (\is_array($jsCode)) { |
| 87 | 87 | $code=""; |
| 88 | - foreach ( $jsCode as $jsC ) { |
|
| 88 | + foreach ($jsCode as $jsC) { |
|
| 89 | 89 | if ($jsC instanceof AjaxCall) { |
| 90 | - $code.="\n" . $jsC->compile($js); |
|
| 90 | + $code.="\n".$jsC->compile($js); |
|
| 91 | 91 | } else { |
| 92 | - $code.="\n" . $jsC; |
|
| 92 | + $code.="\n".$jsC; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | $this->_bsComponent->addEvent($event, $code); |
| 99 | 99 | } |
| 100 | - $this->_events=array (); |
|
| 100 | + $this->_events=array(); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
| 105 | - if(isset($this->_events["_create"])){ |
|
| 104 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
| 105 | + if (isset($this->_events["_create"])) { |
|
| 106 | 106 | $create=$this->_events["_create"]; |
| 107 | - if(\is_array($create)){ |
|
| 107 | + if (\is_array($create)) { |
|
| 108 | 108 | $create=\implode("", $create); |
| 109 | 109 | } |
| 110 | - if(isset($js) && $create!=="") |
|
| 111 | - $js->exec($create,true); |
|
| 110 | + if (isset($js) && $create!=="") |
|
| 111 | + $js->exec($create, true); |
|
| 112 | 112 | unset($this->_events["_create"]); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @return BaseHtml |
| 123 | 123 | */ |
| 124 | 124 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 125 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 125 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 126 | 126 | $params=array_merge($params, $parameters); |
| 127 | 127 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 128 | 128 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function jsDoJquery($jqueryCall, $param="") { |
| 158 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
| 158 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function executeOnRun($jsCode) { |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | trait HtmlLinkTrait { |
| 6 | 6 | |
| 7 | - abstract public function setProperty($name,$value); |
|
| 7 | + abstract public function setProperty($name, $value); |
|
| 8 | 8 | abstract public function getProperty($name); |
| 9 | 9 | |
| 10 | 10 | public function setHref($value) { |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | public function setAttachment($toElement, $side=Side::BOTH) { |
| 16 | 16 | if (isset($toElement)) { |
| 17 | - $toElement->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 17 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 18 | 18 | } |
| 19 | - return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached")); |
|
| 19 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | trait LabeledIconTrait { |
| 14 | 14 | |
| 15 | 15 | abstract public function addToProperty($name, $value, $separator=" "); |
| 16 | - abstract public function addContent($content,$before=false); |
|
| 16 | + abstract public function addContent($content, $before=false); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Adds an icon before or after |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | * @param boolean $labeled |
| 23 | 23 | * @return \Ajax\semantic\html\elements\HtmlIcon |
| 24 | 24 | */ |
| 25 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 25 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 26 | 26 | $iconO=$icon; |
| 27 | - if(\is_string($icon)){ |
|
| 27 | + if (\is_string($icon)) { |
|
| 28 | 28 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 29 | 29 | } |
| 30 | - if($labeled!==false){ |
|
| 31 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
| 30 | + if ($labeled!==false) { |
|
| 31 | + $direction=($before===true) ? Direction::LEFT : Direction::RIGHT; |
|
| 32 | 32 | $this->addToProperty("class", $direction." labeled icon"); |
| 33 | 33 | $this->tagName="div"; |
| 34 | 34 | } |
| 35 | - $this->addContent($iconO,$before); |
|
| 35 | + $this->addContent($iconO, $before); |
|
| 36 | 36 | return $iconO; |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | \ No newline at end of file |
@@ -14,8 +14,9 @@ |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function asAvatar($caption=NULL) { |
| 17 | - if (isset($caption)) |
|
| 18 | - $this->wrap("", $caption); |
|
| 17 | + if (isset($caption)) { |
|
| 18 | + $this->wrap("", $caption); |
|
| 19 | + } |
|
| 19 | 20 | return $this->addToProperty("class", "avatar"); |
| 20 | 21 | } |
| 21 | 22 | |
@@ -7,6 +7,9 @@ |
||
| 7 | 7 | class HtmlImg extends \Ajax\common\html\html5\HtmlImg { |
| 8 | 8 | use BaseTrait; |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param string $identifier |
|
| 12 | + */ |
|
| 10 | 13 | public function __construct($identifier, $src="", $alt="") { |
| 11 | 14 | parent::__construct($identifier, $src, $alt); |
| 12 | 15 | $this->_baseClass="ui image"; |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function setContent($content) { |
| 21 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
| 21 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
| 22 | 22 | return $this; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function asIcon($icon, $title, $subHeader=NULL) { |
| 26 | - $header=new HtmlHeader("header-" . $this->identifier); |
|
| 26 | + $header=new HtmlHeader("header-".$this->identifier); |
|
| 27 | 27 | $header->asIcon($icon, $title, $subHeader); |
| 28 | - if ($this->_inverted === false) |
|
| 28 | + if ($this->_inverted===false) |
|
| 29 | 29 | $header->setInverted(); |
| 30 | 30 | return $this->setContent($header); |
| 31 | 31 | } |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function run(JsUtils $js) { |
| 44 | 44 | if ($this->_container instanceof HtmlSingleElement) |
| 45 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
| 45 | + $this->_bsComponent=$js->semantic()->dimmer("#".$this->_container->getIdentifier(), $this->_params); |
|
| 46 | 46 | return parent::run($js); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function jsShow() { |
| 50 | 50 | if (isset($this->_container)) |
| 51 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
| 51 | + return '$("#.'.$this->_container->getIdentifier().').dimmer("show");'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function setBlurring() { |
@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | public function asIcon($icon, $title, $subHeader=NULL) { |
| 26 | 26 | $header=new HtmlHeader("header-" . $this->identifier); |
| 27 | 27 | $header->asIcon($icon, $title, $subHeader); |
| 28 | - if ($this->_inverted === false) |
|
| 29 | - $header->setInverted(); |
|
| 28 | + if ($this->_inverted === false) { |
|
| 29 | + $header->setInverted(); |
|
| 30 | + } |
|
| 30 | 31 | return $this->setContent($header); |
| 31 | 32 | } |
| 32 | 33 | |
@@ -41,14 +42,16 @@ discard block |
||
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | public function run(JsUtils $js) { |
| 44 | - if ($this->_container instanceof HtmlSingleElement) |
|
| 45 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
| 45 | + if ($this->_container instanceof HtmlSingleElement) { |
|
| 46 | + $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
| 47 | + } |
|
| 46 | 48 | return parent::run($js); |
| 47 | 49 | } |
| 48 | 50 | |
| 49 | 51 | public function jsShow() { |
| 50 | - if (isset($this->_container)) |
|
| 51 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
| 52 | + if (isset($this->_container)) { |
|
| 53 | + return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
| 54 | + } |
|
| 52 | 55 | } |
| 53 | 56 | |
| 54 | 57 | public function setBlurring() { |
@@ -8,12 +8,12 @@ discard block |
||
| 8 | 8 | use Ajax\semantic\html\base\constants\Direction; |
| 9 | 9 | |
| 10 | 10 | class HtmlSearch extends HtmlSemDoubleElement { |
| 11 | - private $_elements=array (); |
|
| 12 | - private $_searchFields=array ("title" ); |
|
| 11 | + private $_elements=array(); |
|
| 12 | + private $_searchFields=array("title"); |
|
| 13 | 13 | private $_local=false; |
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $placeholder=NULL, $icon=NULL) { |
| 16 | - parent::__construct("search-" . $identifier, "div", "ui search", array ()); |
|
| 16 | + parent::__construct("search-".$identifier, "div", "ui search", array()); |
|
| 17 | 17 | $this->createField($placeholder, $icon); |
| 18 | 18 | $this->createResult(); |
| 19 | 19 | $this->_params["type"]="standard"; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | private function createResult() { |
| 35 | - $this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results"); |
|
| 35 | + $this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results"); |
|
| 36 | 36 | return $this->content["result"]; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function setUrl($url) { |
| 52 | - $this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%"; |
|
| 52 | + $this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%"; |
|
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function run(JsUtils $js) { |
| 75 | - $this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
| 75 | + $this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
| 76 | 76 | $searchFields=\json_encode($this->_searchFields); |
| 77 | 77 | $searchFields=str_ireplace("\"", "%quote%", $searchFields); |
| 78 | - $this->_params["searchFields"]="%" . $searchFields . "%"; |
|
| 79 | - if ($this->_local === true) { |
|
| 78 | + $this->_params["searchFields"]="%".$searchFields."%"; |
|
| 79 | + if ($this->_local===true) { |
|
| 80 | 80 | $this->_params["source"]="%content%"; |
| 81 | - $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";"); |
|
| 81 | + $this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";"); |
|
| 82 | 82 | } |
| 83 | - if (isset($this->_bsComponent) === false) { |
|
| 84 | - $this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params); |
|
| 83 | + if (isset($this->_bsComponent)===false) { |
|
| 84 | + $this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params); |
|
| 85 | 85 | } |
| 86 | 86 | $this->addEventsOnRun($js); |
| 87 | 87 | return $this->_bsComponent; |
@@ -21,10 +21,12 @@ |
||
| 21 | 21 | |
| 22 | 22 | private function createField($placeholder=NULL, $icon=NULL) { |
| 23 | 23 | $field=new HtmlInput($this->identifier); |
| 24 | - if (isset($placeholder)) |
|
| 25 | - $field->setPlaceholder($placeholder); |
|
| 26 | - if (isset($icon)) |
|
| 27 | - $field->addIcon($icon, Direction::RIGHT); |
|
| 24 | + if (isset($placeholder)) { |
|
| 25 | + $field->setPlaceholder($placeholder); |
|
| 26 | + } |
|
| 27 | + if (isset($icon)) { |
|
| 28 | + $field->addIcon($icon, Direction::RIGHT); |
|
| 29 | + } |
|
| 28 | 30 | //TODO check getField |
| 29 | 31 | $field->getDataField()->setClass("prompt"); |
| 30 | 32 | $this->content["field"]=$field; |
@@ -12,11 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) { |
| 14 | 14 | parent::__construct($identifier, "div", "ui progress"); |
| 15 | - if (isset($value)) |
|
| 16 | - $this->setProperty("data-percent", $value); |
|
| 15 | + if (isset($value)) { |
|
| 16 | + $this->setProperty("data-percent", $value); |
|
| 17 | + } |
|
| 17 | 18 | $this->createBar(); |
| 18 | - if (isset($label)) |
|
| 19 | - $this->setLabel($label); |
|
| 19 | + if (isset($label)) { |
|
| 20 | + $this->setLabel($label); |
|
| 21 | + } |
|
| 20 | 22 | $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
| 21 | 23 | $this->addToProperty("class", $attributes); |
| 22 | 24 | } |
@@ -111,8 +113,9 @@ discard block |
||
| 111 | 113 | * @see BaseHtml::run() |
| 112 | 114 | */ |
| 113 | 115 | public function run(JsUtils $js) { |
| 114 | - if (isset($this->_bsComponent) === false) |
|
| 115 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 116 | + if (isset($this->_bsComponent) === false) { |
|
| 117 | + $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 118 | + } |
|
| 116 | 119 | $this->addEventsOnRun($js); |
| 117 | 120 | return $this->_bsComponent; |
| 118 | 121 | } |
@@ -17,17 +17,17 @@ discard block |
||
| 17 | 17 | $this->createBar(); |
| 18 | 18 | if (isset($label)) |
| 19 | 19 | $this->setLabel($label); |
| 20 | - $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
|
| 20 | + $this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED]; |
|
| 21 | 21 | $this->addToProperty("class", $attributes); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function setLabel($label) { |
| 25 | - $this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label); |
|
| 25 | + $this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label); |
|
| 26 | 26 | return $this; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | private function createBar() { |
| 30 | - $bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress")); |
|
| 30 | + $bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress")); |
|
| 31 | 31 | $this->content["bar"]=$bar; |
| 32 | 32 | return $this; |
| 33 | 33 | } |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 64 | 64 | */ |
| 65 | 65 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 66 | - $this->content=JArray::sortAssociative($this->content, [ "bar","label" ]); |
|
| 66 | + $this->content=JArray::sortAssociative($this->content, ["bar", "label"]); |
|
| 67 | 67 | return parent::compile($js, $view); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function jsSetValue($value) { |
| 71 | - return '$("#' . $this->identifier . '").progress({value:' . $value . '});'; |
|
| 71 | + return '$("#'.$this->identifier.'").progress({value:'.$value.'});'; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function jsIncValue() { |
| 75 | - return '$("#' . $this->identifier . '").progress("increment");'; |
|
| 75 | + return '$("#'.$this->identifier.'").progress("increment");'; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function jsDecValue() { |
| 79 | - return '$("#' . $this->identifier . '").progress("decrement");'; |
|
| 79 | + return '$("#'.$this->identifier.'").progress("decrement");'; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | $percent=JArray::getDefaultValue($array, "percent", $percent); |
| 99 | 99 | $ratio=JArray::getDefaultValue($array, "ratio", $ratio); |
| 100 | 100 | } |
| 101 | - $this->_params["text"]="%{active : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio : " . \var_export($ratio, true) . "}%"; |
|
| 101 | + $this->_params["text"]="%{active : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio : ".\var_export($ratio, true)."}%"; |
|
| 102 | 102 | return $this; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | public function onChange($jsCode) { |
| 106 | - return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%"; |
|
| 106 | + return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%"; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /* |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | * @see BaseHtml::run() |
| 112 | 112 | */ |
| 113 | 113 | public function run(JsUtils $js) { |
| 114 | - if (isset($this->_bsComponent) === false) |
|
| 115 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 114 | + if (isset($this->_bsComponent)===false) |
|
| 115 | + $this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params); |
|
| 116 | 116 | $this->addEventsOnRun($js); |
| 117 | 117 | return $this->_bsComponent; |
| 118 | 118 | } |