@@ -15,107 +15,107 @@ |
||
15 | 15 | class Critical_Pages_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Critical Pages Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'critical-pages-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Critical Pages Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'critical-pages-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 20 => array( |
|
31 | - 'id' => 'reg_page_id', |
|
32 | - 'content' => $this->_reg_page_id_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'right', |
|
35 | - 'tipAdjustmentY' => -50, |
|
36 | - 'tipAdjustmentX' => 15, |
|
37 | - ), |
|
38 | - ), |
|
39 | - 30 => array( |
|
40 | - 'id' => 'txn_page_id', |
|
41 | - 'content' => $this->_txn_page_id_stop(), |
|
42 | - 'options' => array( |
|
43 | - 'tipLocation' => 'right', |
|
44 | - 'tipAdjustmentY' => -50, |
|
45 | - 'tipAdjustmentX' => 15, |
|
46 | - ), |
|
47 | - ), |
|
48 | - 40 => array( |
|
49 | - 'id' => 'thank_you_page_id', |
|
50 | - 'content' => $this->_thank_you_page_id_stop(), |
|
51 | - 'options' => array( |
|
52 | - 'tipLocation' => 'right', |
|
53 | - 'tipAdjustmentY' => -50, |
|
54 | - 'tipAdjustmentX' => 15, |
|
55 | - ), |
|
56 | - ), |
|
57 | - 50 => array( |
|
58 | - 'id' => 'cancel_page_id', |
|
59 | - 'content' => $this->_cancel_page_id_stop(), |
|
60 | - 'options' => array( |
|
61 | - 'tipLocation' => 'right', |
|
62 | - 'tipAdjustmentY' => -50, |
|
63 | - 'tipAdjustmentX' => 15, |
|
64 | - ), |
|
65 | - ), |
|
66 | - ); |
|
67 | - } |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 20 => array( |
|
31 | + 'id' => 'reg_page_id', |
|
32 | + 'content' => $this->_reg_page_id_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'right', |
|
35 | + 'tipAdjustmentY' => -50, |
|
36 | + 'tipAdjustmentX' => 15, |
|
37 | + ), |
|
38 | + ), |
|
39 | + 30 => array( |
|
40 | + 'id' => 'txn_page_id', |
|
41 | + 'content' => $this->_txn_page_id_stop(), |
|
42 | + 'options' => array( |
|
43 | + 'tipLocation' => 'right', |
|
44 | + 'tipAdjustmentY' => -50, |
|
45 | + 'tipAdjustmentX' => 15, |
|
46 | + ), |
|
47 | + ), |
|
48 | + 40 => array( |
|
49 | + 'id' => 'thank_you_page_id', |
|
50 | + 'content' => $this->_thank_you_page_id_stop(), |
|
51 | + 'options' => array( |
|
52 | + 'tipLocation' => 'right', |
|
53 | + 'tipAdjustmentY' => -50, |
|
54 | + 'tipAdjustmentX' => 15, |
|
55 | + ), |
|
56 | + ), |
|
57 | + 50 => array( |
|
58 | + 'id' => 'cancel_page_id', |
|
59 | + 'content' => $this->_cancel_page_id_stop(), |
|
60 | + 'options' => array( |
|
61 | + 'tipLocation' => 'right', |
|
62 | + 'tipAdjustmentY' => -50, |
|
63 | + 'tipAdjustmentX' => 15, |
|
64 | + ), |
|
65 | + ), |
|
66 | + ); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - protected function _start() |
|
71 | - { |
|
72 | - $content = '<h3>' . __('Critical Pages', 'event_espresso') . '</h3>'; |
|
73 | - $content .= '<p>' |
|
74 | - . __( |
|
75 | - 'This section lists the pages that Event Espresso needs in order to function. Should you wish to change a page that is used you will need to move the shortcode to the new page and then allocate it here. Otherwise your registrations will not work correctly.', |
|
76 | - 'event_espresso' |
|
77 | - ) . '</p>'; |
|
78 | - $content .= '<p>' |
|
79 | - . __( |
|
80 | - 'This section also provides a status of the page to show you at a glance if something is not right.', |
|
81 | - 'event_espresso' |
|
82 | - ) . '</p>'; |
|
83 | - return $content; |
|
84 | - } |
|
70 | + protected function _start() |
|
71 | + { |
|
72 | + $content = '<h3>' . __('Critical Pages', 'event_espresso') . '</h3>'; |
|
73 | + $content .= '<p>' |
|
74 | + . __( |
|
75 | + 'This section lists the pages that Event Espresso needs in order to function. Should you wish to change a page that is used you will need to move the shortcode to the new page and then allocate it here. Otherwise your registrations will not work correctly.', |
|
76 | + 'event_espresso' |
|
77 | + ) . '</p>'; |
|
78 | + $content .= '<p>' |
|
79 | + . __( |
|
80 | + 'This section also provides a status of the page to show you at a glance if something is not right.', |
|
81 | + 'event_espresso' |
|
82 | + ) . '</p>'; |
|
83 | + return $content; |
|
84 | + } |
|
85 | 85 | |
86 | - protected function _reg_page_id_stop() |
|
87 | - { |
|
88 | - return '<p>' |
|
89 | - . __( |
|
90 | - 'This page processes the registrations and is required, even if it is not visible in your menus. ', |
|
91 | - 'event_espresso' |
|
92 | - ) . '</p>'; |
|
93 | - } |
|
86 | + protected function _reg_page_id_stop() |
|
87 | + { |
|
88 | + return '<p>' |
|
89 | + . __( |
|
90 | + 'This page processes the registrations and is required, even if it is not visible in your menus. ', |
|
91 | + 'event_espresso' |
|
92 | + ) . '</p>'; |
|
93 | + } |
|
94 | 94 | |
95 | - protected function _txn_page_id_stop() |
|
96 | - { |
|
97 | - return '<p>' |
|
98 | - . __( |
|
99 | - 'This page processes payments. It should not be visible on your menus, and the page should not contain anything other than the shortcode.', |
|
100 | - 'event_espresso' |
|
101 | - ) . '</p>'; |
|
102 | - } |
|
95 | + protected function _txn_page_id_stop() |
|
96 | + { |
|
97 | + return '<p>' |
|
98 | + . __( |
|
99 | + 'This page processes payments. It should not be visible on your menus, and the page should not contain anything other than the shortcode.', |
|
100 | + 'event_espresso' |
|
101 | + ) . '</p>'; |
|
102 | + } |
|
103 | 103 | |
104 | - protected function _thank_you_page_id_stop() |
|
105 | - { |
|
106 | - return '<p>' |
|
107 | - . __( |
|
108 | - 'This page is displayed after a successful transaction. Feel free to add extra content to this page to personalise it!', |
|
109 | - 'event_espresso' |
|
110 | - ) . '</p>'; |
|
111 | - } |
|
104 | + protected function _thank_you_page_id_stop() |
|
105 | + { |
|
106 | + return '<p>' |
|
107 | + . __( |
|
108 | + 'This page is displayed after a successful transaction. Feel free to add extra content to this page to personalise it!', |
|
109 | + 'event_espresso' |
|
110 | + ) . '</p>'; |
|
111 | + } |
|
112 | 112 | |
113 | - protected function _cancel_page_id_stop() |
|
114 | - { |
|
115 | - return '<p>' |
|
116 | - . __( |
|
117 | - 'This page is displayed after an unsuccessful transaction. Feel free to add extra content to this page to personalise it!', |
|
118 | - 'event_espresso' |
|
119 | - ) . '</p>'; |
|
120 | - } |
|
113 | + protected function _cancel_page_id_stop() |
|
114 | + { |
|
115 | + return '<p>' |
|
116 | + . __( |
|
117 | + 'This page is displayed after an unsuccessful transaction. Feel free to add extra content to this page to personalise it!', |
|
118 | + 'event_espresso' |
|
119 | + ) . '</p>'; |
|
120 | + } |
|
121 | 121 | } |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | |
70 | 70 | protected function _start() |
71 | 71 | { |
72 | - $content = '<h3>' . __('Critical Pages', 'event_espresso') . '</h3>'; |
|
72 | + $content = '<h3>'.__('Critical Pages', 'event_espresso').'</h3>'; |
|
73 | 73 | $content .= '<p>' |
74 | 74 | . __( |
75 | 75 | 'This section lists the pages that Event Espresso needs in order to function. Should you wish to change a page that is used you will need to move the shortcode to the new page and then allocate it here. Otherwise your registrations will not work correctly.', |
76 | 76 | 'event_espresso' |
77 | - ) . '</p>'; |
|
77 | + ).'</p>'; |
|
78 | 78 | $content .= '<p>' |
79 | 79 | . __( |
80 | 80 | 'This section also provides a status of the page to show you at a glance if something is not right.', |
81 | 81 | 'event_espresso' |
82 | - ) . '</p>'; |
|
82 | + ).'</p>'; |
|
83 | 83 | return $content; |
84 | 84 | } |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | . __( |
90 | 90 | 'This page processes the registrations and is required, even if it is not visible in your menus. ', |
91 | 91 | 'event_espresso' |
92 | - ) . '</p>'; |
|
92 | + ).'</p>'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function _txn_page_id_stop() |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | . __( |
99 | 99 | 'This page processes payments. It should not be visible on your menus, and the page should not contain anything other than the shortcode.', |
100 | 100 | 'event_espresso' |
101 | - ) . '</p>'; |
|
101 | + ).'</p>'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | protected function _thank_you_page_id_stop() |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | . __( |
108 | 108 | 'This page is displayed after a successful transaction. Feel free to add extra content to this page to personalise it!', |
109 | 109 | 'event_espresso' |
110 | - ) . '</p>'; |
|
110 | + ).'</p>'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | protected function _cancel_page_id_stop() |
@@ -116,6 +116,6 @@ discard block |
||
116 | 116 | . __( |
117 | 117 | 'This page is displayed after an unsuccessful transaction. Feel free to add extra content to this page to personalise it!', |
118 | 118 | 'event_espresso' |
119 | - ) . '</p>'; |
|
119 | + ).'</p>'; |
|
120 | 120 | } |
121 | 121 | } |
@@ -15,136 +15,136 @@ |
||
15 | 15 | class Your_Organization_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Your Organization Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'your-organization-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Your Organization Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'your-organization-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - protected function _set_tour_stops() |
|
26 | - { |
|
27 | - $this->_stops = array( |
|
28 | - 10 => array( |
|
29 | - 'content' => $this->_start(), |
|
30 | - ), |
|
31 | - 30 => array( |
|
32 | - 'id' => 'contact_info_h4', |
|
33 | - 'content' => $this->_contact_information_stop(), |
|
34 | - 'options' => array( |
|
35 | - 'tipLocation' => 'left', |
|
36 | - 'tipAdjustmentY' => -50, |
|
37 | - 'tipAdjustmentX' => 15, |
|
38 | - ), |
|
39 | - ), |
|
40 | - 40 => array( |
|
41 | - 'id' => 'upload_image', |
|
42 | - 'content' => $this->_upload_image_stop(), |
|
43 | - 'options' => array( |
|
44 | - 'tipLocation' => 'right', |
|
45 | - 'tipAdjustmentY' => -50, |
|
46 | - 'tipAdjustmentX' => 15, |
|
47 | - ), |
|
48 | - ), |
|
49 | - 50 => array( |
|
50 | - 'id' => 'organization_facebook', |
|
51 | - 'content' => $this->_organization_facebook_stop(), |
|
52 | - 'options' => array( |
|
53 | - 'tipLocation' => 'right', |
|
54 | - 'tipAdjustmentY' => -50, |
|
55 | - 'tipAdjustmentX' => 15, |
|
56 | - ), |
|
57 | - ), |
|
58 | - 60 => array( |
|
59 | - 'id' => 'ueip_optin', |
|
60 | - 'content' => $this->_ueip_option_stop(), |
|
61 | - 'options' => array( |
|
62 | - 'tipLocation' => 'right', |
|
63 | - 'tipAdjustmentY' => -50, |
|
64 | - 'tipAdjustmentX' => 15, |
|
65 | - ), |
|
66 | - ), |
|
67 | - 70 => array( |
|
68 | - 'id' => 'espresso_major_buttons_wrapper', |
|
69 | - 'content' => $this->_end_tour_stop(), |
|
70 | - 'options' => array( |
|
71 | - 'tipLocation' => 'right', |
|
72 | - 'tipAdjustmentY' => -50, |
|
73 | - 'tipAdjustmentX' => 185, |
|
74 | - ), |
|
75 | - ), |
|
76 | - ); |
|
25 | + protected function _set_tour_stops() |
|
26 | + { |
|
27 | + $this->_stops = array( |
|
28 | + 10 => array( |
|
29 | + 'content' => $this->_start(), |
|
30 | + ), |
|
31 | + 30 => array( |
|
32 | + 'id' => 'contact_info_h4', |
|
33 | + 'content' => $this->_contact_information_stop(), |
|
34 | + 'options' => array( |
|
35 | + 'tipLocation' => 'left', |
|
36 | + 'tipAdjustmentY' => -50, |
|
37 | + 'tipAdjustmentX' => 15, |
|
38 | + ), |
|
39 | + ), |
|
40 | + 40 => array( |
|
41 | + 'id' => 'upload_image', |
|
42 | + 'content' => $this->_upload_image_stop(), |
|
43 | + 'options' => array( |
|
44 | + 'tipLocation' => 'right', |
|
45 | + 'tipAdjustmentY' => -50, |
|
46 | + 'tipAdjustmentX' => 15, |
|
47 | + ), |
|
48 | + ), |
|
49 | + 50 => array( |
|
50 | + 'id' => 'organization_facebook', |
|
51 | + 'content' => $this->_organization_facebook_stop(), |
|
52 | + 'options' => array( |
|
53 | + 'tipLocation' => 'right', |
|
54 | + 'tipAdjustmentY' => -50, |
|
55 | + 'tipAdjustmentX' => 15, |
|
56 | + ), |
|
57 | + ), |
|
58 | + 60 => array( |
|
59 | + 'id' => 'ueip_optin', |
|
60 | + 'content' => $this->_ueip_option_stop(), |
|
61 | + 'options' => array( |
|
62 | + 'tipLocation' => 'right', |
|
63 | + 'tipAdjustmentY' => -50, |
|
64 | + 'tipAdjustmentX' => 15, |
|
65 | + ), |
|
66 | + ), |
|
67 | + 70 => array( |
|
68 | + 'id' => 'espresso_major_buttons_wrapper', |
|
69 | + 'content' => $this->_end_tour_stop(), |
|
70 | + 'options' => array( |
|
71 | + 'tipLocation' => 'right', |
|
72 | + 'tipAdjustmentY' => -50, |
|
73 | + 'tipAdjustmentX' => 185, |
|
74 | + ), |
|
75 | + ), |
|
76 | + ); |
|
77 | 77 | |
78 | - if (is_main_site()) { |
|
79 | - $this->_stops[20] = array( |
|
80 | - 'id' => 'site_license_key', |
|
81 | - 'content' => $this->_site_license_key_stop(), |
|
82 | - 'options' => array( |
|
83 | - 'tipLocation' => 'right', |
|
84 | - 'tipAdjustmentY' => -50, |
|
85 | - 'tipAdjustmentX' => 15, |
|
86 | - ), |
|
87 | - ); |
|
88 | - } |
|
89 | - ksort($this->_stops); |
|
90 | - } |
|
78 | + if (is_main_site()) { |
|
79 | + $this->_stops[20] = array( |
|
80 | + 'id' => 'site_license_key', |
|
81 | + 'content' => $this->_site_license_key_stop(), |
|
82 | + 'options' => array( |
|
83 | + 'tipLocation' => 'right', |
|
84 | + 'tipAdjustmentY' => -50, |
|
85 | + 'tipAdjustmentX' => 15, |
|
86 | + ), |
|
87 | + ); |
|
88 | + } |
|
89 | + ksort($this->_stops); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | - protected function _start() |
|
94 | - { |
|
95 | - $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>'; |
|
96 | - $content .= '<p>' |
|
97 | - . __( |
|
98 | - 'This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
99 | - 'event_espresso' |
|
100 | - ) . '</p>'; |
|
93 | + protected function _start() |
|
94 | + { |
|
95 | + $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>'; |
|
96 | + $content .= '<p>' |
|
97 | + . __( |
|
98 | + 'This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
99 | + 'event_espresso' |
|
100 | + ) . '</p>'; |
|
101 | 101 | |
102 | - return $content; |
|
103 | - } |
|
102 | + return $content; |
|
103 | + } |
|
104 | 104 | |
105 | - protected function _site_license_key_stop() |
|
106 | - { |
|
107 | - return '<p>' |
|
108 | - . __( |
|
109 | - 'Enter your support license key here to enable one-click updates.', |
|
110 | - 'event_espresso' |
|
111 | - ) . '</p>'; |
|
112 | - } |
|
105 | + protected function _site_license_key_stop() |
|
106 | + { |
|
107 | + return '<p>' |
|
108 | + . __( |
|
109 | + 'Enter your support license key here to enable one-click updates.', |
|
110 | + 'event_espresso' |
|
111 | + ) . '</p>'; |
|
112 | + } |
|
113 | 113 | |
114 | - protected function _contact_information_stop() |
|
115 | - { |
|
116 | - return '<p>' |
|
117 | - . __( |
|
118 | - 'You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
119 | - 'event_espresso' |
|
120 | - ) . '</p>'; |
|
121 | - } |
|
114 | + protected function _contact_information_stop() |
|
115 | + { |
|
116 | + return '<p>' |
|
117 | + . __( |
|
118 | + 'You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
119 | + 'event_espresso' |
|
120 | + ) . '</p>'; |
|
121 | + } |
|
122 | 122 | |
123 | - protected function _upload_image_stop() |
|
124 | - { |
|
125 | - return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
126 | - } |
|
123 | + protected function _upload_image_stop() |
|
124 | + { |
|
125 | + return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
126 | + } |
|
127 | 127 | |
128 | - protected function _organization_facebook_stop() |
|
129 | - { |
|
130 | - return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
131 | - } |
|
128 | + protected function _organization_facebook_stop() |
|
129 | + { |
|
130 | + return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
131 | + } |
|
132 | 132 | |
133 | - protected function _ueip_option_stop() |
|
134 | - { |
|
135 | - return '<p>' |
|
136 | - . __( |
|
137 | - 'Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
138 | - 'event_espresso' |
|
139 | - ) . '</p>'; |
|
140 | - } |
|
133 | + protected function _ueip_option_stop() |
|
134 | + { |
|
135 | + return '<p>' |
|
136 | + . __( |
|
137 | + 'Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
138 | + 'event_espresso' |
|
139 | + ) . '</p>'; |
|
140 | + } |
|
141 | 141 | |
142 | - protected function _end_tour_stop() |
|
143 | - { |
|
144 | - return '<p>' |
|
145 | - . __( |
|
146 | - 'You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
147 | - 'event_espresso' |
|
148 | - ) . '</p>'; |
|
149 | - } |
|
142 | + protected function _end_tour_stop() |
|
143 | + { |
|
144 | + return '<p>' |
|
145 | + . __( |
|
146 | + 'You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
147 | + 'event_espresso' |
|
148 | + ) . '</p>'; |
|
149 | + } |
|
150 | 150 | } |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function _start() |
94 | 94 | { |
95 | - $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>'; |
|
95 | + $content = '<h3>'.__('Organization Settings', 'event_espresso').'</h3>'; |
|
96 | 96 | $content .= '<p>' |
97 | 97 | . __( |
98 | 98 | 'This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
99 | 99 | 'event_espresso' |
100 | - ) . '</p>'; |
|
100 | + ).'</p>'; |
|
101 | 101 | |
102 | 102 | return $content; |
103 | 103 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | . __( |
109 | 109 | 'Enter your support license key here to enable one-click updates.', |
110 | 110 | 'event_espresso' |
111 | - ) . '</p>'; |
|
111 | + ).'</p>'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | protected function _contact_information_stop() |
@@ -117,17 +117,17 @@ discard block |
||
117 | 117 | . __( |
118 | 118 | 'You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
119 | 119 | 'event_espresso' |
120 | - ) . '</p>'; |
|
120 | + ).'</p>'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | protected function _upload_image_stop() |
124 | 124 | { |
125 | - return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
125 | + return '<p>'.__('Add a logo. This can be used for invoices and tickets.', 'event_espresso').'</p>'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | protected function _organization_facebook_stop() |
129 | 129 | { |
130 | - return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
130 | + return '<p>'.__('Add links to various social media networks.', 'event_espresso').'</p>'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | protected function _ueip_option_stop() |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | . __( |
137 | 137 | 'Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
138 | 138 | 'event_espresso' |
139 | - ) . '</p>'; |
|
139 | + ).'</p>'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | protected function _end_tour_stop() |
@@ -145,6 +145,6 @@ discard block |
||
145 | 145 | . __( |
146 | 146 | 'You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
147 | 147 | 'event_espresso' |
148 | - ) . '</p>'; |
|
148 | + ).'</p>'; |
|
149 | 149 | } |
150 | 150 | } |
@@ -15,137 +15,137 @@ |
||
15 | 15 | class Message_Templates_Edit_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Message Template Editor Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'messages-templates-edit-joyride'; |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - protected function _set_tour_stops() |
|
26 | - { |
|
27 | - $this->_stops = array( |
|
28 | - 10 => array( |
|
29 | - 'content' => $this->_start(), |
|
30 | - ), |
|
31 | - 20 => array( |
|
32 | - 'id' => 'submit-msg-context-switcher-sbmt', |
|
33 | - 'content' => $this->_context_switcher_stop(), |
|
34 | - 'options' => array( |
|
35 | - 'tipLocation' => 'bottom', |
|
36 | - 'tipAdjustmentY' => -30, |
|
37 | - 'tipAdjustmentX' => -60, |
|
38 | - ), |
|
39 | - ), |
|
40 | - 30 => array( |
|
41 | - 'class' => 'messages-preview-button"', |
|
42 | - 'content' => $this->_preview_button_stop(), |
|
43 | - 'options' => array( |
|
44 | - 'tipLocation' => 'bottom', |
|
45 | - 'tipAdjustmentY' => -30, |
|
46 | - ), |
|
47 | - ), |
|
48 | - 40 => array( |
|
49 | - 'content' => $this->_template_area_stop(), |
|
50 | - 'options' => array( |
|
51 | - 'tipAdjustmentY' => -100, |
|
52 | - 'tipAdjustmentX' => -60, |
|
53 | - ), |
|
54 | - ), |
|
55 | - 50 => array( |
|
56 | - 'id' => 'mtp_valid_shortcodes', |
|
57 | - 'content' => $this->_mtp_valid_shortcodes_stop(), |
|
58 | - 'options' => array( |
|
59 | - 'tipLocation' => 'left', |
|
60 | - 'tipAdjustmentY' => -50, |
|
61 | - 'tipAdjustmentX' => -15, |
|
62 | - ), |
|
63 | - ), |
|
64 | - 60 => array( |
|
65 | - 'id' => 'mtp_extra_actions', |
|
66 | - 'content' => $this->_mtp_extra_actions_stop(), |
|
67 | - 'options' => array( |
|
68 | - 'tipLocation' => 'left', |
|
69 | - 'tipAdjustmentY' => -50, |
|
70 | - 'tipAdjustmentX' => -15, |
|
71 | - ), |
|
72 | - ), |
|
73 | - 70 => array( |
|
74 | - 'id' => 'espresso_espresso_messages_editor_overview', |
|
75 | - 'content' => $this->_update_metabox_stop(), |
|
76 | - 'options' => array( |
|
77 | - 'tipLocation' => 'left', |
|
78 | - 'tipAdjustmentY' => -50, |
|
79 | - 'tipAdjustmentX' => -15, |
|
80 | - ), |
|
81 | - ), |
|
82 | - ); |
|
83 | - } |
|
84 | - |
|
85 | - |
|
86 | - protected function _start() |
|
87 | - { |
|
88 | - $content = '<h3>' . __('Message Template Editor', 'event_espresso') . '</h3>'; |
|
89 | - $content .= '<p>' |
|
90 | - . __( |
|
91 | - 'This tour of the Message Template Editor page will go over different areas of the screen to help you understand what they are used for.', |
|
92 | - 'event_espresso' |
|
93 | - ) . '</p>'; |
|
94 | - return $content; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - protected function _context_switcher_stop() |
|
99 | - { |
|
100 | - return '<p>' |
|
101 | - . __( |
|
102 | - 'This dropdown allows you to swap between the different recipients templates that are available in this message type. Be sure to save changes befor switching to a different context.', |
|
103 | - 'event_espresso' |
|
104 | - ) . '</p>'; |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - protected function _preview_button_stop() |
|
109 | - { |
|
110 | - return '<p>' |
|
111 | - . __( |
|
112 | - 'Clicking this button will show you a preview of how your message will look.', |
|
113 | - 'event_espresso' |
|
114 | - ) . '</p>'; |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - protected function _template_area_stop() |
|
119 | - { |
|
120 | - return '<p>' |
|
121 | - . __( |
|
122 | - 'Depending on the messenger (recipient) and the message type, the main screen can show different boxes. Overall the screen allows you to confirm who the messages go to and who from, and the actual content of the message.', |
|
123 | - 'event_espresso' |
|
124 | - ) . '</p>'; |
|
125 | - } |
|
126 | - |
|
127 | - protected function _mtp_valid_shortcodes_stop() |
|
128 | - { |
|
129 | - return '<p>' |
|
130 | - . __( |
|
131 | - 'These shortcodes allow you to quickly add data into your messages, without touching code. From emails, to ticket details, to your company logo, building messages with shortcodes is easy and fast.', |
|
132 | - 'event_espresso' |
|
133 | - ) . '</p>'; |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - protected function _mtp_extra_actions_stop() |
|
138 | - { |
|
139 | - return '<p>' |
|
140 | - . __( |
|
141 | - 'Here you will find miscellaneous options to assist you, including a test send button and a reset button.', |
|
142 | - 'event_espresso' |
|
143 | - ) . '</p>'; |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - protected function _update_metabox_stop() |
|
148 | - { |
|
149 | - return '<p>' . __('When done creating your message, click here to save it.', 'event_espresso') . '</p>'; |
|
150 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Message Template Editor Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'messages-templates-edit-joyride'; |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + protected function _set_tour_stops() |
|
26 | + { |
|
27 | + $this->_stops = array( |
|
28 | + 10 => array( |
|
29 | + 'content' => $this->_start(), |
|
30 | + ), |
|
31 | + 20 => array( |
|
32 | + 'id' => 'submit-msg-context-switcher-sbmt', |
|
33 | + 'content' => $this->_context_switcher_stop(), |
|
34 | + 'options' => array( |
|
35 | + 'tipLocation' => 'bottom', |
|
36 | + 'tipAdjustmentY' => -30, |
|
37 | + 'tipAdjustmentX' => -60, |
|
38 | + ), |
|
39 | + ), |
|
40 | + 30 => array( |
|
41 | + 'class' => 'messages-preview-button"', |
|
42 | + 'content' => $this->_preview_button_stop(), |
|
43 | + 'options' => array( |
|
44 | + 'tipLocation' => 'bottom', |
|
45 | + 'tipAdjustmentY' => -30, |
|
46 | + ), |
|
47 | + ), |
|
48 | + 40 => array( |
|
49 | + 'content' => $this->_template_area_stop(), |
|
50 | + 'options' => array( |
|
51 | + 'tipAdjustmentY' => -100, |
|
52 | + 'tipAdjustmentX' => -60, |
|
53 | + ), |
|
54 | + ), |
|
55 | + 50 => array( |
|
56 | + 'id' => 'mtp_valid_shortcodes', |
|
57 | + 'content' => $this->_mtp_valid_shortcodes_stop(), |
|
58 | + 'options' => array( |
|
59 | + 'tipLocation' => 'left', |
|
60 | + 'tipAdjustmentY' => -50, |
|
61 | + 'tipAdjustmentX' => -15, |
|
62 | + ), |
|
63 | + ), |
|
64 | + 60 => array( |
|
65 | + 'id' => 'mtp_extra_actions', |
|
66 | + 'content' => $this->_mtp_extra_actions_stop(), |
|
67 | + 'options' => array( |
|
68 | + 'tipLocation' => 'left', |
|
69 | + 'tipAdjustmentY' => -50, |
|
70 | + 'tipAdjustmentX' => -15, |
|
71 | + ), |
|
72 | + ), |
|
73 | + 70 => array( |
|
74 | + 'id' => 'espresso_espresso_messages_editor_overview', |
|
75 | + 'content' => $this->_update_metabox_stop(), |
|
76 | + 'options' => array( |
|
77 | + 'tipLocation' => 'left', |
|
78 | + 'tipAdjustmentY' => -50, |
|
79 | + 'tipAdjustmentX' => -15, |
|
80 | + ), |
|
81 | + ), |
|
82 | + ); |
|
83 | + } |
|
84 | + |
|
85 | + |
|
86 | + protected function _start() |
|
87 | + { |
|
88 | + $content = '<h3>' . __('Message Template Editor', 'event_espresso') . '</h3>'; |
|
89 | + $content .= '<p>' |
|
90 | + . __( |
|
91 | + 'This tour of the Message Template Editor page will go over different areas of the screen to help you understand what they are used for.', |
|
92 | + 'event_espresso' |
|
93 | + ) . '</p>'; |
|
94 | + return $content; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + protected function _context_switcher_stop() |
|
99 | + { |
|
100 | + return '<p>' |
|
101 | + . __( |
|
102 | + 'This dropdown allows you to swap between the different recipients templates that are available in this message type. Be sure to save changes befor switching to a different context.', |
|
103 | + 'event_espresso' |
|
104 | + ) . '</p>'; |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + protected function _preview_button_stop() |
|
109 | + { |
|
110 | + return '<p>' |
|
111 | + . __( |
|
112 | + 'Clicking this button will show you a preview of how your message will look.', |
|
113 | + 'event_espresso' |
|
114 | + ) . '</p>'; |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + protected function _template_area_stop() |
|
119 | + { |
|
120 | + return '<p>' |
|
121 | + . __( |
|
122 | + 'Depending on the messenger (recipient) and the message type, the main screen can show different boxes. Overall the screen allows you to confirm who the messages go to and who from, and the actual content of the message.', |
|
123 | + 'event_espresso' |
|
124 | + ) . '</p>'; |
|
125 | + } |
|
126 | + |
|
127 | + protected function _mtp_valid_shortcodes_stop() |
|
128 | + { |
|
129 | + return '<p>' |
|
130 | + . __( |
|
131 | + 'These shortcodes allow you to quickly add data into your messages, without touching code. From emails, to ticket details, to your company logo, building messages with shortcodes is easy and fast.', |
|
132 | + 'event_espresso' |
|
133 | + ) . '</p>'; |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + protected function _mtp_extra_actions_stop() |
|
138 | + { |
|
139 | + return '<p>' |
|
140 | + . __( |
|
141 | + 'Here you will find miscellaneous options to assist you, including a test send button and a reset button.', |
|
142 | + 'event_espresso' |
|
143 | + ) . '</p>'; |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + protected function _update_metabox_stop() |
|
148 | + { |
|
149 | + return '<p>' . __('When done creating your message, click here to save it.', 'event_espresso') . '</p>'; |
|
150 | + } |
|
151 | 151 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function _start() |
87 | 87 | { |
88 | - $content = '<h3>' . __('Message Template Editor', 'event_espresso') . '</h3>'; |
|
88 | + $content = '<h3>'.__('Message Template Editor', 'event_espresso').'</h3>'; |
|
89 | 89 | $content .= '<p>' |
90 | 90 | . __( |
91 | 91 | 'This tour of the Message Template Editor page will go over different areas of the screen to help you understand what they are used for.', |
92 | 92 | 'event_espresso' |
93 | - ) . '</p>'; |
|
93 | + ).'</p>'; |
|
94 | 94 | return $content; |
95 | 95 | } |
96 | 96 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | . __( |
102 | 102 | 'This dropdown allows you to swap between the different recipients templates that are available in this message type. Be sure to save changes befor switching to a different context.', |
103 | 103 | 'event_espresso' |
104 | - ) . '</p>'; |
|
104 | + ).'</p>'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | . __( |
112 | 112 | 'Clicking this button will show you a preview of how your message will look.', |
113 | 113 | 'event_espresso' |
114 | - ) . '</p>'; |
|
114 | + ).'</p>'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | . __( |
122 | 122 | 'Depending on the messenger (recipient) and the message type, the main screen can show different boxes. Overall the screen allows you to confirm who the messages go to and who from, and the actual content of the message.', |
123 | 123 | 'event_espresso' |
124 | - ) . '</p>'; |
|
124 | + ).'</p>'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function _mtp_valid_shortcodes_stop() |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | . __( |
131 | 131 | 'These shortcodes allow you to quickly add data into your messages, without touching code. From emails, to ticket details, to your company logo, building messages with shortcodes is easy and fast.', |
132 | 132 | 'event_espresso' |
133 | - ) . '</p>'; |
|
133 | + ).'</p>'; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | . __( |
141 | 141 | 'Here you will find miscellaneous options to assist you, including a test send button and a reset button.', |
142 | 142 | 'event_espresso' |
143 | - ) . '</p>'; |
|
143 | + ).'</p>'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | 147 | protected function _update_metabox_stop() |
148 | 148 | { |
149 | - return '<p>' . __('When done creating your message, click here to save it.', 'event_espresso') . '</p>'; |
|
149 | + return '<p>'.__('When done creating your message, click here to save it.', 'event_espresso').'</p>'; |
|
150 | 150 | } |
151 | 151 | } |
@@ -15,112 +15,112 @@ |
||
15 | 15 | class Messages_Settings_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Messages Settings Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'messages-settings-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Messages Settings Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'messages-settings-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - protected function _set_tour_stops() |
|
26 | - { |
|
27 | - $this->_stops = array( |
|
28 | - 10 => array( |
|
29 | - 'content' => $this->_start(), |
|
30 | - ), |
|
31 | - 20 => array( |
|
32 | - 'class' => 'messenger_links', |
|
33 | - 'content' => $this->_messenger_links_stop(), |
|
34 | - 'options' => array( |
|
35 | - 'tipLocation' => 'bottom', |
|
36 | - 'tipAdjustmentX' => -5, |
|
37 | - 'tipAdjustmentY' => -25, |
|
38 | - ), |
|
39 | - ), |
|
40 | - 30 => array( |
|
41 | - 'id' => 'espresso_email_settings', |
|
42 | - 'content' => $this->_email_settings_metabox_stop(), |
|
43 | - 'options' => array( |
|
44 | - 'tipLocation' => 'top', |
|
45 | - 'tipAdjustmentX' => 20, |
|
46 | - 'tipAdjustmentY' => -30, |
|
47 | - ), |
|
48 | - ), |
|
49 | - 40 => array( |
|
50 | - 'id' => 'on-off-email', |
|
51 | - 'content' => $this->_on_off_toggle_stop(), |
|
52 | - 'options' => array( |
|
53 | - 'tipLocation' => 'left', |
|
54 | - 'tipAdjustmentY' => -50, |
|
55 | - 'tipAdjustmentX' => -15, |
|
56 | - ), |
|
57 | - ), |
|
58 | - 50 => array( |
|
59 | - 'id' => 'active-message-types', |
|
60 | - 'content' => $this->_active_mts_container_stop(), |
|
61 | - 'options' => array( |
|
62 | - 'tipLocation' => 'top', |
|
63 | - 'tipAdjustmentY' => -30, |
|
64 | - ), |
|
65 | - ), |
|
66 | - 60 => array( |
|
67 | - 'id' => 'inactive-message-types', |
|
68 | - 'content' => $this->_inactive_mts_container_stop(), |
|
69 | - 'options' => array( |
|
70 | - 'tipLocation' => 'left', |
|
71 | - 'tipAdjustmentY' => -50, |
|
72 | - 'tipAdjustmentX' => -15, |
|
73 | - ), |
|
74 | - ), |
|
75 | - ); |
|
76 | - } |
|
25 | + protected function _set_tour_stops() |
|
26 | + { |
|
27 | + $this->_stops = array( |
|
28 | + 10 => array( |
|
29 | + 'content' => $this->_start(), |
|
30 | + ), |
|
31 | + 20 => array( |
|
32 | + 'class' => 'messenger_links', |
|
33 | + 'content' => $this->_messenger_links_stop(), |
|
34 | + 'options' => array( |
|
35 | + 'tipLocation' => 'bottom', |
|
36 | + 'tipAdjustmentX' => -5, |
|
37 | + 'tipAdjustmentY' => -25, |
|
38 | + ), |
|
39 | + ), |
|
40 | + 30 => array( |
|
41 | + 'id' => 'espresso_email_settings', |
|
42 | + 'content' => $this->_email_settings_metabox_stop(), |
|
43 | + 'options' => array( |
|
44 | + 'tipLocation' => 'top', |
|
45 | + 'tipAdjustmentX' => 20, |
|
46 | + 'tipAdjustmentY' => -30, |
|
47 | + ), |
|
48 | + ), |
|
49 | + 40 => array( |
|
50 | + 'id' => 'on-off-email', |
|
51 | + 'content' => $this->_on_off_toggle_stop(), |
|
52 | + 'options' => array( |
|
53 | + 'tipLocation' => 'left', |
|
54 | + 'tipAdjustmentY' => -50, |
|
55 | + 'tipAdjustmentX' => -15, |
|
56 | + ), |
|
57 | + ), |
|
58 | + 50 => array( |
|
59 | + 'id' => 'active-message-types', |
|
60 | + 'content' => $this->_active_mts_container_stop(), |
|
61 | + 'options' => array( |
|
62 | + 'tipLocation' => 'top', |
|
63 | + 'tipAdjustmentY' => -30, |
|
64 | + ), |
|
65 | + ), |
|
66 | + 60 => array( |
|
67 | + 'id' => 'inactive-message-types', |
|
68 | + 'content' => $this->_inactive_mts_container_stop(), |
|
69 | + 'options' => array( |
|
70 | + 'tipLocation' => 'left', |
|
71 | + 'tipAdjustmentY' => -50, |
|
72 | + 'tipAdjustmentX' => -15, |
|
73 | + ), |
|
74 | + ), |
|
75 | + ); |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | - protected function _start() |
|
80 | - { |
|
81 | - $content = '<h3>' . __('Messages Settings', 'event_espresso') . '</h3>'; |
|
82 | - $content .= '<p>' |
|
83 | - . __( |
|
84 | - 'This tour of the Messages Settings page will go over different areas of the screen to help you understand what they are used for.', |
|
85 | - 'event_espresso' |
|
86 | - ) . '</p>'; |
|
87 | - return $content; |
|
88 | - } |
|
79 | + protected function _start() |
|
80 | + { |
|
81 | + $content = '<h3>' . __('Messages Settings', 'event_espresso') . '</h3>'; |
|
82 | + $content .= '<p>' |
|
83 | + . __( |
|
84 | + 'This tour of the Messages Settings page will go over different areas of the screen to help you understand what they are used for.', |
|
85 | + 'event_espresso' |
|
86 | + ) . '</p>'; |
|
87 | + return $content; |
|
88 | + } |
|
89 | 89 | |
90 | - protected function _messenger_links_stop() |
|
91 | - { |
|
92 | - return '<p>' . __('Available messengers are shown above.', 'event_espresso') . '</p>'; |
|
93 | - } |
|
90 | + protected function _messenger_links_stop() |
|
91 | + { |
|
92 | + return '<p>' . __('Available messengers are shown above.', 'event_espresso') . '</p>'; |
|
93 | + } |
|
94 | 94 | |
95 | - protected function _email_settings_metabox_stop() |
|
96 | - { |
|
97 | - return '<p>' . __('View the different message types that are currently active.', 'event_espresso') . '</p>'; |
|
98 | - } |
|
95 | + protected function _email_settings_metabox_stop() |
|
96 | + { |
|
97 | + return '<p>' . __('View the different message types that are currently active.', 'event_espresso') . '</p>'; |
|
98 | + } |
|
99 | 99 | |
100 | - protected function _on_off_toggle_stop() |
|
101 | - { |
|
102 | - return '<p>' |
|
103 | - . __( |
|
104 | - 'This toggle will turn all messages on or off for this message type.', |
|
105 | - 'event_espresso' |
|
106 | - ) . '</p>'; |
|
107 | - } |
|
100 | + protected function _on_off_toggle_stop() |
|
101 | + { |
|
102 | + return '<p>' |
|
103 | + . __( |
|
104 | + 'This toggle will turn all messages on or off for this message type.', |
|
105 | + 'event_espresso' |
|
106 | + ) . '</p>'; |
|
107 | + } |
|
108 | 108 | |
109 | - protected function _active_mts_container_stop() |
|
110 | - { |
|
111 | - return '<p>' |
|
112 | - . __( |
|
113 | - 'These are your active message types. Click them to see a description and settings for each one.', |
|
114 | - 'event_espresso' |
|
115 | - ) . '</p>'; |
|
116 | - } |
|
109 | + protected function _active_mts_container_stop() |
|
110 | + { |
|
111 | + return '<p>' |
|
112 | + . __( |
|
113 | + 'These are your active message types. Click them to see a description and settings for each one.', |
|
114 | + 'event_espresso' |
|
115 | + ) . '</p>'; |
|
116 | + } |
|
117 | 117 | |
118 | - protected function _inactive_mts_container_stop() |
|
119 | - { |
|
120 | - return '<p>' |
|
121 | - . __( |
|
122 | - 'Drag message types here to deactivate them. Drag them from here to the active box to reactivate them.', |
|
123 | - 'event_espresso' |
|
124 | - ) . '</p>'; |
|
125 | - } |
|
118 | + protected function _inactive_mts_container_stop() |
|
119 | + { |
|
120 | + return '<p>' |
|
121 | + . __( |
|
122 | + 'Drag message types here to deactivate them. Drag them from here to the active box to reactivate them.', |
|
123 | + 'event_espresso' |
|
124 | + ) . '</p>'; |
|
125 | + } |
|
126 | 126 | } |
@@ -78,23 +78,23 @@ discard block |
||
78 | 78 | |
79 | 79 | protected function _start() |
80 | 80 | { |
81 | - $content = '<h3>' . __('Messages Settings', 'event_espresso') . '</h3>'; |
|
81 | + $content = '<h3>'.__('Messages Settings', 'event_espresso').'</h3>'; |
|
82 | 82 | $content .= '<p>' |
83 | 83 | . __( |
84 | 84 | 'This tour of the Messages Settings page will go over different areas of the screen to help you understand what they are used for.', |
85 | 85 | 'event_espresso' |
86 | - ) . '</p>'; |
|
86 | + ).'</p>'; |
|
87 | 87 | return $content; |
88 | 88 | } |
89 | 89 | |
90 | 90 | protected function _messenger_links_stop() |
91 | 91 | { |
92 | - return '<p>' . __('Available messengers are shown above.', 'event_espresso') . '</p>'; |
|
92 | + return '<p>'.__('Available messengers are shown above.', 'event_espresso').'</p>'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function _email_settings_metabox_stop() |
96 | 96 | { |
97 | - return '<p>' . __('View the different message types that are currently active.', 'event_espresso') . '</p>'; |
|
97 | + return '<p>'.__('View the different message types that are currently active.', 'event_espresso').'</p>'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | protected function _on_off_toggle_stop() |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | . __( |
104 | 104 | 'This toggle will turn all messages on or off for this message type.', |
105 | 105 | 'event_espresso' |
106 | - ) . '</p>'; |
|
106 | + ).'</p>'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | protected function _active_mts_container_stop() |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | . __( |
113 | 113 | 'These are your active message types. Click them to see a description and settings for each one.', |
114 | 114 | 'event_espresso' |
115 | - ) . '</p>'; |
|
115 | + ).'</p>'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | protected function _inactive_mts_container_stop() |
@@ -121,6 +121,6 @@ discard block |
||
121 | 121 | . __( |
122 | 122 | 'Drag message types here to deactivate them. Drag them from here to the active box to reactivate them.', |
123 | 123 | 'event_espresso' |
124 | - ) . '</p>'; |
|
124 | + ).'</p>'; |
|
125 | 125 | } |
126 | 126 | } |
@@ -15,131 +15,131 @@ |
||
15 | 15 | class Messages_Overview_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Messages Overview Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'messages-overview-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Messages Overview Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'messages-overview-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - protected function _set_tour_stops() |
|
26 | - { |
|
27 | - $this->_stops = array( |
|
28 | - 10 => array( |
|
29 | - 'content' => $this->_start(), |
|
30 | - ), |
|
31 | - 20 => array( |
|
32 | - 'id' => 'event', |
|
33 | - 'content' => $this->event_column_stop(), |
|
34 | - 'options' => array( |
|
35 | - 'tipLocation' => 'top', |
|
36 | - 'tipAdjustmentX' => -5, |
|
37 | - 'tipAdjustmentY' => -30, |
|
38 | - ), |
|
39 | - ), |
|
40 | - 30 => array( |
|
41 | - 'id' => 'message_type', |
|
42 | - 'content' => $this->_message_type_column_stop(), |
|
43 | - 'options' => array( |
|
44 | - 'tipLocation' => 'top', |
|
45 | - 'tipAdjustmentX' => 20, |
|
46 | - 'tipAdjustmentY' => -30, |
|
47 | - ), |
|
48 | - ), |
|
49 | - 40 => array( |
|
50 | - 'id' => 'messenger', |
|
51 | - 'content' => $this->_messenger_column_stop(), |
|
52 | - 'options' => array( |
|
53 | - 'tipLocation' => 'top', |
|
54 | - 'tipAdjustmentX' => 5, |
|
55 | - 'tipAdjustmentY' => -30, |
|
56 | - ), |
|
57 | - ), |
|
58 | - 50 => array( |
|
59 | - 'id' => 'description', |
|
60 | - 'content' => $this->_description_column_stop(), |
|
61 | - 'options' => array( |
|
62 | - 'tipLocation' => 'top', |
|
63 | - 'tipAdjustmentX' => 5, |
|
64 | - 'tipAdjustmentY' => -30, |
|
65 | - ), |
|
66 | - ), |
|
67 | - 60 => array( |
|
68 | - 'class' => 'bulkactions', |
|
69 | - 'content' => $this->_bulk_actions_stop(), |
|
70 | - 'options' => array( |
|
71 | - 'tipLocation' => 'top', |
|
72 | - 'tipAdjustmentX' => 25, |
|
73 | - 'tipAdjustmentY' => -35, |
|
74 | - ), |
|
75 | - ), |
|
76 | - 70 => array( |
|
77 | - 'id' => 'ee_messenger_filter_by', |
|
78 | - 'content' => $this->_filters_stop(), |
|
79 | - 'options' => array( |
|
80 | - 'tipLocation' => 'top', |
|
81 | - 'tipAdjustmentX' => 25, |
|
82 | - 'tipAdjustmentY' => -30, |
|
83 | - ), |
|
84 | - ), |
|
85 | - ); |
|
86 | - } |
|
25 | + protected function _set_tour_stops() |
|
26 | + { |
|
27 | + $this->_stops = array( |
|
28 | + 10 => array( |
|
29 | + 'content' => $this->_start(), |
|
30 | + ), |
|
31 | + 20 => array( |
|
32 | + 'id' => 'event', |
|
33 | + 'content' => $this->event_column_stop(), |
|
34 | + 'options' => array( |
|
35 | + 'tipLocation' => 'top', |
|
36 | + 'tipAdjustmentX' => -5, |
|
37 | + 'tipAdjustmentY' => -30, |
|
38 | + ), |
|
39 | + ), |
|
40 | + 30 => array( |
|
41 | + 'id' => 'message_type', |
|
42 | + 'content' => $this->_message_type_column_stop(), |
|
43 | + 'options' => array( |
|
44 | + 'tipLocation' => 'top', |
|
45 | + 'tipAdjustmentX' => 20, |
|
46 | + 'tipAdjustmentY' => -30, |
|
47 | + ), |
|
48 | + ), |
|
49 | + 40 => array( |
|
50 | + 'id' => 'messenger', |
|
51 | + 'content' => $this->_messenger_column_stop(), |
|
52 | + 'options' => array( |
|
53 | + 'tipLocation' => 'top', |
|
54 | + 'tipAdjustmentX' => 5, |
|
55 | + 'tipAdjustmentY' => -30, |
|
56 | + ), |
|
57 | + ), |
|
58 | + 50 => array( |
|
59 | + 'id' => 'description', |
|
60 | + 'content' => $this->_description_column_stop(), |
|
61 | + 'options' => array( |
|
62 | + 'tipLocation' => 'top', |
|
63 | + 'tipAdjustmentX' => 5, |
|
64 | + 'tipAdjustmentY' => -30, |
|
65 | + ), |
|
66 | + ), |
|
67 | + 60 => array( |
|
68 | + 'class' => 'bulkactions', |
|
69 | + 'content' => $this->_bulk_actions_stop(), |
|
70 | + 'options' => array( |
|
71 | + 'tipLocation' => 'top', |
|
72 | + 'tipAdjustmentX' => 25, |
|
73 | + 'tipAdjustmentY' => -35, |
|
74 | + ), |
|
75 | + ), |
|
76 | + 70 => array( |
|
77 | + 'id' => 'ee_messenger_filter_by', |
|
78 | + 'content' => $this->_filters_stop(), |
|
79 | + 'options' => array( |
|
80 | + 'tipLocation' => 'top', |
|
81 | + 'tipAdjustmentX' => 25, |
|
82 | + 'tipAdjustmentY' => -30, |
|
83 | + ), |
|
84 | + ), |
|
85 | + ); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - protected function _start() |
|
90 | - { |
|
91 | - $content = '<h3>' . __('Messages Overview', 'event_espresso') . '</h3>'; |
|
92 | - $content .= '<p>' |
|
93 | - . __( |
|
94 | - 'This tour of the Messages Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
95 | - 'event_espresso' |
|
96 | - ) . '</p>'; |
|
97 | - return $content; |
|
98 | - } |
|
89 | + protected function _start() |
|
90 | + { |
|
91 | + $content = '<h3>' . __('Messages Overview', 'event_espresso') . '</h3>'; |
|
92 | + $content .= '<p>' |
|
93 | + . __( |
|
94 | + 'This tour of the Messages Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
95 | + 'event_espresso' |
|
96 | + ) . '</p>'; |
|
97 | + return $content; |
|
98 | + } |
|
99 | 99 | |
100 | - protected function event_column_stop() |
|
101 | - { |
|
102 | - return '<p>' |
|
103 | - . __( |
|
104 | - 'View if a message is associated with one event or multiple events. Can be sorted in ascending and descending order.', |
|
105 | - 'event_espresso' |
|
106 | - ) . '</p>'; |
|
107 | - } |
|
100 | + protected function event_column_stop() |
|
101 | + { |
|
102 | + return '<p>' |
|
103 | + . __( |
|
104 | + 'View if a message is associated with one event or multiple events. Can be sorted in ascending and descending order.', |
|
105 | + 'event_espresso' |
|
106 | + ) . '</p>'; |
|
107 | + } |
|
108 | 108 | |
109 | - protected function _message_type_column_stop() |
|
110 | - { |
|
111 | - return '<p>' |
|
112 | - . __( |
|
113 | - 'View the type of message. Can be sorted in ascending or descending order.', |
|
114 | - 'event_espresso' |
|
115 | - ) . '</p>'; |
|
116 | - } |
|
109 | + protected function _message_type_column_stop() |
|
110 | + { |
|
111 | + return '<p>' |
|
112 | + . __( |
|
113 | + 'View the type of message. Can be sorted in ascending or descending order.', |
|
114 | + 'event_espresso' |
|
115 | + ) . '</p>'; |
|
116 | + } |
|
117 | 117 | |
118 | - protected function _messenger_column_stop() |
|
119 | - { |
|
120 | - return '<p>' |
|
121 | - . __( |
|
122 | - 'View who messages will be sent to. Can be sorted in ascending or descending order.', |
|
123 | - 'event_espresso' |
|
124 | - ) . '</p>'; |
|
125 | - } |
|
118 | + protected function _messenger_column_stop() |
|
119 | + { |
|
120 | + return '<p>' |
|
121 | + . __( |
|
122 | + 'View who messages will be sent to. Can be sorted in ascending or descending order.', |
|
123 | + 'event_espresso' |
|
124 | + ) . '</p>'; |
|
125 | + } |
|
126 | 126 | |
127 | - protected function _description_column_stop() |
|
128 | - { |
|
129 | - return '<p>' . __('View the description for each message type.', 'event_espresso') . '</p>'; |
|
130 | - } |
|
127 | + protected function _description_column_stop() |
|
128 | + { |
|
129 | + return '<p>' . __('View the description for each message type.', 'event_espresso') . '</p>'; |
|
130 | + } |
|
131 | 131 | |
132 | - protected function _bulk_actions_stop() |
|
133 | - { |
|
134 | - return '<p>' . __('Perform bulk actions to multiple message types.', 'event_espresso') . '</p>'; |
|
135 | - } |
|
132 | + protected function _bulk_actions_stop() |
|
133 | + { |
|
134 | + return '<p>' . __('Perform bulk actions to multiple message types.', 'event_espresso') . '</p>'; |
|
135 | + } |
|
136 | 136 | |
137 | - protected function _filters_stop() |
|
138 | - { |
|
139 | - return '<p>' |
|
140 | - . __( |
|
141 | - 'You can filter by different notifications by making a selection below and clicking on the filter button. To reset your selection, just click on the reset filters button.', |
|
142 | - 'event_espresso' |
|
143 | - ) . '</p>'; |
|
144 | - } |
|
137 | + protected function _filters_stop() |
|
138 | + { |
|
139 | + return '<p>' |
|
140 | + . __( |
|
141 | + 'You can filter by different notifications by making a selection below and clicking on the filter button. To reset your selection, just click on the reset filters button.', |
|
142 | + 'event_espresso' |
|
143 | + ) . '</p>'; |
|
144 | + } |
|
145 | 145 | } |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | |
89 | 89 | protected function _start() |
90 | 90 | { |
91 | - $content = '<h3>' . __('Messages Overview', 'event_espresso') . '</h3>'; |
|
91 | + $content = '<h3>'.__('Messages Overview', 'event_espresso').'</h3>'; |
|
92 | 92 | $content .= '<p>' |
93 | 93 | . __( |
94 | 94 | 'This tour of the Messages Overview page will go over different areas of the screen to help you understand what they are used for.', |
95 | 95 | 'event_espresso' |
96 | - ) . '</p>'; |
|
96 | + ).'</p>'; |
|
97 | 97 | return $content; |
98 | 98 | } |
99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | . __( |
104 | 104 | 'View if a message is associated with one event or multiple events. Can be sorted in ascending and descending order.', |
105 | 105 | 'event_espresso' |
106 | - ) . '</p>'; |
|
106 | + ).'</p>'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | protected function _message_type_column_stop() |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | . __( |
113 | 113 | 'View the type of message. Can be sorted in ascending or descending order.', |
114 | 114 | 'event_espresso' |
115 | - ) . '</p>'; |
|
115 | + ).'</p>'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | protected function _messenger_column_stop() |
@@ -121,17 +121,17 @@ discard block |
||
121 | 121 | . __( |
122 | 122 | 'View who messages will be sent to. Can be sorted in ascending or descending order.', |
123 | 123 | 'event_espresso' |
124 | - ) . '</p>'; |
|
124 | + ).'</p>'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function _description_column_stop() |
128 | 128 | { |
129 | - return '<p>' . __('View the description for each message type.', 'event_espresso') . '</p>'; |
|
129 | + return '<p>'.__('View the description for each message type.', 'event_espresso').'</p>'; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | protected function _bulk_actions_stop() |
133 | 133 | { |
134 | - return '<p>' . __('Perform bulk actions to multiple message types.', 'event_espresso') . '</p>'; |
|
134 | + return '<p>'.__('Perform bulk actions to multiple message types.', 'event_espresso').'</p>'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | protected function _filters_stop() |
@@ -140,6 +140,6 @@ discard block |
||
140 | 140 | . __( |
141 | 141 | 'You can filter by different notifications by making a selection below and clicking on the filter button. To reset your selection, just click on the reset filters button.', |
142 | 142 | 'event_espresso' |
143 | - ) . '</p>'; |
|
143 | + ).'</p>'; |
|
144 | 144 | } |
145 | 145 | } |
@@ -1006,7 +1006,7 @@ |
||
1006 | 1006 | * @access private |
1007 | 1007 | * @param int $VNU_ID |
1008 | 1008 | * @param string $venue_status |
1009 | - * @return void |
|
1009 | + * @return boolean |
|
1010 | 1010 | */ |
1011 | 1011 | private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
1012 | 1012 | { |
@@ -17,1518 +17,1518 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * _venue |
|
22 | - * This will hold the venue object for venue_details screen. |
|
23 | - * |
|
24 | - * @access protected |
|
25 | - * @var object |
|
26 | - */ |
|
27 | - protected $_venue; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * This will hold the category object for category_details screen. |
|
32 | - * |
|
33 | - * @var object |
|
34 | - */ |
|
35 | - protected $_category; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * This property will hold the venue model instance |
|
40 | - * |
|
41 | - * @var object |
|
42 | - */ |
|
43 | - protected $_venue_model; |
|
44 | - |
|
45 | - |
|
46 | - protected function _init_page_props() |
|
47 | - { |
|
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | - $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | - $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | - $this->page_label = __('Event Venues', 'event_espresso'); |
|
53 | - $this->_cpt_model_names = array( |
|
54 | - 'create_new' => 'EEM_Venue', |
|
55 | - 'edit' => 'EEM_Venue', |
|
56 | - ); |
|
57 | - $this->_cpt_edit_routes = array( |
|
58 | - 'espresso_venues' => 'edit', |
|
59 | - ); |
|
60 | - $this->_venue_model = EEM_Venue::instance(); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - protected function _ajax_hooks() |
|
65 | - { |
|
66 | - // todo: all hooks for ee_venues ajax goes in here. |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _define_page_props() |
|
71 | - { |
|
72 | - $this->_admin_page_title = $this->page_label; |
|
73 | - $this->_labels = array( |
|
74 | - 'buttons' => array( |
|
75 | - 'add' => __('Add New Venue', 'event_espresso'), |
|
76 | - 'edit' => __('Edit Venue', 'event_espresso'), |
|
77 | - 'delete' => __('Delete Venue', 'event_espresso'), |
|
78 | - 'add_category' => __('Add New Category', 'event_espresso'), |
|
79 | - 'edit_category' => __('Edit Category', 'event_espresso'), |
|
80 | - 'delete_category' => __('Delete Category', 'event_espresso'), |
|
81 | - ), |
|
82 | - 'editor_title' => array( |
|
83 | - 'espresso_venues' => __('Enter Venue name here', 'event_espresso'), |
|
84 | - ), |
|
85 | - 'publishbox' => array( |
|
86 | - 'create_new' => __('Save New Venue', 'event_espresso'), |
|
87 | - 'edit' => __('Update Venue', 'event_espresso'), |
|
88 | - 'add_category' => __('Save New Category', 'event_espresso'), |
|
89 | - 'edit_category' => __('Update Category', 'event_espresso'), |
|
90 | - 'google_map_settings' => __('Update Settings', 'event_espresso'), |
|
91 | - ), |
|
92 | - ); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - protected function _set_page_routes() |
|
97 | - { |
|
98 | - |
|
99 | - // load formatter helper |
|
100 | - // load field generator helper |
|
101 | - |
|
102 | - // is there a vnu_id in the request? |
|
103 | - $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | - ? $this->_req_data['VNU_ID'] : 0; |
|
105 | - $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | - |
|
107 | - $this->_page_routes = array( |
|
108 | - 'default' => array( |
|
109 | - 'func' => '_overview_list_table', |
|
110 | - 'capability' => 'ee_read_venues', |
|
111 | - ), |
|
112 | - 'create_new' => array( |
|
113 | - 'func' => '_create_new_cpt_item', |
|
114 | - 'capability' => 'ee_edit_venues', |
|
115 | - ), |
|
116 | - 'edit' => array( |
|
117 | - 'func' => '_edit_cpt_item', |
|
118 | - 'capability' => 'ee_edit_venue', |
|
119 | - 'obj_id' => $vnu_id, |
|
120 | - ), |
|
121 | - 'trash_venue' => array( |
|
122 | - 'func' => '_trash_or_restore_venue', |
|
123 | - 'args' => array('venue_status' => 'trash'), |
|
124 | - 'noheader' => true, |
|
125 | - 'capability' => 'ee_delete_venue', |
|
126 | - 'obj_id' => $vnu_id, |
|
127 | - ), |
|
128 | - 'trash_venues' => array( |
|
129 | - 'func' => '_trash_or_restore_venues', |
|
130 | - 'args' => array('venue_status' => 'trash'), |
|
131 | - 'noheader' => true, |
|
132 | - 'capability' => 'ee_delete_venues', |
|
133 | - ), |
|
134 | - 'restore_venue' => array( |
|
135 | - 'func' => '_trash_or_restore_venue', |
|
136 | - 'args' => array('venue_status' => 'draft'), |
|
137 | - 'noheader' => true, |
|
138 | - 'capability' => 'ee_delete_venue', |
|
139 | - 'obj_id' => $vnu_id, |
|
140 | - ), |
|
141 | - 'restore_venues' => array( |
|
142 | - 'func' => '_trash_or_restore_venues', |
|
143 | - 'args' => array('venue_status' => 'draft'), |
|
144 | - 'noheader' => true, |
|
145 | - 'capability' => 'ee_delete_venues', |
|
146 | - ), |
|
147 | - 'delete_venues' => array( |
|
148 | - 'func' => '_delete_venues', |
|
149 | - 'noheader' => true, |
|
150 | - 'capability' => 'ee_delete_venues', |
|
151 | - ), |
|
152 | - 'delete_venue' => array( |
|
153 | - 'func' => '_delete_venue', |
|
154 | - 'noheader' => true, |
|
155 | - 'capability' => 'ee_delete_venue', |
|
156 | - 'obj_id' => $vnu_id, |
|
157 | - ), |
|
158 | - // settings related |
|
159 | - 'google_map_settings' => array( |
|
160 | - 'func' => '_google_map_settings', |
|
161 | - 'capability' => 'manage_options', |
|
162 | - ), |
|
163 | - 'update_google_map_settings' => array( |
|
164 | - 'func' => '_update_google_map_settings', |
|
165 | - 'capability' => 'manage_options', |
|
166 | - 'noheader' => true, |
|
167 | - ), |
|
168 | - // venue category tab related |
|
169 | - 'add_category' => array( |
|
170 | - 'func' => '_category_details', |
|
171 | - 'args' => array('add'), |
|
172 | - 'capability' => 'ee_edit_venue_category', |
|
173 | - ), |
|
174 | - 'edit_category' => array( |
|
175 | - 'func' => '_category_details', |
|
176 | - 'args' => array('edit'), |
|
177 | - 'capability' => 'ee_edit_venue_category', |
|
178 | - ), |
|
179 | - 'delete_categories' => array( |
|
180 | - 'func' => '_delete_categories', |
|
181 | - 'noheader' => true, |
|
182 | - 'capability' => 'ee_delete_venue_category', |
|
183 | - ), |
|
184 | - |
|
185 | - 'delete_category' => array( |
|
186 | - 'func' => '_delete_categories', |
|
187 | - 'noheader' => true, |
|
188 | - 'capability' => 'ee_delete_venue_category', |
|
189 | - ), |
|
190 | - |
|
191 | - 'insert_category' => array( |
|
192 | - 'func' => '_insert_or_update_category', |
|
193 | - 'args' => array('new_category' => true), |
|
194 | - 'noheader' => true, |
|
195 | - 'capability' => 'ee_edit_venue_category', |
|
196 | - ), |
|
197 | - |
|
198 | - 'update_category' => array( |
|
199 | - 'func' => '_insert_or_update_category', |
|
200 | - 'args' => array('new_category' => false), |
|
201 | - 'noheader' => true, |
|
202 | - 'capability' => 'ee_edit_venue_category', |
|
203 | - ), |
|
204 | - 'export_categories' => array( |
|
205 | - 'func' => '_categories_export', |
|
206 | - 'noheader' => true, |
|
207 | - 'capability' => 'export', |
|
208 | - ), |
|
209 | - 'import_categories' => array( |
|
210 | - 'func' => '_import_categories', |
|
211 | - 'capability' => 'import', |
|
212 | - ), |
|
213 | - 'category_list' => array( |
|
214 | - 'func' => '_category_list_table', |
|
215 | - 'capability' => 'ee_manage_venue_categories', |
|
216 | - ), |
|
217 | - ); |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - protected function _set_page_config() |
|
222 | - { |
|
223 | - $this->_page_config = array( |
|
224 | - 'default' => array( |
|
225 | - 'nav' => array( |
|
226 | - 'label' => __('Overview', 'event_espresso'), |
|
227 | - 'order' => 10, |
|
228 | - ), |
|
229 | - 'list_table' => 'Venues_Admin_List_Table', |
|
230 | - 'help_tabs' => array( |
|
231 | - 'venues_overview_help_tab' => array( |
|
232 | - 'title' => __('Venues Overview', 'event_espresso'), |
|
233 | - 'filename' => 'venues_overview', |
|
234 | - ), |
|
235 | - 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | - 'title' => __('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | - 'filename' => 'venues_overview_table_column_headings', |
|
238 | - ), |
|
239 | - 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | - 'title' => __('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | - 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | - ), |
|
243 | - ), |
|
244 | - 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
245 | - 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
246 | - 'require_nonce' => false, |
|
247 | - ), |
|
248 | - 'create_new' => array( |
|
249 | - 'nav' => array( |
|
250 | - 'label' => __('Add Venue', 'event_espresso'), |
|
251 | - 'order' => 5, |
|
252 | - 'persistent' => false, |
|
253 | - ), |
|
254 | - 'help_tabs' => array( |
|
255 | - 'venues_editor_help_tab' => array( |
|
256 | - 'title' => __('Venue Editor', 'event_espresso'), |
|
257 | - 'filename' => 'venues_editor', |
|
258 | - ), |
|
259 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
260 | - 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
261 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
262 | - ), |
|
263 | - 'venues_editor_tags_categories_help_tab' => array( |
|
264 | - 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
265 | - 'filename' => 'venues_editor_tags_categories', |
|
266 | - ), |
|
267 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
268 | - 'title' => __( |
|
269 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
270 | - 'event_espresso' |
|
271 | - ), |
|
272 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
273 | - ), |
|
274 | - 'venues_editor_save_new_venue_help_tab' => array( |
|
275 | - 'title' => __('Save New Venue', 'event_espresso'), |
|
276 | - 'filename' => 'venues_editor_save_new_venue', |
|
277 | - ), |
|
278 | - 'venues_editor_other_help_tab' => array( |
|
279 | - 'title' => __('Venue Editor Other', 'event_espresso'), |
|
280 | - 'filename' => 'venues_editor_other', |
|
281 | - ), |
|
282 | - ), |
|
283 | - 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
284 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
285 | - 'require_nonce' => false, |
|
286 | - ), |
|
287 | - 'edit' => array( |
|
288 | - 'nav' => array( |
|
289 | - 'label' => __('Edit Venue', 'event_espresso'), |
|
290 | - 'order' => 5, |
|
291 | - 'persistent' => false, |
|
292 | - 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
293 | - array('post' => $this->_req_data['post']), |
|
294 | - $this->_current_page_view_url |
|
295 | - ) : $this->_admin_base_url, |
|
296 | - ), |
|
297 | - 'help_tabs' => array( |
|
298 | - 'venues_editor_help_tab' => array( |
|
299 | - 'title' => __('Venue Editor', 'event_espresso'), |
|
300 | - 'filename' => 'venues_editor', |
|
301 | - ), |
|
302 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
303 | - 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
304 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
305 | - ), |
|
306 | - 'venues_editor_tags_categories_help_tab' => array( |
|
307 | - 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
308 | - 'filename' => 'venues_editor_tags_categories', |
|
309 | - ), |
|
310 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
311 | - 'title' => __( |
|
312 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
313 | - 'event_espresso' |
|
314 | - ), |
|
315 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
316 | - ), |
|
317 | - 'venues_editor_save_new_venue_help_tab' => array( |
|
318 | - 'title' => __('Save New Venue', 'event_espresso'), |
|
319 | - 'filename' => 'venues_editor_save_new_venue', |
|
320 | - ), |
|
321 | - 'venues_editor_other_help_tab' => array( |
|
322 | - 'title' => __('Venue Editor Other', 'event_espresso'), |
|
323 | - 'filename' => 'venues_editor_other', |
|
324 | - ), |
|
325 | - ), |
|
326 | - /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
327 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
328 | - 'require_nonce' => false, |
|
329 | - ), |
|
330 | - 'google_map_settings' => array( |
|
331 | - 'nav' => array( |
|
332 | - 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
333 | - 'order' => 40, |
|
334 | - ), |
|
335 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
336 | - 'help_tabs' => array( |
|
337 | - 'general_settings_google_maps_help_tab' => array( |
|
338 | - 'title' => __('Google Maps', 'event_espresso'), |
|
339 | - 'filename' => 'general_settings_google_maps', |
|
340 | - ), |
|
341 | - ), |
|
342 | - 'help_tour' => array('Google_Maps_Help_Tour'), |
|
343 | - 'require_nonce' => false, |
|
344 | - ), |
|
345 | - // venue category stuff |
|
346 | - 'add_category' => array( |
|
347 | - 'nav' => array( |
|
348 | - 'label' => __('Add Category', 'event_espresso'), |
|
349 | - 'order' => 15, |
|
350 | - 'persistent' => false, |
|
351 | - ), |
|
352 | - 'metaboxes' => array('_publish_post_box'), |
|
353 | - 'help_tabs' => array( |
|
354 | - 'venues_add_category_help_tab' => array( |
|
355 | - 'title' => __('Add New Venue Category', 'event_espresso'), |
|
356 | - 'filename' => 'venues_add_category', |
|
357 | - ), |
|
358 | - ), |
|
359 | - 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
360 | - 'require_nonce' => false, |
|
361 | - ), |
|
362 | - 'edit_category' => array( |
|
363 | - 'nav' => array( |
|
364 | - 'label' => __('Edit Category', 'event_espresso'), |
|
365 | - 'order' => 15, |
|
366 | - 'persistent' => false, |
|
367 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
368 | - array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
369 | - $this->_current_page_view_url |
|
370 | - ) : $this->_admin_base_url, |
|
371 | - ), |
|
372 | - 'metaboxes' => array('_publish_post_box'), |
|
373 | - 'help_tabs' => array( |
|
374 | - 'venues_edit_category_help_tab' => array( |
|
375 | - 'title' => __('Edit Venue Category', 'event_espresso'), |
|
376 | - 'filename' => 'venues_edit_category', |
|
377 | - ), |
|
378 | - ), |
|
379 | - /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
380 | - 'require_nonce' => false, |
|
381 | - ), |
|
382 | - 'category_list' => array( |
|
383 | - 'nav' => array( |
|
384 | - 'label' => __('Categories', 'event_espresso'), |
|
385 | - 'order' => 20, |
|
386 | - ), |
|
387 | - 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
388 | - 'help_tabs' => array( |
|
389 | - 'venues_categories_help_tab' => array( |
|
390 | - 'title' => __('Venue Categories', 'event_espresso'), |
|
391 | - 'filename' => 'venues_categories', |
|
392 | - ), |
|
393 | - 'venues_categories_table_column_headings_help_tab' => array( |
|
394 | - 'title' => __('Venue Categories Table Column Headings', 'event_espresso'), |
|
395 | - 'filename' => 'venues_categories_table_column_headings', |
|
396 | - ), |
|
397 | - 'venues_categories_views_help_tab' => array( |
|
398 | - 'title' => __('Venue Categories Views', 'event_espresso'), |
|
399 | - 'filename' => 'venues_categories_views', |
|
400 | - ), |
|
401 | - 'venues_categories_other_help_tab' => array( |
|
402 | - 'title' => __('Venue Categories Other', 'event_espresso'), |
|
403 | - 'filename' => 'venues_categories_other', |
|
404 | - ), |
|
405 | - ), |
|
406 | - 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
407 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
408 | - 'require_nonce' => false, |
|
409 | - ), |
|
410 | - ); |
|
411 | - } |
|
412 | - |
|
413 | - |
|
414 | - protected function _add_screen_options() |
|
415 | - { |
|
416 | - // todo |
|
417 | - } |
|
418 | - |
|
419 | - |
|
420 | - protected function _add_screen_options_default() |
|
421 | - { |
|
422 | - $this->_per_page_screen_option(); |
|
423 | - } |
|
424 | - |
|
425 | - |
|
426 | - protected function _add_screen_options_category_list() |
|
427 | - { |
|
428 | - $page_title = $this->_admin_page_title; |
|
429 | - $this->_admin_page_title = __('Venue Categories', 'event_espresso'); |
|
430 | - $this->_per_page_screen_option(); |
|
431 | - $this->_admin_page_title = $page_title; |
|
432 | - } |
|
433 | - |
|
434 | - |
|
435 | - // none of the below group are currently used for Event Venues |
|
436 | - protected function _add_feature_pointers() |
|
437 | - { |
|
438 | - } |
|
439 | - |
|
440 | - public function admin_init() |
|
441 | - { |
|
442 | - } |
|
443 | - |
|
444 | - public function admin_notices() |
|
445 | - { |
|
446 | - } |
|
447 | - |
|
448 | - public function admin_footer_scripts() |
|
449 | - { |
|
450 | - } |
|
451 | - |
|
452 | - |
|
453 | - public function load_scripts_styles_create_new() |
|
454 | - { |
|
455 | - $this->load_scripts_styles_edit(); |
|
456 | - } |
|
457 | - |
|
458 | - |
|
459 | - public function load_scripts_styles() |
|
460 | - { |
|
461 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
462 | - wp_enqueue_style('ee-cat-admin'); |
|
463 | - } |
|
464 | - |
|
465 | - |
|
466 | - public function load_scripts_styles_add_category() |
|
467 | - { |
|
468 | - $this->load_scripts_styles_edit_category(); |
|
469 | - } |
|
470 | - |
|
471 | - |
|
472 | - public function load_scripts_styles_edit_category() |
|
473 | - { |
|
474 | - } |
|
475 | - |
|
476 | - |
|
477 | - public function load_scripts_styles_edit() |
|
478 | - { |
|
479 | - // styles |
|
480 | - wp_enqueue_style('espresso-ui-theme'); |
|
481 | - wp_register_style( |
|
482 | - 'espresso_venues', |
|
483 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
484 | - array(), |
|
485 | - EVENT_ESPRESSO_VERSION |
|
486 | - ); |
|
487 | - wp_enqueue_style('espresso_venues'); |
|
488 | - } |
|
489 | - |
|
490 | - |
|
491 | - protected function _set_list_table_views_default() |
|
492 | - { |
|
493 | - $this->_views = array( |
|
494 | - 'all' => array( |
|
495 | - 'slug' => 'all', |
|
496 | - 'label' => __('View All Venues', 'event_espresso'), |
|
497 | - 'count' => 0, |
|
498 | - 'bulk_action' => array(), |
|
499 | - ), |
|
500 | - ); |
|
501 | - |
|
502 | - if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
503 | - $this->_views['all']['bulk_action'] = array( |
|
504 | - 'trash_venues' => __('Move to Trash', 'event_espresso'), |
|
505 | - ); |
|
506 | - $this->_views['trash'] = array( |
|
507 | - 'slug' => 'trash', |
|
508 | - 'label' => __('Trash', 'event_espresso'), |
|
509 | - 'count' => 0, |
|
510 | - 'bulk_action' => array( |
|
511 | - 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
|
512 | - 'delete_venues' => __('Delete', 'event_espresso'), |
|
513 | - ), |
|
514 | - ); |
|
515 | - } |
|
516 | - } |
|
517 | - |
|
518 | - |
|
519 | - protected function _set_list_table_views_category_list() |
|
520 | - { |
|
521 | - $this->_views = array( |
|
522 | - 'all' => array( |
|
523 | - 'slug' => 'all', |
|
524 | - 'label' => __('All', 'event_espresso'), |
|
525 | - 'count' => 0, |
|
526 | - 'bulk_action' => array( |
|
527 | - 'delete_categories' => __('Delete Permanently', 'event_espresso'), |
|
528 | - ), |
|
529 | - ), |
|
530 | - ); |
|
531 | - } |
|
532 | - |
|
533 | - |
|
534 | - protected function _overview_list_table() |
|
535 | - { |
|
536 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
537 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
538 | - get_post_type_archive_link('espresso_venues'), |
|
539 | - __("View Venue Archive Page", "event_espresso"), |
|
540 | - 'button' |
|
541 | - ); |
|
542 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
543 | - $this->_search_btn_label = __('Venues', 'event_espresso'); |
|
544 | - $this->display_admin_list_table_page_with_sidebar(); |
|
545 | - } |
|
546 | - |
|
547 | - |
|
548 | - public function extra_misc_actions_publish_box() |
|
549 | - { |
|
550 | - $extra_rows = array( |
|
551 | - 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
552 | - 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
553 | - 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
554 | - ); |
|
555 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
556 | - EEH_Template::display_template($template, $extra_rows); |
|
557 | - } |
|
558 | - |
|
559 | - |
|
560 | - /************* Google Maps *************/ |
|
561 | - |
|
562 | - |
|
563 | - protected function _google_map_settings() |
|
564 | - { |
|
565 | - |
|
566 | - |
|
567 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
568 | - $default_map_settings = new stdClass(); |
|
569 | - $default_map_settings->use_google_maps = true; |
|
570 | - $default_map_settings->google_map_api_key = ''; |
|
571 | - // for event details pages (reg page) |
|
572 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
579 | - // for event list pages |
|
580 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
587 | - |
|
588 | - $this->_template_args['map_settings'] = |
|
589 | - isset(EE_Registry::instance()->CFG->map_settings) |
|
590 | - && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
591 | - ? (object) array_merge( |
|
592 | - (array) $default_map_settings, |
|
593 | - (array) EE_Registry::instance()->CFG->map_settings |
|
594 | - ) |
|
595 | - : $default_map_settings; |
|
596 | - |
|
597 | - $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
598 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
599 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
600 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
601 | - $this->_template_args, |
|
602 | - true |
|
603 | - ); |
|
604 | - $this->display_admin_page_with_sidebar(); |
|
605 | - } |
|
606 | - |
|
607 | - protected function _update_google_map_settings() |
|
608 | - { |
|
609 | - |
|
610 | - EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
611 | - isset($this->_req_data['use_google_maps']) |
|
612 | - ? absint($this->_req_data['use_google_maps']) |
|
613 | - : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
614 | - |
|
615 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
616 | - isset($this->_req_data['google_map_api_key']) |
|
617 | - ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
618 | - : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
619 | - |
|
620 | - EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
621 | - isset($this->_req_data['event_details_map_width']) |
|
622 | - ? absint($this->_req_data['event_details_map_width']) |
|
623 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
624 | - |
|
625 | - EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
626 | - isset($this->_req_data['event_details_map_height']) |
|
627 | - ? absint($this->_req_data['event_details_map_height']) |
|
628 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
629 | - |
|
630 | - EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
631 | - isset($this->_req_data['event_details_map_zoom']) |
|
632 | - ? absint($this->_req_data['event_details_map_zoom']) |
|
633 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
634 | - |
|
635 | - EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
636 | - isset($this->_req_data['event_details_display_nav']) |
|
637 | - ? absint($this->_req_data['event_details_display_nav']) |
|
638 | - : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
639 | - |
|
640 | - EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
641 | - isset($this->_req_data['event_details_nav_size']) |
|
642 | - ? absint($this->_req_data['event_details_nav_size']) |
|
643 | - : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
644 | - |
|
645 | - EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
646 | - isset($this->_req_data['event_details_control_type']) |
|
647 | - ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
648 | - : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
649 | - |
|
650 | - EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
651 | - isset($this->_req_data['event_details_map_align']) |
|
652 | - ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
653 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
654 | - |
|
655 | - EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
656 | - isset($this->_req_data['event_list_map_width']) |
|
657 | - ? absint($this->_req_data['event_list_map_width']) |
|
658 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
659 | - |
|
660 | - EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
661 | - isset($this->_req_data['event_list_map_height']) |
|
662 | - ? absint($this->_req_data['event_list_map_height']) |
|
663 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
664 | - |
|
665 | - EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
666 | - isset($this->_req_data['event_list_map_zoom']) |
|
667 | - ? absint($this->_req_data['event_list_map_zoom']) |
|
668 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
669 | - |
|
670 | - EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
671 | - isset($this->_req_data['event_list_display_nav']) |
|
672 | - ? absint($this->_req_data['event_list_display_nav']) |
|
673 | - : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
674 | - |
|
675 | - EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
676 | - isset($this->_req_data['event_list_nav_size']) |
|
677 | - ? absint($this->_req_data['event_list_nav_size']) |
|
678 | - : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
679 | - |
|
680 | - EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
681 | - isset($this->_req_data['event_list_control_type']) |
|
682 | - ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
683 | - : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
684 | - |
|
685 | - EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
686 | - isset($this->_req_data['event_list_map_align']) |
|
687 | - ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
688 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
689 | - |
|
690 | - EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
691 | - 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
692 | - EE_Registry::instance()->CFG->map_settings |
|
693 | - ); |
|
694 | - |
|
695 | - $what = 'Google Map Settings'; |
|
696 | - $success = $this->_update_espresso_configuration( |
|
697 | - $what, |
|
698 | - EE_Registry::instance()->CFG->map_settings, |
|
699 | - __FILE__, |
|
700 | - __FUNCTION__, |
|
701 | - __LINE__ |
|
702 | - ); |
|
703 | - $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
704 | - } |
|
705 | - |
|
706 | - |
|
707 | - protected function _venue_editor_metaboxes() |
|
708 | - { |
|
709 | - $this->verify_cpt_object(); |
|
710 | - |
|
711 | - add_meta_box( |
|
712 | - 'espresso_venue_address_options', |
|
713 | - __('Physical Location', 'event_espresso'), |
|
714 | - array($this, 'venue_address_metabox'), |
|
715 | - $this->page_slug, |
|
716 | - 'side', |
|
717 | - 'default' |
|
718 | - ); |
|
719 | - add_meta_box( |
|
720 | - 'espresso_venue_gmap_options', |
|
721 | - __('Google Map', 'event_espresso'), |
|
722 | - array($this, 'venue_gmap_metabox'), |
|
723 | - $this->page_slug, |
|
724 | - 'side', |
|
725 | - 'default' |
|
726 | - ); |
|
727 | - add_meta_box( |
|
728 | - 'espresso_venue_virtual_loc_options', |
|
729 | - __('Virtual Location', 'event_espresso'), |
|
730 | - array($this, 'venue_virtual_loc_metabox'), |
|
731 | - $this->page_slug, |
|
732 | - 'side', |
|
733 | - 'default' |
|
734 | - ); |
|
735 | - } |
|
736 | - |
|
737 | - |
|
738 | - public function venue_gmap_metabox() |
|
739 | - { |
|
740 | - $template_args = array( |
|
741 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
742 | - 'vnu_enable_for_gmap', |
|
743 | - $this->get_yes_no_values(), |
|
744 | - $this->_cpt_model_obj->enable_for_gmap() |
|
745 | - ), |
|
746 | - 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
747 | - ); |
|
748 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
749 | - EEH_Template::display_template($template, $template_args); |
|
750 | - } |
|
751 | - |
|
752 | - |
|
753 | - public function venue_address_metabox() |
|
754 | - { |
|
755 | - |
|
756 | - $template_args['_venue'] = $this->_cpt_model_obj; |
|
757 | - |
|
758 | - $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
759 | - $QFI = new EE_Question_Form_Input( |
|
760 | - EE_Question::new_instance( |
|
761 | - array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
762 | - ), |
|
763 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
764 | - array( |
|
765 | - 'input_name' => 'sta_id', |
|
766 | - 'input_id' => 'sta_id', |
|
767 | - 'input_class' => '', |
|
768 | - 'input_prefix' => '', |
|
769 | - 'append_qstn_id' => false, |
|
770 | - ) |
|
771 | - ) |
|
772 | - ); |
|
773 | - $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
774 | - $QFI = new EE_Question_Form_Input( |
|
775 | - EE_Question::new_instance( |
|
776 | - array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
777 | - ), |
|
778 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
779 | - array( |
|
780 | - 'input_name' => 'cnt_iso', |
|
781 | - 'input_id' => 'cnt_iso', |
|
782 | - 'input_class' => '', |
|
783 | - 'input_prefix' => '', |
|
784 | - 'append_qstn_id' => false, |
|
785 | - ) |
|
786 | - ) |
|
787 | - ); |
|
788 | - |
|
789 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
790 | - EEH_Template::display_template($template, $template_args); |
|
791 | - } |
|
792 | - |
|
793 | - |
|
794 | - public function venue_virtual_loc_metabox() |
|
795 | - { |
|
796 | - $template_args = array( |
|
797 | - '_venue' => $this->_cpt_model_obj, |
|
798 | - ); |
|
799 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
800 | - EEH_Template::display_template($template, $template_args); |
|
801 | - } |
|
802 | - |
|
803 | - |
|
804 | - protected function _restore_cpt_item($post_id, $revision_id) |
|
805 | - { |
|
806 | - $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
807 | - |
|
808 | - // meta revision restore |
|
809 | - $venue_obj->restore_revision($revision_id); |
|
810 | - } |
|
811 | - |
|
812 | - |
|
813 | - /** |
|
814 | - * Handles updates for venue cpts |
|
815 | - * |
|
816 | - * @param int $post_id ID of Venue CPT |
|
817 | - * @param object $post Post object (with "blessed" WP properties) |
|
818 | - * @return void |
|
819 | - */ |
|
820 | - protected function _insert_update_cpt_item($post_id, $post) |
|
821 | - { |
|
822 | - |
|
823 | - if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
824 | - return;// get out we're not processing the saving of venues. |
|
825 | - } |
|
826 | - |
|
827 | - $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
828 | - |
|
829 | - $venue_values = array( |
|
830 | - 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
831 | - 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
832 | - : null, |
|
833 | - 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
834 | - 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
835 | - 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
836 | - 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
837 | - 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
838 | - 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
839 | - ',', |
|
840 | - '', |
|
841 | - $this->_req_data['vnu_capacity'] |
|
842 | - ) : EE_INF, |
|
843 | - 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
844 | - 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
845 | - ? $this->_req_data['vnu_virtual_phone'] : null, |
|
846 | - 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
847 | - : null, |
|
848 | - 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
849 | - 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
850 | - ? $this->_req_data['vnu_google_map_link'] : null, |
|
851 | - ); |
|
852 | - |
|
853 | - // update venue |
|
854 | - $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
855 | - |
|
856 | - // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
857 | - $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
858 | - $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
859 | - |
|
860 | - // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
861 | - $venue_update_callbacks = apply_filters( |
|
862 | - 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
863 | - array() |
|
864 | - ); |
|
865 | - |
|
866 | - $att_success = true; |
|
867 | - |
|
868 | - foreach ($venue_update_callbacks as $v_callback) { |
|
869 | - $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
870 | - $att_success = ! $att_success ? $att_success |
|
871 | - : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
872 | - } |
|
873 | - |
|
874 | - // any errors? |
|
875 | - if ($success && ! $att_success) { |
|
876 | - EE_Error::add_error( |
|
877 | - __( |
|
878 | - 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
879 | - 'event_espresso' |
|
880 | - ), |
|
881 | - __FILE__, |
|
882 | - __FUNCTION__, |
|
883 | - __LINE__ |
|
884 | - ); |
|
885 | - } elseif ($success === false) { |
|
886 | - EE_Error::add_error( |
|
887 | - __('Venue Details did not save successfully.', 'event_espresso'), |
|
888 | - __FILE__, |
|
889 | - __FUNCTION__, |
|
890 | - __LINE__ |
|
891 | - ); |
|
892 | - } |
|
893 | - } |
|
894 | - |
|
895 | - |
|
896 | - public function trash_cpt_item($post_id) |
|
897 | - { |
|
898 | - $this->_req_data['VNU_ID'] = $post_id; |
|
899 | - $this->_trash_or_restore_venue('trash', false); |
|
900 | - } |
|
901 | - |
|
902 | - |
|
903 | - public function restore_cpt_item($post_id) |
|
904 | - { |
|
905 | - $this->_req_data['VNU_ID'] = $post_id; |
|
906 | - $this->_trash_or_restore_venue('draft', false); |
|
907 | - } |
|
908 | - |
|
909 | - |
|
910 | - public function delete_cpt_item($post_id) |
|
911 | - { |
|
912 | - $this->_req_data['VNU_ID'] = $post_id; |
|
913 | - $this->_delete_venue(false); |
|
914 | - } |
|
915 | - |
|
916 | - |
|
917 | - public function get_venue_object() |
|
918 | - { |
|
919 | - return $this->_cpt_model_obj; |
|
920 | - } |
|
921 | - |
|
922 | - |
|
923 | - protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
924 | - { |
|
925 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
926 | - |
|
927 | - // loop thru venues |
|
928 | - if ($VNU_ID) { |
|
929 | - // clean status |
|
930 | - $venue_status = sanitize_key($venue_status); |
|
931 | - // grab status |
|
932 | - if (! empty($venue_status)) { |
|
933 | - $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
934 | - } else { |
|
935 | - $success = false; |
|
936 | - $msg = __( |
|
937 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
938 | - 'event_espresso' |
|
939 | - ); |
|
940 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
941 | - } |
|
942 | - } else { |
|
943 | - $success = false; |
|
944 | - $msg = __( |
|
945 | - 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
946 | - 'event_espresso' |
|
947 | - ); |
|
948 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
949 | - } |
|
950 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
951 | - |
|
952 | - if ($redirect_after) { |
|
953 | - $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
954 | - } |
|
955 | - } |
|
956 | - |
|
957 | - |
|
958 | - protected function _trash_or_restore_venues($venue_status = 'trash') |
|
959 | - { |
|
960 | - // clean status |
|
961 | - $venue_status = sanitize_key($venue_status); |
|
962 | - // grab status |
|
963 | - if (! empty($venue_status)) { |
|
964 | - $success = true; |
|
965 | - // determine the event id and set to array. |
|
966 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
967 | - // loop thru events |
|
968 | - foreach ($VNU_IDs as $VNU_ID) { |
|
969 | - if ($VNU_ID = absint($VNU_ID)) { |
|
970 | - $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
971 | - $success = $results !== false ? $success : false; |
|
972 | - } else { |
|
973 | - $msg = sprintf( |
|
974 | - __( |
|
975 | - 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
976 | - 'event_espresso' |
|
977 | - ), |
|
978 | - $VNU_ID |
|
979 | - ); |
|
980 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
981 | - $success = false; |
|
982 | - } |
|
983 | - } |
|
984 | - } else { |
|
985 | - $success = false; |
|
986 | - $msg = __( |
|
987 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
988 | - 'event_espresso' |
|
989 | - ); |
|
990 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
991 | - } |
|
992 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
993 | - $success = $success ? 2 : false; |
|
994 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
995 | - $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
996 | - } |
|
997 | - |
|
998 | - |
|
999 | - /** |
|
1000 | - * _trash_or_restore_venues |
|
1001 | - * |
|
1002 | - * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1003 | - * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1004 | - * accepting a certain number of params. |
|
1005 | - * |
|
1006 | - * @access private |
|
1007 | - * @param int $VNU_ID |
|
1008 | - * @param string $venue_status |
|
1009 | - * @return void |
|
1010 | - */ |
|
1011 | - private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1012 | - { |
|
1013 | - // grab venue id |
|
1014 | - if (! $VNU_ID) { |
|
1015 | - $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1016 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1017 | - return false; |
|
1018 | - } |
|
1019 | - |
|
1020 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1021 | - |
|
1022 | - // clean status |
|
1023 | - $venue_status = sanitize_key($venue_status); |
|
1024 | - // grab status |
|
1025 | - if (! $venue_status) { |
|
1026 | - $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1027 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1028 | - return false; |
|
1029 | - } |
|
1030 | - |
|
1031 | - // was event trashed or restored ? |
|
1032 | - switch ($venue_status) { |
|
1033 | - case 'draft': |
|
1034 | - $action = 'restored from the trash'; |
|
1035 | - $hook = 'AHEE_venue_restored_from_trash'; |
|
1036 | - break; |
|
1037 | - case 'trash': |
|
1038 | - $action = 'moved to the trash'; |
|
1039 | - $hook = 'AHEE_venue_moved_to_trash'; |
|
1040 | - break; |
|
1041 | - default: |
|
1042 | - $action = 'updated'; |
|
1043 | - $hook = false; |
|
1044 | - } |
|
1045 | - // use class to change status |
|
1046 | - $this->_cpt_model_obj->set_status($venue_status); |
|
1047 | - $success = $this->_cpt_model_obj->save(); |
|
1048 | - |
|
1049 | - if ($success === false) { |
|
1050 | - $msg = sprintf(__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1051 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1052 | - return false; |
|
1053 | - } |
|
1054 | - if ($hook) { |
|
1055 | - do_action($hook); |
|
1056 | - } |
|
1057 | - return true; |
|
1058 | - } |
|
1059 | - |
|
1060 | - |
|
1061 | - /** |
|
1062 | - * @param bool $redirect_after |
|
1063 | - * @return void |
|
1064 | - */ |
|
1065 | - protected function _delete_venue($redirect_after = true) |
|
1066 | - { |
|
1067 | - // determine the venue id and set to array. |
|
1068 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1069 | - $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1070 | - |
|
1071 | - |
|
1072 | - // loop thru venues |
|
1073 | - if ($VNU_ID) { |
|
1074 | - $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1075 | - } else { |
|
1076 | - $success = false; |
|
1077 | - $msg = __( |
|
1078 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1079 | - 'event_espresso' |
|
1080 | - ); |
|
1081 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1082 | - } |
|
1083 | - if ($redirect_after) { |
|
1084 | - $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1085 | - } |
|
1086 | - } |
|
1087 | - |
|
1088 | - |
|
1089 | - protected function _delete_venues() |
|
1090 | - { |
|
1091 | - $success = true; |
|
1092 | - // determine the event id and set to array. |
|
1093 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1094 | - // loop thru events |
|
1095 | - foreach ($VNU_IDs as $VNU_ID) { |
|
1096 | - if ($VNU_ID = absint($VNU_ID)) { |
|
1097 | - $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1098 | - $success = $results !== false ? $success : false; |
|
1099 | - } else { |
|
1100 | - $success = false; |
|
1101 | - $msg = __( |
|
1102 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1103 | - 'event_espresso' |
|
1104 | - ); |
|
1105 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1106 | - } |
|
1107 | - } |
|
1108 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1109 | - $success = $success ? 2 : false; |
|
1110 | - $this->_redirect_after_action( |
|
1111 | - $success, |
|
1112 | - __('Venues', 'event_espresso'), |
|
1113 | - __('deleted', 'event_espresso'), |
|
1114 | - array('action' => 'default') |
|
1115 | - ); |
|
1116 | - } |
|
1117 | - |
|
1118 | - |
|
1119 | - // todo: put in parent |
|
1120 | - private function _delete_or_trash_venue($VNU_ID = false) |
|
1121 | - { |
|
1122 | - // grab event id |
|
1123 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1124 | - $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1125 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1126 | - return false; |
|
1127 | - } |
|
1128 | - |
|
1129 | - |
|
1130 | - $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1131 | - // first need to remove all term relationships |
|
1132 | - $venue->_remove_relations('Term_Taxonomy'); |
|
1133 | - $success = $venue->delete_permanently(); |
|
1134 | - // did it all go as planned ? |
|
1135 | - if ($success) { |
|
1136 | - $msg = sprintf(__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1137 | - EE_Error::add_success($msg); |
|
1138 | - } else { |
|
1139 | - $msg = sprintf(__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1140 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1141 | - return false; |
|
1142 | - } |
|
1143 | - do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1144 | - return true; |
|
1145 | - } |
|
1146 | - |
|
1147 | - |
|
1148 | - |
|
1149 | - |
|
1150 | - /***********/ |
|
1151 | - /* QUERIES */ |
|
1152 | - |
|
1153 | - |
|
1154 | - public function get_venues($per_page = 10, $count = false) |
|
1155 | - { |
|
1156 | - |
|
1157 | - $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1158 | - |
|
1159 | - switch ($_orderby) { |
|
1160 | - case 'id': |
|
1161 | - $orderby = 'VNU_ID'; |
|
1162 | - break; |
|
1163 | - |
|
1164 | - case 'capacity': |
|
1165 | - $orderby = 'VNU_capacity'; |
|
1166 | - break; |
|
1167 | - |
|
1168 | - case 'city': |
|
1169 | - $orderby = 'VNU_city'; |
|
1170 | - break; |
|
1171 | - |
|
1172 | - default: |
|
1173 | - $orderby = 'VNU_name'; |
|
1174 | - } |
|
1175 | - |
|
1176 | - |
|
1177 | - $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1178 | - : 'ASC'; |
|
1179 | - |
|
1180 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1181 | - ? $this->_req_data['paged'] : 1; |
|
1182 | - $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1183 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1184 | - ? $this->_req_data['perpage'] : $per_page; |
|
1185 | - |
|
1186 | - |
|
1187 | - $offset = ($current_page - 1) * $per_page; |
|
1188 | - $limit = array($offset, $per_page); |
|
1189 | - |
|
1190 | - $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1191 | - ? $this->_req_data['category'] : null; |
|
1192 | - $where = array(); |
|
1193 | - |
|
1194 | - // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1195 | - if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1196 | - $where['status'] = $this->_req_data['status']; |
|
1197 | - } |
|
1198 | - |
|
1199 | - if (isset($this->_req_data['venue_status'])) { |
|
1200 | - $where['status'] = $this->_req_data['venue_status']; |
|
1201 | - } |
|
1202 | - |
|
1203 | - |
|
1204 | - if ($category) { |
|
1205 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1206 | - $where['Term_Taxonomy.term_id'] = $category; |
|
1207 | - } |
|
1208 | - |
|
1209 | - |
|
1210 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1211 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1212 | - } else { |
|
1213 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1214 | - $where['OR'] = array( |
|
1215 | - 'status*restrict_private' => array('!=', 'private'), |
|
1216 | - 'AND' => array( |
|
1217 | - 'status*inclusive' => array('=', 'private'), |
|
1218 | - 'VNU_wp_user' => get_current_user_id(), |
|
1219 | - ), |
|
1220 | - ); |
|
1221 | - } |
|
1222 | - } |
|
1223 | - |
|
1224 | - |
|
1225 | - if (isset($this->_req_data['s'])) { |
|
1226 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1227 | - $where['OR'] = array( |
|
1228 | - 'VNU_name' => array('LIKE', $sstr), |
|
1229 | - 'VNU_desc' => array('LIKE', $sstr), |
|
1230 | - 'VNU_short_desc' => array('LIKE', $sstr), |
|
1231 | - 'VNU_address' => array('LIKE', $sstr), |
|
1232 | - 'VNU_address2' => array('LIKE', $sstr), |
|
1233 | - 'VNU_city' => array('LIKE', $sstr), |
|
1234 | - 'VNU_zip' => array('LIKE', $sstr), |
|
1235 | - 'VNU_phone' => array('LIKE', $sstr), |
|
1236 | - 'VNU_url' => array('LIKE', $sstr), |
|
1237 | - 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1238 | - 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1239 | - 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1240 | - 'Event.EVT_name' => array('LIKE', $sstr), |
|
1241 | - 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1242 | - 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1243 | - 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1244 | - ); |
|
1245 | - } |
|
20 | + /** |
|
21 | + * _venue |
|
22 | + * This will hold the venue object for venue_details screen. |
|
23 | + * |
|
24 | + * @access protected |
|
25 | + * @var object |
|
26 | + */ |
|
27 | + protected $_venue; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * This will hold the category object for category_details screen. |
|
32 | + * |
|
33 | + * @var object |
|
34 | + */ |
|
35 | + protected $_category; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * This property will hold the venue model instance |
|
40 | + * |
|
41 | + * @var object |
|
42 | + */ |
|
43 | + protected $_venue_model; |
|
44 | + |
|
45 | + |
|
46 | + protected function _init_page_props() |
|
47 | + { |
|
48 | + require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | + $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | + $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | + $this->page_label = __('Event Venues', 'event_espresso'); |
|
53 | + $this->_cpt_model_names = array( |
|
54 | + 'create_new' => 'EEM_Venue', |
|
55 | + 'edit' => 'EEM_Venue', |
|
56 | + ); |
|
57 | + $this->_cpt_edit_routes = array( |
|
58 | + 'espresso_venues' => 'edit', |
|
59 | + ); |
|
60 | + $this->_venue_model = EEM_Venue::instance(); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + protected function _ajax_hooks() |
|
65 | + { |
|
66 | + // todo: all hooks for ee_venues ajax goes in here. |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _define_page_props() |
|
71 | + { |
|
72 | + $this->_admin_page_title = $this->page_label; |
|
73 | + $this->_labels = array( |
|
74 | + 'buttons' => array( |
|
75 | + 'add' => __('Add New Venue', 'event_espresso'), |
|
76 | + 'edit' => __('Edit Venue', 'event_espresso'), |
|
77 | + 'delete' => __('Delete Venue', 'event_espresso'), |
|
78 | + 'add_category' => __('Add New Category', 'event_espresso'), |
|
79 | + 'edit_category' => __('Edit Category', 'event_espresso'), |
|
80 | + 'delete_category' => __('Delete Category', 'event_espresso'), |
|
81 | + ), |
|
82 | + 'editor_title' => array( |
|
83 | + 'espresso_venues' => __('Enter Venue name here', 'event_espresso'), |
|
84 | + ), |
|
85 | + 'publishbox' => array( |
|
86 | + 'create_new' => __('Save New Venue', 'event_espresso'), |
|
87 | + 'edit' => __('Update Venue', 'event_espresso'), |
|
88 | + 'add_category' => __('Save New Category', 'event_espresso'), |
|
89 | + 'edit_category' => __('Update Category', 'event_espresso'), |
|
90 | + 'google_map_settings' => __('Update Settings', 'event_espresso'), |
|
91 | + ), |
|
92 | + ); |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + protected function _set_page_routes() |
|
97 | + { |
|
98 | + |
|
99 | + // load formatter helper |
|
100 | + // load field generator helper |
|
101 | + |
|
102 | + // is there a vnu_id in the request? |
|
103 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | + ? $this->_req_data['VNU_ID'] : 0; |
|
105 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | + |
|
107 | + $this->_page_routes = array( |
|
108 | + 'default' => array( |
|
109 | + 'func' => '_overview_list_table', |
|
110 | + 'capability' => 'ee_read_venues', |
|
111 | + ), |
|
112 | + 'create_new' => array( |
|
113 | + 'func' => '_create_new_cpt_item', |
|
114 | + 'capability' => 'ee_edit_venues', |
|
115 | + ), |
|
116 | + 'edit' => array( |
|
117 | + 'func' => '_edit_cpt_item', |
|
118 | + 'capability' => 'ee_edit_venue', |
|
119 | + 'obj_id' => $vnu_id, |
|
120 | + ), |
|
121 | + 'trash_venue' => array( |
|
122 | + 'func' => '_trash_or_restore_venue', |
|
123 | + 'args' => array('venue_status' => 'trash'), |
|
124 | + 'noheader' => true, |
|
125 | + 'capability' => 'ee_delete_venue', |
|
126 | + 'obj_id' => $vnu_id, |
|
127 | + ), |
|
128 | + 'trash_venues' => array( |
|
129 | + 'func' => '_trash_or_restore_venues', |
|
130 | + 'args' => array('venue_status' => 'trash'), |
|
131 | + 'noheader' => true, |
|
132 | + 'capability' => 'ee_delete_venues', |
|
133 | + ), |
|
134 | + 'restore_venue' => array( |
|
135 | + 'func' => '_trash_or_restore_venue', |
|
136 | + 'args' => array('venue_status' => 'draft'), |
|
137 | + 'noheader' => true, |
|
138 | + 'capability' => 'ee_delete_venue', |
|
139 | + 'obj_id' => $vnu_id, |
|
140 | + ), |
|
141 | + 'restore_venues' => array( |
|
142 | + 'func' => '_trash_or_restore_venues', |
|
143 | + 'args' => array('venue_status' => 'draft'), |
|
144 | + 'noheader' => true, |
|
145 | + 'capability' => 'ee_delete_venues', |
|
146 | + ), |
|
147 | + 'delete_venues' => array( |
|
148 | + 'func' => '_delete_venues', |
|
149 | + 'noheader' => true, |
|
150 | + 'capability' => 'ee_delete_venues', |
|
151 | + ), |
|
152 | + 'delete_venue' => array( |
|
153 | + 'func' => '_delete_venue', |
|
154 | + 'noheader' => true, |
|
155 | + 'capability' => 'ee_delete_venue', |
|
156 | + 'obj_id' => $vnu_id, |
|
157 | + ), |
|
158 | + // settings related |
|
159 | + 'google_map_settings' => array( |
|
160 | + 'func' => '_google_map_settings', |
|
161 | + 'capability' => 'manage_options', |
|
162 | + ), |
|
163 | + 'update_google_map_settings' => array( |
|
164 | + 'func' => '_update_google_map_settings', |
|
165 | + 'capability' => 'manage_options', |
|
166 | + 'noheader' => true, |
|
167 | + ), |
|
168 | + // venue category tab related |
|
169 | + 'add_category' => array( |
|
170 | + 'func' => '_category_details', |
|
171 | + 'args' => array('add'), |
|
172 | + 'capability' => 'ee_edit_venue_category', |
|
173 | + ), |
|
174 | + 'edit_category' => array( |
|
175 | + 'func' => '_category_details', |
|
176 | + 'args' => array('edit'), |
|
177 | + 'capability' => 'ee_edit_venue_category', |
|
178 | + ), |
|
179 | + 'delete_categories' => array( |
|
180 | + 'func' => '_delete_categories', |
|
181 | + 'noheader' => true, |
|
182 | + 'capability' => 'ee_delete_venue_category', |
|
183 | + ), |
|
184 | + |
|
185 | + 'delete_category' => array( |
|
186 | + 'func' => '_delete_categories', |
|
187 | + 'noheader' => true, |
|
188 | + 'capability' => 'ee_delete_venue_category', |
|
189 | + ), |
|
190 | + |
|
191 | + 'insert_category' => array( |
|
192 | + 'func' => '_insert_or_update_category', |
|
193 | + 'args' => array('new_category' => true), |
|
194 | + 'noheader' => true, |
|
195 | + 'capability' => 'ee_edit_venue_category', |
|
196 | + ), |
|
197 | + |
|
198 | + 'update_category' => array( |
|
199 | + 'func' => '_insert_or_update_category', |
|
200 | + 'args' => array('new_category' => false), |
|
201 | + 'noheader' => true, |
|
202 | + 'capability' => 'ee_edit_venue_category', |
|
203 | + ), |
|
204 | + 'export_categories' => array( |
|
205 | + 'func' => '_categories_export', |
|
206 | + 'noheader' => true, |
|
207 | + 'capability' => 'export', |
|
208 | + ), |
|
209 | + 'import_categories' => array( |
|
210 | + 'func' => '_import_categories', |
|
211 | + 'capability' => 'import', |
|
212 | + ), |
|
213 | + 'category_list' => array( |
|
214 | + 'func' => '_category_list_table', |
|
215 | + 'capability' => 'ee_manage_venue_categories', |
|
216 | + ), |
|
217 | + ); |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + protected function _set_page_config() |
|
222 | + { |
|
223 | + $this->_page_config = array( |
|
224 | + 'default' => array( |
|
225 | + 'nav' => array( |
|
226 | + 'label' => __('Overview', 'event_espresso'), |
|
227 | + 'order' => 10, |
|
228 | + ), |
|
229 | + 'list_table' => 'Venues_Admin_List_Table', |
|
230 | + 'help_tabs' => array( |
|
231 | + 'venues_overview_help_tab' => array( |
|
232 | + 'title' => __('Venues Overview', 'event_espresso'), |
|
233 | + 'filename' => 'venues_overview', |
|
234 | + ), |
|
235 | + 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | + 'title' => __('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | + 'filename' => 'venues_overview_table_column_headings', |
|
238 | + ), |
|
239 | + 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | + 'title' => __('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | + 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | + ), |
|
243 | + ), |
|
244 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
245 | + 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
246 | + 'require_nonce' => false, |
|
247 | + ), |
|
248 | + 'create_new' => array( |
|
249 | + 'nav' => array( |
|
250 | + 'label' => __('Add Venue', 'event_espresso'), |
|
251 | + 'order' => 5, |
|
252 | + 'persistent' => false, |
|
253 | + ), |
|
254 | + 'help_tabs' => array( |
|
255 | + 'venues_editor_help_tab' => array( |
|
256 | + 'title' => __('Venue Editor', 'event_espresso'), |
|
257 | + 'filename' => 'venues_editor', |
|
258 | + ), |
|
259 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
260 | + 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
261 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
262 | + ), |
|
263 | + 'venues_editor_tags_categories_help_tab' => array( |
|
264 | + 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
265 | + 'filename' => 'venues_editor_tags_categories', |
|
266 | + ), |
|
267 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
268 | + 'title' => __( |
|
269 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
270 | + 'event_espresso' |
|
271 | + ), |
|
272 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
273 | + ), |
|
274 | + 'venues_editor_save_new_venue_help_tab' => array( |
|
275 | + 'title' => __('Save New Venue', 'event_espresso'), |
|
276 | + 'filename' => 'venues_editor_save_new_venue', |
|
277 | + ), |
|
278 | + 'venues_editor_other_help_tab' => array( |
|
279 | + 'title' => __('Venue Editor Other', 'event_espresso'), |
|
280 | + 'filename' => 'venues_editor_other', |
|
281 | + ), |
|
282 | + ), |
|
283 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
284 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
285 | + 'require_nonce' => false, |
|
286 | + ), |
|
287 | + 'edit' => array( |
|
288 | + 'nav' => array( |
|
289 | + 'label' => __('Edit Venue', 'event_espresso'), |
|
290 | + 'order' => 5, |
|
291 | + 'persistent' => false, |
|
292 | + 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
293 | + array('post' => $this->_req_data['post']), |
|
294 | + $this->_current_page_view_url |
|
295 | + ) : $this->_admin_base_url, |
|
296 | + ), |
|
297 | + 'help_tabs' => array( |
|
298 | + 'venues_editor_help_tab' => array( |
|
299 | + 'title' => __('Venue Editor', 'event_espresso'), |
|
300 | + 'filename' => 'venues_editor', |
|
301 | + ), |
|
302 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
303 | + 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
304 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
305 | + ), |
|
306 | + 'venues_editor_tags_categories_help_tab' => array( |
|
307 | + 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
308 | + 'filename' => 'venues_editor_tags_categories', |
|
309 | + ), |
|
310 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
311 | + 'title' => __( |
|
312 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
313 | + 'event_espresso' |
|
314 | + ), |
|
315 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
316 | + ), |
|
317 | + 'venues_editor_save_new_venue_help_tab' => array( |
|
318 | + 'title' => __('Save New Venue', 'event_espresso'), |
|
319 | + 'filename' => 'venues_editor_save_new_venue', |
|
320 | + ), |
|
321 | + 'venues_editor_other_help_tab' => array( |
|
322 | + 'title' => __('Venue Editor Other', 'event_espresso'), |
|
323 | + 'filename' => 'venues_editor_other', |
|
324 | + ), |
|
325 | + ), |
|
326 | + /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
327 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
328 | + 'require_nonce' => false, |
|
329 | + ), |
|
330 | + 'google_map_settings' => array( |
|
331 | + 'nav' => array( |
|
332 | + 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
333 | + 'order' => 40, |
|
334 | + ), |
|
335 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
336 | + 'help_tabs' => array( |
|
337 | + 'general_settings_google_maps_help_tab' => array( |
|
338 | + 'title' => __('Google Maps', 'event_espresso'), |
|
339 | + 'filename' => 'general_settings_google_maps', |
|
340 | + ), |
|
341 | + ), |
|
342 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
343 | + 'require_nonce' => false, |
|
344 | + ), |
|
345 | + // venue category stuff |
|
346 | + 'add_category' => array( |
|
347 | + 'nav' => array( |
|
348 | + 'label' => __('Add Category', 'event_espresso'), |
|
349 | + 'order' => 15, |
|
350 | + 'persistent' => false, |
|
351 | + ), |
|
352 | + 'metaboxes' => array('_publish_post_box'), |
|
353 | + 'help_tabs' => array( |
|
354 | + 'venues_add_category_help_tab' => array( |
|
355 | + 'title' => __('Add New Venue Category', 'event_espresso'), |
|
356 | + 'filename' => 'venues_add_category', |
|
357 | + ), |
|
358 | + ), |
|
359 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
360 | + 'require_nonce' => false, |
|
361 | + ), |
|
362 | + 'edit_category' => array( |
|
363 | + 'nav' => array( |
|
364 | + 'label' => __('Edit Category', 'event_espresso'), |
|
365 | + 'order' => 15, |
|
366 | + 'persistent' => false, |
|
367 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
368 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
369 | + $this->_current_page_view_url |
|
370 | + ) : $this->_admin_base_url, |
|
371 | + ), |
|
372 | + 'metaboxes' => array('_publish_post_box'), |
|
373 | + 'help_tabs' => array( |
|
374 | + 'venues_edit_category_help_tab' => array( |
|
375 | + 'title' => __('Edit Venue Category', 'event_espresso'), |
|
376 | + 'filename' => 'venues_edit_category', |
|
377 | + ), |
|
378 | + ), |
|
379 | + /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
380 | + 'require_nonce' => false, |
|
381 | + ), |
|
382 | + 'category_list' => array( |
|
383 | + 'nav' => array( |
|
384 | + 'label' => __('Categories', 'event_espresso'), |
|
385 | + 'order' => 20, |
|
386 | + ), |
|
387 | + 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
388 | + 'help_tabs' => array( |
|
389 | + 'venues_categories_help_tab' => array( |
|
390 | + 'title' => __('Venue Categories', 'event_espresso'), |
|
391 | + 'filename' => 'venues_categories', |
|
392 | + ), |
|
393 | + 'venues_categories_table_column_headings_help_tab' => array( |
|
394 | + 'title' => __('Venue Categories Table Column Headings', 'event_espresso'), |
|
395 | + 'filename' => 'venues_categories_table_column_headings', |
|
396 | + ), |
|
397 | + 'venues_categories_views_help_tab' => array( |
|
398 | + 'title' => __('Venue Categories Views', 'event_espresso'), |
|
399 | + 'filename' => 'venues_categories_views', |
|
400 | + ), |
|
401 | + 'venues_categories_other_help_tab' => array( |
|
402 | + 'title' => __('Venue Categories Other', 'event_espresso'), |
|
403 | + 'filename' => 'venues_categories_other', |
|
404 | + ), |
|
405 | + ), |
|
406 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
407 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
408 | + 'require_nonce' => false, |
|
409 | + ), |
|
410 | + ); |
|
411 | + } |
|
412 | + |
|
413 | + |
|
414 | + protected function _add_screen_options() |
|
415 | + { |
|
416 | + // todo |
|
417 | + } |
|
418 | + |
|
419 | + |
|
420 | + protected function _add_screen_options_default() |
|
421 | + { |
|
422 | + $this->_per_page_screen_option(); |
|
423 | + } |
|
424 | + |
|
425 | + |
|
426 | + protected function _add_screen_options_category_list() |
|
427 | + { |
|
428 | + $page_title = $this->_admin_page_title; |
|
429 | + $this->_admin_page_title = __('Venue Categories', 'event_espresso'); |
|
430 | + $this->_per_page_screen_option(); |
|
431 | + $this->_admin_page_title = $page_title; |
|
432 | + } |
|
433 | + |
|
434 | + |
|
435 | + // none of the below group are currently used for Event Venues |
|
436 | + protected function _add_feature_pointers() |
|
437 | + { |
|
438 | + } |
|
439 | + |
|
440 | + public function admin_init() |
|
441 | + { |
|
442 | + } |
|
443 | + |
|
444 | + public function admin_notices() |
|
445 | + { |
|
446 | + } |
|
447 | + |
|
448 | + public function admin_footer_scripts() |
|
449 | + { |
|
450 | + } |
|
451 | + |
|
452 | + |
|
453 | + public function load_scripts_styles_create_new() |
|
454 | + { |
|
455 | + $this->load_scripts_styles_edit(); |
|
456 | + } |
|
457 | + |
|
458 | + |
|
459 | + public function load_scripts_styles() |
|
460 | + { |
|
461 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
462 | + wp_enqueue_style('ee-cat-admin'); |
|
463 | + } |
|
464 | + |
|
465 | + |
|
466 | + public function load_scripts_styles_add_category() |
|
467 | + { |
|
468 | + $this->load_scripts_styles_edit_category(); |
|
469 | + } |
|
470 | + |
|
471 | + |
|
472 | + public function load_scripts_styles_edit_category() |
|
473 | + { |
|
474 | + } |
|
475 | + |
|
476 | + |
|
477 | + public function load_scripts_styles_edit() |
|
478 | + { |
|
479 | + // styles |
|
480 | + wp_enqueue_style('espresso-ui-theme'); |
|
481 | + wp_register_style( |
|
482 | + 'espresso_venues', |
|
483 | + EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
484 | + array(), |
|
485 | + EVENT_ESPRESSO_VERSION |
|
486 | + ); |
|
487 | + wp_enqueue_style('espresso_venues'); |
|
488 | + } |
|
489 | + |
|
490 | + |
|
491 | + protected function _set_list_table_views_default() |
|
492 | + { |
|
493 | + $this->_views = array( |
|
494 | + 'all' => array( |
|
495 | + 'slug' => 'all', |
|
496 | + 'label' => __('View All Venues', 'event_espresso'), |
|
497 | + 'count' => 0, |
|
498 | + 'bulk_action' => array(), |
|
499 | + ), |
|
500 | + ); |
|
501 | + |
|
502 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
503 | + $this->_views['all']['bulk_action'] = array( |
|
504 | + 'trash_venues' => __('Move to Trash', 'event_espresso'), |
|
505 | + ); |
|
506 | + $this->_views['trash'] = array( |
|
507 | + 'slug' => 'trash', |
|
508 | + 'label' => __('Trash', 'event_espresso'), |
|
509 | + 'count' => 0, |
|
510 | + 'bulk_action' => array( |
|
511 | + 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
|
512 | + 'delete_venues' => __('Delete', 'event_espresso'), |
|
513 | + ), |
|
514 | + ); |
|
515 | + } |
|
516 | + } |
|
517 | + |
|
518 | + |
|
519 | + protected function _set_list_table_views_category_list() |
|
520 | + { |
|
521 | + $this->_views = array( |
|
522 | + 'all' => array( |
|
523 | + 'slug' => 'all', |
|
524 | + 'label' => __('All', 'event_espresso'), |
|
525 | + 'count' => 0, |
|
526 | + 'bulk_action' => array( |
|
527 | + 'delete_categories' => __('Delete Permanently', 'event_espresso'), |
|
528 | + ), |
|
529 | + ), |
|
530 | + ); |
|
531 | + } |
|
532 | + |
|
533 | + |
|
534 | + protected function _overview_list_table() |
|
535 | + { |
|
536 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
537 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
538 | + get_post_type_archive_link('espresso_venues'), |
|
539 | + __("View Venue Archive Page", "event_espresso"), |
|
540 | + 'button' |
|
541 | + ); |
|
542 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
543 | + $this->_search_btn_label = __('Venues', 'event_espresso'); |
|
544 | + $this->display_admin_list_table_page_with_sidebar(); |
|
545 | + } |
|
546 | + |
|
547 | + |
|
548 | + public function extra_misc_actions_publish_box() |
|
549 | + { |
|
550 | + $extra_rows = array( |
|
551 | + 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
552 | + 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
553 | + 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
554 | + ); |
|
555 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
556 | + EEH_Template::display_template($template, $extra_rows); |
|
557 | + } |
|
558 | + |
|
559 | + |
|
560 | + /************* Google Maps *************/ |
|
561 | + |
|
562 | + |
|
563 | + protected function _google_map_settings() |
|
564 | + { |
|
565 | + |
|
566 | + |
|
567 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
568 | + $default_map_settings = new stdClass(); |
|
569 | + $default_map_settings->use_google_maps = true; |
|
570 | + $default_map_settings->google_map_api_key = ''; |
|
571 | + // for event details pages (reg page) |
|
572 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
579 | + // for event list pages |
|
580 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
587 | + |
|
588 | + $this->_template_args['map_settings'] = |
|
589 | + isset(EE_Registry::instance()->CFG->map_settings) |
|
590 | + && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
591 | + ? (object) array_merge( |
|
592 | + (array) $default_map_settings, |
|
593 | + (array) EE_Registry::instance()->CFG->map_settings |
|
594 | + ) |
|
595 | + : $default_map_settings; |
|
596 | + |
|
597 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
598 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
599 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
600 | + EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
601 | + $this->_template_args, |
|
602 | + true |
|
603 | + ); |
|
604 | + $this->display_admin_page_with_sidebar(); |
|
605 | + } |
|
606 | + |
|
607 | + protected function _update_google_map_settings() |
|
608 | + { |
|
609 | + |
|
610 | + EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
611 | + isset($this->_req_data['use_google_maps']) |
|
612 | + ? absint($this->_req_data['use_google_maps']) |
|
613 | + : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
614 | + |
|
615 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
616 | + isset($this->_req_data['google_map_api_key']) |
|
617 | + ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
618 | + : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
619 | + |
|
620 | + EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
621 | + isset($this->_req_data['event_details_map_width']) |
|
622 | + ? absint($this->_req_data['event_details_map_width']) |
|
623 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
624 | + |
|
625 | + EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
626 | + isset($this->_req_data['event_details_map_height']) |
|
627 | + ? absint($this->_req_data['event_details_map_height']) |
|
628 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
629 | + |
|
630 | + EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
631 | + isset($this->_req_data['event_details_map_zoom']) |
|
632 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
633 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
634 | + |
|
635 | + EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
636 | + isset($this->_req_data['event_details_display_nav']) |
|
637 | + ? absint($this->_req_data['event_details_display_nav']) |
|
638 | + : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
639 | + |
|
640 | + EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
641 | + isset($this->_req_data['event_details_nav_size']) |
|
642 | + ? absint($this->_req_data['event_details_nav_size']) |
|
643 | + : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
644 | + |
|
645 | + EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
646 | + isset($this->_req_data['event_details_control_type']) |
|
647 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
648 | + : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
649 | + |
|
650 | + EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
651 | + isset($this->_req_data['event_details_map_align']) |
|
652 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
653 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
654 | + |
|
655 | + EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
656 | + isset($this->_req_data['event_list_map_width']) |
|
657 | + ? absint($this->_req_data['event_list_map_width']) |
|
658 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
659 | + |
|
660 | + EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
661 | + isset($this->_req_data['event_list_map_height']) |
|
662 | + ? absint($this->_req_data['event_list_map_height']) |
|
663 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
664 | + |
|
665 | + EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
666 | + isset($this->_req_data['event_list_map_zoom']) |
|
667 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
668 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
669 | + |
|
670 | + EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
671 | + isset($this->_req_data['event_list_display_nav']) |
|
672 | + ? absint($this->_req_data['event_list_display_nav']) |
|
673 | + : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
674 | + |
|
675 | + EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
676 | + isset($this->_req_data['event_list_nav_size']) |
|
677 | + ? absint($this->_req_data['event_list_nav_size']) |
|
678 | + : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
679 | + |
|
680 | + EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
681 | + isset($this->_req_data['event_list_control_type']) |
|
682 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
683 | + : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
684 | + |
|
685 | + EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
686 | + isset($this->_req_data['event_list_map_align']) |
|
687 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
688 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
689 | + |
|
690 | + EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
691 | + 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
692 | + EE_Registry::instance()->CFG->map_settings |
|
693 | + ); |
|
694 | + |
|
695 | + $what = 'Google Map Settings'; |
|
696 | + $success = $this->_update_espresso_configuration( |
|
697 | + $what, |
|
698 | + EE_Registry::instance()->CFG->map_settings, |
|
699 | + __FILE__, |
|
700 | + __FUNCTION__, |
|
701 | + __LINE__ |
|
702 | + ); |
|
703 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
704 | + } |
|
705 | + |
|
706 | + |
|
707 | + protected function _venue_editor_metaboxes() |
|
708 | + { |
|
709 | + $this->verify_cpt_object(); |
|
710 | + |
|
711 | + add_meta_box( |
|
712 | + 'espresso_venue_address_options', |
|
713 | + __('Physical Location', 'event_espresso'), |
|
714 | + array($this, 'venue_address_metabox'), |
|
715 | + $this->page_slug, |
|
716 | + 'side', |
|
717 | + 'default' |
|
718 | + ); |
|
719 | + add_meta_box( |
|
720 | + 'espresso_venue_gmap_options', |
|
721 | + __('Google Map', 'event_espresso'), |
|
722 | + array($this, 'venue_gmap_metabox'), |
|
723 | + $this->page_slug, |
|
724 | + 'side', |
|
725 | + 'default' |
|
726 | + ); |
|
727 | + add_meta_box( |
|
728 | + 'espresso_venue_virtual_loc_options', |
|
729 | + __('Virtual Location', 'event_espresso'), |
|
730 | + array($this, 'venue_virtual_loc_metabox'), |
|
731 | + $this->page_slug, |
|
732 | + 'side', |
|
733 | + 'default' |
|
734 | + ); |
|
735 | + } |
|
736 | + |
|
737 | + |
|
738 | + public function venue_gmap_metabox() |
|
739 | + { |
|
740 | + $template_args = array( |
|
741 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
742 | + 'vnu_enable_for_gmap', |
|
743 | + $this->get_yes_no_values(), |
|
744 | + $this->_cpt_model_obj->enable_for_gmap() |
|
745 | + ), |
|
746 | + 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
747 | + ); |
|
748 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
749 | + EEH_Template::display_template($template, $template_args); |
|
750 | + } |
|
751 | + |
|
752 | + |
|
753 | + public function venue_address_metabox() |
|
754 | + { |
|
755 | + |
|
756 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
757 | + |
|
758 | + $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
759 | + $QFI = new EE_Question_Form_Input( |
|
760 | + EE_Question::new_instance( |
|
761 | + array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
762 | + ), |
|
763 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
764 | + array( |
|
765 | + 'input_name' => 'sta_id', |
|
766 | + 'input_id' => 'sta_id', |
|
767 | + 'input_class' => '', |
|
768 | + 'input_prefix' => '', |
|
769 | + 'append_qstn_id' => false, |
|
770 | + ) |
|
771 | + ) |
|
772 | + ); |
|
773 | + $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
774 | + $QFI = new EE_Question_Form_Input( |
|
775 | + EE_Question::new_instance( |
|
776 | + array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
777 | + ), |
|
778 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
779 | + array( |
|
780 | + 'input_name' => 'cnt_iso', |
|
781 | + 'input_id' => 'cnt_iso', |
|
782 | + 'input_class' => '', |
|
783 | + 'input_prefix' => '', |
|
784 | + 'append_qstn_id' => false, |
|
785 | + ) |
|
786 | + ) |
|
787 | + ); |
|
788 | + |
|
789 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
790 | + EEH_Template::display_template($template, $template_args); |
|
791 | + } |
|
792 | + |
|
793 | + |
|
794 | + public function venue_virtual_loc_metabox() |
|
795 | + { |
|
796 | + $template_args = array( |
|
797 | + '_venue' => $this->_cpt_model_obj, |
|
798 | + ); |
|
799 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
800 | + EEH_Template::display_template($template, $template_args); |
|
801 | + } |
|
802 | + |
|
803 | + |
|
804 | + protected function _restore_cpt_item($post_id, $revision_id) |
|
805 | + { |
|
806 | + $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
807 | + |
|
808 | + // meta revision restore |
|
809 | + $venue_obj->restore_revision($revision_id); |
|
810 | + } |
|
811 | + |
|
812 | + |
|
813 | + /** |
|
814 | + * Handles updates for venue cpts |
|
815 | + * |
|
816 | + * @param int $post_id ID of Venue CPT |
|
817 | + * @param object $post Post object (with "blessed" WP properties) |
|
818 | + * @return void |
|
819 | + */ |
|
820 | + protected function _insert_update_cpt_item($post_id, $post) |
|
821 | + { |
|
822 | + |
|
823 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
824 | + return;// get out we're not processing the saving of venues. |
|
825 | + } |
|
826 | + |
|
827 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
828 | + |
|
829 | + $venue_values = array( |
|
830 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
831 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
832 | + : null, |
|
833 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
834 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
835 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
836 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
837 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
838 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
839 | + ',', |
|
840 | + '', |
|
841 | + $this->_req_data['vnu_capacity'] |
|
842 | + ) : EE_INF, |
|
843 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
844 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
845 | + ? $this->_req_data['vnu_virtual_phone'] : null, |
|
846 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
847 | + : null, |
|
848 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
849 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
850 | + ? $this->_req_data['vnu_google_map_link'] : null, |
|
851 | + ); |
|
852 | + |
|
853 | + // update venue |
|
854 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
855 | + |
|
856 | + // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
857 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
858 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
859 | + |
|
860 | + // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
861 | + $venue_update_callbacks = apply_filters( |
|
862 | + 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
863 | + array() |
|
864 | + ); |
|
865 | + |
|
866 | + $att_success = true; |
|
867 | + |
|
868 | + foreach ($venue_update_callbacks as $v_callback) { |
|
869 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
870 | + $att_success = ! $att_success ? $att_success |
|
871 | + : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
872 | + } |
|
873 | + |
|
874 | + // any errors? |
|
875 | + if ($success && ! $att_success) { |
|
876 | + EE_Error::add_error( |
|
877 | + __( |
|
878 | + 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
879 | + 'event_espresso' |
|
880 | + ), |
|
881 | + __FILE__, |
|
882 | + __FUNCTION__, |
|
883 | + __LINE__ |
|
884 | + ); |
|
885 | + } elseif ($success === false) { |
|
886 | + EE_Error::add_error( |
|
887 | + __('Venue Details did not save successfully.', 'event_espresso'), |
|
888 | + __FILE__, |
|
889 | + __FUNCTION__, |
|
890 | + __LINE__ |
|
891 | + ); |
|
892 | + } |
|
893 | + } |
|
894 | + |
|
895 | + |
|
896 | + public function trash_cpt_item($post_id) |
|
897 | + { |
|
898 | + $this->_req_data['VNU_ID'] = $post_id; |
|
899 | + $this->_trash_or_restore_venue('trash', false); |
|
900 | + } |
|
901 | + |
|
902 | + |
|
903 | + public function restore_cpt_item($post_id) |
|
904 | + { |
|
905 | + $this->_req_data['VNU_ID'] = $post_id; |
|
906 | + $this->_trash_or_restore_venue('draft', false); |
|
907 | + } |
|
908 | + |
|
909 | + |
|
910 | + public function delete_cpt_item($post_id) |
|
911 | + { |
|
912 | + $this->_req_data['VNU_ID'] = $post_id; |
|
913 | + $this->_delete_venue(false); |
|
914 | + } |
|
915 | + |
|
916 | + |
|
917 | + public function get_venue_object() |
|
918 | + { |
|
919 | + return $this->_cpt_model_obj; |
|
920 | + } |
|
921 | + |
|
922 | + |
|
923 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
924 | + { |
|
925 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
926 | + |
|
927 | + // loop thru venues |
|
928 | + if ($VNU_ID) { |
|
929 | + // clean status |
|
930 | + $venue_status = sanitize_key($venue_status); |
|
931 | + // grab status |
|
932 | + if (! empty($venue_status)) { |
|
933 | + $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
934 | + } else { |
|
935 | + $success = false; |
|
936 | + $msg = __( |
|
937 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
938 | + 'event_espresso' |
|
939 | + ); |
|
940 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
941 | + } |
|
942 | + } else { |
|
943 | + $success = false; |
|
944 | + $msg = __( |
|
945 | + 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
946 | + 'event_espresso' |
|
947 | + ); |
|
948 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
949 | + } |
|
950 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
951 | + |
|
952 | + if ($redirect_after) { |
|
953 | + $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
954 | + } |
|
955 | + } |
|
956 | + |
|
957 | + |
|
958 | + protected function _trash_or_restore_venues($venue_status = 'trash') |
|
959 | + { |
|
960 | + // clean status |
|
961 | + $venue_status = sanitize_key($venue_status); |
|
962 | + // grab status |
|
963 | + if (! empty($venue_status)) { |
|
964 | + $success = true; |
|
965 | + // determine the event id and set to array. |
|
966 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
967 | + // loop thru events |
|
968 | + foreach ($VNU_IDs as $VNU_ID) { |
|
969 | + if ($VNU_ID = absint($VNU_ID)) { |
|
970 | + $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
971 | + $success = $results !== false ? $success : false; |
|
972 | + } else { |
|
973 | + $msg = sprintf( |
|
974 | + __( |
|
975 | + 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
976 | + 'event_espresso' |
|
977 | + ), |
|
978 | + $VNU_ID |
|
979 | + ); |
|
980 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
981 | + $success = false; |
|
982 | + } |
|
983 | + } |
|
984 | + } else { |
|
985 | + $success = false; |
|
986 | + $msg = __( |
|
987 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
988 | + 'event_espresso' |
|
989 | + ); |
|
990 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
991 | + } |
|
992 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
993 | + $success = $success ? 2 : false; |
|
994 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
995 | + $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
996 | + } |
|
997 | + |
|
998 | + |
|
999 | + /** |
|
1000 | + * _trash_or_restore_venues |
|
1001 | + * |
|
1002 | + * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1003 | + * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1004 | + * accepting a certain number of params. |
|
1005 | + * |
|
1006 | + * @access private |
|
1007 | + * @param int $VNU_ID |
|
1008 | + * @param string $venue_status |
|
1009 | + * @return void |
|
1010 | + */ |
|
1011 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1012 | + { |
|
1013 | + // grab venue id |
|
1014 | + if (! $VNU_ID) { |
|
1015 | + $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1016 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1017 | + return false; |
|
1018 | + } |
|
1019 | + |
|
1020 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1021 | + |
|
1022 | + // clean status |
|
1023 | + $venue_status = sanitize_key($venue_status); |
|
1024 | + // grab status |
|
1025 | + if (! $venue_status) { |
|
1026 | + $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1027 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1028 | + return false; |
|
1029 | + } |
|
1030 | + |
|
1031 | + // was event trashed or restored ? |
|
1032 | + switch ($venue_status) { |
|
1033 | + case 'draft': |
|
1034 | + $action = 'restored from the trash'; |
|
1035 | + $hook = 'AHEE_venue_restored_from_trash'; |
|
1036 | + break; |
|
1037 | + case 'trash': |
|
1038 | + $action = 'moved to the trash'; |
|
1039 | + $hook = 'AHEE_venue_moved_to_trash'; |
|
1040 | + break; |
|
1041 | + default: |
|
1042 | + $action = 'updated'; |
|
1043 | + $hook = false; |
|
1044 | + } |
|
1045 | + // use class to change status |
|
1046 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1047 | + $success = $this->_cpt_model_obj->save(); |
|
1048 | + |
|
1049 | + if ($success === false) { |
|
1050 | + $msg = sprintf(__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1051 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1052 | + return false; |
|
1053 | + } |
|
1054 | + if ($hook) { |
|
1055 | + do_action($hook); |
|
1056 | + } |
|
1057 | + return true; |
|
1058 | + } |
|
1059 | + |
|
1060 | + |
|
1061 | + /** |
|
1062 | + * @param bool $redirect_after |
|
1063 | + * @return void |
|
1064 | + */ |
|
1065 | + protected function _delete_venue($redirect_after = true) |
|
1066 | + { |
|
1067 | + // determine the venue id and set to array. |
|
1068 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1069 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1070 | + |
|
1071 | + |
|
1072 | + // loop thru venues |
|
1073 | + if ($VNU_ID) { |
|
1074 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1075 | + } else { |
|
1076 | + $success = false; |
|
1077 | + $msg = __( |
|
1078 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1079 | + 'event_espresso' |
|
1080 | + ); |
|
1081 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1082 | + } |
|
1083 | + if ($redirect_after) { |
|
1084 | + $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1085 | + } |
|
1086 | + } |
|
1087 | + |
|
1088 | + |
|
1089 | + protected function _delete_venues() |
|
1090 | + { |
|
1091 | + $success = true; |
|
1092 | + // determine the event id and set to array. |
|
1093 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1094 | + // loop thru events |
|
1095 | + foreach ($VNU_IDs as $VNU_ID) { |
|
1096 | + if ($VNU_ID = absint($VNU_ID)) { |
|
1097 | + $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1098 | + $success = $results !== false ? $success : false; |
|
1099 | + } else { |
|
1100 | + $success = false; |
|
1101 | + $msg = __( |
|
1102 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1103 | + 'event_espresso' |
|
1104 | + ); |
|
1105 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1106 | + } |
|
1107 | + } |
|
1108 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1109 | + $success = $success ? 2 : false; |
|
1110 | + $this->_redirect_after_action( |
|
1111 | + $success, |
|
1112 | + __('Venues', 'event_espresso'), |
|
1113 | + __('deleted', 'event_espresso'), |
|
1114 | + array('action' => 'default') |
|
1115 | + ); |
|
1116 | + } |
|
1117 | + |
|
1118 | + |
|
1119 | + // todo: put in parent |
|
1120 | + private function _delete_or_trash_venue($VNU_ID = false) |
|
1121 | + { |
|
1122 | + // grab event id |
|
1123 | + if (! $VNU_ID = absint($VNU_ID)) { |
|
1124 | + $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1125 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1126 | + return false; |
|
1127 | + } |
|
1128 | + |
|
1129 | + |
|
1130 | + $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1131 | + // first need to remove all term relationships |
|
1132 | + $venue->_remove_relations('Term_Taxonomy'); |
|
1133 | + $success = $venue->delete_permanently(); |
|
1134 | + // did it all go as planned ? |
|
1135 | + if ($success) { |
|
1136 | + $msg = sprintf(__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1137 | + EE_Error::add_success($msg); |
|
1138 | + } else { |
|
1139 | + $msg = sprintf(__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1140 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1141 | + return false; |
|
1142 | + } |
|
1143 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1144 | + return true; |
|
1145 | + } |
|
1146 | + |
|
1147 | + |
|
1148 | + |
|
1149 | + |
|
1150 | + /***********/ |
|
1151 | + /* QUERIES */ |
|
1152 | + |
|
1153 | + |
|
1154 | + public function get_venues($per_page = 10, $count = false) |
|
1155 | + { |
|
1156 | + |
|
1157 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1158 | + |
|
1159 | + switch ($_orderby) { |
|
1160 | + case 'id': |
|
1161 | + $orderby = 'VNU_ID'; |
|
1162 | + break; |
|
1163 | + |
|
1164 | + case 'capacity': |
|
1165 | + $orderby = 'VNU_capacity'; |
|
1166 | + break; |
|
1167 | + |
|
1168 | + case 'city': |
|
1169 | + $orderby = 'VNU_city'; |
|
1170 | + break; |
|
1171 | + |
|
1172 | + default: |
|
1173 | + $orderby = 'VNU_name'; |
|
1174 | + } |
|
1175 | + |
|
1176 | + |
|
1177 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1178 | + : 'ASC'; |
|
1179 | + |
|
1180 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1181 | + ? $this->_req_data['paged'] : 1; |
|
1182 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1183 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1184 | + ? $this->_req_data['perpage'] : $per_page; |
|
1185 | + |
|
1186 | + |
|
1187 | + $offset = ($current_page - 1) * $per_page; |
|
1188 | + $limit = array($offset, $per_page); |
|
1189 | + |
|
1190 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1191 | + ? $this->_req_data['category'] : null; |
|
1192 | + $where = array(); |
|
1193 | + |
|
1194 | + // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1195 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1196 | + $where['status'] = $this->_req_data['status']; |
|
1197 | + } |
|
1198 | + |
|
1199 | + if (isset($this->_req_data['venue_status'])) { |
|
1200 | + $where['status'] = $this->_req_data['venue_status']; |
|
1201 | + } |
|
1202 | + |
|
1203 | + |
|
1204 | + if ($category) { |
|
1205 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1206 | + $where['Term_Taxonomy.term_id'] = $category; |
|
1207 | + } |
|
1208 | + |
|
1209 | + |
|
1210 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1211 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1212 | + } else { |
|
1213 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1214 | + $where['OR'] = array( |
|
1215 | + 'status*restrict_private' => array('!=', 'private'), |
|
1216 | + 'AND' => array( |
|
1217 | + 'status*inclusive' => array('=', 'private'), |
|
1218 | + 'VNU_wp_user' => get_current_user_id(), |
|
1219 | + ), |
|
1220 | + ); |
|
1221 | + } |
|
1222 | + } |
|
1223 | + |
|
1224 | + |
|
1225 | + if (isset($this->_req_data['s'])) { |
|
1226 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1227 | + $where['OR'] = array( |
|
1228 | + 'VNU_name' => array('LIKE', $sstr), |
|
1229 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1230 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1231 | + 'VNU_address' => array('LIKE', $sstr), |
|
1232 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1233 | + 'VNU_city' => array('LIKE', $sstr), |
|
1234 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1235 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1236 | + 'VNU_url' => array('LIKE', $sstr), |
|
1237 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1238 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1239 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1240 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1241 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1242 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1243 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1244 | + ); |
|
1245 | + } |
|
1246 | 1246 | |
1247 | 1247 | |
1248 | - $venues = $count |
|
1249 | - ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1250 | - : $this->_venue_model->get_all( |
|
1251 | - array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1252 | - ); |
|
1253 | - |
|
1254 | - return $venues; |
|
1255 | - } |
|
1256 | - |
|
1257 | - |
|
1258 | - |
|
1259 | - |
|
1260 | - /** Venue Category Stuff **/ |
|
1261 | - |
|
1262 | - /** |
|
1263 | - * set the _category property with the category object for the loaded page. |
|
1264 | - * |
|
1265 | - * @access private |
|
1266 | - * @return void |
|
1267 | - */ |
|
1268 | - private function _set_category_object() |
|
1269 | - { |
|
1270 | - if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1271 | - return; |
|
1272 | - } // already have the category object so get out. |
|
1273 | - |
|
1274 | - // set default category object |
|
1275 | - $this->_set_empty_category_object(); |
|
1276 | - |
|
1277 | - // only set if we've got an id |
|
1278 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1279 | - return; |
|
1280 | - } |
|
1281 | - |
|
1282 | - $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1283 | - $term = get_term($category_id, 'espresso_venue_categories'); |
|
1284 | - |
|
1285 | - |
|
1286 | - if (! empty($term)) { |
|
1287 | - $this->_category->category_name = $term->name; |
|
1288 | - $this->_category->category_identifier = $term->slug; |
|
1289 | - $this->_category->category_desc = $term->description; |
|
1290 | - $this->_category->id = $term->term_id; |
|
1291 | - $this->_category->parent = $term->parent; |
|
1292 | - } |
|
1293 | - } |
|
1294 | - |
|
1295 | - |
|
1296 | - private function _set_empty_category_object() |
|
1297 | - { |
|
1298 | - $this->_category = new stdClass(); |
|
1299 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1300 | - $this->_category->id = $this->_category->parent = 0; |
|
1301 | - } |
|
1302 | - |
|
1303 | - |
|
1304 | - protected function _category_list_table() |
|
1305 | - { |
|
1306 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1307 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1308 | - 'add_category', |
|
1309 | - 'add_category', |
|
1310 | - array(), |
|
1311 | - 'add-new-h2' |
|
1312 | - ); |
|
1313 | - $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
|
1314 | - $this->display_admin_list_table_page_with_sidebar(); |
|
1315 | - } |
|
1316 | - |
|
1317 | - |
|
1318 | - protected function _category_details($view) |
|
1319 | - { |
|
1320 | - |
|
1321 | - // load formatter helper |
|
1322 | - // load field generator helper |
|
1323 | - |
|
1324 | - $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1325 | - $this->_set_add_edit_form_tags($route); |
|
1326 | - |
|
1327 | - $this->_set_category_object(); |
|
1328 | - $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1329 | - |
|
1330 | - $delete_action = 'delete_category'; |
|
1331 | - |
|
1332 | - $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1333 | - |
|
1334 | - $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1335 | - |
|
1336 | - // take care of contents |
|
1337 | - $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1338 | - $this->display_admin_page_with_sidebar(); |
|
1339 | - } |
|
1340 | - |
|
1341 | - |
|
1342 | - protected function _category_details_content() |
|
1343 | - { |
|
1344 | - $editor_args['category_desc'] = array( |
|
1345 | - 'type' => 'wp_editor', |
|
1346 | - 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1347 | - 'class' => 'my_editor_custom', |
|
1348 | - 'wpeditor_args' => array('media_buttons' => false), |
|
1349 | - ); |
|
1350 | - $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1351 | - |
|
1352 | - $all_terms = get_terms( |
|
1353 | - array('espresso_venue_categories'), |
|
1354 | - array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1355 | - ); |
|
1356 | - |
|
1357 | - // setup category select for term parents. |
|
1358 | - $category_select_values[] = array( |
|
1359 | - 'text' => __('No Parent', 'event_espresso'), |
|
1360 | - 'id' => 0, |
|
1361 | - ); |
|
1362 | - foreach ($all_terms as $term) { |
|
1363 | - $category_select_values[] = array( |
|
1364 | - 'text' => $term->name, |
|
1365 | - 'id' => $term->term_id, |
|
1366 | - ); |
|
1367 | - } |
|
1368 | - |
|
1369 | - $category_select = EEH_Form_Fields::select_input( |
|
1370 | - 'category_parent', |
|
1371 | - $category_select_values, |
|
1372 | - $this->_category->parent |
|
1373 | - ); |
|
1374 | - $template_args = array( |
|
1375 | - 'category' => $this->_category, |
|
1376 | - 'category_select' => $category_select, |
|
1377 | - 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1378 | - 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1379 | - 'disable' => '', |
|
1380 | - 'disabled_message' => false, |
|
1381 | - ); |
|
1382 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1383 | - return EEH_Template::display_template($template, $template_args, true); |
|
1384 | - } |
|
1385 | - |
|
1386 | - |
|
1387 | - protected function _delete_categories() |
|
1388 | - { |
|
1389 | - $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1390 | - : (array) $this->_req_data['category_id']; |
|
1391 | - |
|
1392 | - foreach ($cat_ids as $cat_id) { |
|
1393 | - $this->_delete_category($cat_id); |
|
1394 | - } |
|
1395 | - |
|
1396 | - // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1397 | - $query_args = array( |
|
1398 | - 'action' => 'category_list', |
|
1399 | - ); |
|
1400 | - $this->_redirect_after_action(0, '', '', $query_args); |
|
1401 | - } |
|
1402 | - |
|
1403 | - |
|
1404 | - protected function _delete_category($cat_id) |
|
1405 | - { |
|
1406 | - $cat_id = absint($cat_id); |
|
1407 | - wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1408 | - } |
|
1409 | - |
|
1410 | - |
|
1411 | - protected function _insert_or_update_category($new_category) |
|
1412 | - { |
|
1413 | - |
|
1414 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1415 | - $success = 0; // we already have a success message so lets not send another. |
|
1416 | - if ($cat_id) { |
|
1417 | - $query_args = array( |
|
1418 | - 'action' => 'edit_category', |
|
1419 | - 'VEN_CAT_ID' => $cat_id, |
|
1420 | - ); |
|
1421 | - } else { |
|
1422 | - $query_args = array('action' => 'add_category'); |
|
1423 | - } |
|
1424 | - $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1425 | - } |
|
1426 | - |
|
1427 | - |
|
1428 | - private function _insert_category($update = false) |
|
1429 | - { |
|
1430 | - $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1431 | - $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1432 | - $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1433 | - $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1434 | - |
|
1435 | - if (empty($category_name)) { |
|
1436 | - $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1437 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1438 | - return false; |
|
1439 | - } |
|
1440 | - |
|
1441 | - |
|
1442 | - $term_args = array( |
|
1443 | - 'name' => $category_name, |
|
1444 | - 'description' => $category_desc, |
|
1445 | - 'parent' => $category_parent, |
|
1446 | - ); |
|
1447 | - |
|
1448 | - $insert_ids = $update |
|
1449 | - ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1450 | - : wp_insert_term( |
|
1451 | - $category_name, |
|
1452 | - 'espresso_venue_categories', |
|
1453 | - $term_args |
|
1454 | - ); |
|
1455 | - |
|
1456 | - if (! is_array($insert_ids)) { |
|
1457 | - $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1458 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1459 | - } else { |
|
1460 | - $cat_id = $insert_ids['term_id']; |
|
1461 | - $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1462 | - EE_Error::add_success($msg); |
|
1463 | - } |
|
1464 | - |
|
1465 | - return $cat_id; |
|
1466 | - } |
|
1467 | - |
|
1468 | - |
|
1469 | - /** |
|
1470 | - * TODO handle category exports() |
|
1471 | - * |
|
1472 | - * @return file export |
|
1473 | - */ |
|
1474 | - protected function _categories_export() |
|
1475 | - { |
|
1476 | - |
|
1477 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1478 | - $new_request_args = array( |
|
1479 | - 'export' => 'report', |
|
1480 | - 'action' => 'categories', |
|
1481 | - 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1482 | - ); |
|
1483 | - |
|
1484 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1485 | - |
|
1486 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1487 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1488 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
1489 | - $EE_Export->export(); |
|
1490 | - } |
|
1491 | - } |
|
1492 | - |
|
1493 | - |
|
1494 | - protected function _import_categories() |
|
1495 | - { |
|
1496 | - |
|
1497 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1498 | - EE_Import::instance()->import(); |
|
1499 | - } |
|
1500 | - |
|
1501 | - |
|
1502 | - public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1503 | - { |
|
1504 | - |
|
1505 | - // testing term stuff |
|
1506 | - $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1507 | - $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1508 | - $limit = ($current_page - 1) * $per_page; |
|
1509 | - $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1510 | - if (isset($this->_req_data['s'])) { |
|
1511 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1512 | - $where['OR'] = array( |
|
1513 | - 'Term.name' => array('LIKE', $sstr), |
|
1514 | - 'description' => array('LIKE', $sstr), |
|
1515 | - ); |
|
1516 | - } |
|
1517 | - |
|
1518 | - $query_params = array( |
|
1519 | - $where, |
|
1520 | - 'order_by' => array($orderby => $order), |
|
1521 | - 'limit' => $limit . ',' . $per_page, |
|
1522 | - 'force_join' => array('Term'), |
|
1523 | - ); |
|
1524 | - |
|
1525 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1526 | - : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1527 | - |
|
1528 | - return $categories; |
|
1529 | - } |
|
1530 | - |
|
1531 | - |
|
1532 | - /* end category stuff */ |
|
1533 | - /**************/ |
|
1248 | + $venues = $count |
|
1249 | + ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1250 | + : $this->_venue_model->get_all( |
|
1251 | + array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1252 | + ); |
|
1253 | + |
|
1254 | + return $venues; |
|
1255 | + } |
|
1256 | + |
|
1257 | + |
|
1258 | + |
|
1259 | + |
|
1260 | + /** Venue Category Stuff **/ |
|
1261 | + |
|
1262 | + /** |
|
1263 | + * set the _category property with the category object for the loaded page. |
|
1264 | + * |
|
1265 | + * @access private |
|
1266 | + * @return void |
|
1267 | + */ |
|
1268 | + private function _set_category_object() |
|
1269 | + { |
|
1270 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1271 | + return; |
|
1272 | + } // already have the category object so get out. |
|
1273 | + |
|
1274 | + // set default category object |
|
1275 | + $this->_set_empty_category_object(); |
|
1276 | + |
|
1277 | + // only set if we've got an id |
|
1278 | + if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1279 | + return; |
|
1280 | + } |
|
1281 | + |
|
1282 | + $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1283 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1284 | + |
|
1285 | + |
|
1286 | + if (! empty($term)) { |
|
1287 | + $this->_category->category_name = $term->name; |
|
1288 | + $this->_category->category_identifier = $term->slug; |
|
1289 | + $this->_category->category_desc = $term->description; |
|
1290 | + $this->_category->id = $term->term_id; |
|
1291 | + $this->_category->parent = $term->parent; |
|
1292 | + } |
|
1293 | + } |
|
1294 | + |
|
1295 | + |
|
1296 | + private function _set_empty_category_object() |
|
1297 | + { |
|
1298 | + $this->_category = new stdClass(); |
|
1299 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1300 | + $this->_category->id = $this->_category->parent = 0; |
|
1301 | + } |
|
1302 | + |
|
1303 | + |
|
1304 | + protected function _category_list_table() |
|
1305 | + { |
|
1306 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1307 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1308 | + 'add_category', |
|
1309 | + 'add_category', |
|
1310 | + array(), |
|
1311 | + 'add-new-h2' |
|
1312 | + ); |
|
1313 | + $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
|
1314 | + $this->display_admin_list_table_page_with_sidebar(); |
|
1315 | + } |
|
1316 | + |
|
1317 | + |
|
1318 | + protected function _category_details($view) |
|
1319 | + { |
|
1320 | + |
|
1321 | + // load formatter helper |
|
1322 | + // load field generator helper |
|
1323 | + |
|
1324 | + $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1325 | + $this->_set_add_edit_form_tags($route); |
|
1326 | + |
|
1327 | + $this->_set_category_object(); |
|
1328 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1329 | + |
|
1330 | + $delete_action = 'delete_category'; |
|
1331 | + |
|
1332 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1333 | + |
|
1334 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1335 | + |
|
1336 | + // take care of contents |
|
1337 | + $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1338 | + $this->display_admin_page_with_sidebar(); |
|
1339 | + } |
|
1340 | + |
|
1341 | + |
|
1342 | + protected function _category_details_content() |
|
1343 | + { |
|
1344 | + $editor_args['category_desc'] = array( |
|
1345 | + 'type' => 'wp_editor', |
|
1346 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1347 | + 'class' => 'my_editor_custom', |
|
1348 | + 'wpeditor_args' => array('media_buttons' => false), |
|
1349 | + ); |
|
1350 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1351 | + |
|
1352 | + $all_terms = get_terms( |
|
1353 | + array('espresso_venue_categories'), |
|
1354 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1355 | + ); |
|
1356 | + |
|
1357 | + // setup category select for term parents. |
|
1358 | + $category_select_values[] = array( |
|
1359 | + 'text' => __('No Parent', 'event_espresso'), |
|
1360 | + 'id' => 0, |
|
1361 | + ); |
|
1362 | + foreach ($all_terms as $term) { |
|
1363 | + $category_select_values[] = array( |
|
1364 | + 'text' => $term->name, |
|
1365 | + 'id' => $term->term_id, |
|
1366 | + ); |
|
1367 | + } |
|
1368 | + |
|
1369 | + $category_select = EEH_Form_Fields::select_input( |
|
1370 | + 'category_parent', |
|
1371 | + $category_select_values, |
|
1372 | + $this->_category->parent |
|
1373 | + ); |
|
1374 | + $template_args = array( |
|
1375 | + 'category' => $this->_category, |
|
1376 | + 'category_select' => $category_select, |
|
1377 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1378 | + 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1379 | + 'disable' => '', |
|
1380 | + 'disabled_message' => false, |
|
1381 | + ); |
|
1382 | + $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1383 | + return EEH_Template::display_template($template, $template_args, true); |
|
1384 | + } |
|
1385 | + |
|
1386 | + |
|
1387 | + protected function _delete_categories() |
|
1388 | + { |
|
1389 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1390 | + : (array) $this->_req_data['category_id']; |
|
1391 | + |
|
1392 | + foreach ($cat_ids as $cat_id) { |
|
1393 | + $this->_delete_category($cat_id); |
|
1394 | + } |
|
1395 | + |
|
1396 | + // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1397 | + $query_args = array( |
|
1398 | + 'action' => 'category_list', |
|
1399 | + ); |
|
1400 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1401 | + } |
|
1402 | + |
|
1403 | + |
|
1404 | + protected function _delete_category($cat_id) |
|
1405 | + { |
|
1406 | + $cat_id = absint($cat_id); |
|
1407 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1408 | + } |
|
1409 | + |
|
1410 | + |
|
1411 | + protected function _insert_or_update_category($new_category) |
|
1412 | + { |
|
1413 | + |
|
1414 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1415 | + $success = 0; // we already have a success message so lets not send another. |
|
1416 | + if ($cat_id) { |
|
1417 | + $query_args = array( |
|
1418 | + 'action' => 'edit_category', |
|
1419 | + 'VEN_CAT_ID' => $cat_id, |
|
1420 | + ); |
|
1421 | + } else { |
|
1422 | + $query_args = array('action' => 'add_category'); |
|
1423 | + } |
|
1424 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1425 | + } |
|
1426 | + |
|
1427 | + |
|
1428 | + private function _insert_category($update = false) |
|
1429 | + { |
|
1430 | + $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1431 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1432 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1433 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1434 | + |
|
1435 | + if (empty($category_name)) { |
|
1436 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1437 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1438 | + return false; |
|
1439 | + } |
|
1440 | + |
|
1441 | + |
|
1442 | + $term_args = array( |
|
1443 | + 'name' => $category_name, |
|
1444 | + 'description' => $category_desc, |
|
1445 | + 'parent' => $category_parent, |
|
1446 | + ); |
|
1447 | + |
|
1448 | + $insert_ids = $update |
|
1449 | + ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1450 | + : wp_insert_term( |
|
1451 | + $category_name, |
|
1452 | + 'espresso_venue_categories', |
|
1453 | + $term_args |
|
1454 | + ); |
|
1455 | + |
|
1456 | + if (! is_array($insert_ids)) { |
|
1457 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1458 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1459 | + } else { |
|
1460 | + $cat_id = $insert_ids['term_id']; |
|
1461 | + $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1462 | + EE_Error::add_success($msg); |
|
1463 | + } |
|
1464 | + |
|
1465 | + return $cat_id; |
|
1466 | + } |
|
1467 | + |
|
1468 | + |
|
1469 | + /** |
|
1470 | + * TODO handle category exports() |
|
1471 | + * |
|
1472 | + * @return file export |
|
1473 | + */ |
|
1474 | + protected function _categories_export() |
|
1475 | + { |
|
1476 | + |
|
1477 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1478 | + $new_request_args = array( |
|
1479 | + 'export' => 'report', |
|
1480 | + 'action' => 'categories', |
|
1481 | + 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1482 | + ); |
|
1483 | + |
|
1484 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1485 | + |
|
1486 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1487 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1488 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1489 | + $EE_Export->export(); |
|
1490 | + } |
|
1491 | + } |
|
1492 | + |
|
1493 | + |
|
1494 | + protected function _import_categories() |
|
1495 | + { |
|
1496 | + |
|
1497 | + require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1498 | + EE_Import::instance()->import(); |
|
1499 | + } |
|
1500 | + |
|
1501 | + |
|
1502 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1503 | + { |
|
1504 | + |
|
1505 | + // testing term stuff |
|
1506 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1507 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1508 | + $limit = ($current_page - 1) * $per_page; |
|
1509 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1510 | + if (isset($this->_req_data['s'])) { |
|
1511 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1512 | + $where['OR'] = array( |
|
1513 | + 'Term.name' => array('LIKE', $sstr), |
|
1514 | + 'description' => array('LIKE', $sstr), |
|
1515 | + ); |
|
1516 | + } |
|
1517 | + |
|
1518 | + $query_params = array( |
|
1519 | + $where, |
|
1520 | + 'order_by' => array($orderby => $order), |
|
1521 | + 'limit' => $limit . ',' . $per_page, |
|
1522 | + 'force_join' => array('Term'), |
|
1523 | + ); |
|
1524 | + |
|
1525 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1526 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1527 | + |
|
1528 | + return $categories; |
|
1529 | + } |
|
1530 | + |
|
1531 | + |
|
1532 | + /* end category stuff */ |
|
1533 | + /**************/ |
|
1534 | 1534 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function _init_page_props() |
47 | 47 | { |
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
48 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
49 | 49 | $this->page_slug = EE_VENUES_PG_SLUG; |
50 | 50 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
52 | 52 | $this->page_label = __('Event Venues', 'event_espresso'); |
53 | 53 | $this->_cpt_model_names = array( |
54 | 54 | 'create_new' => 'EEM_Venue', |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | public function load_scripts_styles() |
460 | 460 | { |
461 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
461 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
462 | 462 | wp_enqueue_style('ee-cat-admin'); |
463 | 463 | } |
464 | 464 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | wp_enqueue_style('espresso-ui-theme'); |
481 | 481 | wp_register_style( |
482 | 482 | 'espresso_venues', |
483 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
483 | + EE_VENUES_ASSETS_URL.'ee-venues-admin.css', |
|
484 | 484 | array(), |
485 | 485 | EVENT_ESPRESSO_VERSION |
486 | 486 | ); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | __("View Venue Archive Page", "event_espresso"), |
540 | 540 | 'button' |
541 | 541 | ); |
542 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
542 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
543 | 543 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
544 | 544 | $this->display_admin_list_table_page_with_sidebar(); |
545 | 545 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
553 | 553 | 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
554 | 554 | ); |
555 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
555 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
556 | 556 | EEH_Template::display_template($template, $extra_rows); |
557 | 557 | } |
558 | 558 | |
@@ -569,21 +569,21 @@ discard block |
||
569 | 569 | $default_map_settings->use_google_maps = true; |
570 | 570 | $default_map_settings->google_map_api_key = ''; |
571 | 571 | // for event details pages (reg page) |
572 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
572 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
579 | 579 | // for event list pages |
580 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
580 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
587 | 587 | |
588 | 588 | $this->_template_args['map_settings'] = |
589 | 589 | isset(EE_Registry::instance()->CFG->map_settings) |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $this->_set_add_edit_form_tags('update_google_map_settings'); |
598 | 598 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
599 | 599 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
600 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
600 | + EE_VENUES_TEMPLATE_PATH.'google_map.template.php', |
|
601 | 601 | $this->_template_args, |
602 | 602 | true |
603 | 603 | ); |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | ), |
746 | 746 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
747 | 747 | ); |
748 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
748 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
749 | 749 | EEH_Template::display_template($template, $template_args); |
750 | 750 | } |
751 | 751 | |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | ) |
787 | 787 | ); |
788 | 788 | |
789 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
789 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
790 | 790 | EEH_Template::display_template($template, $template_args); |
791 | 791 | } |
792 | 792 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | $template_args = array( |
797 | 797 | '_venue' => $this->_cpt_model_obj, |
798 | 798 | ); |
799 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
799 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
800 | 800 | EEH_Template::display_template($template, $template_args); |
801 | 801 | } |
802 | 802 | |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | { |
822 | 822 | |
823 | 823 | if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
824 | - return;// get out we're not processing the saving of venues. |
|
824 | + return; // get out we're not processing the saving of venues. |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | // clean status |
930 | 930 | $venue_status = sanitize_key($venue_status); |
931 | 931 | // grab status |
932 | - if (! empty($venue_status)) { |
|
932 | + if ( ! empty($venue_status)) { |
|
933 | 933 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
934 | 934 | } else { |
935 | 935 | $success = false; |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | // clean status |
961 | 961 | $venue_status = sanitize_key($venue_status); |
962 | 962 | // grab status |
963 | - if (! empty($venue_status)) { |
|
963 | + if ( ! empty($venue_status)) { |
|
964 | 964 | $success = true; |
965 | 965 | // determine the event id and set to array. |
966 | 966 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
1012 | 1012 | { |
1013 | 1013 | // grab venue id |
1014 | - if (! $VNU_ID) { |
|
1014 | + if ( ! $VNU_ID) { |
|
1015 | 1015 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1016 | 1016 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1017 | 1017 | return false; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | // clean status |
1023 | 1023 | $venue_status = sanitize_key($venue_status); |
1024 | 1024 | // grab status |
1025 | - if (! $venue_status) { |
|
1025 | + if ( ! $venue_status) { |
|
1026 | 1026 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
1027 | 1027 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1028 | 1028 | return false; |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | private function _delete_or_trash_venue($VNU_ID = false) |
1121 | 1121 | { |
1122 | 1122 | // grab event id |
1123 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1123 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1124 | 1124 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1125 | 1125 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1126 | 1126 | return false; |
@@ -1207,10 +1207,10 @@ discard block |
||
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1210 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1211 | 1211 | $where['VNU_wp_user'] = get_current_user_id(); |
1212 | 1212 | } else { |
1213 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1213 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1214 | 1214 | $where['OR'] = array( |
1215 | 1215 | 'status*restrict_private' => array('!=', 'private'), |
1216 | 1216 | 'AND' => array( |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | |
1224 | 1224 | |
1225 | 1225 | if (isset($this->_req_data['s'])) { |
1226 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1226 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1227 | 1227 | $where['OR'] = array( |
1228 | 1228 | 'VNU_name' => array('LIKE', $sstr), |
1229 | 1229 | 'VNU_desc' => array('LIKE', $sstr), |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | $this->_set_empty_category_object(); |
1276 | 1276 | |
1277 | 1277 | // only set if we've got an id |
1278 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1278 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1279 | 1279 | return; |
1280 | 1280 | } |
1281 | 1281 | |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | $term = get_term($category_id, 'espresso_venue_categories'); |
1284 | 1284 | |
1285 | 1285 | |
1286 | - if (! empty($term)) { |
|
1286 | + if ( ! empty($term)) { |
|
1287 | 1287 | $this->_category->category_name = $term->name; |
1288 | 1288 | $this->_category->category_identifier = $term->slug; |
1289 | 1289 | $this->_category->category_desc = $term->description; |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | protected function _category_list_table() |
1305 | 1305 | { |
1306 | 1306 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
1307 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1307 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
1308 | 1308 | 'add_category', |
1309 | 1309 | 'add_category', |
1310 | 1310 | array(), |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | 'disable' => '', |
1380 | 1380 | 'disabled_message' => false, |
1381 | 1381 | ); |
1382 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1382 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1383 | 1383 | return EEH_Template::display_template($template, $template_args, true); |
1384 | 1384 | } |
1385 | 1385 | |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | $term_args |
1454 | 1454 | ); |
1455 | 1455 | |
1456 | - if (! is_array($insert_ids)) { |
|
1456 | + if ( ! is_array($insert_ids)) { |
|
1457 | 1457 | $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
1458 | 1458 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1459 | 1459 | } else { |
@@ -1483,8 +1483,8 @@ discard block |
||
1483 | 1483 | |
1484 | 1484 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
1485 | 1485 | |
1486 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1487 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1486 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1487 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1488 | 1488 | $EE_Export = EE_Export::instance($this->_req_data); |
1489 | 1489 | $EE_Export->export(); |
1490 | 1490 | } |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | protected function _import_categories() |
1495 | 1495 | { |
1496 | 1496 | |
1497 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1497 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1498 | 1498 | EE_Import::instance()->import(); |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | $limit = ($current_page - 1) * $per_page; |
1509 | 1509 | $where = array('taxonomy' => 'espresso_venue_categories'); |
1510 | 1510 | if (isset($this->_req_data['s'])) { |
1511 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1511 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1512 | 1512 | $where['OR'] = array( |
1513 | 1513 | 'Term.name' => array('LIKE', $sstr), |
1514 | 1514 | 'description' => array('LIKE', $sstr), |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | $query_params = array( |
1519 | 1519 | $where, |
1520 | 1520 | 'order_by' => array($orderby => $order), |
1521 | - 'limit' => $limit . ',' . $per_page, |
|
1521 | + 'limit' => $limit.','.$per_page, |
|
1522 | 1522 | 'force_join' => array('Term'), |
1523 | 1523 | ); |
1524 | 1524 |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * |
343 | 343 | * @param $template |
344 | 344 | * @param $template_args |
345 | - * @return mixed |
|
345 | + * @return string |
|
346 | 346 | * @throws DomainException |
347 | 347 | */ |
348 | 348 | public function add_additional_datetime_button($template, $template_args) |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @param $template |
362 | 362 | * @param $template_args |
363 | - * @return mixed |
|
363 | + * @return string |
|
364 | 364 | * @throws DomainException |
365 | 365 | */ |
366 | 366 | public function add_datetime_clone_button($template, $template_args) |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @param $template |
380 | 380 | * @param $template_args |
381 | - * @return mixed |
|
381 | + * @return string |
|
382 | 382 | * @throws DomainException |
383 | 383 | */ |
384 | 384 | public function datetime_timezones_template($template, $template_args) |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($routing = true) |
38 | 38 | { |
39 | - if (! defined('EVENTS_CAF_TEMPLATE_PATH')) { |
|
40 | - define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
41 | - define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
42 | - define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
39 | + if ( ! defined('EVENTS_CAF_TEMPLATE_PATH')) { |
|
40 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
41 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
42 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
43 | 43 | } |
44 | 44 | parent::__construct($routing); |
45 | 45 | $this->admin_config = $this->loader->getShared('EE_Admin_Config'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function _extend_page_config() |
59 | 59 | { |
60 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
60 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
61 | 61 | // is there a evt_id in the request? |
62 | 62 | $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
63 | 63 | ? $this->_req_data['EVT_ID'] |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | 'capability' => 'manage_options', |
109 | 109 | 'noheader' => true, |
110 | 110 | ], |
111 | - ]; // don't load these meta boxes if using the advanced editor |
|
111 | + ]; // don't load these meta boxes if using the advanced editor |
|
112 | 112 | $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
113 | 113 | $this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
114 | - if (! $this->admin_config->useAdvancedEditor()) { |
|
114 | + if ( ! $this->admin_config->useAdvancedEditor()) { |
|
115 | 115 | $this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips'; |
116 | 116 | $this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips'; |
117 | 117 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | { |
304 | 304 | $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
305 | 305 | // make sure this is only when editing |
306 | - if (! empty($id)) { |
|
306 | + if ( ! empty($id)) { |
|
307 | 307 | $href = EE_Admin_Page::add_query_args_and_nonce( |
308 | 308 | ['action' => 'duplicate_event', 'EVT_ID' => $id], |
309 | 309 | $this->_admin_base_url |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function load_scripts_styles_edit() |
355 | 355 | { |
356 | - if (! $this->admin_config->useAdvancedEditor()) { |
|
356 | + if ( ! $this->admin_config->useAdvancedEditor()) { |
|
357 | 357 | wp_register_script( |
358 | 358 | 'ee-event-editor-heartbeat', |
359 | - EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', |
|
359 | + EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', |
|
360 | 360 | ['ee_admin_js', 'heartbeat'], |
361 | 361 | EVENT_ESPRESSO_VERSION, |
362 | 362 | true |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | public function add_additional_datetime_button($template, $template_args) |
382 | 382 | { |
383 | 383 | return EEH_Template::display_template( |
384 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', |
|
384 | + EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', |
|
385 | 385 | $template_args, |
386 | 386 | true |
387 | 387 | ); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | public function add_datetime_clone_button($template, $template_args) |
400 | 400 | { |
401 | 401 | return EEH_Template::display_template( |
402 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', |
|
402 | + EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', |
|
403 | 403 | $template_args, |
404 | 404 | true |
405 | 405 | ); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | public function datetime_timezones_template($template, $template_args) |
418 | 418 | { |
419 | 419 | return EEH_Template::display_template( |
420 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', |
|
420 | + EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', |
|
421 | 421 | $template_args, |
422 | 422 | true |
423 | 423 | ); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | { |
549 | 549 | // first make sure the ID for the event is in the request. |
550 | 550 | // If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?) |
551 | - if (! isset($this->_req_data['EVT_ID'])) { |
|
551 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
552 | 552 | EE_Error::add_error( |
553 | 553 | esc_html__( |
554 | 554 | 'In order to duplicate an event an Event ID is required. None was given.', |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | // k we've got EVT_ID so let's use that to get the event we'll duplicate |
565 | 565 | $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
566 | - if (! $orig_event instanceof EE_Event) { |
|
566 | + if ( ! $orig_event instanceof EE_Event) { |
|
567 | 567 | throw new EE_Error( |
568 | 568 | sprintf( |
569 | 569 | esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | $orig_ven = $orig_event->get_many_related('Venue'); |
580 | 580 | // reset the ID and modify other details to make it clear this is a dupe |
581 | 581 | $new_event->set('EVT_ID', 0); |
582 | - $new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso'); |
|
582 | + $new_name = $new_event->name().' '.esc_html__('**DUPLICATE**', 'event_espresso'); |
|
583 | 583 | $new_event->set('EVT_name', $new_name); |
584 | 584 | $new_event->set( |
585 | 585 | 'EVT_slug', |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | 'Question_Group', |
609 | 609 | [['Event_Question_Group.EQG_primary' => true]] |
610 | 610 | ); |
611 | - if (! empty($orig_primary_qgs)) { |
|
611 | + if ( ! empty($orig_primary_qgs)) { |
|
612 | 612 | foreach ($orig_primary_qgs as $id => $obj) { |
613 | 613 | if ($obj instanceof EE_Question_Group) { |
614 | 614 | $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | 'Question_Group', |
621 | 621 | [['Event_Question_Group.EQG_additional' => true]] |
622 | 622 | ); |
623 | - if (! empty($orig_additional_qgs)) { |
|
623 | + if ( ! empty($orig_additional_qgs)) { |
|
624 | 624 | foreach ($orig_additional_qgs as $id => $obj) { |
625 | 625 | if ($obj instanceof EE_Question_Group) { |
626 | 626 | $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | // k now that we have the new event saved we can loop through the datetimes and start adding relations. |
634 | 634 | $cloned_tickets = []; |
635 | 635 | foreach ($orig_datetimes as $orig_dtt) { |
636 | - if (! $orig_dtt instanceof EE_Datetime) { |
|
636 | + if ( ! $orig_dtt instanceof EE_Datetime) { |
|
637 | 637 | continue; |
638 | 638 | } |
639 | 639 | $new_dtt = clone $orig_dtt; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | // now let's get the ticket relations setup. |
649 | 649 | foreach ((array) $orig_tkts as $orig_tkt) { |
650 | 650 | // it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
651 | - if (! $orig_tkt instanceof EE_Ticket) { |
|
651 | + if ( ! $orig_tkt instanceof EE_Ticket) { |
|
652 | 652 | continue; |
653 | 653 | } |
654 | 654 | // is this ticket archived? If it is then let's skip |
@@ -657,8 +657,8 @@ discard block |
||
657 | 657 | } |
658 | 658 | // does this original ticket already exist in the clone_tickets cache? |
659 | 659 | // If so we'll just use the new ticket from it. |
660 | - if (isset($cloned_tickets[ $orig_tkt->ID() ])) { |
|
661 | - $new_tkt = $cloned_tickets[ $orig_tkt->ID() ]; |
|
660 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
661 | + $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
|
662 | 662 | } else { |
663 | 663 | $new_tkt = clone $orig_tkt; |
664 | 664 | // get relations on the $orig_tkt that we need to setup. |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | // for use with later datetimes that have the same ticket. |
692 | 692 | $new_dtt->_add_relation_to($new_tkt, 'Ticket'); |
693 | 693 | $new_dtt->save(); |
694 | - $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt; |
|
694 | + $cloned_tickets[$orig_tkt->ID()] = $new_tkt; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | // clone taxonomy information |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | $this->_admin_base_url |
779 | 779 | ); |
780 | 780 | $content = EEH_Template::display_template( |
781 | - EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php', |
|
781 | + EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', |
|
782 | 782 | $this->_template_args, |
783 | 783 | true |
784 | 784 | ); |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | */ |
800 | 800 | protected function _import_events() |
801 | 801 | { |
802 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
802 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
803 | 803 | $success = EE_Import::instance()->import(); |
804 | 804 | $this->_redirect_after_action($success, 'Import File', 'ran', ['action' => 'import_page'], true); |
805 | 805 | } |
@@ -828,8 +828,8 @@ discard block |
||
828 | 828 | 'EVT_ID' => $event_ids, |
829 | 829 | ]; |
830 | 830 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
831 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
832 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
831 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
832 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
833 | 833 | $EE_Export = EE_Export::instance($this->_req_data); |
834 | 834 | if ($EE_Export instanceof EE_Export) { |
835 | 835 | $EE_Export->export(); |
@@ -852,8 +852,8 @@ discard block |
||
852 | 852 | 'category_ids' => $this->_req_data['EVT_CAT_ID'], |
853 | 853 | ]; |
854 | 854 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
855 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
856 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
855 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
856 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
857 | 857 | $EE_Export = EE_Export::instance($this->_req_data); |
858 | 858 | if ($EE_Export instanceof EE_Export) { |
859 | 859 | $EE_Export->export(); |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | $this->_set_add_edit_form_tags('update_template_settings'); |
899 | 899 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
900 | 900 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
901 | - EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', |
|
901 | + EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', |
|
902 | 902 | $this->_template_args, |
903 | 903 | true |
904 | 904 | ); |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | /** @var FeatureFlags $flags */ |
968 | 968 | $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags'); |
969 | 969 | // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version |
970 | - if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) { |
|
970 | + if ( ! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) { |
|
971 | 971 | add_meta_box( |
972 | 972 | 'espresso_event_editor_event_options', |
973 | 973 | esc_html__('Event Registration Options', 'event_espresso'), |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | $default_reg_status_values |
1037 | 1037 | ); |
1038 | 1038 | EEH_Template::display_template( |
1039 | - EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1039 | + EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php', |
|
1040 | 1040 | $template_args |
1041 | 1041 | ); |
1042 | 1042 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | $venues = $venue_model->get_all(['order_by' => ['VNU_name' => 'ASC']]); |
1146 | 1146 | |
1147 | 1147 | foreach ($venues as $venue) { |
1148 | - $values[ $venue->ID() ] = $venue->name(); |
|
1148 | + $values[$venue->ID()] = $venue->name(); |
|
1149 | 1149 | } |
1150 | 1150 | |
1151 | 1151 | return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
@@ -1179,13 +1179,13 @@ discard block |
||
1179 | 1179 | { |
1180 | 1180 | $start = EEM_Datetime::instance()->convert_datetime_for_query( |
1181 | 1181 | 'DTT_EVT_start', |
1182 | - date('Y-m-d') . ' 00:00:00', |
|
1182 | + date('Y-m-d').' 00:00:00', |
|
1183 | 1183 | 'Y-m-d H:i:s', |
1184 | 1184 | 'UTC' |
1185 | 1185 | ); |
1186 | 1186 | $end = EEM_Datetime::instance()->convert_datetime_for_query( |
1187 | 1187 | 'DTT_EVT_start', |
1188 | - date('Y-m-d') . ' 23:59:59', |
|
1188 | + date('Y-m-d').' 23:59:59', |
|
1189 | 1189 | 'Y-m-d H:i:s', |
1190 | 1190 | 'UTC' |
1191 | 1191 | ); |
@@ -1214,13 +1214,13 @@ discard block |
||
1214 | 1214 | $days_this_month = date('t'); |
1215 | 1215 | $start = EEM_Datetime::instance()->convert_datetime_for_query( |
1216 | 1216 | 'DTT_EVT_start', |
1217 | - $this_year_r . '-' . $this_month_r . '-01 00:00:00', |
|
1217 | + $this_year_r.'-'.$this_month_r.'-01 00:00:00', |
|
1218 | 1218 | 'Y-m-d H:i:s', |
1219 | 1219 | 'UTC' |
1220 | 1220 | ); |
1221 | 1221 | $end = EEM_Datetime::instance()->convert_datetime_for_query( |
1222 | 1222 | 'DTT_EVT_start', |
1223 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', |
|
1223 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', |
|
1224 | 1224 | 'Y-m-d H:i:s', |
1225 | 1225 | 'UTC' |
1226 | 1226 | ); |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | $offset = ($current_page - 1) * $per_page; |
1297 | 1297 | $limit = [$offset, $per_page]; |
1298 | 1298 | if (isset($this->_req_data['s'])) { |
1299 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1299 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1300 | 1300 | $_where['OR'] = [ |
1301 | 1301 | 'TKT_name' => ['LIKE', $sstr], |
1302 | 1302 | 'TKT_description' => ['LIKE', $sstr], |
@@ -1327,16 +1327,16 @@ discard block |
||
1327 | 1327 | $success = 1; |
1328 | 1328 | $TKT = EEM_Ticket::instance(); |
1329 | 1329 | // checkboxes? |
1330 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1330 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1331 | 1331 | // if array has more than one element then success message should be plural |
1332 | 1332 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
1333 | 1333 | // cycle thru the boxes |
1334 | 1334 | foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
1335 | 1335 | if ($trash) { |
1336 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
1336 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
1337 | 1337 | $success = 0; |
1338 | 1338 | } |
1339 | - } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
1339 | + } elseif ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
1340 | 1340 | $success = 0; |
1341 | 1341 | } |
1342 | 1342 | } |
@@ -1344,10 +1344,10 @@ discard block |
||
1344 | 1344 | // grab single id and trash |
1345 | 1345 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
1346 | 1346 | if ($trash) { |
1347 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
1347 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
1348 | 1348 | $success = 0; |
1349 | 1349 | } |
1350 | - } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
1350 | + } elseif ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
1351 | 1351 | $success = 0; |
1352 | 1352 | } |
1353 | 1353 | } |
@@ -1373,20 +1373,20 @@ discard block |
||
1373 | 1373 | { |
1374 | 1374 | $success = 1; |
1375 | 1375 | // checkboxes? |
1376 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1376 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1377 | 1377 | // if array has more than one element then success message should be plural |
1378 | 1378 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
1379 | 1379 | // cycle thru the boxes |
1380 | 1380 | foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
1381 | 1381 | // delete |
1382 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
1382 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1383 | 1383 | $success = 0; |
1384 | 1384 | } |
1385 | 1385 | } |
1386 | 1386 | } else { |
1387 | 1387 | // grab single id and trash |
1388 | 1388 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
1389 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
1389 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1390 | 1390 | $success = 0; |
1391 | 1391 | } |
1392 | 1392 | } |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | protected function _delete_the_ticket($TKT_ID) |
1420 | 1420 | { |
1421 | 1421 | $ticket = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
1422 | - if (! $ticket instanceof EE_Ticket) { |
|
1422 | + if ( ! $ticket instanceof EE_Ticket) { |
|
1423 | 1423 | return false; |
1424 | 1424 | } |
1425 | 1425 | $ticket->_remove_relations('Datetime'); |
@@ -17,1416 +17,1416 @@ |
||
17 | 17 | class Extend_Events_Admin_Page extends Events_Admin_Page |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var EE_Admin_Config |
|
22 | - */ |
|
23 | - protected $admin_config; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var AdvancedEditorAdminFormSection |
|
27 | - */ |
|
28 | - protected $advanced_editor_admin_form; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * Extend_Events_Admin_Page constructor. |
|
33 | - * |
|
34 | - * @param bool $routing |
|
35 | - * @throws ReflectionException |
|
36 | - */ |
|
37 | - public function __construct($routing = true) |
|
38 | - { |
|
39 | - if (! defined('EVENTS_CAF_TEMPLATE_PATH')) { |
|
40 | - define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
41 | - define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
42 | - define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
43 | - } |
|
44 | - parent::__construct($routing); |
|
45 | - $this->admin_config = $this->loader->getShared('EE_Admin_Config'); |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * Sets routes. |
|
51 | - * |
|
52 | - * @throws EE_Error |
|
53 | - * @throws InvalidArgumentException |
|
54 | - * @throws InvalidDataTypeException |
|
55 | - * @throws InvalidInterfaceException |
|
56 | - * @throws Exception |
|
57 | - */ |
|
58 | - protected function _extend_page_config() |
|
59 | - { |
|
60 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
61 | - // is there a evt_id in the request? |
|
62 | - $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
63 | - ? $this->_req_data['EVT_ID'] |
|
64 | - : 0; |
|
65 | - $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
66 | - // tkt_id? |
|
67 | - $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
68 | - ? $this->_req_data['TKT_ID'] |
|
69 | - : 0; |
|
70 | - $new_page_routes = [ |
|
71 | - 'duplicate_event' => [ |
|
72 | - 'func' => '_duplicate_event', |
|
73 | - 'capability' => 'ee_edit_event', |
|
74 | - 'obj_id' => $evt_id, |
|
75 | - 'noheader' => true, |
|
76 | - ], |
|
77 | - 'import_page' => [ |
|
78 | - 'func' => '_import_page', |
|
79 | - 'capability' => 'import', |
|
80 | - ], |
|
81 | - 'import' => [ |
|
82 | - 'func' => '_import_events', |
|
83 | - 'capability' => 'import', |
|
84 | - 'noheader' => true, |
|
85 | - ], |
|
86 | - 'import_events' => [ |
|
87 | - 'func' => '_import_events', |
|
88 | - 'capability' => 'import', |
|
89 | - 'noheader' => true, |
|
90 | - ], |
|
91 | - 'export_events' => [ |
|
92 | - 'func' => '_events_export', |
|
93 | - 'capability' => 'export', |
|
94 | - 'noheader' => true, |
|
95 | - ], |
|
96 | - 'export_categories' => [ |
|
97 | - 'func' => '_categories_export', |
|
98 | - 'capability' => 'export', |
|
99 | - 'noheader' => true, |
|
100 | - ], |
|
101 | - 'sample_export_file' => [ |
|
102 | - 'func' => '_sample_export_file', |
|
103 | - 'capability' => 'export', |
|
104 | - 'noheader' => true, |
|
105 | - ], |
|
106 | - 'update_template_settings' => [ |
|
107 | - 'func' => '_update_template_settings', |
|
108 | - 'capability' => 'manage_options', |
|
109 | - 'noheader' => true, |
|
110 | - ], |
|
111 | - ]; // don't load these meta boxes if using the advanced editor |
|
112 | - $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
113 | - $this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
114 | - if (! $this->admin_config->useAdvancedEditor()) { |
|
115 | - $this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
116 | - $this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
117 | - |
|
118 | - $legacy_editor_page_routes = [ |
|
119 | - 'ticket_list_table' => [ |
|
120 | - 'func' => '_tickets_overview_list_table', |
|
121 | - 'capability' => 'ee_read_default_tickets', |
|
122 | - ], |
|
123 | - 'trash_ticket' => [ |
|
124 | - 'func' => '_trash_or_restore_ticket', |
|
125 | - 'capability' => 'ee_delete_default_ticket', |
|
126 | - 'obj_id' => $tkt_id, |
|
127 | - 'noheader' => true, |
|
128 | - 'args' => ['trash' => true], |
|
129 | - ], |
|
130 | - 'trash_tickets' => [ |
|
131 | - 'func' => '_trash_or_restore_ticket', |
|
132 | - 'capability' => 'ee_delete_default_tickets', |
|
133 | - 'noheader' => true, |
|
134 | - 'args' => ['trash' => true], |
|
135 | - ], |
|
136 | - 'restore_ticket' => [ |
|
137 | - 'func' => '_trash_or_restore_ticket', |
|
138 | - 'capability' => 'ee_delete_default_ticket', |
|
139 | - 'obj_id' => $tkt_id, |
|
140 | - 'noheader' => true, |
|
141 | - ], |
|
142 | - 'restore_tickets' => [ |
|
143 | - 'func' => '_trash_or_restore_ticket', |
|
144 | - 'capability' => 'ee_delete_default_tickets', |
|
145 | - 'noheader' => true, |
|
146 | - ], |
|
147 | - 'delete_ticket' => [ |
|
148 | - 'func' => '_delete_ticket', |
|
149 | - 'capability' => 'ee_delete_default_ticket', |
|
150 | - 'obj_id' => $tkt_id, |
|
151 | - 'noheader' => true, |
|
152 | - ], |
|
153 | - 'delete_tickets' => [ |
|
154 | - 'func' => '_delete_ticket', |
|
155 | - 'capability' => 'ee_delete_default_tickets', |
|
156 | - 'noheader' => true, |
|
157 | - ], |
|
158 | - ]; |
|
159 | - $new_page_routes = array_merge($new_page_routes, $legacy_editor_page_routes); |
|
160 | - } |
|
161 | - |
|
162 | - $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
163 | - // partial route/config override |
|
164 | - $this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes; |
|
165 | - $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
|
166 | - // add tickets tab but only if there are more than one default ticket! |
|
167 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
168 | - [['TKT_is_default' => 1]], |
|
169 | - 'TKT_ID', |
|
170 | - true |
|
171 | - ); |
|
172 | - if ($tkt_count > 1) { |
|
173 | - $new_page_config = [ |
|
174 | - 'ticket_list_table' => [ |
|
175 | - 'nav' => [ |
|
176 | - 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
177 | - 'order' => 60, |
|
178 | - ], |
|
179 | - 'list_table' => 'Tickets_List_Table', |
|
180 | - 'require_nonce' => false, |
|
181 | - ], |
|
182 | - ]; |
|
183 | - } |
|
184 | - // template settings |
|
185 | - $new_page_config['template_settings'] = [ |
|
186 | - 'nav' => [ |
|
187 | - 'label' => esc_html__('Templates', 'event_espresso'), |
|
188 | - 'order' => 30, |
|
189 | - ], |
|
190 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
191 | - 'help_tabs' => [ |
|
192 | - 'general_settings_templates_help_tab' => [ |
|
193 | - 'title' => esc_html__('Templates', 'event_espresso'), |
|
194 | - 'filename' => 'general_settings_templates', |
|
195 | - ], |
|
196 | - ], |
|
197 | - 'help_tour' => ['Templates_Help_Tour'], |
|
198 | - 'require_nonce' => false, |
|
199 | - ]; |
|
200 | - $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
201 | - // add filters and actions |
|
202 | - // modifying _views |
|
203 | - add_filter( |
|
204 | - 'FHEE_event_datetime_metabox_add_additional_date_time_template', |
|
205 | - [$this, 'add_additional_datetime_button'], |
|
206 | - 10, |
|
207 | - 2 |
|
208 | - ); |
|
209 | - add_filter( |
|
210 | - 'FHEE_event_datetime_metabox_clone_button_template', |
|
211 | - [$this, 'add_datetime_clone_button'], |
|
212 | - 10, |
|
213 | - 2 |
|
214 | - ); |
|
215 | - add_filter( |
|
216 | - 'FHEE_event_datetime_metabox_timezones_template', |
|
217 | - [$this, 'datetime_timezones_template'], |
|
218 | - 10, |
|
219 | - 2 |
|
220 | - ); |
|
221 | - // filters for event list table |
|
222 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', [$this, 'list_table_filters'], 10, 2); |
|
223 | - add_filter( |
|
224 | - 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
225 | - [$this, 'extra_list_table_actions'], |
|
226 | - 10, |
|
227 | - 2 |
|
228 | - ); |
|
229 | - // legend item |
|
230 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', [$this, 'additional_legend_items']); |
|
231 | - add_action('admin_init', [$this, 'admin_init']); |
|
232 | - // load additional handlers |
|
233 | - $this->handleActionRequest(); |
|
234 | - } |
|
235 | - |
|
236 | - |
|
237 | - private function getRequestAction() |
|
238 | - { |
|
239 | - return isset($this->_req_data['action']) ? sanitize_key($this->_req_data['action']) : null; |
|
240 | - } |
|
241 | - |
|
242 | - |
|
243 | - /** |
|
244 | - * @throws Exception |
|
245 | - */ |
|
246 | - private function handleActionRequest() |
|
247 | - { |
|
248 | - $action = $this->getRequestAction(); |
|
249 | - if ($action) { |
|
250 | - // setup Advanced Editor ??? |
|
251 | - if ($action === 'default_event_settings' || $action === 'update_default_event_settings') { |
|
252 | - $this->advanced_editor_admin_form = $this->loader->getShared( |
|
253 | - 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' |
|
254 | - ); |
|
255 | - } |
|
256 | - } |
|
257 | - } |
|
258 | - |
|
259 | - |
|
260 | - /** |
|
261 | - * admin_init |
|
262 | - */ |
|
263 | - public function admin_init() |
|
264 | - { |
|
265 | - EE_Registry::$i18n_js_strings = array_merge( |
|
266 | - EE_Registry::$i18n_js_strings, |
|
267 | - [ |
|
268 | - 'image_confirm' => esc_html__( |
|
269 | - 'Do you really want to delete this image? Please remember to update your event to complete the removal.', |
|
270 | - 'event_espresso' |
|
271 | - ), |
|
272 | - 'event_starts_on' => esc_html__('Event Starts on', 'event_espresso'), |
|
273 | - 'event_ends_on' => esc_html__('Event Ends on', 'event_espresso'), |
|
274 | - 'event_datetime_actions' => esc_html__('Actions', 'event_espresso'), |
|
275 | - 'event_clone_dt_msg' => esc_html__('Clone this Event Date and Time', 'event_espresso'), |
|
276 | - 'remove_event_dt_msg' => esc_html__('Remove this Event Time', 'event_espresso'), |
|
277 | - ] |
|
278 | - ); |
|
279 | - } |
|
280 | - |
|
281 | - |
|
282 | - /** |
|
283 | - * Add per page screen options to the default ticket list table view. |
|
284 | - * |
|
285 | - * @throws InvalidArgumentException |
|
286 | - * @throws InvalidDataTypeException |
|
287 | - * @throws InvalidInterfaceException |
|
288 | - */ |
|
289 | - protected function _add_screen_options_ticket_list_table() |
|
290 | - { |
|
291 | - $this->_per_page_screen_option(); |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * @param string $return |
|
297 | - * @param int $id |
|
298 | - * @param string $new_title |
|
299 | - * @param string $new_slug |
|
300 | - * @return string |
|
301 | - */ |
|
302 | - public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) |
|
303 | - { |
|
304 | - $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
305 | - // make sure this is only when editing |
|
306 | - if (! empty($id)) { |
|
307 | - $href = EE_Admin_Page::add_query_args_and_nonce( |
|
308 | - ['action' => 'duplicate_event', 'EVT_ID' => $id], |
|
309 | - $this->_admin_base_url |
|
310 | - ); |
|
311 | - $title = esc_attr__('Duplicate Event', 'event_espresso'); |
|
312 | - $return .= '<a href="' |
|
313 | - . $href |
|
314 | - . '" title="' |
|
315 | - . $title |
|
316 | - . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' |
|
317 | - . $title |
|
318 | - . '</a>'; |
|
319 | - } |
|
320 | - return $return; |
|
321 | - } |
|
322 | - |
|
323 | - |
|
324 | - /** |
|
325 | - * Set the list table views for the default ticket list table view. |
|
326 | - */ |
|
327 | - public function _set_list_table_views_ticket_list_table() |
|
328 | - { |
|
329 | - $this->_views = [ |
|
330 | - 'all' => [ |
|
331 | - 'slug' => 'all', |
|
332 | - 'label' => esc_html__('All', 'event_espresso'), |
|
333 | - 'count' => 0, |
|
334 | - 'bulk_action' => [ |
|
335 | - 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
336 | - ], |
|
337 | - ], |
|
338 | - 'trashed' => [ |
|
339 | - 'slug' => 'trashed', |
|
340 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
341 | - 'count' => 0, |
|
342 | - 'bulk_action' => [ |
|
343 | - 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
344 | - 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
345 | - ], |
|
346 | - ], |
|
347 | - ]; |
|
348 | - } |
|
349 | - |
|
350 | - |
|
351 | - /** |
|
352 | - * Enqueue scripts and styles for the event editor. |
|
353 | - */ |
|
354 | - public function load_scripts_styles_edit() |
|
355 | - { |
|
356 | - if (! $this->admin_config->useAdvancedEditor()) { |
|
357 | - wp_register_script( |
|
358 | - 'ee-event-editor-heartbeat', |
|
359 | - EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', |
|
360 | - ['ee_admin_js', 'heartbeat'], |
|
361 | - EVENT_ESPRESSO_VERSION, |
|
362 | - true |
|
363 | - ); |
|
364 | - wp_enqueue_script('ee-accounting'); |
|
365 | - wp_enqueue_script('ee-event-editor-heartbeat'); |
|
366 | - } |
|
367 | - wp_enqueue_script('event_editor_js'); |
|
368 | - // styles |
|
369 | - wp_enqueue_style('espresso-ui-theme'); |
|
370 | - } |
|
371 | - |
|
372 | - |
|
373 | - /** |
|
374 | - * Returns template for the additional datetime. |
|
375 | - * |
|
376 | - * @param $template |
|
377 | - * @param $template_args |
|
378 | - * @return mixed |
|
379 | - * @throws DomainException |
|
380 | - */ |
|
381 | - public function add_additional_datetime_button($template, $template_args) |
|
382 | - { |
|
383 | - return EEH_Template::display_template( |
|
384 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', |
|
385 | - $template_args, |
|
386 | - true |
|
387 | - ); |
|
388 | - } |
|
389 | - |
|
390 | - |
|
391 | - /** |
|
392 | - * Returns the template for cloning a datetime. |
|
393 | - * |
|
394 | - * @param $template |
|
395 | - * @param $template_args |
|
396 | - * @return mixed |
|
397 | - * @throws DomainException |
|
398 | - */ |
|
399 | - public function add_datetime_clone_button($template, $template_args) |
|
400 | - { |
|
401 | - return EEH_Template::display_template( |
|
402 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', |
|
403 | - $template_args, |
|
404 | - true |
|
405 | - ); |
|
406 | - } |
|
407 | - |
|
408 | - |
|
409 | - /** |
|
410 | - * Returns the template for datetime timezones. |
|
411 | - * |
|
412 | - * @param $template |
|
413 | - * @param $template_args |
|
414 | - * @return mixed |
|
415 | - * @throws DomainException |
|
416 | - */ |
|
417 | - public function datetime_timezones_template($template, $template_args) |
|
418 | - { |
|
419 | - return EEH_Template::display_template( |
|
420 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', |
|
421 | - $template_args, |
|
422 | - true |
|
423 | - ); |
|
424 | - } |
|
425 | - |
|
426 | - |
|
427 | - /** |
|
428 | - * Sets the views for the default list table view. |
|
429 | - * |
|
430 | - * @throws EE_Error |
|
431 | - */ |
|
432 | - protected function _set_list_table_views_default() |
|
433 | - { |
|
434 | - parent::_set_list_table_views_default(); |
|
435 | - $new_views = [ |
|
436 | - 'today' => [ |
|
437 | - 'slug' => 'today', |
|
438 | - 'label' => esc_html__('Today', 'event_espresso'), |
|
439 | - 'count' => $this->total_events_today(), |
|
440 | - 'bulk_action' => [ |
|
441 | - 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
442 | - ], |
|
443 | - ], |
|
444 | - 'month' => [ |
|
445 | - 'slug' => 'month', |
|
446 | - 'label' => esc_html__('This Month', 'event_espresso'), |
|
447 | - 'count' => $this->total_events_this_month(), |
|
448 | - 'bulk_action' => [ |
|
449 | - 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
450 | - ], |
|
451 | - ], |
|
452 | - ]; |
|
453 | - $this->_views = array_merge($this->_views, $new_views); |
|
454 | - } |
|
455 | - |
|
456 | - |
|
457 | - /** |
|
458 | - * Returns the extra action links for the default list table view. |
|
459 | - * |
|
460 | - * @param array $action_links |
|
461 | - * @param EE_Event $event |
|
462 | - * @return array |
|
463 | - * @throws EE_Error |
|
464 | - * @throws InvalidArgumentException |
|
465 | - * @throws InvalidDataTypeException |
|
466 | - * @throws InvalidInterfaceException |
|
467 | - * @throws ReflectionException |
|
468 | - */ |
|
469 | - public function extra_list_table_actions(array $action_links, EE_Event $event) |
|
470 | - { |
|
471 | - if ( |
|
472 | - EE_Registry::instance()->CAP->current_user_can( |
|
473 | - 'ee_read_registrations', |
|
474 | - 'espresso_registrations_reports', |
|
475 | - $event->ID() |
|
476 | - ) |
|
477 | - ) { |
|
478 | - $reports_query_args = [ |
|
479 | - 'action' => 'reports', |
|
480 | - 'EVT_ID' => $event->ID(), |
|
481 | - ]; |
|
482 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
483 | - $action_links[] = '<a href="' |
|
484 | - . $reports_link |
|
485 | - . '" title="' |
|
486 | - . esc_attr__('View Report', 'event_espresso') |
|
487 | - . '"><div class="dashicons dashicons-chart-bar"></div></a>' |
|
488 | - . "\n\t"; |
|
489 | - } |
|
490 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
491 | - EE_Registry::instance()->load_helper('MSG_Template'); |
|
492 | - $action_links[] = EEH_MSG_Template::get_message_action_link( |
|
493 | - 'see_notifications_for', |
|
494 | - null, |
|
495 | - ['EVT_ID' => $event->ID()] |
|
496 | - ); |
|
497 | - } |
|
498 | - return $action_links; |
|
499 | - } |
|
500 | - |
|
501 | - |
|
502 | - /** |
|
503 | - * @param $items |
|
504 | - * @return mixed |
|
505 | - */ |
|
506 | - public function additional_legend_items($items) |
|
507 | - { |
|
508 | - if ( |
|
509 | - EE_Registry::instance()->CAP->current_user_can( |
|
510 | - 'ee_read_registrations', |
|
511 | - 'espresso_registrations_reports' |
|
512 | - ) |
|
513 | - ) { |
|
514 | - $items['reports'] = [ |
|
515 | - 'class' => 'dashicons dashicons-chart-bar', |
|
516 | - 'desc' => esc_html__('Event Reports', 'event_espresso'), |
|
517 | - ]; |
|
518 | - } |
|
519 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
520 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
521 | - // $related_for_icon can sometimes be a string so 'css_class' would be an illegal offset |
|
522 | - // (can only use numeric offsets when treating strings as arrays) |
|
523 | - if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) { |
|
524 | - $items['view_related_messages'] = [ |
|
525 | - 'class' => $related_for_icon['css_class'], |
|
526 | - 'desc' => $related_for_icon['label'], |
|
527 | - ]; |
|
528 | - } |
|
529 | - } |
|
530 | - return $items; |
|
531 | - } |
|
532 | - |
|
533 | - |
|
534 | - /** |
|
535 | - * This is the callback method for the duplicate event route |
|
536 | - * Method looks for 'EVT_ID' in the request and retrieves that event and its details and duplicates them |
|
537 | - * into a new event. We add a hook so that any plugins that add extra event details can hook into this |
|
538 | - * action. Note that the dupe will have **DUPLICATE** as its title and slug. |
|
539 | - * After duplication the redirect is to the new event edit page. |
|
540 | - * |
|
541 | - * @return void |
|
542 | - * @throws EE_Error If EE_Event is not available with given ID |
|
543 | - * @throws InvalidArgumentException |
|
544 | - * @throws InvalidDataTypeException |
|
545 | - * @throws InvalidInterfaceException |
|
546 | - * @throws ReflectionException |
|
547 | - * @access protected |
|
548 | - */ |
|
549 | - protected function _duplicate_event() |
|
550 | - { |
|
551 | - // first make sure the ID for the event is in the request. |
|
552 | - // If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?) |
|
553 | - if (! isset($this->_req_data['EVT_ID'])) { |
|
554 | - EE_Error::add_error( |
|
555 | - esc_html__( |
|
556 | - 'In order to duplicate an event an Event ID is required. None was given.', |
|
557 | - 'event_espresso' |
|
558 | - ), |
|
559 | - __FILE__, |
|
560 | - __FUNCTION__, |
|
561 | - __LINE__ |
|
562 | - ); |
|
563 | - $this->_redirect_after_action(false, '', '', [], true); |
|
564 | - return; |
|
565 | - } |
|
566 | - // k we've got EVT_ID so let's use that to get the event we'll duplicate |
|
567 | - $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
568 | - if (! $orig_event instanceof EE_Event) { |
|
569 | - throw new EE_Error( |
|
570 | - sprintf( |
|
571 | - esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), |
|
572 | - $this->_req_data['EVT_ID'] |
|
573 | - ) |
|
574 | - ); |
|
575 | - } |
|
576 | - // k now let's clone the $orig_event before getting relations |
|
577 | - $new_event = clone $orig_event; |
|
578 | - // original datetimes |
|
579 | - $orig_datetimes = $orig_event->get_many_related('Datetime'); |
|
580 | - // other original relations |
|
581 | - $orig_ven = $orig_event->get_many_related('Venue'); |
|
582 | - // reset the ID and modify other details to make it clear this is a dupe |
|
583 | - $new_event->set('EVT_ID', 0); |
|
584 | - $new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso'); |
|
585 | - $new_event->set('EVT_name', $new_name); |
|
586 | - $new_event->set( |
|
587 | - 'EVT_slug', |
|
588 | - wp_unique_post_slug( |
|
589 | - sanitize_title($orig_event->name()), |
|
590 | - 0, |
|
591 | - 'publish', |
|
592 | - 'espresso_events', |
|
593 | - 0 |
|
594 | - ) |
|
595 | - ); |
|
596 | - $new_event->set('status', 'draft'); |
|
597 | - // duplicate discussion settings |
|
598 | - $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
599 | - $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
600 | - // save the new event |
|
601 | - $new_event->save(); |
|
602 | - // venues |
|
603 | - foreach ($orig_ven as $ven) { |
|
604 | - $new_event->_add_relation_to($ven, 'Venue'); |
|
605 | - } |
|
606 | - $new_event->save(); |
|
607 | - // now we need to get the question group relations and handle that |
|
608 | - // first primary question groups |
|
609 | - $orig_primary_qgs = $orig_event->get_many_related( |
|
610 | - 'Question_Group', |
|
611 | - [['Event_Question_Group.EQG_primary' => true]] |
|
612 | - ); |
|
613 | - if (! empty($orig_primary_qgs)) { |
|
614 | - foreach ($orig_primary_qgs as $id => $obj) { |
|
615 | - if ($obj instanceof EE_Question_Group) { |
|
616 | - $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]); |
|
617 | - } |
|
618 | - } |
|
619 | - } |
|
620 | - // next additional attendee question groups |
|
621 | - $orig_additional_qgs = $orig_event->get_many_related( |
|
622 | - 'Question_Group', |
|
623 | - [['Event_Question_Group.EQG_additional' => true]] |
|
624 | - ); |
|
625 | - if (! empty($orig_additional_qgs)) { |
|
626 | - foreach ($orig_additional_qgs as $id => $obj) { |
|
627 | - if ($obj instanceof EE_Question_Group) { |
|
628 | - $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]); |
|
629 | - } |
|
630 | - } |
|
631 | - } |
|
632 | - |
|
633 | - $new_event->save(); |
|
634 | - |
|
635 | - // k now that we have the new event saved we can loop through the datetimes and start adding relations. |
|
636 | - $cloned_tickets = []; |
|
637 | - foreach ($orig_datetimes as $orig_dtt) { |
|
638 | - if (! $orig_dtt instanceof EE_Datetime) { |
|
639 | - continue; |
|
640 | - } |
|
641 | - $new_dtt = clone $orig_dtt; |
|
642 | - $orig_tkts = $orig_dtt->tickets(); |
|
643 | - // save new dtt then add to event |
|
644 | - $new_dtt->set('DTT_ID', 0); |
|
645 | - $new_dtt->set('DTT_sold', 0); |
|
646 | - $new_dtt->set_reserved(0); |
|
647 | - $new_dtt->save(); |
|
648 | - $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
649 | - $new_event->save(); |
|
650 | - // now let's get the ticket relations setup. |
|
651 | - foreach ((array) $orig_tkts as $orig_tkt) { |
|
652 | - // it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
|
653 | - if (! $orig_tkt instanceof EE_Ticket) { |
|
654 | - continue; |
|
655 | - } |
|
656 | - // is this ticket archived? If it is then let's skip |
|
657 | - if ($orig_tkt->get('TKT_deleted')) { |
|
658 | - continue; |
|
659 | - } |
|
660 | - // does this original ticket already exist in the clone_tickets cache? |
|
661 | - // If so we'll just use the new ticket from it. |
|
662 | - if (isset($cloned_tickets[ $orig_tkt->ID() ])) { |
|
663 | - $new_tkt = $cloned_tickets[ $orig_tkt->ID() ]; |
|
664 | - } else { |
|
665 | - $new_tkt = clone $orig_tkt; |
|
666 | - // get relations on the $orig_tkt that we need to setup. |
|
667 | - $orig_prices = $orig_tkt->prices(); |
|
668 | - $new_tkt->set('TKT_ID', 0); |
|
669 | - $new_tkt->set('TKT_sold', 0); |
|
670 | - $new_tkt->set('TKT_reserved', 0); |
|
671 | - $new_tkt->save(); // make sure new ticket has ID. |
|
672 | - // price relations on new ticket need to be setup. |
|
673 | - foreach ($orig_prices as $orig_price) { |
|
674 | - $new_price = clone $orig_price; |
|
675 | - $new_price->set('PRC_ID', 0); |
|
676 | - $new_price->save(); |
|
677 | - $new_tkt->_add_relation_to($new_price, 'Price'); |
|
678 | - $new_tkt->save(); |
|
679 | - } |
|
680 | - |
|
681 | - do_action( |
|
682 | - 'AHEE__Extend_Events_Admin_Page___duplicate_event__duplicate_ticket__after', |
|
683 | - $orig_tkt, |
|
684 | - $new_tkt, |
|
685 | - $orig_prices, |
|
686 | - $orig_event, |
|
687 | - $orig_dtt, |
|
688 | - $new_dtt |
|
689 | - ); |
|
690 | - } |
|
691 | - // k now we can add the new ticket as a relation to the new datetime |
|
692 | - // and make sure its added to our cached $cloned_tickets array |
|
693 | - // for use with later datetimes that have the same ticket. |
|
694 | - $new_dtt->_add_relation_to($new_tkt, 'Ticket'); |
|
695 | - $new_dtt->save(); |
|
696 | - $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt; |
|
697 | - } |
|
698 | - } |
|
699 | - // clone taxonomy information |
|
700 | - $taxonomies_to_clone_with = apply_filters( |
|
701 | - 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', |
|
702 | - ['espresso_event_categories', 'espresso_event_type', 'post_tag'] |
|
703 | - ); |
|
704 | - // get terms for original event (notice) |
|
705 | - $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
706 | - // loop through terms and add them to new event. |
|
707 | - foreach ($orig_terms as $term) { |
|
708 | - wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
709 | - } |
|
710 | - |
|
711 | - // duplicate other core WP_Post items for this event. |
|
712 | - // post thumbnail (feature image). |
|
713 | - $feature_image_id = get_post_thumbnail_id($orig_event->ID()); |
|
714 | - if ($feature_image_id) { |
|
715 | - update_post_meta($new_event->ID(), '_thumbnail_id', $feature_image_id); |
|
716 | - } |
|
717 | - |
|
718 | - // duplicate page_template setting |
|
719 | - $page_template = get_post_meta($orig_event->ID(), '_wp_page_template', true); |
|
720 | - if ($page_template) { |
|
721 | - update_post_meta($new_event->ID(), '_wp_page_template', $page_template); |
|
722 | - } |
|
723 | - |
|
724 | - do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
725 | - // now let's redirect to the edit page for this duplicated event if we have a new event id. |
|
726 | - if ($new_event->ID()) { |
|
727 | - $redirect_args = [ |
|
728 | - 'post' => $new_event->ID(), |
|
729 | - 'action' => 'edit', |
|
730 | - ]; |
|
731 | - EE_Error::add_success( |
|
732 | - esc_html__( |
|
733 | - 'Event successfully duplicated. Please review the details below and make any necessary edits', |
|
734 | - 'event_espresso' |
|
735 | - ) |
|
736 | - ); |
|
737 | - } else { |
|
738 | - $redirect_args = [ |
|
739 | - 'action' => 'default', |
|
740 | - ]; |
|
741 | - EE_Error::add_error( |
|
742 | - esc_html__('Not able to duplicate event. Something went wrong.', 'event_espresso'), |
|
743 | - __FILE__, |
|
744 | - __FUNCTION__, |
|
745 | - __LINE__ |
|
746 | - ); |
|
747 | - } |
|
748 | - $this->_redirect_after_action(false, '', '', $redirect_args, true); |
|
749 | - } |
|
750 | - |
|
751 | - |
|
752 | - /** |
|
753 | - * Generates output for the import page. |
|
754 | - * |
|
755 | - * @throws DomainException |
|
756 | - * @throws EE_Error |
|
757 | - * @throws InvalidArgumentException |
|
758 | - * @throws InvalidDataTypeException |
|
759 | - * @throws InvalidInterfaceException |
|
760 | - */ |
|
761 | - protected function _import_page() |
|
762 | - { |
|
763 | - $title = esc_html__('Import', 'event_espresso'); |
|
764 | - $intro = esc_html__( |
|
765 | - 'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', |
|
766 | - 'event_espresso' |
|
767 | - ); |
|
768 | - $form_url = EVENTS_ADMIN_URL; |
|
769 | - $action = 'import_events'; |
|
770 | - $type = 'csv'; |
|
771 | - $this->_template_args['form'] = EE_Import::instance()->upload_form( |
|
772 | - $title, |
|
773 | - $intro, |
|
774 | - $form_url, |
|
775 | - $action, |
|
776 | - $type |
|
777 | - ); |
|
778 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
779 | - ['action' => 'sample_export_file'], |
|
780 | - $this->_admin_base_url |
|
781 | - ); |
|
782 | - $content = EEH_Template::display_template( |
|
783 | - EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php', |
|
784 | - $this->_template_args, |
|
785 | - true |
|
786 | - ); |
|
787 | - $this->_template_args['admin_page_content'] = $content; |
|
788 | - $this->display_admin_page_with_sidebar(); |
|
789 | - } |
|
790 | - |
|
791 | - |
|
792 | - /** |
|
793 | - * _import_events |
|
794 | - * This handles displaying the screen and running imports for importing events. |
|
795 | - * |
|
796 | - * @return void |
|
797 | - * @throws EE_Error |
|
798 | - * @throws InvalidArgumentException |
|
799 | - * @throws InvalidDataTypeException |
|
800 | - * @throws InvalidInterfaceException |
|
801 | - */ |
|
802 | - protected function _import_events() |
|
803 | - { |
|
804 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
805 | - $success = EE_Import::instance()->import(); |
|
806 | - $this->_redirect_after_action($success, 'Import File', 'ran', ['action' => 'import_page'], true); |
|
807 | - } |
|
808 | - |
|
809 | - |
|
810 | - /** |
|
811 | - * _events_export |
|
812 | - * Will export all (or just the given event) to a Excel compatible file. |
|
813 | - * |
|
814 | - * @access protected |
|
815 | - * @return void |
|
816 | - */ |
|
817 | - protected function _events_export() |
|
818 | - { |
|
819 | - if (isset($this->_req_data['EVT_ID'])) { |
|
820 | - $event_ids = $this->_req_data['EVT_ID']; |
|
821 | - } elseif (isset($this->_req_data['EVT_IDs'])) { |
|
822 | - $event_ids = $this->_req_data['EVT_IDs']; |
|
823 | - } else { |
|
824 | - $event_ids = null; |
|
825 | - } |
|
826 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
827 | - $new_request_args = [ |
|
828 | - 'export' => 'report', |
|
829 | - 'action' => 'all_event_data', |
|
830 | - 'EVT_ID' => $event_ids, |
|
831 | - ]; |
|
832 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
833 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
834 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
835 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
836 | - if ($EE_Export instanceof EE_Export) { |
|
837 | - $EE_Export->export(); |
|
838 | - } |
|
839 | - } |
|
840 | - } |
|
841 | - |
|
842 | - |
|
843 | - /** |
|
844 | - * handle category exports() |
|
845 | - * |
|
846 | - * @return void |
|
847 | - */ |
|
848 | - protected function _categories_export() |
|
849 | - { |
|
850 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
851 | - $new_request_args = [ |
|
852 | - 'export' => 'report', |
|
853 | - 'action' => 'categories', |
|
854 | - 'category_ids' => $this->_req_data['EVT_CAT_ID'], |
|
855 | - ]; |
|
856 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
857 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
858 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
859 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
860 | - if ($EE_Export instanceof EE_Export) { |
|
861 | - $EE_Export->export(); |
|
862 | - } |
|
863 | - } |
|
864 | - } |
|
865 | - |
|
866 | - |
|
867 | - /** |
|
868 | - * Creates a sample CSV file for importing |
|
869 | - */ |
|
870 | - protected function _sample_export_file() |
|
871 | - { |
|
872 | - $EE_Export = EE_Export::instance(); |
|
873 | - if ($EE_Export instanceof EE_Export) { |
|
874 | - $EE_Export->export(); |
|
875 | - } |
|
876 | - } |
|
877 | - |
|
878 | - |
|
879 | - /************* Template Settings *************/ |
|
880 | - /** |
|
881 | - * Generates template settings page output |
|
882 | - * |
|
883 | - * @throws DomainException |
|
884 | - * @throws EE_Error |
|
885 | - * @throws InvalidArgumentException |
|
886 | - * @throws InvalidDataTypeException |
|
887 | - * @throws InvalidInterfaceException |
|
888 | - */ |
|
889 | - protected function _template_settings() |
|
890 | - { |
|
891 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
892 | - /** |
|
893 | - * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
894 | - * from General_Settings_Admin_Page to here. |
|
895 | - */ |
|
896 | - $this->_template_args = apply_filters( |
|
897 | - 'FHEE__General_Settings_Admin_Page__template_settings__template_args', |
|
898 | - $this->_template_args |
|
899 | - ); |
|
900 | - $this->_set_add_edit_form_tags('update_template_settings'); |
|
901 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
902 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
903 | - EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', |
|
904 | - $this->_template_args, |
|
905 | - true |
|
906 | - ); |
|
907 | - $this->display_admin_page_with_sidebar(); |
|
908 | - } |
|
909 | - |
|
910 | - |
|
911 | - /** |
|
912 | - * Handler for updating template settings. |
|
913 | - * |
|
914 | - * @throws EE_Error |
|
915 | - * @throws InvalidArgumentException |
|
916 | - * @throws InvalidDataTypeException |
|
917 | - * @throws InvalidInterfaceException |
|
918 | - */ |
|
919 | - protected function _update_template_settings() |
|
920 | - { |
|
921 | - /** |
|
922 | - * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
923 | - * from General_Settings_Admin_Page to here. |
|
924 | - */ |
|
925 | - EE_Registry::instance()->CFG->template_settings = apply_filters( |
|
926 | - 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
927 | - EE_Registry::instance()->CFG->template_settings, |
|
928 | - $this->_req_data |
|
929 | - ); |
|
930 | - // update custom post type slugs and detect if we need to flush rewrite rules |
|
931 | - $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
|
932 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) |
|
933 | - ? EE_Registry::instance()->CFG->core->event_cpt_slug |
|
934 | - : EEH_URL::slugify($this->_req_data['event_cpt_slug'], 'events'); |
|
935 | - $what = 'Template Settings'; |
|
936 | - $success = $this->_update_espresso_configuration( |
|
937 | - $what, |
|
938 | - EE_Registry::instance()->CFG->template_settings, |
|
939 | - __FILE__, |
|
940 | - __FUNCTION__, |
|
941 | - __LINE__ |
|
942 | - ); |
|
943 | - if (EE_Registry::instance()->CFG->core->event_cpt_slug !== $old_slug) { |
|
944 | - /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
945 | - $rewrite_rules = LoaderFactory::getLoader()->getShared( |
|
946 | - 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
947 | - ); |
|
948 | - $rewrite_rules->flush(); |
|
949 | - } |
|
950 | - $this->_redirect_after_action($success, $what, 'updated', ['action' => 'template_settings']); |
|
951 | - } |
|
952 | - |
|
953 | - |
|
954 | - /** |
|
955 | - * _premium_event_editor_meta_boxes |
|
956 | - * add all metaboxes related to the event_editor |
|
957 | - * |
|
958 | - * @access protected |
|
959 | - * @return void |
|
960 | - * @throws EE_Error |
|
961 | - * @throws InvalidArgumentException |
|
962 | - * @throws InvalidDataTypeException |
|
963 | - * @throws InvalidInterfaceException |
|
964 | - * @throws ReflectionException |
|
965 | - */ |
|
966 | - protected function _premium_event_editor_meta_boxes() |
|
967 | - { |
|
968 | - $this->verify_cpt_object(); |
|
969 | - /** @var FeatureFlags $flags */ |
|
970 | - $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags'); |
|
971 | - // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version |
|
972 | - if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) { |
|
973 | - add_meta_box( |
|
974 | - 'espresso_event_editor_event_options', |
|
975 | - esc_html__('Event Registration Options', 'event_espresso'), |
|
976 | - [$this, 'registration_options_meta_box'], |
|
977 | - $this->page_slug, |
|
978 | - 'side', |
|
979 | - 'core' |
|
980 | - ); |
|
981 | - } |
|
982 | - } |
|
983 | - |
|
984 | - |
|
985 | - /** |
|
986 | - * override caf metabox |
|
987 | - * |
|
988 | - * @return void |
|
989 | - * @throws DomainException |
|
990 | - * @throws EE_Error |
|
991 | - */ |
|
992 | - public function registration_options_meta_box() |
|
993 | - { |
|
994 | - $yes_no_values = [ |
|
995 | - ['id' => true, 'text' => esc_html__('Yes', 'event_espresso')], |
|
996 | - ['id' => false, 'text' => esc_html__('No', 'event_espresso')], |
|
997 | - ]; |
|
998 | - $default_reg_status_values = EEM_Registration::reg_status_array( |
|
999 | - [ |
|
1000 | - EEM_Registration::status_id_cancelled, |
|
1001 | - EEM_Registration::status_id_declined, |
|
1002 | - EEM_Registration::status_id_incomplete, |
|
1003 | - EEM_Registration::status_id_wait_list, |
|
1004 | - ], |
|
1005 | - true |
|
1006 | - ); |
|
1007 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
1008 | - $template_args['_event'] = $this->_cpt_model_obj; |
|
1009 | - $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
|
1010 | - $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
|
1011 | - 'default_reg_status', |
|
1012 | - $default_reg_status_values, |
|
1013 | - $this->_cpt_model_obj->default_registration_status() |
|
1014 | - ); |
|
1015 | - $template_args['display_description'] = EEH_Form_Fields::select_input( |
|
1016 | - 'display_desc', |
|
1017 | - $yes_no_values, |
|
1018 | - $this->_cpt_model_obj->display_description() |
|
1019 | - ); |
|
1020 | - $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input( |
|
1021 | - 'display_ticket_selector', |
|
1022 | - $yes_no_values, |
|
1023 | - $this->_cpt_model_obj->display_ticket_selector(), |
|
1024 | - '', |
|
1025 | - '', |
|
1026 | - false |
|
1027 | - ); |
|
1028 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input( |
|
1029 | - 'EVT_default_registration_status', |
|
1030 | - $default_reg_status_values, |
|
1031 | - $this->_cpt_model_obj->default_registration_status() |
|
1032 | - ); |
|
1033 | - $template_args['additional_registration_options'] = apply_filters( |
|
1034 | - 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', |
|
1035 | - '', |
|
1036 | - $template_args, |
|
1037 | - $yes_no_values, |
|
1038 | - $default_reg_status_values |
|
1039 | - ); |
|
1040 | - EEH_Template::display_template( |
|
1041 | - EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1042 | - $template_args |
|
1043 | - ); |
|
1044 | - } |
|
1045 | - |
|
1046 | - |
|
1047 | - |
|
1048 | - /** |
|
1049 | - * wp_list_table_mods for caf |
|
1050 | - * ============================ |
|
1051 | - */ |
|
1052 | - /** |
|
1053 | - * hook into list table filters and provide filters for caffeinated list table |
|
1054 | - * |
|
1055 | - * @param array $old_filters any existing filters present |
|
1056 | - * @param array $list_table_obj the list table object |
|
1057 | - * @return array new filters |
|
1058 | - * @throws EE_Error |
|
1059 | - * @throws InvalidArgumentException |
|
1060 | - * @throws InvalidDataTypeException |
|
1061 | - * @throws InvalidInterfaceException |
|
1062 | - * @throws ReflectionException |
|
1063 | - */ |
|
1064 | - public function list_table_filters($old_filters, $list_table_obj) |
|
1065 | - { |
|
1066 | - $filters = []; |
|
1067 | - // first month/year filters |
|
1068 | - $filters[] = $this->espresso_event_months_dropdown(); |
|
1069 | - $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1070 | - // active status dropdown |
|
1071 | - if ($status !== 'draft') { |
|
1072 | - $filters[] = $this->active_status_dropdown( |
|
1073 | - isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '' |
|
1074 | - ); |
|
1075 | - $filters[] = $this->venuesDropdown( |
|
1076 | - isset($this->_req_data['venue']) ? $this->_req_data['venue'] : '' |
|
1077 | - ); |
|
1078 | - } |
|
1079 | - // category filter |
|
1080 | - $filters[] = $this->category_dropdown(); |
|
1081 | - return array_merge($old_filters, $filters); |
|
1082 | - } |
|
1083 | - |
|
1084 | - |
|
1085 | - /** |
|
1086 | - * espresso_event_months_dropdown |
|
1087 | - * |
|
1088 | - * @access public |
|
1089 | - * @return string dropdown listing month/year selections for events. |
|
1090 | - */ |
|
1091 | - public function espresso_event_months_dropdown() |
|
1092 | - { |
|
1093 | - // what we need to do is get all PRIMARY datetimes for all events to filter on. |
|
1094 | - // Note we need to include any other filters that are set! |
|
1095 | - $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1096 | - // categories? |
|
1097 | - $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
1098 | - ? $this->_req_data['EVT_CAT'] |
|
1099 | - : null; |
|
1100 | - // active status? |
|
1101 | - $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null; |
|
1102 | - $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
1103 | - return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
1104 | - } |
|
1105 | - |
|
1106 | - |
|
1107 | - /** |
|
1108 | - * returns a list of "active" statuses on the event |
|
1109 | - * |
|
1110 | - * @param string $current_value whatever the current active status is |
|
1111 | - * @return string |
|
1112 | - */ |
|
1113 | - public function active_status_dropdown($current_value = '') |
|
1114 | - { |
|
1115 | - $select_name = 'active_status'; |
|
1116 | - $values = [ |
|
1117 | - 'none' => esc_html__('Show Active/Inactive', 'event_espresso'), |
|
1118 | - 'active' => esc_html__('Active', 'event_espresso'), |
|
1119 | - 'upcoming' => esc_html__('Upcoming', 'event_espresso'), |
|
1120 | - 'expired' => esc_html__('Expired', 'event_espresso'), |
|
1121 | - 'inactive' => esc_html__('Inactive', 'event_espresso'), |
|
1122 | - ]; |
|
1123 | - |
|
1124 | - return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
1125 | - } |
|
1126 | - |
|
1127 | - |
|
1128 | - /** |
|
1129 | - * returns a list of "venues" |
|
1130 | - * |
|
1131 | - * @param string $current_value whatever the current active status is |
|
1132 | - * @return string |
|
1133 | - * @throws EE_Error |
|
1134 | - * @throws InvalidArgumentException |
|
1135 | - * @throws InvalidDataTypeException |
|
1136 | - * @throws InvalidInterfaceException |
|
1137 | - * @throws ReflectionException |
|
1138 | - */ |
|
1139 | - protected function venuesDropdown($current_value = '') |
|
1140 | - { |
|
1141 | - $select_name = 'venue'; |
|
1142 | - $values = [ |
|
1143 | - '' => esc_html__('All Venues', 'event_espresso'), |
|
1144 | - ]; |
|
1145 | - // populate the list of venues. |
|
1146 | - $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
1147 | - $venues = $venue_model->get_all(['order_by' => ['VNU_name' => 'ASC']]); |
|
1148 | - |
|
1149 | - foreach ($venues as $venue) { |
|
1150 | - $values[ $venue->ID() ] = $venue->name(); |
|
1151 | - } |
|
1152 | - |
|
1153 | - return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
1154 | - } |
|
1155 | - |
|
1156 | - |
|
1157 | - /** |
|
1158 | - * output a dropdown of the categories for the category filter on the event admin list table |
|
1159 | - * |
|
1160 | - * @access public |
|
1161 | - * @return string html |
|
1162 | - */ |
|
1163 | - public function category_dropdown() |
|
1164 | - { |
|
1165 | - $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
1166 | - return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
1167 | - } |
|
1168 | - |
|
1169 | - |
|
1170 | - /** |
|
1171 | - * get total number of events today |
|
1172 | - * |
|
1173 | - * @access public |
|
1174 | - * @return int |
|
1175 | - * @throws EE_Error |
|
1176 | - * @throws InvalidArgumentException |
|
1177 | - * @throws InvalidDataTypeException |
|
1178 | - * @throws InvalidInterfaceException |
|
1179 | - */ |
|
1180 | - public function total_events_today() |
|
1181 | - { |
|
1182 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1183 | - 'DTT_EVT_start', |
|
1184 | - date('Y-m-d') . ' 00:00:00', |
|
1185 | - 'Y-m-d H:i:s', |
|
1186 | - 'UTC' |
|
1187 | - ); |
|
1188 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1189 | - 'DTT_EVT_start', |
|
1190 | - date('Y-m-d') . ' 23:59:59', |
|
1191 | - 'Y-m-d H:i:s', |
|
1192 | - 'UTC' |
|
1193 | - ); |
|
1194 | - $where = [ |
|
1195 | - 'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]], |
|
1196 | - ]; |
|
1197 | - return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true); |
|
1198 | - } |
|
1199 | - |
|
1200 | - |
|
1201 | - /** |
|
1202 | - * get total number of events this month |
|
1203 | - * |
|
1204 | - * @access public |
|
1205 | - * @return int |
|
1206 | - * @throws EE_Error |
|
1207 | - * @throws InvalidArgumentException |
|
1208 | - * @throws InvalidDataTypeException |
|
1209 | - * @throws InvalidInterfaceException |
|
1210 | - */ |
|
1211 | - public function total_events_this_month() |
|
1212 | - { |
|
1213 | - // Dates |
|
1214 | - $this_year_r = date('Y'); |
|
1215 | - $this_month_r = date('m'); |
|
1216 | - $days_this_month = date('t'); |
|
1217 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1218 | - 'DTT_EVT_start', |
|
1219 | - $this_year_r . '-' . $this_month_r . '-01 00:00:00', |
|
1220 | - 'Y-m-d H:i:s', |
|
1221 | - 'UTC' |
|
1222 | - ); |
|
1223 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1224 | - 'DTT_EVT_start', |
|
1225 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', |
|
1226 | - 'Y-m-d H:i:s', |
|
1227 | - 'UTC' |
|
1228 | - ); |
|
1229 | - $where = [ |
|
1230 | - 'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]], |
|
1231 | - ]; |
|
1232 | - return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true); |
|
1233 | - } |
|
1234 | - |
|
1235 | - |
|
1236 | - /** DEFAULT TICKETS STUFF **/ |
|
1237 | - |
|
1238 | - /** |
|
1239 | - * Output default tickets list table view. |
|
1240 | - * |
|
1241 | - * @throws DomainException |
|
1242 | - * @throws EE_Error |
|
1243 | - * @throws InvalidArgumentException |
|
1244 | - * @throws InvalidDataTypeException |
|
1245 | - * @throws InvalidInterfaceException |
|
1246 | - */ |
|
1247 | - public function _tickets_overview_list_table() |
|
1248 | - { |
|
1249 | - $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
1250 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
1251 | - } |
|
1252 | - |
|
1253 | - |
|
1254 | - /** |
|
1255 | - * @param int $per_page |
|
1256 | - * @param bool $count |
|
1257 | - * @param bool $trashed |
|
1258 | - * @return EE_Soft_Delete_Base_Class[]|int |
|
1259 | - * @throws EE_Error |
|
1260 | - * @throws InvalidArgumentException |
|
1261 | - * @throws InvalidDataTypeException |
|
1262 | - * @throws InvalidInterfaceException |
|
1263 | - */ |
|
1264 | - public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
1265 | - { |
|
1266 | - $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1267 | - $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1268 | - switch ($orderby) { |
|
1269 | - case 'TKT_name': |
|
1270 | - $orderby = ['TKT_name' => $order]; |
|
1271 | - break; |
|
1272 | - case 'TKT_price': |
|
1273 | - $orderby = ['TKT_price' => $order]; |
|
1274 | - break; |
|
1275 | - case 'TKT_uses': |
|
1276 | - $orderby = ['TKT_uses' => $order]; |
|
1277 | - break; |
|
1278 | - case 'TKT_min': |
|
1279 | - $orderby = ['TKT_min' => $order]; |
|
1280 | - break; |
|
1281 | - case 'TKT_max': |
|
1282 | - $orderby = ['TKT_max' => $order]; |
|
1283 | - break; |
|
1284 | - case 'TKT_qty': |
|
1285 | - $orderby = ['TKT_qty' => $order]; |
|
1286 | - break; |
|
1287 | - } |
|
1288 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1289 | - ? $this->_req_data['paged'] |
|
1290 | - : 1; |
|
1291 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1292 | - ? $this->_req_data['perpage'] |
|
1293 | - : $per_page; |
|
1294 | - $_where = [ |
|
1295 | - 'TKT_is_default' => 1, |
|
1296 | - 'TKT_deleted' => $trashed, |
|
1297 | - ]; |
|
1298 | - $offset = ($current_page - 1) * $per_page; |
|
1299 | - $limit = [$offset, $per_page]; |
|
1300 | - if (isset($this->_req_data['s'])) { |
|
1301 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1302 | - $_where['OR'] = [ |
|
1303 | - 'TKT_name' => ['LIKE', $sstr], |
|
1304 | - 'TKT_description' => ['LIKE', $sstr], |
|
1305 | - ]; |
|
1306 | - } |
|
1307 | - $query_params = [ |
|
1308 | - $_where, |
|
1309 | - 'order_by' => $orderby, |
|
1310 | - 'limit' => $limit, |
|
1311 | - 'group_by' => 'TKT_ID', |
|
1312 | - ]; |
|
1313 | - if ($count) { |
|
1314 | - return EEM_Ticket::instance()->count_deleted_and_undeleted([$_where]); |
|
1315 | - } |
|
1316 | - return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
1317 | - } |
|
1318 | - |
|
1319 | - |
|
1320 | - /** |
|
1321 | - * @param bool $trash |
|
1322 | - * @throws EE_Error |
|
1323 | - * @throws InvalidArgumentException |
|
1324 | - * @throws InvalidDataTypeException |
|
1325 | - * @throws InvalidInterfaceException |
|
1326 | - */ |
|
1327 | - protected function _trash_or_restore_ticket($trash = false) |
|
1328 | - { |
|
1329 | - $success = 1; |
|
1330 | - $TKT = EEM_Ticket::instance(); |
|
1331 | - // checkboxes? |
|
1332 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1333 | - // if array has more than one element then success message should be plural |
|
1334 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1335 | - // cycle thru the boxes |
|
1336 | - foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
1337 | - if ($trash) { |
|
1338 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
1339 | - $success = 0; |
|
1340 | - } |
|
1341 | - } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
1342 | - $success = 0; |
|
1343 | - } |
|
1344 | - } |
|
1345 | - } else { |
|
1346 | - // grab single id and trash |
|
1347 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1348 | - if ($trash) { |
|
1349 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
1350 | - $success = 0; |
|
1351 | - } |
|
1352 | - } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
1353 | - $success = 0; |
|
1354 | - } |
|
1355 | - } |
|
1356 | - $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
1357 | - $query_args = [ |
|
1358 | - 'action' => 'ticket_list_table', |
|
1359 | - 'status' => $trash ? '' : 'trashed', |
|
1360 | - ]; |
|
1361 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1362 | - } |
|
1363 | - |
|
1364 | - |
|
1365 | - /** |
|
1366 | - * Handles trashing default ticket. |
|
1367 | - * |
|
1368 | - * @throws EE_Error |
|
1369 | - * @throws InvalidArgumentException |
|
1370 | - * @throws InvalidDataTypeException |
|
1371 | - * @throws InvalidInterfaceException |
|
1372 | - * @throws ReflectionException |
|
1373 | - */ |
|
1374 | - protected function _delete_ticket() |
|
1375 | - { |
|
1376 | - $success = 1; |
|
1377 | - // checkboxes? |
|
1378 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1379 | - // if array has more than one element then success message should be plural |
|
1380 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1381 | - // cycle thru the boxes |
|
1382 | - foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
1383 | - // delete |
|
1384 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
1385 | - $success = 0; |
|
1386 | - } |
|
1387 | - } |
|
1388 | - } else { |
|
1389 | - // grab single id and trash |
|
1390 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1391 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
1392 | - $success = 0; |
|
1393 | - } |
|
1394 | - } |
|
1395 | - $action_desc = 'deleted'; |
|
1396 | - // fail safe. If the default ticket count === 1 then we need to redirect to event overview. |
|
1397 | - $ticket_count = EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
1398 | - [['TKT_is_default' => 1]], |
|
1399 | - 'TKT_ID', |
|
1400 | - true |
|
1401 | - ); |
|
1402 | - $query_args = $ticket_count |
|
1403 | - ? [] |
|
1404 | - : [ |
|
1405 | - 'action' => 'ticket_list_table', |
|
1406 | - 'status' => 'trashed', |
|
1407 | - ]; |
|
1408 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1409 | - } |
|
1410 | - |
|
1411 | - |
|
1412 | - /** |
|
1413 | - * @param int $TKT_ID |
|
1414 | - * @return bool|int |
|
1415 | - * @throws EE_Error |
|
1416 | - * @throws InvalidArgumentException |
|
1417 | - * @throws InvalidDataTypeException |
|
1418 | - * @throws InvalidInterfaceException |
|
1419 | - * @throws ReflectionException |
|
1420 | - */ |
|
1421 | - protected function _delete_the_ticket($TKT_ID) |
|
1422 | - { |
|
1423 | - $ticket = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1424 | - if (! $ticket instanceof EE_Ticket) { |
|
1425 | - return false; |
|
1426 | - } |
|
1427 | - $ticket->_remove_relations('Datetime'); |
|
1428 | - // delete all related prices first |
|
1429 | - $ticket->delete_related_permanently('Price'); |
|
1430 | - return $ticket->delete_permanently(); |
|
1431 | - } |
|
20 | + /** |
|
21 | + * @var EE_Admin_Config |
|
22 | + */ |
|
23 | + protected $admin_config; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var AdvancedEditorAdminFormSection |
|
27 | + */ |
|
28 | + protected $advanced_editor_admin_form; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * Extend_Events_Admin_Page constructor. |
|
33 | + * |
|
34 | + * @param bool $routing |
|
35 | + * @throws ReflectionException |
|
36 | + */ |
|
37 | + public function __construct($routing = true) |
|
38 | + { |
|
39 | + if (! defined('EVENTS_CAF_TEMPLATE_PATH')) { |
|
40 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
41 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
42 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
43 | + } |
|
44 | + parent::__construct($routing); |
|
45 | + $this->admin_config = $this->loader->getShared('EE_Admin_Config'); |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * Sets routes. |
|
51 | + * |
|
52 | + * @throws EE_Error |
|
53 | + * @throws InvalidArgumentException |
|
54 | + * @throws InvalidDataTypeException |
|
55 | + * @throws InvalidInterfaceException |
|
56 | + * @throws Exception |
|
57 | + */ |
|
58 | + protected function _extend_page_config() |
|
59 | + { |
|
60 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
61 | + // is there a evt_id in the request? |
|
62 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
63 | + ? $this->_req_data['EVT_ID'] |
|
64 | + : 0; |
|
65 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
66 | + // tkt_id? |
|
67 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
68 | + ? $this->_req_data['TKT_ID'] |
|
69 | + : 0; |
|
70 | + $new_page_routes = [ |
|
71 | + 'duplicate_event' => [ |
|
72 | + 'func' => '_duplicate_event', |
|
73 | + 'capability' => 'ee_edit_event', |
|
74 | + 'obj_id' => $evt_id, |
|
75 | + 'noheader' => true, |
|
76 | + ], |
|
77 | + 'import_page' => [ |
|
78 | + 'func' => '_import_page', |
|
79 | + 'capability' => 'import', |
|
80 | + ], |
|
81 | + 'import' => [ |
|
82 | + 'func' => '_import_events', |
|
83 | + 'capability' => 'import', |
|
84 | + 'noheader' => true, |
|
85 | + ], |
|
86 | + 'import_events' => [ |
|
87 | + 'func' => '_import_events', |
|
88 | + 'capability' => 'import', |
|
89 | + 'noheader' => true, |
|
90 | + ], |
|
91 | + 'export_events' => [ |
|
92 | + 'func' => '_events_export', |
|
93 | + 'capability' => 'export', |
|
94 | + 'noheader' => true, |
|
95 | + ], |
|
96 | + 'export_categories' => [ |
|
97 | + 'func' => '_categories_export', |
|
98 | + 'capability' => 'export', |
|
99 | + 'noheader' => true, |
|
100 | + ], |
|
101 | + 'sample_export_file' => [ |
|
102 | + 'func' => '_sample_export_file', |
|
103 | + 'capability' => 'export', |
|
104 | + 'noheader' => true, |
|
105 | + ], |
|
106 | + 'update_template_settings' => [ |
|
107 | + 'func' => '_update_template_settings', |
|
108 | + 'capability' => 'manage_options', |
|
109 | + 'noheader' => true, |
|
110 | + ], |
|
111 | + ]; // don't load these meta boxes if using the advanced editor |
|
112 | + $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
113 | + $this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
|
114 | + if (! $this->admin_config->useAdvancedEditor()) { |
|
115 | + $this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
116 | + $this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips'; |
|
117 | + |
|
118 | + $legacy_editor_page_routes = [ |
|
119 | + 'ticket_list_table' => [ |
|
120 | + 'func' => '_tickets_overview_list_table', |
|
121 | + 'capability' => 'ee_read_default_tickets', |
|
122 | + ], |
|
123 | + 'trash_ticket' => [ |
|
124 | + 'func' => '_trash_or_restore_ticket', |
|
125 | + 'capability' => 'ee_delete_default_ticket', |
|
126 | + 'obj_id' => $tkt_id, |
|
127 | + 'noheader' => true, |
|
128 | + 'args' => ['trash' => true], |
|
129 | + ], |
|
130 | + 'trash_tickets' => [ |
|
131 | + 'func' => '_trash_or_restore_ticket', |
|
132 | + 'capability' => 'ee_delete_default_tickets', |
|
133 | + 'noheader' => true, |
|
134 | + 'args' => ['trash' => true], |
|
135 | + ], |
|
136 | + 'restore_ticket' => [ |
|
137 | + 'func' => '_trash_or_restore_ticket', |
|
138 | + 'capability' => 'ee_delete_default_ticket', |
|
139 | + 'obj_id' => $tkt_id, |
|
140 | + 'noheader' => true, |
|
141 | + ], |
|
142 | + 'restore_tickets' => [ |
|
143 | + 'func' => '_trash_or_restore_ticket', |
|
144 | + 'capability' => 'ee_delete_default_tickets', |
|
145 | + 'noheader' => true, |
|
146 | + ], |
|
147 | + 'delete_ticket' => [ |
|
148 | + 'func' => '_delete_ticket', |
|
149 | + 'capability' => 'ee_delete_default_ticket', |
|
150 | + 'obj_id' => $tkt_id, |
|
151 | + 'noheader' => true, |
|
152 | + ], |
|
153 | + 'delete_tickets' => [ |
|
154 | + 'func' => '_delete_ticket', |
|
155 | + 'capability' => 'ee_delete_default_tickets', |
|
156 | + 'noheader' => true, |
|
157 | + ], |
|
158 | + ]; |
|
159 | + $new_page_routes = array_merge($new_page_routes, $legacy_editor_page_routes); |
|
160 | + } |
|
161 | + |
|
162 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
163 | + // partial route/config override |
|
164 | + $this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes; |
|
165 | + $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
|
166 | + // add tickets tab but only if there are more than one default ticket! |
|
167 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
168 | + [['TKT_is_default' => 1]], |
|
169 | + 'TKT_ID', |
|
170 | + true |
|
171 | + ); |
|
172 | + if ($tkt_count > 1) { |
|
173 | + $new_page_config = [ |
|
174 | + 'ticket_list_table' => [ |
|
175 | + 'nav' => [ |
|
176 | + 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
177 | + 'order' => 60, |
|
178 | + ], |
|
179 | + 'list_table' => 'Tickets_List_Table', |
|
180 | + 'require_nonce' => false, |
|
181 | + ], |
|
182 | + ]; |
|
183 | + } |
|
184 | + // template settings |
|
185 | + $new_page_config['template_settings'] = [ |
|
186 | + 'nav' => [ |
|
187 | + 'label' => esc_html__('Templates', 'event_espresso'), |
|
188 | + 'order' => 30, |
|
189 | + ], |
|
190 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
191 | + 'help_tabs' => [ |
|
192 | + 'general_settings_templates_help_tab' => [ |
|
193 | + 'title' => esc_html__('Templates', 'event_espresso'), |
|
194 | + 'filename' => 'general_settings_templates', |
|
195 | + ], |
|
196 | + ], |
|
197 | + 'help_tour' => ['Templates_Help_Tour'], |
|
198 | + 'require_nonce' => false, |
|
199 | + ]; |
|
200 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
201 | + // add filters and actions |
|
202 | + // modifying _views |
|
203 | + add_filter( |
|
204 | + 'FHEE_event_datetime_metabox_add_additional_date_time_template', |
|
205 | + [$this, 'add_additional_datetime_button'], |
|
206 | + 10, |
|
207 | + 2 |
|
208 | + ); |
|
209 | + add_filter( |
|
210 | + 'FHEE_event_datetime_metabox_clone_button_template', |
|
211 | + [$this, 'add_datetime_clone_button'], |
|
212 | + 10, |
|
213 | + 2 |
|
214 | + ); |
|
215 | + add_filter( |
|
216 | + 'FHEE_event_datetime_metabox_timezones_template', |
|
217 | + [$this, 'datetime_timezones_template'], |
|
218 | + 10, |
|
219 | + 2 |
|
220 | + ); |
|
221 | + // filters for event list table |
|
222 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', [$this, 'list_table_filters'], 10, 2); |
|
223 | + add_filter( |
|
224 | + 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
225 | + [$this, 'extra_list_table_actions'], |
|
226 | + 10, |
|
227 | + 2 |
|
228 | + ); |
|
229 | + // legend item |
|
230 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', [$this, 'additional_legend_items']); |
|
231 | + add_action('admin_init', [$this, 'admin_init']); |
|
232 | + // load additional handlers |
|
233 | + $this->handleActionRequest(); |
|
234 | + } |
|
235 | + |
|
236 | + |
|
237 | + private function getRequestAction() |
|
238 | + { |
|
239 | + return isset($this->_req_data['action']) ? sanitize_key($this->_req_data['action']) : null; |
|
240 | + } |
|
241 | + |
|
242 | + |
|
243 | + /** |
|
244 | + * @throws Exception |
|
245 | + */ |
|
246 | + private function handleActionRequest() |
|
247 | + { |
|
248 | + $action = $this->getRequestAction(); |
|
249 | + if ($action) { |
|
250 | + // setup Advanced Editor ??? |
|
251 | + if ($action === 'default_event_settings' || $action === 'update_default_event_settings') { |
|
252 | + $this->advanced_editor_admin_form = $this->loader->getShared( |
|
253 | + 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' |
|
254 | + ); |
|
255 | + } |
|
256 | + } |
|
257 | + } |
|
258 | + |
|
259 | + |
|
260 | + /** |
|
261 | + * admin_init |
|
262 | + */ |
|
263 | + public function admin_init() |
|
264 | + { |
|
265 | + EE_Registry::$i18n_js_strings = array_merge( |
|
266 | + EE_Registry::$i18n_js_strings, |
|
267 | + [ |
|
268 | + 'image_confirm' => esc_html__( |
|
269 | + 'Do you really want to delete this image? Please remember to update your event to complete the removal.', |
|
270 | + 'event_espresso' |
|
271 | + ), |
|
272 | + 'event_starts_on' => esc_html__('Event Starts on', 'event_espresso'), |
|
273 | + 'event_ends_on' => esc_html__('Event Ends on', 'event_espresso'), |
|
274 | + 'event_datetime_actions' => esc_html__('Actions', 'event_espresso'), |
|
275 | + 'event_clone_dt_msg' => esc_html__('Clone this Event Date and Time', 'event_espresso'), |
|
276 | + 'remove_event_dt_msg' => esc_html__('Remove this Event Time', 'event_espresso'), |
|
277 | + ] |
|
278 | + ); |
|
279 | + } |
|
280 | + |
|
281 | + |
|
282 | + /** |
|
283 | + * Add per page screen options to the default ticket list table view. |
|
284 | + * |
|
285 | + * @throws InvalidArgumentException |
|
286 | + * @throws InvalidDataTypeException |
|
287 | + * @throws InvalidInterfaceException |
|
288 | + */ |
|
289 | + protected function _add_screen_options_ticket_list_table() |
|
290 | + { |
|
291 | + $this->_per_page_screen_option(); |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * @param string $return |
|
297 | + * @param int $id |
|
298 | + * @param string $new_title |
|
299 | + * @param string $new_slug |
|
300 | + * @return string |
|
301 | + */ |
|
302 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) |
|
303 | + { |
|
304 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
305 | + // make sure this is only when editing |
|
306 | + if (! empty($id)) { |
|
307 | + $href = EE_Admin_Page::add_query_args_and_nonce( |
|
308 | + ['action' => 'duplicate_event', 'EVT_ID' => $id], |
|
309 | + $this->_admin_base_url |
|
310 | + ); |
|
311 | + $title = esc_attr__('Duplicate Event', 'event_espresso'); |
|
312 | + $return .= '<a href="' |
|
313 | + . $href |
|
314 | + . '" title="' |
|
315 | + . $title |
|
316 | + . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' |
|
317 | + . $title |
|
318 | + . '</a>'; |
|
319 | + } |
|
320 | + return $return; |
|
321 | + } |
|
322 | + |
|
323 | + |
|
324 | + /** |
|
325 | + * Set the list table views for the default ticket list table view. |
|
326 | + */ |
|
327 | + public function _set_list_table_views_ticket_list_table() |
|
328 | + { |
|
329 | + $this->_views = [ |
|
330 | + 'all' => [ |
|
331 | + 'slug' => 'all', |
|
332 | + 'label' => esc_html__('All', 'event_espresso'), |
|
333 | + 'count' => 0, |
|
334 | + 'bulk_action' => [ |
|
335 | + 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
336 | + ], |
|
337 | + ], |
|
338 | + 'trashed' => [ |
|
339 | + 'slug' => 'trashed', |
|
340 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
341 | + 'count' => 0, |
|
342 | + 'bulk_action' => [ |
|
343 | + 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
344 | + 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
345 | + ], |
|
346 | + ], |
|
347 | + ]; |
|
348 | + } |
|
349 | + |
|
350 | + |
|
351 | + /** |
|
352 | + * Enqueue scripts and styles for the event editor. |
|
353 | + */ |
|
354 | + public function load_scripts_styles_edit() |
|
355 | + { |
|
356 | + if (! $this->admin_config->useAdvancedEditor()) { |
|
357 | + wp_register_script( |
|
358 | + 'ee-event-editor-heartbeat', |
|
359 | + EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', |
|
360 | + ['ee_admin_js', 'heartbeat'], |
|
361 | + EVENT_ESPRESSO_VERSION, |
|
362 | + true |
|
363 | + ); |
|
364 | + wp_enqueue_script('ee-accounting'); |
|
365 | + wp_enqueue_script('ee-event-editor-heartbeat'); |
|
366 | + } |
|
367 | + wp_enqueue_script('event_editor_js'); |
|
368 | + // styles |
|
369 | + wp_enqueue_style('espresso-ui-theme'); |
|
370 | + } |
|
371 | + |
|
372 | + |
|
373 | + /** |
|
374 | + * Returns template for the additional datetime. |
|
375 | + * |
|
376 | + * @param $template |
|
377 | + * @param $template_args |
|
378 | + * @return mixed |
|
379 | + * @throws DomainException |
|
380 | + */ |
|
381 | + public function add_additional_datetime_button($template, $template_args) |
|
382 | + { |
|
383 | + return EEH_Template::display_template( |
|
384 | + EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', |
|
385 | + $template_args, |
|
386 | + true |
|
387 | + ); |
|
388 | + } |
|
389 | + |
|
390 | + |
|
391 | + /** |
|
392 | + * Returns the template for cloning a datetime. |
|
393 | + * |
|
394 | + * @param $template |
|
395 | + * @param $template_args |
|
396 | + * @return mixed |
|
397 | + * @throws DomainException |
|
398 | + */ |
|
399 | + public function add_datetime_clone_button($template, $template_args) |
|
400 | + { |
|
401 | + return EEH_Template::display_template( |
|
402 | + EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', |
|
403 | + $template_args, |
|
404 | + true |
|
405 | + ); |
|
406 | + } |
|
407 | + |
|
408 | + |
|
409 | + /** |
|
410 | + * Returns the template for datetime timezones. |
|
411 | + * |
|
412 | + * @param $template |
|
413 | + * @param $template_args |
|
414 | + * @return mixed |
|
415 | + * @throws DomainException |
|
416 | + */ |
|
417 | + public function datetime_timezones_template($template, $template_args) |
|
418 | + { |
|
419 | + return EEH_Template::display_template( |
|
420 | + EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', |
|
421 | + $template_args, |
|
422 | + true |
|
423 | + ); |
|
424 | + } |
|
425 | + |
|
426 | + |
|
427 | + /** |
|
428 | + * Sets the views for the default list table view. |
|
429 | + * |
|
430 | + * @throws EE_Error |
|
431 | + */ |
|
432 | + protected function _set_list_table_views_default() |
|
433 | + { |
|
434 | + parent::_set_list_table_views_default(); |
|
435 | + $new_views = [ |
|
436 | + 'today' => [ |
|
437 | + 'slug' => 'today', |
|
438 | + 'label' => esc_html__('Today', 'event_espresso'), |
|
439 | + 'count' => $this->total_events_today(), |
|
440 | + 'bulk_action' => [ |
|
441 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
442 | + ], |
|
443 | + ], |
|
444 | + 'month' => [ |
|
445 | + 'slug' => 'month', |
|
446 | + 'label' => esc_html__('This Month', 'event_espresso'), |
|
447 | + 'count' => $this->total_events_this_month(), |
|
448 | + 'bulk_action' => [ |
|
449 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
450 | + ], |
|
451 | + ], |
|
452 | + ]; |
|
453 | + $this->_views = array_merge($this->_views, $new_views); |
|
454 | + } |
|
455 | + |
|
456 | + |
|
457 | + /** |
|
458 | + * Returns the extra action links for the default list table view. |
|
459 | + * |
|
460 | + * @param array $action_links |
|
461 | + * @param EE_Event $event |
|
462 | + * @return array |
|
463 | + * @throws EE_Error |
|
464 | + * @throws InvalidArgumentException |
|
465 | + * @throws InvalidDataTypeException |
|
466 | + * @throws InvalidInterfaceException |
|
467 | + * @throws ReflectionException |
|
468 | + */ |
|
469 | + public function extra_list_table_actions(array $action_links, EE_Event $event) |
|
470 | + { |
|
471 | + if ( |
|
472 | + EE_Registry::instance()->CAP->current_user_can( |
|
473 | + 'ee_read_registrations', |
|
474 | + 'espresso_registrations_reports', |
|
475 | + $event->ID() |
|
476 | + ) |
|
477 | + ) { |
|
478 | + $reports_query_args = [ |
|
479 | + 'action' => 'reports', |
|
480 | + 'EVT_ID' => $event->ID(), |
|
481 | + ]; |
|
482 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
483 | + $action_links[] = '<a href="' |
|
484 | + . $reports_link |
|
485 | + . '" title="' |
|
486 | + . esc_attr__('View Report', 'event_espresso') |
|
487 | + . '"><div class="dashicons dashicons-chart-bar"></div></a>' |
|
488 | + . "\n\t"; |
|
489 | + } |
|
490 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
491 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
492 | + $action_links[] = EEH_MSG_Template::get_message_action_link( |
|
493 | + 'see_notifications_for', |
|
494 | + null, |
|
495 | + ['EVT_ID' => $event->ID()] |
|
496 | + ); |
|
497 | + } |
|
498 | + return $action_links; |
|
499 | + } |
|
500 | + |
|
501 | + |
|
502 | + /** |
|
503 | + * @param $items |
|
504 | + * @return mixed |
|
505 | + */ |
|
506 | + public function additional_legend_items($items) |
|
507 | + { |
|
508 | + if ( |
|
509 | + EE_Registry::instance()->CAP->current_user_can( |
|
510 | + 'ee_read_registrations', |
|
511 | + 'espresso_registrations_reports' |
|
512 | + ) |
|
513 | + ) { |
|
514 | + $items['reports'] = [ |
|
515 | + 'class' => 'dashicons dashicons-chart-bar', |
|
516 | + 'desc' => esc_html__('Event Reports', 'event_espresso'), |
|
517 | + ]; |
|
518 | + } |
|
519 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
520 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
521 | + // $related_for_icon can sometimes be a string so 'css_class' would be an illegal offset |
|
522 | + // (can only use numeric offsets when treating strings as arrays) |
|
523 | + if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) { |
|
524 | + $items['view_related_messages'] = [ |
|
525 | + 'class' => $related_for_icon['css_class'], |
|
526 | + 'desc' => $related_for_icon['label'], |
|
527 | + ]; |
|
528 | + } |
|
529 | + } |
|
530 | + return $items; |
|
531 | + } |
|
532 | + |
|
533 | + |
|
534 | + /** |
|
535 | + * This is the callback method for the duplicate event route |
|
536 | + * Method looks for 'EVT_ID' in the request and retrieves that event and its details and duplicates them |
|
537 | + * into a new event. We add a hook so that any plugins that add extra event details can hook into this |
|
538 | + * action. Note that the dupe will have **DUPLICATE** as its title and slug. |
|
539 | + * After duplication the redirect is to the new event edit page. |
|
540 | + * |
|
541 | + * @return void |
|
542 | + * @throws EE_Error If EE_Event is not available with given ID |
|
543 | + * @throws InvalidArgumentException |
|
544 | + * @throws InvalidDataTypeException |
|
545 | + * @throws InvalidInterfaceException |
|
546 | + * @throws ReflectionException |
|
547 | + * @access protected |
|
548 | + */ |
|
549 | + protected function _duplicate_event() |
|
550 | + { |
|
551 | + // first make sure the ID for the event is in the request. |
|
552 | + // If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?) |
|
553 | + if (! isset($this->_req_data['EVT_ID'])) { |
|
554 | + EE_Error::add_error( |
|
555 | + esc_html__( |
|
556 | + 'In order to duplicate an event an Event ID is required. None was given.', |
|
557 | + 'event_espresso' |
|
558 | + ), |
|
559 | + __FILE__, |
|
560 | + __FUNCTION__, |
|
561 | + __LINE__ |
|
562 | + ); |
|
563 | + $this->_redirect_after_action(false, '', '', [], true); |
|
564 | + return; |
|
565 | + } |
|
566 | + // k we've got EVT_ID so let's use that to get the event we'll duplicate |
|
567 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
568 | + if (! $orig_event instanceof EE_Event) { |
|
569 | + throw new EE_Error( |
|
570 | + sprintf( |
|
571 | + esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), |
|
572 | + $this->_req_data['EVT_ID'] |
|
573 | + ) |
|
574 | + ); |
|
575 | + } |
|
576 | + // k now let's clone the $orig_event before getting relations |
|
577 | + $new_event = clone $orig_event; |
|
578 | + // original datetimes |
|
579 | + $orig_datetimes = $orig_event->get_many_related('Datetime'); |
|
580 | + // other original relations |
|
581 | + $orig_ven = $orig_event->get_many_related('Venue'); |
|
582 | + // reset the ID and modify other details to make it clear this is a dupe |
|
583 | + $new_event->set('EVT_ID', 0); |
|
584 | + $new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso'); |
|
585 | + $new_event->set('EVT_name', $new_name); |
|
586 | + $new_event->set( |
|
587 | + 'EVT_slug', |
|
588 | + wp_unique_post_slug( |
|
589 | + sanitize_title($orig_event->name()), |
|
590 | + 0, |
|
591 | + 'publish', |
|
592 | + 'espresso_events', |
|
593 | + 0 |
|
594 | + ) |
|
595 | + ); |
|
596 | + $new_event->set('status', 'draft'); |
|
597 | + // duplicate discussion settings |
|
598 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
599 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
600 | + // save the new event |
|
601 | + $new_event->save(); |
|
602 | + // venues |
|
603 | + foreach ($orig_ven as $ven) { |
|
604 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
605 | + } |
|
606 | + $new_event->save(); |
|
607 | + // now we need to get the question group relations and handle that |
|
608 | + // first primary question groups |
|
609 | + $orig_primary_qgs = $orig_event->get_many_related( |
|
610 | + 'Question_Group', |
|
611 | + [['Event_Question_Group.EQG_primary' => true]] |
|
612 | + ); |
|
613 | + if (! empty($orig_primary_qgs)) { |
|
614 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
615 | + if ($obj instanceof EE_Question_Group) { |
|
616 | + $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]); |
|
617 | + } |
|
618 | + } |
|
619 | + } |
|
620 | + // next additional attendee question groups |
|
621 | + $orig_additional_qgs = $orig_event->get_many_related( |
|
622 | + 'Question_Group', |
|
623 | + [['Event_Question_Group.EQG_additional' => true]] |
|
624 | + ); |
|
625 | + if (! empty($orig_additional_qgs)) { |
|
626 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
627 | + if ($obj instanceof EE_Question_Group) { |
|
628 | + $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]); |
|
629 | + } |
|
630 | + } |
|
631 | + } |
|
632 | + |
|
633 | + $new_event->save(); |
|
634 | + |
|
635 | + // k now that we have the new event saved we can loop through the datetimes and start adding relations. |
|
636 | + $cloned_tickets = []; |
|
637 | + foreach ($orig_datetimes as $orig_dtt) { |
|
638 | + if (! $orig_dtt instanceof EE_Datetime) { |
|
639 | + continue; |
|
640 | + } |
|
641 | + $new_dtt = clone $orig_dtt; |
|
642 | + $orig_tkts = $orig_dtt->tickets(); |
|
643 | + // save new dtt then add to event |
|
644 | + $new_dtt->set('DTT_ID', 0); |
|
645 | + $new_dtt->set('DTT_sold', 0); |
|
646 | + $new_dtt->set_reserved(0); |
|
647 | + $new_dtt->save(); |
|
648 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
649 | + $new_event->save(); |
|
650 | + // now let's get the ticket relations setup. |
|
651 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
652 | + // it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
|
653 | + if (! $orig_tkt instanceof EE_Ticket) { |
|
654 | + continue; |
|
655 | + } |
|
656 | + // is this ticket archived? If it is then let's skip |
|
657 | + if ($orig_tkt->get('TKT_deleted')) { |
|
658 | + continue; |
|
659 | + } |
|
660 | + // does this original ticket already exist in the clone_tickets cache? |
|
661 | + // If so we'll just use the new ticket from it. |
|
662 | + if (isset($cloned_tickets[ $orig_tkt->ID() ])) { |
|
663 | + $new_tkt = $cloned_tickets[ $orig_tkt->ID() ]; |
|
664 | + } else { |
|
665 | + $new_tkt = clone $orig_tkt; |
|
666 | + // get relations on the $orig_tkt that we need to setup. |
|
667 | + $orig_prices = $orig_tkt->prices(); |
|
668 | + $new_tkt->set('TKT_ID', 0); |
|
669 | + $new_tkt->set('TKT_sold', 0); |
|
670 | + $new_tkt->set('TKT_reserved', 0); |
|
671 | + $new_tkt->save(); // make sure new ticket has ID. |
|
672 | + // price relations on new ticket need to be setup. |
|
673 | + foreach ($orig_prices as $orig_price) { |
|
674 | + $new_price = clone $orig_price; |
|
675 | + $new_price->set('PRC_ID', 0); |
|
676 | + $new_price->save(); |
|
677 | + $new_tkt->_add_relation_to($new_price, 'Price'); |
|
678 | + $new_tkt->save(); |
|
679 | + } |
|
680 | + |
|
681 | + do_action( |
|
682 | + 'AHEE__Extend_Events_Admin_Page___duplicate_event__duplicate_ticket__after', |
|
683 | + $orig_tkt, |
|
684 | + $new_tkt, |
|
685 | + $orig_prices, |
|
686 | + $orig_event, |
|
687 | + $orig_dtt, |
|
688 | + $new_dtt |
|
689 | + ); |
|
690 | + } |
|
691 | + // k now we can add the new ticket as a relation to the new datetime |
|
692 | + // and make sure its added to our cached $cloned_tickets array |
|
693 | + // for use with later datetimes that have the same ticket. |
|
694 | + $new_dtt->_add_relation_to($new_tkt, 'Ticket'); |
|
695 | + $new_dtt->save(); |
|
696 | + $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt; |
|
697 | + } |
|
698 | + } |
|
699 | + // clone taxonomy information |
|
700 | + $taxonomies_to_clone_with = apply_filters( |
|
701 | + 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', |
|
702 | + ['espresso_event_categories', 'espresso_event_type', 'post_tag'] |
|
703 | + ); |
|
704 | + // get terms for original event (notice) |
|
705 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
706 | + // loop through terms and add them to new event. |
|
707 | + foreach ($orig_terms as $term) { |
|
708 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
709 | + } |
|
710 | + |
|
711 | + // duplicate other core WP_Post items for this event. |
|
712 | + // post thumbnail (feature image). |
|
713 | + $feature_image_id = get_post_thumbnail_id($orig_event->ID()); |
|
714 | + if ($feature_image_id) { |
|
715 | + update_post_meta($new_event->ID(), '_thumbnail_id', $feature_image_id); |
|
716 | + } |
|
717 | + |
|
718 | + // duplicate page_template setting |
|
719 | + $page_template = get_post_meta($orig_event->ID(), '_wp_page_template', true); |
|
720 | + if ($page_template) { |
|
721 | + update_post_meta($new_event->ID(), '_wp_page_template', $page_template); |
|
722 | + } |
|
723 | + |
|
724 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
725 | + // now let's redirect to the edit page for this duplicated event if we have a new event id. |
|
726 | + if ($new_event->ID()) { |
|
727 | + $redirect_args = [ |
|
728 | + 'post' => $new_event->ID(), |
|
729 | + 'action' => 'edit', |
|
730 | + ]; |
|
731 | + EE_Error::add_success( |
|
732 | + esc_html__( |
|
733 | + 'Event successfully duplicated. Please review the details below and make any necessary edits', |
|
734 | + 'event_espresso' |
|
735 | + ) |
|
736 | + ); |
|
737 | + } else { |
|
738 | + $redirect_args = [ |
|
739 | + 'action' => 'default', |
|
740 | + ]; |
|
741 | + EE_Error::add_error( |
|
742 | + esc_html__('Not able to duplicate event. Something went wrong.', 'event_espresso'), |
|
743 | + __FILE__, |
|
744 | + __FUNCTION__, |
|
745 | + __LINE__ |
|
746 | + ); |
|
747 | + } |
|
748 | + $this->_redirect_after_action(false, '', '', $redirect_args, true); |
|
749 | + } |
|
750 | + |
|
751 | + |
|
752 | + /** |
|
753 | + * Generates output for the import page. |
|
754 | + * |
|
755 | + * @throws DomainException |
|
756 | + * @throws EE_Error |
|
757 | + * @throws InvalidArgumentException |
|
758 | + * @throws InvalidDataTypeException |
|
759 | + * @throws InvalidInterfaceException |
|
760 | + */ |
|
761 | + protected function _import_page() |
|
762 | + { |
|
763 | + $title = esc_html__('Import', 'event_espresso'); |
|
764 | + $intro = esc_html__( |
|
765 | + 'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', |
|
766 | + 'event_espresso' |
|
767 | + ); |
|
768 | + $form_url = EVENTS_ADMIN_URL; |
|
769 | + $action = 'import_events'; |
|
770 | + $type = 'csv'; |
|
771 | + $this->_template_args['form'] = EE_Import::instance()->upload_form( |
|
772 | + $title, |
|
773 | + $intro, |
|
774 | + $form_url, |
|
775 | + $action, |
|
776 | + $type |
|
777 | + ); |
|
778 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce( |
|
779 | + ['action' => 'sample_export_file'], |
|
780 | + $this->_admin_base_url |
|
781 | + ); |
|
782 | + $content = EEH_Template::display_template( |
|
783 | + EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php', |
|
784 | + $this->_template_args, |
|
785 | + true |
|
786 | + ); |
|
787 | + $this->_template_args['admin_page_content'] = $content; |
|
788 | + $this->display_admin_page_with_sidebar(); |
|
789 | + } |
|
790 | + |
|
791 | + |
|
792 | + /** |
|
793 | + * _import_events |
|
794 | + * This handles displaying the screen and running imports for importing events. |
|
795 | + * |
|
796 | + * @return void |
|
797 | + * @throws EE_Error |
|
798 | + * @throws InvalidArgumentException |
|
799 | + * @throws InvalidDataTypeException |
|
800 | + * @throws InvalidInterfaceException |
|
801 | + */ |
|
802 | + protected function _import_events() |
|
803 | + { |
|
804 | + require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
805 | + $success = EE_Import::instance()->import(); |
|
806 | + $this->_redirect_after_action($success, 'Import File', 'ran', ['action' => 'import_page'], true); |
|
807 | + } |
|
808 | + |
|
809 | + |
|
810 | + /** |
|
811 | + * _events_export |
|
812 | + * Will export all (or just the given event) to a Excel compatible file. |
|
813 | + * |
|
814 | + * @access protected |
|
815 | + * @return void |
|
816 | + */ |
|
817 | + protected function _events_export() |
|
818 | + { |
|
819 | + if (isset($this->_req_data['EVT_ID'])) { |
|
820 | + $event_ids = $this->_req_data['EVT_ID']; |
|
821 | + } elseif (isset($this->_req_data['EVT_IDs'])) { |
|
822 | + $event_ids = $this->_req_data['EVT_IDs']; |
|
823 | + } else { |
|
824 | + $event_ids = null; |
|
825 | + } |
|
826 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
827 | + $new_request_args = [ |
|
828 | + 'export' => 'report', |
|
829 | + 'action' => 'all_event_data', |
|
830 | + 'EVT_ID' => $event_ids, |
|
831 | + ]; |
|
832 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
833 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
834 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
835 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
836 | + if ($EE_Export instanceof EE_Export) { |
|
837 | + $EE_Export->export(); |
|
838 | + } |
|
839 | + } |
|
840 | + } |
|
841 | + |
|
842 | + |
|
843 | + /** |
|
844 | + * handle category exports() |
|
845 | + * |
|
846 | + * @return void |
|
847 | + */ |
|
848 | + protected function _categories_export() |
|
849 | + { |
|
850 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
851 | + $new_request_args = [ |
|
852 | + 'export' => 'report', |
|
853 | + 'action' => 'categories', |
|
854 | + 'category_ids' => $this->_req_data['EVT_CAT_ID'], |
|
855 | + ]; |
|
856 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
857 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
858 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
859 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
860 | + if ($EE_Export instanceof EE_Export) { |
|
861 | + $EE_Export->export(); |
|
862 | + } |
|
863 | + } |
|
864 | + } |
|
865 | + |
|
866 | + |
|
867 | + /** |
|
868 | + * Creates a sample CSV file for importing |
|
869 | + */ |
|
870 | + protected function _sample_export_file() |
|
871 | + { |
|
872 | + $EE_Export = EE_Export::instance(); |
|
873 | + if ($EE_Export instanceof EE_Export) { |
|
874 | + $EE_Export->export(); |
|
875 | + } |
|
876 | + } |
|
877 | + |
|
878 | + |
|
879 | + /************* Template Settings *************/ |
|
880 | + /** |
|
881 | + * Generates template settings page output |
|
882 | + * |
|
883 | + * @throws DomainException |
|
884 | + * @throws EE_Error |
|
885 | + * @throws InvalidArgumentException |
|
886 | + * @throws InvalidDataTypeException |
|
887 | + * @throws InvalidInterfaceException |
|
888 | + */ |
|
889 | + protected function _template_settings() |
|
890 | + { |
|
891 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
892 | + /** |
|
893 | + * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
894 | + * from General_Settings_Admin_Page to here. |
|
895 | + */ |
|
896 | + $this->_template_args = apply_filters( |
|
897 | + 'FHEE__General_Settings_Admin_Page__template_settings__template_args', |
|
898 | + $this->_template_args |
|
899 | + ); |
|
900 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
901 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
902 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
903 | + EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', |
|
904 | + $this->_template_args, |
|
905 | + true |
|
906 | + ); |
|
907 | + $this->display_admin_page_with_sidebar(); |
|
908 | + } |
|
909 | + |
|
910 | + |
|
911 | + /** |
|
912 | + * Handler for updating template settings. |
|
913 | + * |
|
914 | + * @throws EE_Error |
|
915 | + * @throws InvalidArgumentException |
|
916 | + * @throws InvalidDataTypeException |
|
917 | + * @throws InvalidInterfaceException |
|
918 | + */ |
|
919 | + protected function _update_template_settings() |
|
920 | + { |
|
921 | + /** |
|
922 | + * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
|
923 | + * from General_Settings_Admin_Page to here. |
|
924 | + */ |
|
925 | + EE_Registry::instance()->CFG->template_settings = apply_filters( |
|
926 | + 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
927 | + EE_Registry::instance()->CFG->template_settings, |
|
928 | + $this->_req_data |
|
929 | + ); |
|
930 | + // update custom post type slugs and detect if we need to flush rewrite rules |
|
931 | + $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
|
932 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) |
|
933 | + ? EE_Registry::instance()->CFG->core->event_cpt_slug |
|
934 | + : EEH_URL::slugify($this->_req_data['event_cpt_slug'], 'events'); |
|
935 | + $what = 'Template Settings'; |
|
936 | + $success = $this->_update_espresso_configuration( |
|
937 | + $what, |
|
938 | + EE_Registry::instance()->CFG->template_settings, |
|
939 | + __FILE__, |
|
940 | + __FUNCTION__, |
|
941 | + __LINE__ |
|
942 | + ); |
|
943 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug !== $old_slug) { |
|
944 | + /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
945 | + $rewrite_rules = LoaderFactory::getLoader()->getShared( |
|
946 | + 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
947 | + ); |
|
948 | + $rewrite_rules->flush(); |
|
949 | + } |
|
950 | + $this->_redirect_after_action($success, $what, 'updated', ['action' => 'template_settings']); |
|
951 | + } |
|
952 | + |
|
953 | + |
|
954 | + /** |
|
955 | + * _premium_event_editor_meta_boxes |
|
956 | + * add all metaboxes related to the event_editor |
|
957 | + * |
|
958 | + * @access protected |
|
959 | + * @return void |
|
960 | + * @throws EE_Error |
|
961 | + * @throws InvalidArgumentException |
|
962 | + * @throws InvalidDataTypeException |
|
963 | + * @throws InvalidInterfaceException |
|
964 | + * @throws ReflectionException |
|
965 | + */ |
|
966 | + protected function _premium_event_editor_meta_boxes() |
|
967 | + { |
|
968 | + $this->verify_cpt_object(); |
|
969 | + /** @var FeatureFlags $flags */ |
|
970 | + $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags'); |
|
971 | + // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version |
|
972 | + if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) { |
|
973 | + add_meta_box( |
|
974 | + 'espresso_event_editor_event_options', |
|
975 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
976 | + [$this, 'registration_options_meta_box'], |
|
977 | + $this->page_slug, |
|
978 | + 'side', |
|
979 | + 'core' |
|
980 | + ); |
|
981 | + } |
|
982 | + } |
|
983 | + |
|
984 | + |
|
985 | + /** |
|
986 | + * override caf metabox |
|
987 | + * |
|
988 | + * @return void |
|
989 | + * @throws DomainException |
|
990 | + * @throws EE_Error |
|
991 | + */ |
|
992 | + public function registration_options_meta_box() |
|
993 | + { |
|
994 | + $yes_no_values = [ |
|
995 | + ['id' => true, 'text' => esc_html__('Yes', 'event_espresso')], |
|
996 | + ['id' => false, 'text' => esc_html__('No', 'event_espresso')], |
|
997 | + ]; |
|
998 | + $default_reg_status_values = EEM_Registration::reg_status_array( |
|
999 | + [ |
|
1000 | + EEM_Registration::status_id_cancelled, |
|
1001 | + EEM_Registration::status_id_declined, |
|
1002 | + EEM_Registration::status_id_incomplete, |
|
1003 | + EEM_Registration::status_id_wait_list, |
|
1004 | + ], |
|
1005 | + true |
|
1006 | + ); |
|
1007 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
1008 | + $template_args['_event'] = $this->_cpt_model_obj; |
|
1009 | + $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
|
1010 | + $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
|
1011 | + 'default_reg_status', |
|
1012 | + $default_reg_status_values, |
|
1013 | + $this->_cpt_model_obj->default_registration_status() |
|
1014 | + ); |
|
1015 | + $template_args['display_description'] = EEH_Form_Fields::select_input( |
|
1016 | + 'display_desc', |
|
1017 | + $yes_no_values, |
|
1018 | + $this->_cpt_model_obj->display_description() |
|
1019 | + ); |
|
1020 | + $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input( |
|
1021 | + 'display_ticket_selector', |
|
1022 | + $yes_no_values, |
|
1023 | + $this->_cpt_model_obj->display_ticket_selector(), |
|
1024 | + '', |
|
1025 | + '', |
|
1026 | + false |
|
1027 | + ); |
|
1028 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input( |
|
1029 | + 'EVT_default_registration_status', |
|
1030 | + $default_reg_status_values, |
|
1031 | + $this->_cpt_model_obj->default_registration_status() |
|
1032 | + ); |
|
1033 | + $template_args['additional_registration_options'] = apply_filters( |
|
1034 | + 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', |
|
1035 | + '', |
|
1036 | + $template_args, |
|
1037 | + $yes_no_values, |
|
1038 | + $default_reg_status_values |
|
1039 | + ); |
|
1040 | + EEH_Template::display_template( |
|
1041 | + EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1042 | + $template_args |
|
1043 | + ); |
|
1044 | + } |
|
1045 | + |
|
1046 | + |
|
1047 | + |
|
1048 | + /** |
|
1049 | + * wp_list_table_mods for caf |
|
1050 | + * ============================ |
|
1051 | + */ |
|
1052 | + /** |
|
1053 | + * hook into list table filters and provide filters for caffeinated list table |
|
1054 | + * |
|
1055 | + * @param array $old_filters any existing filters present |
|
1056 | + * @param array $list_table_obj the list table object |
|
1057 | + * @return array new filters |
|
1058 | + * @throws EE_Error |
|
1059 | + * @throws InvalidArgumentException |
|
1060 | + * @throws InvalidDataTypeException |
|
1061 | + * @throws InvalidInterfaceException |
|
1062 | + * @throws ReflectionException |
|
1063 | + */ |
|
1064 | + public function list_table_filters($old_filters, $list_table_obj) |
|
1065 | + { |
|
1066 | + $filters = []; |
|
1067 | + // first month/year filters |
|
1068 | + $filters[] = $this->espresso_event_months_dropdown(); |
|
1069 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1070 | + // active status dropdown |
|
1071 | + if ($status !== 'draft') { |
|
1072 | + $filters[] = $this->active_status_dropdown( |
|
1073 | + isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '' |
|
1074 | + ); |
|
1075 | + $filters[] = $this->venuesDropdown( |
|
1076 | + isset($this->_req_data['venue']) ? $this->_req_data['venue'] : '' |
|
1077 | + ); |
|
1078 | + } |
|
1079 | + // category filter |
|
1080 | + $filters[] = $this->category_dropdown(); |
|
1081 | + return array_merge($old_filters, $filters); |
|
1082 | + } |
|
1083 | + |
|
1084 | + |
|
1085 | + /** |
|
1086 | + * espresso_event_months_dropdown |
|
1087 | + * |
|
1088 | + * @access public |
|
1089 | + * @return string dropdown listing month/year selections for events. |
|
1090 | + */ |
|
1091 | + public function espresso_event_months_dropdown() |
|
1092 | + { |
|
1093 | + // what we need to do is get all PRIMARY datetimes for all events to filter on. |
|
1094 | + // Note we need to include any other filters that are set! |
|
1095 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1096 | + // categories? |
|
1097 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
1098 | + ? $this->_req_data['EVT_CAT'] |
|
1099 | + : null; |
|
1100 | + // active status? |
|
1101 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null; |
|
1102 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
1103 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
1104 | + } |
|
1105 | + |
|
1106 | + |
|
1107 | + /** |
|
1108 | + * returns a list of "active" statuses on the event |
|
1109 | + * |
|
1110 | + * @param string $current_value whatever the current active status is |
|
1111 | + * @return string |
|
1112 | + */ |
|
1113 | + public function active_status_dropdown($current_value = '') |
|
1114 | + { |
|
1115 | + $select_name = 'active_status'; |
|
1116 | + $values = [ |
|
1117 | + 'none' => esc_html__('Show Active/Inactive', 'event_espresso'), |
|
1118 | + 'active' => esc_html__('Active', 'event_espresso'), |
|
1119 | + 'upcoming' => esc_html__('Upcoming', 'event_espresso'), |
|
1120 | + 'expired' => esc_html__('Expired', 'event_espresso'), |
|
1121 | + 'inactive' => esc_html__('Inactive', 'event_espresso'), |
|
1122 | + ]; |
|
1123 | + |
|
1124 | + return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
1125 | + } |
|
1126 | + |
|
1127 | + |
|
1128 | + /** |
|
1129 | + * returns a list of "venues" |
|
1130 | + * |
|
1131 | + * @param string $current_value whatever the current active status is |
|
1132 | + * @return string |
|
1133 | + * @throws EE_Error |
|
1134 | + * @throws InvalidArgumentException |
|
1135 | + * @throws InvalidDataTypeException |
|
1136 | + * @throws InvalidInterfaceException |
|
1137 | + * @throws ReflectionException |
|
1138 | + */ |
|
1139 | + protected function venuesDropdown($current_value = '') |
|
1140 | + { |
|
1141 | + $select_name = 'venue'; |
|
1142 | + $values = [ |
|
1143 | + '' => esc_html__('All Venues', 'event_espresso'), |
|
1144 | + ]; |
|
1145 | + // populate the list of venues. |
|
1146 | + $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
1147 | + $venues = $venue_model->get_all(['order_by' => ['VNU_name' => 'ASC']]); |
|
1148 | + |
|
1149 | + foreach ($venues as $venue) { |
|
1150 | + $values[ $venue->ID() ] = $venue->name(); |
|
1151 | + } |
|
1152 | + |
|
1153 | + return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide'); |
|
1154 | + } |
|
1155 | + |
|
1156 | + |
|
1157 | + /** |
|
1158 | + * output a dropdown of the categories for the category filter on the event admin list table |
|
1159 | + * |
|
1160 | + * @access public |
|
1161 | + * @return string html |
|
1162 | + */ |
|
1163 | + public function category_dropdown() |
|
1164 | + { |
|
1165 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
1166 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
1167 | + } |
|
1168 | + |
|
1169 | + |
|
1170 | + /** |
|
1171 | + * get total number of events today |
|
1172 | + * |
|
1173 | + * @access public |
|
1174 | + * @return int |
|
1175 | + * @throws EE_Error |
|
1176 | + * @throws InvalidArgumentException |
|
1177 | + * @throws InvalidDataTypeException |
|
1178 | + * @throws InvalidInterfaceException |
|
1179 | + */ |
|
1180 | + public function total_events_today() |
|
1181 | + { |
|
1182 | + $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1183 | + 'DTT_EVT_start', |
|
1184 | + date('Y-m-d') . ' 00:00:00', |
|
1185 | + 'Y-m-d H:i:s', |
|
1186 | + 'UTC' |
|
1187 | + ); |
|
1188 | + $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1189 | + 'DTT_EVT_start', |
|
1190 | + date('Y-m-d') . ' 23:59:59', |
|
1191 | + 'Y-m-d H:i:s', |
|
1192 | + 'UTC' |
|
1193 | + ); |
|
1194 | + $where = [ |
|
1195 | + 'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]], |
|
1196 | + ]; |
|
1197 | + return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true); |
|
1198 | + } |
|
1199 | + |
|
1200 | + |
|
1201 | + /** |
|
1202 | + * get total number of events this month |
|
1203 | + * |
|
1204 | + * @access public |
|
1205 | + * @return int |
|
1206 | + * @throws EE_Error |
|
1207 | + * @throws InvalidArgumentException |
|
1208 | + * @throws InvalidDataTypeException |
|
1209 | + * @throws InvalidInterfaceException |
|
1210 | + */ |
|
1211 | + public function total_events_this_month() |
|
1212 | + { |
|
1213 | + // Dates |
|
1214 | + $this_year_r = date('Y'); |
|
1215 | + $this_month_r = date('m'); |
|
1216 | + $days_this_month = date('t'); |
|
1217 | + $start = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1218 | + 'DTT_EVT_start', |
|
1219 | + $this_year_r . '-' . $this_month_r . '-01 00:00:00', |
|
1220 | + 'Y-m-d H:i:s', |
|
1221 | + 'UTC' |
|
1222 | + ); |
|
1223 | + $end = EEM_Datetime::instance()->convert_datetime_for_query( |
|
1224 | + 'DTT_EVT_start', |
|
1225 | + $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', |
|
1226 | + 'Y-m-d H:i:s', |
|
1227 | + 'UTC' |
|
1228 | + ); |
|
1229 | + $where = [ |
|
1230 | + 'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]], |
|
1231 | + ]; |
|
1232 | + return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true); |
|
1233 | + } |
|
1234 | + |
|
1235 | + |
|
1236 | + /** DEFAULT TICKETS STUFF **/ |
|
1237 | + |
|
1238 | + /** |
|
1239 | + * Output default tickets list table view. |
|
1240 | + * |
|
1241 | + * @throws DomainException |
|
1242 | + * @throws EE_Error |
|
1243 | + * @throws InvalidArgumentException |
|
1244 | + * @throws InvalidDataTypeException |
|
1245 | + * @throws InvalidInterfaceException |
|
1246 | + */ |
|
1247 | + public function _tickets_overview_list_table() |
|
1248 | + { |
|
1249 | + $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
1250 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
1251 | + } |
|
1252 | + |
|
1253 | + |
|
1254 | + /** |
|
1255 | + * @param int $per_page |
|
1256 | + * @param bool $count |
|
1257 | + * @param bool $trashed |
|
1258 | + * @return EE_Soft_Delete_Base_Class[]|int |
|
1259 | + * @throws EE_Error |
|
1260 | + * @throws InvalidArgumentException |
|
1261 | + * @throws InvalidDataTypeException |
|
1262 | + * @throws InvalidInterfaceException |
|
1263 | + */ |
|
1264 | + public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
1265 | + { |
|
1266 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1267 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1268 | + switch ($orderby) { |
|
1269 | + case 'TKT_name': |
|
1270 | + $orderby = ['TKT_name' => $order]; |
|
1271 | + break; |
|
1272 | + case 'TKT_price': |
|
1273 | + $orderby = ['TKT_price' => $order]; |
|
1274 | + break; |
|
1275 | + case 'TKT_uses': |
|
1276 | + $orderby = ['TKT_uses' => $order]; |
|
1277 | + break; |
|
1278 | + case 'TKT_min': |
|
1279 | + $orderby = ['TKT_min' => $order]; |
|
1280 | + break; |
|
1281 | + case 'TKT_max': |
|
1282 | + $orderby = ['TKT_max' => $order]; |
|
1283 | + break; |
|
1284 | + case 'TKT_qty': |
|
1285 | + $orderby = ['TKT_qty' => $order]; |
|
1286 | + break; |
|
1287 | + } |
|
1288 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1289 | + ? $this->_req_data['paged'] |
|
1290 | + : 1; |
|
1291 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1292 | + ? $this->_req_data['perpage'] |
|
1293 | + : $per_page; |
|
1294 | + $_where = [ |
|
1295 | + 'TKT_is_default' => 1, |
|
1296 | + 'TKT_deleted' => $trashed, |
|
1297 | + ]; |
|
1298 | + $offset = ($current_page - 1) * $per_page; |
|
1299 | + $limit = [$offset, $per_page]; |
|
1300 | + if (isset($this->_req_data['s'])) { |
|
1301 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1302 | + $_where['OR'] = [ |
|
1303 | + 'TKT_name' => ['LIKE', $sstr], |
|
1304 | + 'TKT_description' => ['LIKE', $sstr], |
|
1305 | + ]; |
|
1306 | + } |
|
1307 | + $query_params = [ |
|
1308 | + $_where, |
|
1309 | + 'order_by' => $orderby, |
|
1310 | + 'limit' => $limit, |
|
1311 | + 'group_by' => 'TKT_ID', |
|
1312 | + ]; |
|
1313 | + if ($count) { |
|
1314 | + return EEM_Ticket::instance()->count_deleted_and_undeleted([$_where]); |
|
1315 | + } |
|
1316 | + return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
1317 | + } |
|
1318 | + |
|
1319 | + |
|
1320 | + /** |
|
1321 | + * @param bool $trash |
|
1322 | + * @throws EE_Error |
|
1323 | + * @throws InvalidArgumentException |
|
1324 | + * @throws InvalidDataTypeException |
|
1325 | + * @throws InvalidInterfaceException |
|
1326 | + */ |
|
1327 | + protected function _trash_or_restore_ticket($trash = false) |
|
1328 | + { |
|
1329 | + $success = 1; |
|
1330 | + $TKT = EEM_Ticket::instance(); |
|
1331 | + // checkboxes? |
|
1332 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1333 | + // if array has more than one element then success message should be plural |
|
1334 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1335 | + // cycle thru the boxes |
|
1336 | + foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
1337 | + if ($trash) { |
|
1338 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
1339 | + $success = 0; |
|
1340 | + } |
|
1341 | + } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
1342 | + $success = 0; |
|
1343 | + } |
|
1344 | + } |
|
1345 | + } else { |
|
1346 | + // grab single id and trash |
|
1347 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1348 | + if ($trash) { |
|
1349 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
1350 | + $success = 0; |
|
1351 | + } |
|
1352 | + } elseif (! $TKT->restore_by_ID($TKT_ID)) { |
|
1353 | + $success = 0; |
|
1354 | + } |
|
1355 | + } |
|
1356 | + $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
1357 | + $query_args = [ |
|
1358 | + 'action' => 'ticket_list_table', |
|
1359 | + 'status' => $trash ? '' : 'trashed', |
|
1360 | + ]; |
|
1361 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1362 | + } |
|
1363 | + |
|
1364 | + |
|
1365 | + /** |
|
1366 | + * Handles trashing default ticket. |
|
1367 | + * |
|
1368 | + * @throws EE_Error |
|
1369 | + * @throws InvalidArgumentException |
|
1370 | + * @throws InvalidDataTypeException |
|
1371 | + * @throws InvalidInterfaceException |
|
1372 | + * @throws ReflectionException |
|
1373 | + */ |
|
1374 | + protected function _delete_ticket() |
|
1375 | + { |
|
1376 | + $success = 1; |
|
1377 | + // checkboxes? |
|
1378 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1379 | + // if array has more than one element then success message should be plural |
|
1380 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1381 | + // cycle thru the boxes |
|
1382 | + foreach ($this->_req_data['checkbox'] as $TKT_ID) { |
|
1383 | + // delete |
|
1384 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
1385 | + $success = 0; |
|
1386 | + } |
|
1387 | + } |
|
1388 | + } else { |
|
1389 | + // grab single id and trash |
|
1390 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1391 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
1392 | + $success = 0; |
|
1393 | + } |
|
1394 | + } |
|
1395 | + $action_desc = 'deleted'; |
|
1396 | + // fail safe. If the default ticket count === 1 then we need to redirect to event overview. |
|
1397 | + $ticket_count = EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
1398 | + [['TKT_is_default' => 1]], |
|
1399 | + 'TKT_ID', |
|
1400 | + true |
|
1401 | + ); |
|
1402 | + $query_args = $ticket_count |
|
1403 | + ? [] |
|
1404 | + : [ |
|
1405 | + 'action' => 'ticket_list_table', |
|
1406 | + 'status' => 'trashed', |
|
1407 | + ]; |
|
1408 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1409 | + } |
|
1410 | + |
|
1411 | + |
|
1412 | + /** |
|
1413 | + * @param int $TKT_ID |
|
1414 | + * @return bool|int |
|
1415 | + * @throws EE_Error |
|
1416 | + * @throws InvalidArgumentException |
|
1417 | + * @throws InvalidDataTypeException |
|
1418 | + * @throws InvalidInterfaceException |
|
1419 | + * @throws ReflectionException |
|
1420 | + */ |
|
1421 | + protected function _delete_the_ticket($TKT_ID) |
|
1422 | + { |
|
1423 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1424 | + if (! $ticket instanceof EE_Ticket) { |
|
1425 | + return false; |
|
1426 | + } |
|
1427 | + $ticket->_remove_relations('Datetime'); |
|
1428 | + // delete all related prices first |
|
1429 | + $ticket->delete_related_permanently('Price'); |
|
1430 | + return $ticket->delete_permanently(); |
|
1431 | + } |
|
1432 | 1432 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | * |
97 | 97 | * @access public |
98 | 98 | * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
99 | - * @return void |
|
99 | + * @return EE_Help_Tour |
|
100 | 100 | */ |
101 | 101 | public function __construct($caf = false) |
102 | 102 | { |
@@ -15,268 +15,268 @@ |
||
15 | 15 | abstract class EE_Help_Tour extends EE_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the |
|
20 | - * constructor of the child class. |
|
21 | - * |
|
22 | - * @access protected |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_label = ''; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * This is the slug for the tour. It should be unique from all tours and is used for starting a tour and setting |
|
30 | - * cookies for the tour. Set this in the constructor of the child class. |
|
31 | - * |
|
32 | - * @access protected |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $_slug = ''; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for |
|
40 | - * setting up a tour on a given page. format for array is: array( |
|
41 | - * 0 => array( |
|
42 | - * 'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take |
|
43 | - * precendence even if you also set class. |
|
44 | - * 'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use |
|
45 | - * this param. The first element for that class is the anchor. If the class or the id are empty then the |
|
46 | - * stop will be a modal on the page anchored to the main body. |
|
47 | - * 'custom_class' => 'some_custom_class', //optional custom class to add for this stop. |
|
48 | - * 'button_text' => 'custom text for button', //optional |
|
49 | - * 'content' => 'The content for the stop', //required |
|
50 | - * 'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get |
|
51 | - * added to the pauseAfter global option array setup for the joyride instance. This is only applicable |
|
52 | - * when this tour has been set to run on timer. |
|
53 | - * 'options' => array( |
|
54 | - * //override any of the global options set via the help_tour "option_callback" for the joyride |
|
55 | - * instance on this specific stop. |
|
56 | - * ) |
|
57 | - * ) |
|
58 | - * ); |
|
59 | - * |
|
60 | - * @access protected |
|
61 | - * @var array |
|
62 | - */ |
|
63 | - protected $_stops = array(); |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * This contains any stop specific options for the tour. |
|
68 | - * defaults are set but child classes can override. |
|
69 | - * |
|
70 | - * @access protected |
|
71 | - * @var array |
|
72 | - */ |
|
73 | - protected $_options = array(); |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * holds anything found in the $_REQUEST object (however we override any _gets with _post data). |
|
78 | - * |
|
79 | - * @access protected |
|
80 | - * @var array |
|
81 | - */ |
|
82 | - protected $_req_data = array(); |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * a flag that is set on init for whether this help_tour is happening on a caf install or not. |
|
87 | - * |
|
88 | - * @var boolean |
|
89 | - */ |
|
90 | - protected $_is_caf = false; |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * _constructor |
|
95 | - * initialized the tour object and sets up important properties required to setup the tour. |
|
96 | - * |
|
97 | - * @access public |
|
98 | - * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
|
99 | - * @return void |
|
100 | - */ |
|
101 | - public function __construct($caf = false) |
|
102 | - { |
|
103 | - $this->_is_caf = $caf; |
|
104 | - $this->_req_data = array_merge($_GET, $_POST); |
|
105 | - $this->_set_tour_properties(); |
|
106 | - $this->_set_tour_stops(); |
|
107 | - $this->_set_tour_options(); |
|
108 | - |
|
109 | - // make sure the last tour stop has "end tour" for its button |
|
110 | - $end = array_pop($this->_stops); |
|
111 | - $end['button_text'] = __('End Tour', 'event_espresso'); |
|
112 | - // add back to stops |
|
113 | - $this->_stops[] = $end; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * required method that has the sole purpose of setting up the tour $_label and $_slug properties |
|
119 | - * |
|
120 | - * @abstract |
|
121 | - * @access protected |
|
122 | - * @return void |
|
123 | - */ |
|
124 | - abstract protected function _set_tour_properties(); |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * required method that's sole purpose is to setup the $_stops property |
|
129 | - * |
|
130 | - * @abstract |
|
131 | - * @access protected |
|
132 | - * @return void |
|
133 | - */ |
|
134 | - abstract protected function _set_tour_stops(); |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * The method can optionally be overridden by child classes to set the _options array if there are any default |
|
139 | - * options the child wishes to override for a this tour. See property definition for more info |
|
140 | - * |
|
141 | - * @access protected |
|
142 | - * @return void |
|
143 | - */ |
|
144 | - protected function _set_tour_options($options = array()) |
|
145 | - { |
|
146 | - $defaults = array( |
|
147 | - 'tipLocation' => 'bottom', |
|
148 | - // 'top', 'bottom', 'right', 'left' in relation to parent |
|
149 | - 'nubPosition' => 'auto', |
|
150 | - // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
151 | - 'tipAdjustmentY' => 0, |
|
152 | - // allow for adjustment of tip |
|
153 | - 'tipAdjustmentX' => 0, |
|
154 | - // allow for adjustment of tip |
|
155 | - 'scroll' => true, |
|
156 | - // whether to scrollTo the next step or not |
|
157 | - 'scrollSpeed' => 300, |
|
158 | - // Page scrolling speed in ms |
|
159 | - 'timer' => 0, |
|
160 | - // 0 = off, all other numbers = time(ms) |
|
161 | - 'autoStart' => true, |
|
162 | - // true or false - false tour starts when restart called |
|
163 | - 'startTimerOnClick' => true, |
|
164 | - // true/false to start timer on first click |
|
165 | - 'nextButton' => true, |
|
166 | - // true/false for next button visibility |
|
167 | - 'button_text' => __('Next', 'event_espresso'), |
|
168 | - 'tipAnimation' => 'fade', |
|
169 | - // 'pop' or 'fade' in each tip |
|
170 | - 'pauseAfter' => array(), |
|
171 | - // array of indexes where to pause the tour after |
|
172 | - 'tipAnimationFadeSpeed' => 300, |
|
173 | - // if 'fade'- speed in ms of transition |
|
174 | - 'cookieMonster' => true, |
|
175 | - // true/false for whether cookies are used |
|
176 | - 'cookieName' => $this->get_slug(), |
|
177 | - // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
178 | - 'cookieDomain' => false, |
|
179 | - // set to false or yoursite.com |
|
180 | - // 'tipContainer' => 'body', // Where the tip be attached if not inline |
|
181 | - 'modal' => false, |
|
182 | - // Whether to cover page with modal during the tour |
|
183 | - 'expose' => false, |
|
184 | - // Whether to expose the elements at each step in the tour (requires modal:true), |
|
185 | - 'postExposeCallback' => 'EEHelpTour.postExposeCallback', |
|
186 | - // A method to call after an element has been exposed |
|
187 | - 'preRideCallback' => 'EEHelpTour_preRideCallback', |
|
188 | - // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
189 | - 'postRideCallback' => 'EEHelpTour_postRideCallback', |
|
190 | - // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
191 | - 'preStepCallback' => 'EEHelpTour_preStepCallback', |
|
192 | - // A method to call before each step |
|
193 | - 'postStepCallback' => 'EEHelpTour_postStepCallback', |
|
194 | - // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
195 | - ); |
|
196 | - |
|
197 | - $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
198 | - $this->_options = $options; |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - /** |
|
203 | - * getter functions to return all the properties for the tour. |
|
204 | - */ |
|
205 | - |
|
206 | - |
|
207 | - /** |
|
208 | - * get_slug |
|
209 | - * |
|
210 | - * @return string slug for the tour |
|
211 | - */ |
|
212 | - public function get_slug() |
|
213 | - { |
|
214 | - if (empty($this->_slug)) { |
|
215 | - throw new EE_Error( |
|
216 | - sprintf( |
|
217 | - __( |
|
218 | - 'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', |
|
219 | - 'event_espresso' |
|
220 | - ), |
|
221 | - get_class($this) |
|
222 | - ) |
|
223 | - ); |
|
224 | - } |
|
225 | - return $this->_slug; |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * get_label |
|
231 | - * |
|
232 | - * @return string |
|
233 | - */ |
|
234 | - public function get_label() |
|
235 | - { |
|
236 | - if (empty($this->_label)) { |
|
237 | - throw new EE_Error( |
|
238 | - sprintf( |
|
239 | - __( |
|
240 | - 'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', |
|
241 | - 'event_espresso' |
|
242 | - ), |
|
243 | - get_class($this) |
|
244 | - ) |
|
245 | - ); |
|
246 | - } |
|
247 | - return $this->_label; |
|
248 | - } |
|
249 | - |
|
250 | - |
|
251 | - /** |
|
252 | - * get_stops |
|
253 | - * |
|
254 | - * @return array |
|
255 | - */ |
|
256 | - public function get_stops() |
|
257 | - { |
|
258 | - foreach ($this->_stops as $ind => $stop) { |
|
259 | - if (! isset($stop['button_text'])) { |
|
260 | - $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
261 | - } |
|
262 | - } |
|
263 | - return $this->_stops; |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * get options |
|
269 | - * |
|
270 | - * @return array |
|
271 | - */ |
|
272 | - public function get_options() |
|
273 | - { |
|
274 | - // let's make sure there are not pauses set |
|
275 | - foreach ($this->_stops as $ind => $stop) { |
|
276 | - if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
277 | - $this->_options['pauseAfter'][] = $ind; |
|
278 | - } |
|
279 | - } |
|
280 | - return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
281 | - } |
|
18 | + /** |
|
19 | + * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the |
|
20 | + * constructor of the child class. |
|
21 | + * |
|
22 | + * @access protected |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_label = ''; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * This is the slug for the tour. It should be unique from all tours and is used for starting a tour and setting |
|
30 | + * cookies for the tour. Set this in the constructor of the child class. |
|
31 | + * |
|
32 | + * @access protected |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $_slug = ''; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for |
|
40 | + * setting up a tour on a given page. format for array is: array( |
|
41 | + * 0 => array( |
|
42 | + * 'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take |
|
43 | + * precendence even if you also set class. |
|
44 | + * 'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use |
|
45 | + * this param. The first element for that class is the anchor. If the class or the id are empty then the |
|
46 | + * stop will be a modal on the page anchored to the main body. |
|
47 | + * 'custom_class' => 'some_custom_class', //optional custom class to add for this stop. |
|
48 | + * 'button_text' => 'custom text for button', //optional |
|
49 | + * 'content' => 'The content for the stop', //required |
|
50 | + * 'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get |
|
51 | + * added to the pauseAfter global option array setup for the joyride instance. This is only applicable |
|
52 | + * when this tour has been set to run on timer. |
|
53 | + * 'options' => array( |
|
54 | + * //override any of the global options set via the help_tour "option_callback" for the joyride |
|
55 | + * instance on this specific stop. |
|
56 | + * ) |
|
57 | + * ) |
|
58 | + * ); |
|
59 | + * |
|
60 | + * @access protected |
|
61 | + * @var array |
|
62 | + */ |
|
63 | + protected $_stops = array(); |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * This contains any stop specific options for the tour. |
|
68 | + * defaults are set but child classes can override. |
|
69 | + * |
|
70 | + * @access protected |
|
71 | + * @var array |
|
72 | + */ |
|
73 | + protected $_options = array(); |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * holds anything found in the $_REQUEST object (however we override any _gets with _post data). |
|
78 | + * |
|
79 | + * @access protected |
|
80 | + * @var array |
|
81 | + */ |
|
82 | + protected $_req_data = array(); |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * a flag that is set on init for whether this help_tour is happening on a caf install or not. |
|
87 | + * |
|
88 | + * @var boolean |
|
89 | + */ |
|
90 | + protected $_is_caf = false; |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * _constructor |
|
95 | + * initialized the tour object and sets up important properties required to setup the tour. |
|
96 | + * |
|
97 | + * @access public |
|
98 | + * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
|
99 | + * @return void |
|
100 | + */ |
|
101 | + public function __construct($caf = false) |
|
102 | + { |
|
103 | + $this->_is_caf = $caf; |
|
104 | + $this->_req_data = array_merge($_GET, $_POST); |
|
105 | + $this->_set_tour_properties(); |
|
106 | + $this->_set_tour_stops(); |
|
107 | + $this->_set_tour_options(); |
|
108 | + |
|
109 | + // make sure the last tour stop has "end tour" for its button |
|
110 | + $end = array_pop($this->_stops); |
|
111 | + $end['button_text'] = __('End Tour', 'event_espresso'); |
|
112 | + // add back to stops |
|
113 | + $this->_stops[] = $end; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * required method that has the sole purpose of setting up the tour $_label and $_slug properties |
|
119 | + * |
|
120 | + * @abstract |
|
121 | + * @access protected |
|
122 | + * @return void |
|
123 | + */ |
|
124 | + abstract protected function _set_tour_properties(); |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * required method that's sole purpose is to setup the $_stops property |
|
129 | + * |
|
130 | + * @abstract |
|
131 | + * @access protected |
|
132 | + * @return void |
|
133 | + */ |
|
134 | + abstract protected function _set_tour_stops(); |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * The method can optionally be overridden by child classes to set the _options array if there are any default |
|
139 | + * options the child wishes to override for a this tour. See property definition for more info |
|
140 | + * |
|
141 | + * @access protected |
|
142 | + * @return void |
|
143 | + */ |
|
144 | + protected function _set_tour_options($options = array()) |
|
145 | + { |
|
146 | + $defaults = array( |
|
147 | + 'tipLocation' => 'bottom', |
|
148 | + // 'top', 'bottom', 'right', 'left' in relation to parent |
|
149 | + 'nubPosition' => 'auto', |
|
150 | + // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
151 | + 'tipAdjustmentY' => 0, |
|
152 | + // allow for adjustment of tip |
|
153 | + 'tipAdjustmentX' => 0, |
|
154 | + // allow for adjustment of tip |
|
155 | + 'scroll' => true, |
|
156 | + // whether to scrollTo the next step or not |
|
157 | + 'scrollSpeed' => 300, |
|
158 | + // Page scrolling speed in ms |
|
159 | + 'timer' => 0, |
|
160 | + // 0 = off, all other numbers = time(ms) |
|
161 | + 'autoStart' => true, |
|
162 | + // true or false - false tour starts when restart called |
|
163 | + 'startTimerOnClick' => true, |
|
164 | + // true/false to start timer on first click |
|
165 | + 'nextButton' => true, |
|
166 | + // true/false for next button visibility |
|
167 | + 'button_text' => __('Next', 'event_espresso'), |
|
168 | + 'tipAnimation' => 'fade', |
|
169 | + // 'pop' or 'fade' in each tip |
|
170 | + 'pauseAfter' => array(), |
|
171 | + // array of indexes where to pause the tour after |
|
172 | + 'tipAnimationFadeSpeed' => 300, |
|
173 | + // if 'fade'- speed in ms of transition |
|
174 | + 'cookieMonster' => true, |
|
175 | + // true/false for whether cookies are used |
|
176 | + 'cookieName' => $this->get_slug(), |
|
177 | + // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
178 | + 'cookieDomain' => false, |
|
179 | + // set to false or yoursite.com |
|
180 | + // 'tipContainer' => 'body', // Where the tip be attached if not inline |
|
181 | + 'modal' => false, |
|
182 | + // Whether to cover page with modal during the tour |
|
183 | + 'expose' => false, |
|
184 | + // Whether to expose the elements at each step in the tour (requires modal:true), |
|
185 | + 'postExposeCallback' => 'EEHelpTour.postExposeCallback', |
|
186 | + // A method to call after an element has been exposed |
|
187 | + 'preRideCallback' => 'EEHelpTour_preRideCallback', |
|
188 | + // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
189 | + 'postRideCallback' => 'EEHelpTour_postRideCallback', |
|
190 | + // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
191 | + 'preStepCallback' => 'EEHelpTour_preStepCallback', |
|
192 | + // A method to call before each step |
|
193 | + 'postStepCallback' => 'EEHelpTour_postStepCallback', |
|
194 | + // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
195 | + ); |
|
196 | + |
|
197 | + $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
198 | + $this->_options = $options; |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + /** |
|
203 | + * getter functions to return all the properties for the tour. |
|
204 | + */ |
|
205 | + |
|
206 | + |
|
207 | + /** |
|
208 | + * get_slug |
|
209 | + * |
|
210 | + * @return string slug for the tour |
|
211 | + */ |
|
212 | + public function get_slug() |
|
213 | + { |
|
214 | + if (empty($this->_slug)) { |
|
215 | + throw new EE_Error( |
|
216 | + sprintf( |
|
217 | + __( |
|
218 | + 'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', |
|
219 | + 'event_espresso' |
|
220 | + ), |
|
221 | + get_class($this) |
|
222 | + ) |
|
223 | + ); |
|
224 | + } |
|
225 | + return $this->_slug; |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * get_label |
|
231 | + * |
|
232 | + * @return string |
|
233 | + */ |
|
234 | + public function get_label() |
|
235 | + { |
|
236 | + if (empty($this->_label)) { |
|
237 | + throw new EE_Error( |
|
238 | + sprintf( |
|
239 | + __( |
|
240 | + 'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', |
|
241 | + 'event_espresso' |
|
242 | + ), |
|
243 | + get_class($this) |
|
244 | + ) |
|
245 | + ); |
|
246 | + } |
|
247 | + return $this->_label; |
|
248 | + } |
|
249 | + |
|
250 | + |
|
251 | + /** |
|
252 | + * get_stops |
|
253 | + * |
|
254 | + * @return array |
|
255 | + */ |
|
256 | + public function get_stops() |
|
257 | + { |
|
258 | + foreach ($this->_stops as $ind => $stop) { |
|
259 | + if (! isset($stop['button_text'])) { |
|
260 | + $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
261 | + } |
|
262 | + } |
|
263 | + return $this->_stops; |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * get options |
|
269 | + * |
|
270 | + * @return array |
|
271 | + */ |
|
272 | + public function get_options() |
|
273 | + { |
|
274 | + // let's make sure there are not pauses set |
|
275 | + foreach ($this->_stops as $ind => $stop) { |
|
276 | + if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
277 | + $this->_options['pauseAfter'][] = $ind; |
|
278 | + } |
|
279 | + } |
|
280 | + return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
281 | + } |
|
282 | 282 | } |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | public function get_stops() |
257 | 257 | { |
258 | 258 | foreach ($this->_stops as $ind => $stop) { |
259 | - if (! isset($stop['button_text'])) { |
|
260 | - $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
259 | + if ( ! isset($stop['button_text'])) { |
|
260 | + $this->_stops[$ind]['button_text'] = $this->_options['button_text']; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | return $this->_stops; |
@@ -277,6 +277,6 @@ discard block |
||
277 | 277 | $this->_options['pauseAfter'][] = $ind; |
278 | 278 | } |
279 | 279 | } |
280 | - return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
280 | + return apply_filters('FHEE__'.get_class($this).'__get_options', $this->_options, $this); |
|
281 | 281 | } |
282 | 282 | } |
@@ -62,7 +62,6 @@ |
||
62 | 62 | /** |
63 | 63 | * Creates a 4.1 price base type |
64 | 64 | * @global type $wpdb |
65 | - * @param array $old_price |
|
66 | 65 | * @param int $new_reg_id |
67 | 66 | * @return int |
68 | 67 | */ |
@@ -32,102 +32,102 @@ |
||
32 | 32 | |
33 | 33 | class EE_DMS_4_1_0_answers extends EE_Data_Migration_Script_Stage_Table |
34 | 34 | { |
35 | - private $_new_answer_table; |
|
36 | - private $_new_question_table; |
|
37 | - public function __construct() |
|
38 | - { |
|
39 | - global $wpdb; |
|
40 | - $this->_pretty_name = __("Answers", "event_espresso"); |
|
41 | - $this->_old_table = $wpdb->prefix . "events_answer"; |
|
42 | - // join to attendee and then join to events table |
|
43 | - $this->select_expression = 'ans.*, e.event_status'; |
|
44 | - $this->_extra_where_sql = ' AS ans |
|
35 | + private $_new_answer_table; |
|
36 | + private $_new_question_table; |
|
37 | + public function __construct() |
|
38 | + { |
|
39 | + global $wpdb; |
|
40 | + $this->_pretty_name = __("Answers", "event_espresso"); |
|
41 | + $this->_old_table = $wpdb->prefix . "events_answer"; |
|
42 | + // join to attendee and then join to events table |
|
43 | + $this->select_expression = 'ans.*, e.event_status'; |
|
44 | + $this->_extra_where_sql = ' AS ans |
|
45 | 45 | INNER JOIN ' . $wpdb->prefix . 'events_attendee AS att ON ans.attendee_id = att.id |
46 | 46 | INNER JOIN ' . $wpdb->prefix . 'events_detail AS e ON att.event_id = e.id |
47 | 47 | WHERE e.event_status !="D"'; |
48 | - $this->_new_answer_table = $wpdb->prefix . "esp_answer"; |
|
49 | - $this->_new_question_table = $wpdb->prefix . "esp_question"; |
|
50 | - parent::__construct(); |
|
51 | - } |
|
52 | - protected function _migrate_old_row($old_row) |
|
53 | - { |
|
54 | - // get the new REGs for the old answer |
|
55 | - global $wpdb; |
|
56 | - $old_attendee_table = $wpdb->prefix . "events_attendee"; |
|
57 | - $new_reg_table = $wpdb->prefix . "esp_registration"; |
|
58 | - $regs = $this->get_migration_script()->get_mapping_new_pk($old_attendee_table, $old_row['attendee_id'], $new_reg_table); |
|
59 | - if (! $regs) { |
|
60 | - $this->add_error(sprintf(__("Could not find new registrations for old attendee %d when creating answer %s", "event_espresso"), $old_row['attendee_id'], $this->_json_encode($old_row))); |
|
61 | - return false; |
|
62 | - } |
|
63 | - // as inefficient as this sounds, we create an answer per REGISTRATION, (even if the registrations use the same attendee) |
|
64 | - foreach ($regs as $new_reg_id) { |
|
65 | - $this->_insert_new_answer($old_row, $new_reg_id); |
|
66 | - } |
|
67 | - } |
|
68 | - /** |
|
69 | - * Creates a 4.1 price base type |
|
70 | - * @global type $wpdb |
|
71 | - * @param array $old_price |
|
72 | - * @param int $new_reg_id |
|
73 | - * @return int |
|
74 | - */ |
|
75 | - private function _insert_new_answer($old_answer, $new_reg_id) |
|
76 | - { |
|
77 | - global $wpdb; |
|
78 | - $old_question_table = $wpdb->prefix . "events_question"; |
|
79 | - $new_question_id = $this->get_migration_script()->get_mapping_new_pk($old_question_table, $old_answer['question_id'], $this->_new_question_table); |
|
48 | + $this->_new_answer_table = $wpdb->prefix . "esp_answer"; |
|
49 | + $this->_new_question_table = $wpdb->prefix . "esp_question"; |
|
50 | + parent::__construct(); |
|
51 | + } |
|
52 | + protected function _migrate_old_row($old_row) |
|
53 | + { |
|
54 | + // get the new REGs for the old answer |
|
55 | + global $wpdb; |
|
56 | + $old_attendee_table = $wpdb->prefix . "events_attendee"; |
|
57 | + $new_reg_table = $wpdb->prefix . "esp_registration"; |
|
58 | + $regs = $this->get_migration_script()->get_mapping_new_pk($old_attendee_table, $old_row['attendee_id'], $new_reg_table); |
|
59 | + if (! $regs) { |
|
60 | + $this->add_error(sprintf(__("Could not find new registrations for old attendee %d when creating answer %s", "event_espresso"), $old_row['attendee_id'], $this->_json_encode($old_row))); |
|
61 | + return false; |
|
62 | + } |
|
63 | + // as inefficient as this sounds, we create an answer per REGISTRATION, (even if the registrations use the same attendee) |
|
64 | + foreach ($regs as $new_reg_id) { |
|
65 | + $this->_insert_new_answer($old_row, $new_reg_id); |
|
66 | + } |
|
67 | + } |
|
68 | + /** |
|
69 | + * Creates a 4.1 price base type |
|
70 | + * @global type $wpdb |
|
71 | + * @param array $old_price |
|
72 | + * @param int $new_reg_id |
|
73 | + * @return int |
|
74 | + */ |
|
75 | + private function _insert_new_answer($old_answer, $new_reg_id) |
|
76 | + { |
|
77 | + global $wpdb; |
|
78 | + $old_question_table = $wpdb->prefix . "events_question"; |
|
79 | + $new_question_id = $this->get_migration_script()->get_mapping_new_pk($old_question_table, $old_answer['question_id'], $this->_new_question_table); |
|
80 | 80 | |
81 | - $question_row = $this->_get_question_type_and_system($new_question_id); |
|
82 | - if ($question_row['QST_system']) { |
|
83 | - // It's an answer to a system question? EE3 used to store that on both the attendee and the answers column, |
|
84 | - // but not EE4! It's just stored in the attendee meta table. The answers table is ONLY for answers to custom |
|
85 | - // questions. |
|
86 | - return 0; |
|
87 | - } |
|
88 | - if (in_array($question_row['QST_type'], array('MULTIPLE'))) { |
|
89 | - $ans_value = serialize(explode(",", stripslashes($old_answer['answer']))); |
|
90 | - } else { |
|
91 | - $ans_value = stripslashes($old_answer['answer']); |
|
92 | - } |
|
93 | - $cols_n_values = array( |
|
94 | - 'REG_ID' => $new_reg_id, |
|
95 | - 'QST_ID' => $new_question_id, |
|
96 | - 'ANS_value' => $ans_value |
|
97 | - ); |
|
98 | - $datatypes = array( |
|
99 | - '%d',// REG_ID |
|
100 | - '%d',// QST_ID |
|
101 | - '%s',// ANS_value |
|
102 | - ); |
|
103 | - $success = $wpdb->insert($this->_new_answer_table, $cols_n_values, $datatypes); |
|
104 | - if (! $success) { |
|
105 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_answer, $this->_new_answer_table, $cols_n_values, $datatypes)); |
|
106 | - return 0; |
|
107 | - } |
|
108 | - $new_id = $wpdb->insert_id; |
|
109 | - return $new_id; |
|
110 | - } |
|
81 | + $question_row = $this->_get_question_type_and_system($new_question_id); |
|
82 | + if ($question_row['QST_system']) { |
|
83 | + // It's an answer to a system question? EE3 used to store that on both the attendee and the answers column, |
|
84 | + // but not EE4! It's just stored in the attendee meta table. The answers table is ONLY for answers to custom |
|
85 | + // questions. |
|
86 | + return 0; |
|
87 | + } |
|
88 | + if (in_array($question_row['QST_type'], array('MULTIPLE'))) { |
|
89 | + $ans_value = serialize(explode(",", stripslashes($old_answer['answer']))); |
|
90 | + } else { |
|
91 | + $ans_value = stripslashes($old_answer['answer']); |
|
92 | + } |
|
93 | + $cols_n_values = array( |
|
94 | + 'REG_ID' => $new_reg_id, |
|
95 | + 'QST_ID' => $new_question_id, |
|
96 | + 'ANS_value' => $ans_value |
|
97 | + ); |
|
98 | + $datatypes = array( |
|
99 | + '%d',// REG_ID |
|
100 | + '%d',// QST_ID |
|
101 | + '%s',// ANS_value |
|
102 | + ); |
|
103 | + $success = $wpdb->insert($this->_new_answer_table, $cols_n_values, $datatypes); |
|
104 | + if (! $success) { |
|
105 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_answer, $this->_new_answer_table, $cols_n_values, $datatypes)); |
|
106 | + return 0; |
|
107 | + } |
|
108 | + $new_id = $wpdb->insert_id; |
|
109 | + return $new_id; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * Gets the question's type |
|
114 | - * @global type $wpdb |
|
115 | - * @param type $question_id |
|
116 | - * @return array { |
|
117 | - * @type string $QST_type |
|
118 | - * @type string $QST_system |
|
119 | - * } |
|
120 | - */ |
|
121 | - private function _get_question_type_and_system($question_id) |
|
122 | - { |
|
123 | - global $wpdb; |
|
124 | - $row = $wpdb->get_row( |
|
125 | - $wpdb->prepare( |
|
126 | - "SELECT QST_type, QST_system FROM " . $this->_new_question_table . " WHERE QST_ID=%d LIMIT 1", |
|
127 | - $question_id |
|
128 | - ), |
|
129 | - ARRAY_A |
|
130 | - ); |
|
131 | - return $row; |
|
132 | - } |
|
112 | + /** |
|
113 | + * Gets the question's type |
|
114 | + * @global type $wpdb |
|
115 | + * @param type $question_id |
|
116 | + * @return array { |
|
117 | + * @type string $QST_type |
|
118 | + * @type string $QST_system |
|
119 | + * } |
|
120 | + */ |
|
121 | + private function _get_question_type_and_system($question_id) |
|
122 | + { |
|
123 | + global $wpdb; |
|
124 | + $row = $wpdb->get_row( |
|
125 | + $wpdb->prepare( |
|
126 | + "SELECT QST_type, QST_system FROM " . $this->_new_question_table . " WHERE QST_ID=%d LIMIT 1", |
|
127 | + $question_id |
|
128 | + ), |
|
129 | + ARRAY_A |
|
130 | + ); |
|
131 | + return $row; |
|
132 | + } |
|
133 | 133 | } |
@@ -38,25 +38,25 @@ discard block |
||
38 | 38 | { |
39 | 39 | global $wpdb; |
40 | 40 | $this->_pretty_name = __("Answers", "event_espresso"); |
41 | - $this->_old_table = $wpdb->prefix . "events_answer"; |
|
41 | + $this->_old_table = $wpdb->prefix."events_answer"; |
|
42 | 42 | // join to attendee and then join to events table |
43 | 43 | $this->select_expression = 'ans.*, e.event_status'; |
44 | 44 | $this->_extra_where_sql = ' AS ans |
45 | - INNER JOIN ' . $wpdb->prefix . 'events_attendee AS att ON ans.attendee_id = att.id |
|
46 | - INNER JOIN ' . $wpdb->prefix . 'events_detail AS e ON att.event_id = e.id |
|
45 | + INNER JOIN ' . $wpdb->prefix.'events_attendee AS att ON ans.attendee_id = att.id |
|
46 | + INNER JOIN ' . $wpdb->prefix.'events_detail AS e ON att.event_id = e.id |
|
47 | 47 | WHERE e.event_status !="D"'; |
48 | - $this->_new_answer_table = $wpdb->prefix . "esp_answer"; |
|
49 | - $this->_new_question_table = $wpdb->prefix . "esp_question"; |
|
48 | + $this->_new_answer_table = $wpdb->prefix."esp_answer"; |
|
49 | + $this->_new_question_table = $wpdb->prefix."esp_question"; |
|
50 | 50 | parent::__construct(); |
51 | 51 | } |
52 | 52 | protected function _migrate_old_row($old_row) |
53 | 53 | { |
54 | 54 | // get the new REGs for the old answer |
55 | 55 | global $wpdb; |
56 | - $old_attendee_table = $wpdb->prefix . "events_attendee"; |
|
57 | - $new_reg_table = $wpdb->prefix . "esp_registration"; |
|
56 | + $old_attendee_table = $wpdb->prefix."events_attendee"; |
|
57 | + $new_reg_table = $wpdb->prefix."esp_registration"; |
|
58 | 58 | $regs = $this->get_migration_script()->get_mapping_new_pk($old_attendee_table, $old_row['attendee_id'], $new_reg_table); |
59 | - if (! $regs) { |
|
59 | + if ( ! $regs) { |
|
60 | 60 | $this->add_error(sprintf(__("Could not find new registrations for old attendee %d when creating answer %s", "event_espresso"), $old_row['attendee_id'], $this->_json_encode($old_row))); |
61 | 61 | return false; |
62 | 62 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | private function _insert_new_answer($old_answer, $new_reg_id) |
76 | 76 | { |
77 | 77 | global $wpdb; |
78 | - $old_question_table = $wpdb->prefix . "events_question"; |
|
78 | + $old_question_table = $wpdb->prefix."events_question"; |
|
79 | 79 | $new_question_id = $this->get_migration_script()->get_mapping_new_pk($old_question_table, $old_answer['question_id'], $this->_new_question_table); |
80 | 80 | |
81 | 81 | $question_row = $this->_get_question_type_and_system($new_question_id); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | 'ANS_value' => $ans_value |
97 | 97 | ); |
98 | 98 | $datatypes = array( |
99 | - '%d',// REG_ID |
|
100 | - '%d',// QST_ID |
|
101 | - '%s',// ANS_value |
|
99 | + '%d', // REG_ID |
|
100 | + '%d', // QST_ID |
|
101 | + '%s', // ANS_value |
|
102 | 102 | ); |
103 | 103 | $success = $wpdb->insert($this->_new_answer_table, $cols_n_values, $datatypes); |
104 | - if (! $success) { |
|
104 | + if ( ! $success) { |
|
105 | 105 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_answer, $this->_new_answer_table, $cols_n_values, $datatypes)); |
106 | 106 | return 0; |
107 | 107 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | global $wpdb; |
124 | 124 | $row = $wpdb->get_row( |
125 | 125 | $wpdb->prepare( |
126 | - "SELECT QST_type, QST_system FROM " . $this->_new_question_table . " WHERE QST_ID=%d LIMIT 1", |
|
126 | + "SELECT QST_type, QST_system FROM ".$this->_new_question_table." WHERE QST_ID=%d LIMIT 1", |
|
127 | 127 | $question_id |
128 | 128 | ), |
129 | 129 | ARRAY_A |