1 <?php
2 /**
3 * Panel.php
4 *
5 * @author Elvyrra SAS
6 * @license http://rem.mit-license.org/ MIT
7 */
8
9 namespace Hawk\View\Plugins;
10
11 /**
12 * This class is used to display a panel in a view
13 *
14 * @package View\Plugins
15 */
16 class Panel extends \Hawk\ViewPlugin{
17 /**
18 * The 'id' attribute of the panel
19 */
20 public $id,
21
22 /**
23 * The panel title
24 *
25 * @var string
26 */
27 $title,
28
29 /**
30 * The panel title icon
31 *
32 * @var string
33 */
34 $icon,
35
36 /**
37 * The panel content
38 *
39 * @var string
40 */
41 $content,
42
43 /**
44 * The panel type : 'default', 'info', 'primary', 'success', 'warning', or 'danger'
45 *
46 * @var string
47 */
48 $type;
49
50 /**
51 * Display the panel
52 *
53 * @return string the displayed HTML
54 */
55 public function display(){
56 if(!$this->id) {
57 $this->id = uniqid();
58 }
59
60 return \Hawk\View::make(
61 \Hawk\Theme::getSelected()->getView('panel.tpl'), array(
62 'id' => $this->id,
63 'title' => $this->title,
64 'icon' => $this->icon,
65 'content' => $this->content,
66 'type' => $this->type ? $this->type : 'default'
67 )
68 );
69 }
70 }
71