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