PluginProbe
WP Ultimate Post Grid / 1.7.2
WP Ultimate Post Grid v1.7.2
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 / date.php

date.php in WP Ultimate Post Grid 1.7.2, at vendor/vafpress/classes/control/field/date.php

112 lines 2.0 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_Date extends VP_Control_Field
4 {
5
6 private $_min_date;
7
8 private $_max_date;
9
10 private $_format;
11
12 public function __construct()
13 {
14 parent::__construct();
15 }
16
17 public static function withArray($arr = array(), $class_name = null)
18 {
19 if(is_null($class_name))
20 $instance = new self();
21 else
22 $instance = new $class_name;
23 $instance->_basic_make($arr);
24 $instance->set_min_date(isset($arr['min_date']) ? $arr['min_date'] : '');
25 $instance->set_max_date(isset($arr['max_date']) ? $arr['max_date'] : '');
26 $instance->set_format(isset($arr['format']) ? $arr['format'] : 'yy-mm-dd');
27 return $instance;
28 }
29
30 protected function _setup_data()
31 {
32 $opt = array(
33 'minDate' => $this->get_min_date(),
34 'maxDate' => $this->get_max_date(),
35 'dateFormat' => $this->get_format(),
36 'value' => $this->get_value()
37 );
38 $this->add_data('opt', VP_Util_Text::make_opt($opt));
39 parent::_setup_data();
40 }
41
42 public function render($is_compact = false)
43 {
44 // Setup Data
45 $this->_setup_data();
46 $this->add_data('is_compact', $is_compact);
47 return VP_View::instance()->load('control/date', $this->get_data());
48 }
49
50 /**
51 * Get Minimum Date
52 *
53 * @return String Minimum Date
54 */
55 public function get_min_date() {
56 return $this->_min_date;
57 }
58
59 /**
60 * Set Minimum Date
61 *
62 * @param String $_min_date Minimum Date
63 */
64 public function set_min_date($_min_date) {
65 $this->_min_date = $_min_date;
66 return $this;
67 }
68
69 /**
70 * Get Maximum Date
71 *
72 * @return String Maximum Date
73 */
74 public function get_max_date() {
75 return $this->_max_date;
76 }
77
78 /**
79 * Set Maximum Date
80 *
81 * @param String $_max_date Maximum Date
82 */
83 public function set_max_date($_max_date) {
84 $this->_max_date = $_max_date;
85 return $this;
86 }
87
88
89 /**
90 * Get Date Format
91 *
92 * @return String Date format
93 */
94 public function get_format() {
95 return $this->_format;
96 }
97
98 /**
99 * Set Date Format
100 *
101 * @param String $_format Date format
102 */
103 public function set_format($_format) {
104 $this->_format = $_format;
105 return $this;
106 }
107
108 }
109
110 /**
111 * EOF
112 */