PluginProbe
WP Ultimate Post Grid / 2.6.0
WP Ultimate Post Grid v2.6.0
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / vendor / vafpress / classes / control / field / notebox.php

notebox.php in WP Ultimate Post Grid 2.6.0, at vendor/vafpress/classes/control/field/notebox.php

96 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class VP_Control_Field_NoteBox extends VP_Control_Field
4 {
5
6 /**
7 * Status of message, can be one of these:
8 * - normal
9 * - info
10 * - warning
11 * - error
12 * - success
13 * @var String
14 */
15 protected $_status;
16
17 public function __construct()
18 {
19 parent::__construct();
20 }
21
22 public static function withArray($arr = array(), $class_name = null)
23 {
24 if(is_null($class_name))
25 $instance = new self();
26 else
27 $instance = new $class_name;
28 $instance->_basic_make($arr);
29 return $instance;
30 }
31
32 protected function _basic_make($arr)
33 {
34 parent::_basic_make($arr);
35 $this->set_status(isset($arr['status']) ? $arr['status'] : 'normal');
36 }
37
38 protected function _setup_data()
39 {
40 switch ($this->get_status())
41 {
42 case 'normal':
43 $this->add_container_extra_classes('note-normal');
44 break;
45 case 'info':
46 $this->add_container_extra_classes('note-info');
47 break;
48 case 'warning':
49 $this->add_container_extra_classes('note-warning');
50 break;
51 case 'error':
52 $this->add_container_extra_classes('note-error');
53 break;
54 case 'success':
55 $this->add_container_extra_classes('note-success');
56 break;
57 default:
58 $this->add_container_extra_classes('note-normal');
59 break;
60 }
61 $this->add_data('status', $this->get_status());
62 parent::_setup_data();
63 }
64
65 public function render($is_compact = false)
66 {
67 // Setup Data
68 $this->_setup_data();
69 $this->add_data('is_compact', $is_compact);
70 return VP_View::instance()->load('control/notebox', $this->get_data());
71 }
72
73 /**
74 * Get the status of message
75 *
76 * @return String Status of message
77 */
78 public function get_status() {
79 return $this->_status;
80 }
81
82 /**
83 * Set the status of message
84 *
85 * @param String $_status Status of message
86 */
87 public function set_status($_status) {
88 $this->_status = $_status;
89 return $this;
90 }
91
92 }
93
94 /**
95 * EOF
96 */