| @@ 242-259 (lines=18) @@ | ||
| 239 | * |
|
| 240 | * @return $this |
|
| 241 | */ |
|
| 242 | public function button($style = 'default') |
|
| 243 | { |
|
| 244 | if (is_array($style)) { |
|
| 245 | $style = array_map(function ($style) { |
|
| 246 | return 'btn-'.$style; |
|
| 247 | }, $style); |
|
| 248 | ||
| 249 | $style = implode(' ', $style); |
|
| 250 | } elseif (is_string($style)) { |
|
| 251 | $style = 'btn-'.$style; |
|
| 252 | } |
|
| 253 | ||
| 254 | $callback = "<span class='btn $style'>{value}</span>"; |
|
| 255 | ||
| 256 | $this->htmlCallback($callback); |
|
| 257 | ||
| 258 | return $this; |
|
| 259 | } |
|
| 260 | ||
| 261 | /** |
|
| 262 | * Wrap value as a progressbar. |
|
| @@ 270-295 (lines=26) @@ | ||
| 267 | * |
|
| 268 | * @return $this |
|
| 269 | */ |
|
| 270 | public function progressBar($style = 'primary', $size = 'sm', $max = 100) |
|
| 271 | { |
|
| 272 | if (is_array($style)) { |
|
| 273 | $style = array_map(function ($style) { |
|
| 274 | return 'progress-bar-'.$style; |
|
| 275 | }, $style); |
|
| 276 | ||
| 277 | $style = implode(' ', $style); |
|
| 278 | } elseif (is_string($style)) { |
|
| 279 | $style = 'progress-bar-'.$style; |
|
| 280 | } |
|
| 281 | ||
| 282 | $callback = <<<EOT |
|
| 283 | ||
| 284 | <div class="progress progress-$size"> |
|
| 285 | <div class="progress-bar $style" role="progressbar" aria-valuenow="{value}" aria-valuemin="0" aria-valuemax="$max" style="width: {value}%"> |
|
| 286 | <span class="sr-only">{value}</span> |
|
| 287 | </div> |
|
| 288 | </div> |
|
| 289 | ||
| 290 | EOT; |
|
| 291 | ||
| 292 | $this->htmlCallback($callback); |
|
| 293 | ||
| 294 | return $this; |
|
| 295 | } |
|
| 296 | ||
| 297 | /** |
|
| 298 | * Wrap value as a image. |
|