@@ -27,282 +27,282 @@ |
||
27 | 27 | class EE_Brewing_Regular extends EE_BASE implements InterminableInterface |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis |
|
32 | - */ |
|
33 | - protected $_table_analysis; |
|
30 | + /** |
|
31 | + * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis |
|
32 | + */ |
|
33 | + protected $_table_analysis; |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * EE_Brewing_Regular constructor. |
|
38 | - * |
|
39 | - * @throws \DomainException |
|
40 | - * @throws \EE_Error |
|
41 | - * @throws InvalidDataTypeException |
|
42 | - * @throws InvalidInterfaceException |
|
43 | - * @throws \InvalidArgumentException |
|
44 | - */ |
|
45 | - public function __construct(TableAnalysis $table_analysis) |
|
46 | - { |
|
47 | - $this->_table_analysis = $table_analysis; |
|
48 | - if (defined('EE_CAFF_PATH')) { |
|
49 | - // activation |
|
50 | - add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
51 | - // load caff init |
|
52 | - add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
53 | - // remove the "powered by" credit link from receipts and invoices |
|
54 | - add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
55 | - // add caffeinated modules |
|
56 | - add_filter( |
|
57 | - 'FHEE__EE_Config__register_modules__modules_to_register', |
|
58 | - array($this, 'caffeinated_modules_to_register') |
|
59 | - ); |
|
60 | - // load caff scripts |
|
61 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
62 | - add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
63 | - // add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
64 | - EE_Register_Payment_Method::register( |
|
65 | - 'caffeinated_payment_methods', |
|
66 | - array( |
|
67 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
68 | - ) |
|
69 | - ); |
|
70 | - // caffeinated constructed |
|
71 | - do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
72 | - // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
73 | - add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
74 | - } |
|
75 | - } |
|
36 | + /** |
|
37 | + * EE_Brewing_Regular constructor. |
|
38 | + * |
|
39 | + * @throws \DomainException |
|
40 | + * @throws \EE_Error |
|
41 | + * @throws InvalidDataTypeException |
|
42 | + * @throws InvalidInterfaceException |
|
43 | + * @throws \InvalidArgumentException |
|
44 | + */ |
|
45 | + public function __construct(TableAnalysis $table_analysis) |
|
46 | + { |
|
47 | + $this->_table_analysis = $table_analysis; |
|
48 | + if (defined('EE_CAFF_PATH')) { |
|
49 | + // activation |
|
50 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
51 | + // load caff init |
|
52 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
53 | + // remove the "powered by" credit link from receipts and invoices |
|
54 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
55 | + // add caffeinated modules |
|
56 | + add_filter( |
|
57 | + 'FHEE__EE_Config__register_modules__modules_to_register', |
|
58 | + array($this, 'caffeinated_modules_to_register') |
|
59 | + ); |
|
60 | + // load caff scripts |
|
61 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
62 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
63 | + // add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
64 | + EE_Register_Payment_Method::register( |
|
65 | + 'caffeinated_payment_methods', |
|
66 | + array( |
|
67 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
68 | + ) |
|
69 | + ); |
|
70 | + // caffeinated constructed |
|
71 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
72 | + // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
73 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
80 | - * |
|
81 | - * @param array $paths original helper paths array |
|
82 | - * @return array new array of paths |
|
83 | - */ |
|
84 | - public function caf_helper_paths($paths) |
|
85 | - { |
|
86 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
87 | - return $paths; |
|
88 | - } |
|
78 | + /** |
|
79 | + * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
80 | + * |
|
81 | + * @param array $paths original helper paths array |
|
82 | + * @return array new array of paths |
|
83 | + */ |
|
84 | + public function caf_helper_paths($paths) |
|
85 | + { |
|
86 | + $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
87 | + return $paths; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
93 | - * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
94 | - * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
95 | - * This action should only be called when EE 4.x.0.P is initially activated. |
|
96 | - * Right now the only CAF content are these global prices. If there's more in the future, then |
|
97 | - * we should probably create a caf file to contain it all instead just a function like this. |
|
98 | - * Right now, we ASSUME the only price types in the system are default ones |
|
99 | - * |
|
100 | - * @global wpdb $wpdb |
|
101 | - */ |
|
102 | - public function initialize_caf_db_content() |
|
103 | - { |
|
104 | - global $wpdb; |
|
105 | - // use same method of getting creator id as the version introducing the change |
|
106 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
107 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
108 | - $price_table = $wpdb->prefix . "esp_price"; |
|
109 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
110 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
111 | - $tax_price_type_count = $wpdb->get_var($SQL); |
|
112 | - if ($tax_price_type_count <= 1) { |
|
113 | - $wpdb->insert( |
|
114 | - $price_type_table, |
|
115 | - array( |
|
116 | - 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
117 | - 'PBT_ID' => 4, |
|
118 | - 'PRT_is_percent' => true, |
|
119 | - 'PRT_order' => 60, |
|
120 | - 'PRT_deleted' => false, |
|
121 | - 'PRT_wp_user' => $default_creator_id, |
|
122 | - ), |
|
123 | - array( |
|
124 | - '%s',// PRT_name |
|
125 | - '%d',// PBT_id |
|
126 | - '%d',// PRT_is_percent |
|
127 | - '%d',// PRT_order |
|
128 | - '%d',// PRT_deleted |
|
129 | - '%d', // PRT_wp_user |
|
130 | - ) |
|
131 | - ); |
|
132 | - // federal tax |
|
133 | - $result = $wpdb->insert( |
|
134 | - $price_type_table, |
|
135 | - array( |
|
136 | - 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
137 | - 'PBT_ID' => 4, |
|
138 | - 'PRT_is_percent' => true, |
|
139 | - 'PRT_order' => 70, |
|
140 | - 'PRT_deleted' => false, |
|
141 | - 'PRT_wp_user' => $default_creator_id, |
|
142 | - ), |
|
143 | - array( |
|
144 | - '%s',// PRT_name |
|
145 | - '%d',// PBT_id |
|
146 | - '%d',// PRT_is_percent |
|
147 | - '%d',// PRT_order |
|
148 | - '%d',// PRT_deleted |
|
149 | - '%d' // PRT_wp_user |
|
150 | - ) |
|
151 | - ); |
|
152 | - if ($result) { |
|
153 | - $wpdb->insert( |
|
154 | - $price_table, |
|
155 | - array( |
|
156 | - 'PRT_ID' => $wpdb->insert_id, |
|
157 | - 'PRC_amount' => 15.00, |
|
158 | - 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
159 | - 'PRC_desc' => '', |
|
160 | - 'PRC_is_default' => true, |
|
161 | - 'PRC_overrides' => null, |
|
162 | - 'PRC_deleted' => false, |
|
163 | - 'PRC_order' => 50, |
|
164 | - 'PRC_parent' => null, |
|
165 | - 'PRC_wp_user' => $default_creator_id, |
|
166 | - ), |
|
167 | - array( |
|
168 | - '%d',// PRT_id |
|
169 | - '%f',// PRC_amount |
|
170 | - '%s',// PRC_name |
|
171 | - '%s',// PRC_desc |
|
172 | - '%d',// PRC_is_default |
|
173 | - '%d',// PRC_overrides |
|
174 | - '%d',// PRC_deleted |
|
175 | - '%d',// PRC_order |
|
176 | - '%d',// PRC_parent |
|
177 | - '%d' // PRC_wp_user |
|
178 | - ) |
|
179 | - ); |
|
180 | - } |
|
181 | - } |
|
182 | - } |
|
183 | - } |
|
91 | + /** |
|
92 | + * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
93 | + * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
94 | + * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
95 | + * This action should only be called when EE 4.x.0.P is initially activated. |
|
96 | + * Right now the only CAF content are these global prices. If there's more in the future, then |
|
97 | + * we should probably create a caf file to contain it all instead just a function like this. |
|
98 | + * Right now, we ASSUME the only price types in the system are default ones |
|
99 | + * |
|
100 | + * @global wpdb $wpdb |
|
101 | + */ |
|
102 | + public function initialize_caf_db_content() |
|
103 | + { |
|
104 | + global $wpdb; |
|
105 | + // use same method of getting creator id as the version introducing the change |
|
106 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
107 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
108 | + $price_table = $wpdb->prefix . "esp_price"; |
|
109 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
110 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
111 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
112 | + if ($tax_price_type_count <= 1) { |
|
113 | + $wpdb->insert( |
|
114 | + $price_type_table, |
|
115 | + array( |
|
116 | + 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
117 | + 'PBT_ID' => 4, |
|
118 | + 'PRT_is_percent' => true, |
|
119 | + 'PRT_order' => 60, |
|
120 | + 'PRT_deleted' => false, |
|
121 | + 'PRT_wp_user' => $default_creator_id, |
|
122 | + ), |
|
123 | + array( |
|
124 | + '%s',// PRT_name |
|
125 | + '%d',// PBT_id |
|
126 | + '%d',// PRT_is_percent |
|
127 | + '%d',// PRT_order |
|
128 | + '%d',// PRT_deleted |
|
129 | + '%d', // PRT_wp_user |
|
130 | + ) |
|
131 | + ); |
|
132 | + // federal tax |
|
133 | + $result = $wpdb->insert( |
|
134 | + $price_type_table, |
|
135 | + array( |
|
136 | + 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
137 | + 'PBT_ID' => 4, |
|
138 | + 'PRT_is_percent' => true, |
|
139 | + 'PRT_order' => 70, |
|
140 | + 'PRT_deleted' => false, |
|
141 | + 'PRT_wp_user' => $default_creator_id, |
|
142 | + ), |
|
143 | + array( |
|
144 | + '%s',// PRT_name |
|
145 | + '%d',// PBT_id |
|
146 | + '%d',// PRT_is_percent |
|
147 | + '%d',// PRT_order |
|
148 | + '%d',// PRT_deleted |
|
149 | + '%d' // PRT_wp_user |
|
150 | + ) |
|
151 | + ); |
|
152 | + if ($result) { |
|
153 | + $wpdb->insert( |
|
154 | + $price_table, |
|
155 | + array( |
|
156 | + 'PRT_ID' => $wpdb->insert_id, |
|
157 | + 'PRC_amount' => 15.00, |
|
158 | + 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
159 | + 'PRC_desc' => '', |
|
160 | + 'PRC_is_default' => true, |
|
161 | + 'PRC_overrides' => null, |
|
162 | + 'PRC_deleted' => false, |
|
163 | + 'PRC_order' => 50, |
|
164 | + 'PRC_parent' => null, |
|
165 | + 'PRC_wp_user' => $default_creator_id, |
|
166 | + ), |
|
167 | + array( |
|
168 | + '%d',// PRT_id |
|
169 | + '%f',// PRC_amount |
|
170 | + '%s',// PRC_name |
|
171 | + '%s',// PRC_desc |
|
172 | + '%d',// PRC_is_default |
|
173 | + '%d',// PRC_overrides |
|
174 | + '%d',// PRC_deleted |
|
175 | + '%d',// PRC_order |
|
176 | + '%d',// PRC_parent |
|
177 | + '%d' // PRC_wp_user |
|
178 | + ) |
|
179 | + ); |
|
180 | + } |
|
181 | + } |
|
182 | + } |
|
183 | + } |
|
184 | 184 | |
185 | 185 | |
186 | - /** |
|
187 | - * caffeinated_modules_to_register |
|
188 | - * |
|
189 | - * @access public |
|
190 | - * @param array $modules_to_register |
|
191 | - * @return array |
|
192 | - */ |
|
193 | - public function caffeinated_modules_to_register($modules_to_register = array()) |
|
194 | - { |
|
195 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
196 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
197 | - if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
198 | - $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
199 | - } |
|
200 | - } |
|
201 | - return $modules_to_register; |
|
202 | - } |
|
186 | + /** |
|
187 | + * caffeinated_modules_to_register |
|
188 | + * |
|
189 | + * @access public |
|
190 | + * @param array $modules_to_register |
|
191 | + * @return array |
|
192 | + */ |
|
193 | + public function caffeinated_modules_to_register($modules_to_register = array()) |
|
194 | + { |
|
195 | + if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
196 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
197 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
198 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
199 | + } |
|
200 | + } |
|
201 | + return $modules_to_register; |
|
202 | + } |
|
203 | 203 | |
204 | 204 | |
205 | - /** |
|
206 | - * @throws EE_Error |
|
207 | - * @throws InvalidArgumentException |
|
208 | - * @throws ReflectionException |
|
209 | - * @throws InvalidDataTypeException |
|
210 | - * @throws InvalidInterfaceException |
|
211 | - */ |
|
212 | - public function caffeinated_init() |
|
213 | - { |
|
214 | - // Custom Post Type hooks |
|
215 | - add_filter( |
|
216 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
217 | - array($this, 'filter_taxonomies') |
|
218 | - ); |
|
219 | - add_filter( |
|
220 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
221 | - array($this, 'filter_cpts') |
|
222 | - ); |
|
223 | - add_filter( |
|
224 | - 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
225 | - array($this, 'nav_metabox_items') |
|
226 | - ); |
|
227 | - EE_Registry::instance()->load_file( |
|
228 | - EE_CAFF_PATH, |
|
229 | - 'EE_Caf_Messages', |
|
230 | - 'class', |
|
231 | - array(), |
|
232 | - false |
|
233 | - ); |
|
234 | - // caffeinated_init__complete hook |
|
235 | - do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
236 | - } |
|
205 | + /** |
|
206 | + * @throws EE_Error |
|
207 | + * @throws InvalidArgumentException |
|
208 | + * @throws ReflectionException |
|
209 | + * @throws InvalidDataTypeException |
|
210 | + * @throws InvalidInterfaceException |
|
211 | + */ |
|
212 | + public function caffeinated_init() |
|
213 | + { |
|
214 | + // Custom Post Type hooks |
|
215 | + add_filter( |
|
216 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
217 | + array($this, 'filter_taxonomies') |
|
218 | + ); |
|
219 | + add_filter( |
|
220 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
221 | + array($this, 'filter_cpts') |
|
222 | + ); |
|
223 | + add_filter( |
|
224 | + 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
225 | + array($this, 'nav_metabox_items') |
|
226 | + ); |
|
227 | + EE_Registry::instance()->load_file( |
|
228 | + EE_CAFF_PATH, |
|
229 | + 'EE_Caf_Messages', |
|
230 | + 'class', |
|
231 | + array(), |
|
232 | + false |
|
233 | + ); |
|
234 | + // caffeinated_init__complete hook |
|
235 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
236 | + } |
|
237 | 237 | |
238 | 238 | |
239 | - public function enqueue_caffeinated_scripts() |
|
240 | - { |
|
241 | - // sound of crickets... |
|
242 | - } |
|
239 | + public function enqueue_caffeinated_scripts() |
|
240 | + { |
|
241 | + // sound of crickets... |
|
242 | + } |
|
243 | 243 | |
244 | 244 | |
245 | - /** |
|
246 | - * callbacks below here |
|
247 | - * |
|
248 | - * @param array $taxonomy_array |
|
249 | - * @return array |
|
250 | - */ |
|
251 | - public function filter_taxonomies(array $taxonomy_array) |
|
252 | - { |
|
253 | - $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
254 | - return $taxonomy_array; |
|
255 | - } |
|
245 | + /** |
|
246 | + * callbacks below here |
|
247 | + * |
|
248 | + * @param array $taxonomy_array |
|
249 | + * @return array |
|
250 | + */ |
|
251 | + public function filter_taxonomies(array $taxonomy_array) |
|
252 | + { |
|
253 | + $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
254 | + return $taxonomy_array; |
|
255 | + } |
|
256 | 256 | |
257 | 257 | |
258 | - /** |
|
259 | - * @param array $cpt_array |
|
260 | - * @return mixed |
|
261 | - */ |
|
262 | - public function filter_cpts(array $cpt_array) |
|
263 | - { |
|
264 | - $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
265 | - return $cpt_array; |
|
266 | - } |
|
258 | + /** |
|
259 | + * @param array $cpt_array |
|
260 | + * @return mixed |
|
261 | + */ |
|
262 | + public function filter_cpts(array $cpt_array) |
|
263 | + { |
|
264 | + $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
265 | + return $cpt_array; |
|
266 | + } |
|
267 | 267 | |
268 | 268 | |
269 | - /** |
|
270 | - * @param array $menuitems |
|
271 | - * @return array |
|
272 | - */ |
|
273 | - public function nav_metabox_items(array $menuitems) |
|
274 | - { |
|
275 | - $menuitems[] = array( |
|
276 | - 'title' => __('Venue List', 'event_espresso'), |
|
277 | - 'url' => get_post_type_archive_link('espresso_venues'), |
|
278 | - 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
279 | - ); |
|
280 | - return $menuitems; |
|
281 | - } |
|
269 | + /** |
|
270 | + * @param array $menuitems |
|
271 | + * @return array |
|
272 | + */ |
|
273 | + public function nav_metabox_items(array $menuitems) |
|
274 | + { |
|
275 | + $menuitems[] = array( |
|
276 | + 'title' => __('Venue List', 'event_espresso'), |
|
277 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
278 | + 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
279 | + ); |
|
280 | + return $menuitems; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | |
284 | - /** |
|
285 | - * Gets the injected table analyzer, or throws an exception |
|
286 | - * |
|
287 | - * @return TableAnalysis |
|
288 | - * @throws \EE_Error |
|
289 | - */ |
|
290 | - protected function _get_table_analysis() |
|
291 | - { |
|
292 | - if ($this->_table_analysis instanceof TableAnalysis) { |
|
293 | - return $this->_table_analysis; |
|
294 | - } else { |
|
295 | - throw new \EE_Error( |
|
296 | - sprintf( |
|
297 | - __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
298 | - get_class($this) |
|
299 | - ) |
|
300 | - ); |
|
301 | - } |
|
302 | - } |
|
284 | + /** |
|
285 | + * Gets the injected table analyzer, or throws an exception |
|
286 | + * |
|
287 | + * @return TableAnalysis |
|
288 | + * @throws \EE_Error |
|
289 | + */ |
|
290 | + protected function _get_table_analysis() |
|
291 | + { |
|
292 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
293 | + return $this->_table_analysis; |
|
294 | + } else { |
|
295 | + throw new \EE_Error( |
|
296 | + sprintf( |
|
297 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
298 | + get_class($this) |
|
299 | + ) |
|
300 | + ); |
|
301 | + } |
|
302 | + } |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | 306 | $brewing = new EE_Brewing_Regular( |
307 | - EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
307 | + EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
308 | 308 | ); |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | * define and use the hook in a specific caffeinated/whatever class or file. |
12 | 12 | */ |
13 | 13 | // defined some new constants related to caffeinated folder |
14 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/'); |
|
15 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
16 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
17 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS); |
|
14 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
15 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
16 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
17 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | EE_Register_Payment_Method::register( |
65 | 65 | 'caffeinated_payment_methods', |
66 | 66 | array( |
67 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
67 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR), |
|
68 | 68 | ) |
69 | 69 | ); |
70 | 70 | // caffeinated constructed |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function caf_helper_paths($paths) |
85 | 85 | { |
86 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
86 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
87 | 87 | return $paths; |
88 | 88 | } |
89 | 89 | |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | global $wpdb; |
105 | 105 | // use same method of getting creator id as the version introducing the change |
106 | 106 | $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
107 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
108 | - $price_table = $wpdb->prefix . "esp_price"; |
|
107 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
108 | + $price_table = $wpdb->prefix."esp_price"; |
|
109 | 109 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
110 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
110 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; // include trashed price types |
|
111 | 111 | $tax_price_type_count = $wpdb->get_var($SQL); |
112 | 112 | if ($tax_price_type_count <= 1) { |
113 | 113 | $wpdb->insert( |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | 'PRT_wp_user' => $default_creator_id, |
122 | 122 | ), |
123 | 123 | array( |
124 | - '%s',// PRT_name |
|
125 | - '%d',// PBT_id |
|
126 | - '%d',// PRT_is_percent |
|
127 | - '%d',// PRT_order |
|
128 | - '%d',// PRT_deleted |
|
124 | + '%s', // PRT_name |
|
125 | + '%d', // PBT_id |
|
126 | + '%d', // PRT_is_percent |
|
127 | + '%d', // PRT_order |
|
128 | + '%d', // PRT_deleted |
|
129 | 129 | '%d', // PRT_wp_user |
130 | 130 | ) |
131 | 131 | ); |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | 'PRT_wp_user' => $default_creator_id, |
142 | 142 | ), |
143 | 143 | array( |
144 | - '%s',// PRT_name |
|
145 | - '%d',// PBT_id |
|
146 | - '%d',// PRT_is_percent |
|
147 | - '%d',// PRT_order |
|
148 | - '%d',// PRT_deleted |
|
144 | + '%s', // PRT_name |
|
145 | + '%d', // PBT_id |
|
146 | + '%d', // PRT_is_percent |
|
147 | + '%d', // PRT_order |
|
148 | + '%d', // PRT_deleted |
|
149 | 149 | '%d' // PRT_wp_user |
150 | 150 | ) |
151 | 151 | ); |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | 'PRC_wp_user' => $default_creator_id, |
166 | 166 | ), |
167 | 167 | array( |
168 | - '%d',// PRT_id |
|
169 | - '%f',// PRC_amount |
|
170 | - '%s',// PRC_name |
|
171 | - '%s',// PRC_desc |
|
172 | - '%d',// PRC_is_default |
|
173 | - '%d',// PRC_overrides |
|
174 | - '%d',// PRC_deleted |
|
175 | - '%d',// PRC_order |
|
176 | - '%d',// PRC_parent |
|
168 | + '%d', // PRT_id |
|
169 | + '%f', // PRC_amount |
|
170 | + '%s', // PRC_name |
|
171 | + '%s', // PRC_desc |
|
172 | + '%d', // PRC_is_default |
|
173 | + '%d', // PRC_overrides |
|
174 | + '%d', // PRC_deleted |
|
175 | + '%d', // PRC_order |
|
176 | + '%d', // PRC_parent |
|
177 | 177 | '%d' // PRC_wp_user |
178 | 178 | ) |
179 | 179 | ); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function caffeinated_modules_to_register($modules_to_register = array()) |
194 | 194 | { |
195 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
196 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
195 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
196 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
197 | 197 | if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
198 | 198 | $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
199 | 199 | } |
@@ -16,208 +16,208 @@ |
||
16 | 16 | class espresso_events_Registration_Form_Hooks_Extend extends espresso_events_Registration_Form_Hooks |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * extending the properties set in espresso_events_Registration_From_Hooks |
|
21 | - * |
|
22 | - * @access protected |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - protected function _extend_properties() |
|
26 | - { |
|
27 | - $this->_metaboxes = array_merge( |
|
28 | - $this->_metaboxes, |
|
29 | - array( |
|
30 | - 1 => array( |
|
31 | - 'page_route' => array('create_new', 'edit'), |
|
32 | - 'func' => 'additional_questions', |
|
33 | - 'label' => esc_html__('Questions for Additional Registrants', 'event_espresso'), |
|
34 | - 'priority' => 'default', |
|
35 | - 'context' => 'side', |
|
36 | - ), |
|
37 | - ) |
|
38 | - ); |
|
39 | - $this->_scripts_styles = array( |
|
40 | - 'registers' => array( |
|
41 | - 'extended-event-editor' => array( |
|
42 | - 'url' => EE_CORE_CAF_ADMIN_EXTEND_URL |
|
43 | - . 'registration_form/assets/event-editor-question-groups.js', |
|
44 | - 'depends' => array('jquery'), |
|
45 | - ), |
|
46 | - ), |
|
47 | - 'enqueues' => array( |
|
48 | - 'extended-event-editor' => array('edit', 'create_new'), |
|
49 | - ), |
|
50 | - ); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @param Callable[] $callbacks |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function modify_callbacks($callbacks) |
|
59 | - { |
|
60 | - $callbacks = parent::modify_callbacks($callbacks); |
|
61 | - $callbacks[] = array($this, 'additional_question_group_update'); |
|
62 | - return $callbacks; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Call back hooked into revision restores. |
|
68 | - * |
|
69 | - * @param $post_id |
|
70 | - * @param $revision_id |
|
71 | - * @return EE_Base_Class|void |
|
72 | - * @throws EE_Error |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws InvalidDataTypeException |
|
75 | - * @throws InvalidInterfaceException |
|
76 | - * @throws ReflectionException |
|
77 | - */ |
|
78 | - public function restore_revision($post_id, $revision_id) |
|
79 | - { |
|
80 | - $post_evt = parent::restore_revision($post_id, $revision_id); |
|
81 | - |
|
82 | - // restore revision for additional questions |
|
83 | - $post_evt->restore_revision( |
|
84 | - $revision_id, |
|
85 | - array('Question_Group'), |
|
86 | - array( |
|
87 | - 'Question_Group' => array('Event_Question_Group.EQG_primary' => 0), |
|
88 | - ) |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @param $post_id |
|
95 | - * @param $post |
|
96 | - * @throws EE_Error |
|
97 | - * @throws InvalidArgumentException |
|
98 | - * @throws InvalidDataTypeException |
|
99 | - * @throws InvalidInterfaceException |
|
100 | - */ |
|
101 | - public function additional_questions($post_id, $post) |
|
102 | - { |
|
103 | - $this->_event = $this->_adminpage_obj->get_event_object(); |
|
104 | - $event_id = $this->_event->ID(); |
|
105 | - ?> |
|
19 | + /** |
|
20 | + * extending the properties set in espresso_events_Registration_From_Hooks |
|
21 | + * |
|
22 | + * @access protected |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + protected function _extend_properties() |
|
26 | + { |
|
27 | + $this->_metaboxes = array_merge( |
|
28 | + $this->_metaboxes, |
|
29 | + array( |
|
30 | + 1 => array( |
|
31 | + 'page_route' => array('create_new', 'edit'), |
|
32 | + 'func' => 'additional_questions', |
|
33 | + 'label' => esc_html__('Questions for Additional Registrants', 'event_espresso'), |
|
34 | + 'priority' => 'default', |
|
35 | + 'context' => 'side', |
|
36 | + ), |
|
37 | + ) |
|
38 | + ); |
|
39 | + $this->_scripts_styles = array( |
|
40 | + 'registers' => array( |
|
41 | + 'extended-event-editor' => array( |
|
42 | + 'url' => EE_CORE_CAF_ADMIN_EXTEND_URL |
|
43 | + . 'registration_form/assets/event-editor-question-groups.js', |
|
44 | + 'depends' => array('jquery'), |
|
45 | + ), |
|
46 | + ), |
|
47 | + 'enqueues' => array( |
|
48 | + 'extended-event-editor' => array('edit', 'create_new'), |
|
49 | + ), |
|
50 | + ); |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @param Callable[] $callbacks |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function modify_callbacks($callbacks) |
|
59 | + { |
|
60 | + $callbacks = parent::modify_callbacks($callbacks); |
|
61 | + $callbacks[] = array($this, 'additional_question_group_update'); |
|
62 | + return $callbacks; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Call back hooked into revision restores. |
|
68 | + * |
|
69 | + * @param $post_id |
|
70 | + * @param $revision_id |
|
71 | + * @return EE_Base_Class|void |
|
72 | + * @throws EE_Error |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws InvalidDataTypeException |
|
75 | + * @throws InvalidInterfaceException |
|
76 | + * @throws ReflectionException |
|
77 | + */ |
|
78 | + public function restore_revision($post_id, $revision_id) |
|
79 | + { |
|
80 | + $post_evt = parent::restore_revision($post_id, $revision_id); |
|
81 | + |
|
82 | + // restore revision for additional questions |
|
83 | + $post_evt->restore_revision( |
|
84 | + $revision_id, |
|
85 | + array('Question_Group'), |
|
86 | + array( |
|
87 | + 'Question_Group' => array('Event_Question_Group.EQG_primary' => 0), |
|
88 | + ) |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @param $post_id |
|
95 | + * @param $post |
|
96 | + * @throws EE_Error |
|
97 | + * @throws InvalidArgumentException |
|
98 | + * @throws InvalidDataTypeException |
|
99 | + * @throws InvalidInterfaceException |
|
100 | + */ |
|
101 | + public function additional_questions($post_id, $post) |
|
102 | + { |
|
103 | + $this->_event = $this->_adminpage_obj->get_event_object(); |
|
104 | + $event_id = $this->_event->ID(); |
|
105 | + ?> |
|
106 | 106 | <div class="inside"> |
107 | 107 | <p><strong> |
108 | 108 | <?php _e('Question Groups', 'event_espresso'); ?> |
109 | 109 | </strong><br/> |
110 | 110 | <?php |
111 | - printf( |
|
112 | - esc_html__( |
|
113 | - 'Add a pre-populated %1$sgroup of questions%2$s to your event.', |
|
114 | - 'event_espresso' |
|
115 | - ), |
|
116 | - '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
117 | - '</a>' |
|
118 | - ); |
|
119 | - ?> |
|
111 | + printf( |
|
112 | + esc_html__( |
|
113 | + 'Add a pre-populated %1$sgroup of questions%2$s to your event.', |
|
114 | + 'event_espresso' |
|
115 | + ), |
|
116 | + '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
117 | + '</a>' |
|
118 | + ); |
|
119 | + ?> |
|
120 | 120 | </p> |
121 | 121 | <?php |
122 | 122 | |
123 | - $qsg_where['QSG_deleted'] = false; |
|
124 | - $query_params = apply_filters( |
|
125 | - 'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters', |
|
126 | - array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
127 | - ); |
|
128 | - $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
129 | - $EQGs = ! empty($event_id) |
|
130 | - ? $this->_event->get_many_related( |
|
131 | - 'Question_Group', |
|
132 | - array(array('Event_Question_Group.EQG_primary' => 0)) |
|
133 | - ) |
|
134 | - : array(); |
|
135 | - $EQGids = array_keys($EQGs); |
|
136 | - |
|
137 | - if (! empty($QSGs)) { |
|
138 | - $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
139 | - foreach ($QSGs as $QSG) { |
|
140 | - $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
|
141 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
142 | - array( |
|
143 | - 'action' => 'edit_question_group', |
|
144 | - 'QSG_ID' => $QSG->ID(), |
|
145 | - ), |
|
146 | - EE_FORMS_ADMIN_URL |
|
147 | - ); |
|
148 | - |
|
149 | - $html .= ' |
|
123 | + $qsg_where['QSG_deleted'] = false; |
|
124 | + $query_params = apply_filters( |
|
125 | + 'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters', |
|
126 | + array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
127 | + ); |
|
128 | + $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
129 | + $EQGs = ! empty($event_id) |
|
130 | + ? $this->_event->get_many_related( |
|
131 | + 'Question_Group', |
|
132 | + array(array('Event_Question_Group.EQG_primary' => 0)) |
|
133 | + ) |
|
134 | + : array(); |
|
135 | + $EQGids = array_keys($EQGs); |
|
136 | + |
|
137 | + if (! empty($QSGs)) { |
|
138 | + $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
139 | + foreach ($QSGs as $QSG) { |
|
140 | + $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
|
141 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
142 | + array( |
|
143 | + 'action' => 'edit_question_group', |
|
144 | + 'QSG_ID' => $QSG->ID(), |
|
145 | + ), |
|
146 | + EE_FORMS_ADMIN_URL |
|
147 | + ); |
|
148 | + |
|
149 | + $html .= ' |
|
150 | 150 | <p id="event-question-group-' . $QSG->ID() . '"> |
151 | 151 | <input value="' . $QSG->ID() . '"' |
152 | - . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
152 | + . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
153 | 153 | <a href="' . $edit_link . '" title="' |
154 | - . sprintf( |
|
155 | - esc_attr__('Edit %s Group', 'event_espresso'), |
|
156 | - $QSG->get('QSG_name') |
|
157 | - ) |
|
158 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
154 | + . sprintf( |
|
155 | + esc_attr__('Edit %s Group', 'event_espresso'), |
|
156 | + $QSG->get('QSG_name') |
|
157 | + ) |
|
158 | + . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
159 | 159 | </p>'; |
160 | - if ($QSG->ID() === 2) { |
|
161 | - $html .= ' |
|
160 | + if ($QSG->ID() === 2) { |
|
161 | + $html .= ' |
|
162 | 162 | <p id="question-group-requirements-notice-pg" class="important-notice small-text" style="display: none;">' |
163 | - . esc_html__( |
|
164 | - 'The Personal Information question group is required whenever the Address Information question group is activated.', |
|
165 | - 'event_espresso' |
|
166 | - ) |
|
167 | - . '</p>'; |
|
168 | - } |
|
169 | - } |
|
170 | - $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | - |
|
172 | - echo $html; |
|
173 | - } else { |
|
174 | - esc_html_e( |
|
175 | - 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | - 'event_espresso' |
|
177 | - ); |
|
178 | - } |
|
179 | - do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
180 | - ?> |
|
163 | + . esc_html__( |
|
164 | + 'The Personal Information question group is required whenever the Address Information question group is activated.', |
|
165 | + 'event_espresso' |
|
166 | + ) |
|
167 | + . '</p>'; |
|
168 | + } |
|
169 | + } |
|
170 | + $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | + |
|
172 | + echo $html; |
|
173 | + } else { |
|
174 | + esc_html_e( |
|
175 | + 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | + 'event_espresso' |
|
177 | + ); |
|
178 | + } |
|
179 | + do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
180 | + ?> |
|
181 | 181 | </div> |
182 | 182 | <?php |
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - public function additional_question_group_update($evtobj, $data) |
|
187 | - { |
|
188 | - $question_groups = ! empty($data['add_attendee_question_groups']) |
|
189 | - ? (array) $data['add_attendee_question_groups'] |
|
190 | - : array(); |
|
191 | - $added_qgs = array_keys($question_groups); |
|
192 | - $success = array(); |
|
193 | - |
|
194 | - // let's get all current question groups associated with this event. |
|
195 | - $current_qgs = $evtobj->get_many_related( |
|
196 | - 'Question_Group', |
|
197 | - array(array('Event_Question_Group.EQG_primary' => 0)) |
|
198 | - ); |
|
199 | - $current_qgs = array_keys($current_qgs); // we just want the ids |
|
200 | - |
|
201 | - // now let's get the groups selected in the editor and update (IF we have data) |
|
202 | - if (! empty($question_groups)) { |
|
203 | - foreach ($question_groups as $id => $val) { |
|
204 | - // add to event |
|
205 | - if ($val) { |
|
206 | - $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 0)); |
|
207 | - } |
|
208 | - $success[] = ! empty($qg) ? 1 : 0; |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
213 | - $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
214 | - |
|
215 | - foreach ($removed_qgs as $qgid) { |
|
216 | - $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 0)); |
|
217 | - $success[] = ! empty($qg) ? 1 : 0; |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - return in_array(0, $success, true) ? false : true; |
|
222 | - } |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + public function additional_question_group_update($evtobj, $data) |
|
187 | + { |
|
188 | + $question_groups = ! empty($data['add_attendee_question_groups']) |
|
189 | + ? (array) $data['add_attendee_question_groups'] |
|
190 | + : array(); |
|
191 | + $added_qgs = array_keys($question_groups); |
|
192 | + $success = array(); |
|
193 | + |
|
194 | + // let's get all current question groups associated with this event. |
|
195 | + $current_qgs = $evtobj->get_many_related( |
|
196 | + 'Question_Group', |
|
197 | + array(array('Event_Question_Group.EQG_primary' => 0)) |
|
198 | + ); |
|
199 | + $current_qgs = array_keys($current_qgs); // we just want the ids |
|
200 | + |
|
201 | + // now let's get the groups selected in the editor and update (IF we have data) |
|
202 | + if (! empty($question_groups)) { |
|
203 | + foreach ($question_groups as $id => $val) { |
|
204 | + // add to event |
|
205 | + if ($val) { |
|
206 | + $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 0)); |
|
207 | + } |
|
208 | + $success[] = ! empty($qg) ? 1 : 0; |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
213 | + $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
214 | + |
|
215 | + foreach ($removed_qgs as $qgid) { |
|
216 | + $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 0)); |
|
217 | + $success[] = ! empty($qg) ? 1 : 0; |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + return in_array(0, $success, true) ? false : true; |
|
222 | + } |
|
223 | 223 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | : array(); |
135 | 135 | $EQGids = array_keys($EQGs); |
136 | 136 | |
137 | - if (! empty($QSGs)) { |
|
137 | + if ( ! empty($QSGs)) { |
|
138 | 138 | $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
139 | 139 | foreach ($QSGs as $QSG) { |
140 | 140 | $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | ); |
148 | 148 | |
149 | 149 | $html .= ' |
150 | - <p id="event-question-group-' . $QSG->ID() . '"> |
|
151 | - <input value="' . $QSG->ID() . '"' |
|
152 | - . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
153 | - <a href="' . $edit_link . '" title="' |
|
150 | + <p id="event-question-group-' . $QSG->ID().'"> |
|
151 | + <input value="' . $QSG->ID().'"' |
|
152 | + . ' type="checkbox" name="add_attendee_question_groups['.$QSG->ID().']"'.$checked.' /> |
|
153 | + <a href="' . $edit_link.'" title="' |
|
154 | 154 | . sprintf( |
155 | 155 | esc_attr__('Edit %s Group', 'event_espresso'), |
156 | 156 | $QSG->get('QSG_name') |
157 | 157 | ) |
158 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
158 | + . '" target="_blank">'.$QSG->get('QSG_name').'</a> |
|
159 | 159 | </p>'; |
160 | 160 | if ($QSG->ID() === 2) { |
161 | 161 | $html .= ' |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $current_qgs = array_keys($current_qgs); // we just want the ids |
200 | 200 | |
201 | 201 | // now let's get the groups selected in the editor and update (IF we have data) |
202 | - if (! empty($question_groups)) { |
|
202 | + if ( ! empty($question_groups)) { |
|
203 | 203 | foreach ($question_groups as $id => $val) { |
204 | 204 | // add to event |
205 | 205 | if ($val) { |
@@ -16,113 +16,113 @@ |
||
16 | 16 | class Extend_Registration_Form_Questions_Admin_List_Table extends Registration_Form_Questions_Admin_List_Table |
17 | 17 | { |
18 | 18 | |
19 | - public function __construct($admin_page) |
|
20 | - { |
|
21 | - parent::__construct($admin_page); |
|
22 | - } |
|
19 | + public function __construct($admin_page) |
|
20 | + { |
|
21 | + parent::__construct($admin_page); |
|
22 | + } |
|
23 | 23 | |
24 | - public function column_display_text(EE_Question $item) |
|
25 | - { |
|
26 | - $system_question = $item->is_system_question(); |
|
27 | - $actions = array(); |
|
24 | + public function column_display_text(EE_Question $item) |
|
25 | + { |
|
26 | + $system_question = $item->is_system_question(); |
|
27 | + $actions = array(); |
|
28 | 28 | |
29 | - if (! defined('REG_ADMIN_URL')) { |
|
30 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
31 | - } |
|
29 | + if (! defined('REG_ADMIN_URL')) { |
|
30 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
31 | + } |
|
32 | 32 | |
33 | - $edit_query_args = array( |
|
34 | - 'action' => 'edit_question', |
|
35 | - 'QST_ID' => $item->ID(), |
|
36 | - ); |
|
33 | + $edit_query_args = array( |
|
34 | + 'action' => 'edit_question', |
|
35 | + 'QST_ID' => $item->ID(), |
|
36 | + ); |
|
37 | 37 | |
38 | - $trash_query_args = array( |
|
39 | - 'action' => 'trash_question', |
|
40 | - 'QST_ID' => $item->ID(), |
|
41 | - ); |
|
38 | + $trash_query_args = array( |
|
39 | + 'action' => 'trash_question', |
|
40 | + 'QST_ID' => $item->ID(), |
|
41 | + ); |
|
42 | 42 | |
43 | - $restore_query_args = array( |
|
44 | - 'action' => 'restore_question', |
|
45 | - 'QST_ID' => $item->ID(), |
|
46 | - ); |
|
43 | + $restore_query_args = array( |
|
44 | + 'action' => 'restore_question', |
|
45 | + 'QST_ID' => $item->ID(), |
|
46 | + ); |
|
47 | 47 | |
48 | - $delete_query_args = array( |
|
49 | - 'action' => 'delete_questions', |
|
50 | - 'QST_ID' => $item->ID(), |
|
51 | - ); |
|
48 | + $delete_query_args = array( |
|
49 | + 'action' => 'delete_questions', |
|
50 | + 'QST_ID' => $item->ID(), |
|
51 | + ); |
|
52 | 52 | |
53 | - $duplicate_query_args = array( |
|
54 | - 'action' => 'duplicate_question', |
|
55 | - 'QST_ID' => $item->ID(), |
|
56 | - ); |
|
53 | + $duplicate_query_args = array( |
|
54 | + 'action' => 'duplicate_question', |
|
55 | + 'QST_ID' => $item->ID(), |
|
56 | + ); |
|
57 | 57 | |
58 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
59 | - $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
60 | - $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
61 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
62 | - $duplicate_link = EE_Admin_Page::add_query_args_and_nonce($duplicate_query_args, EE_FORMS_ADMIN_URL); |
|
58 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
59 | + $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
60 | + $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
61 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
62 | + $duplicate_link = EE_Admin_Page::add_query_args_and_nonce($duplicate_query_args, EE_FORMS_ADMIN_URL); |
|
63 | 63 | |
64 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
65 | - 'ee_edit_question', |
|
66 | - 'espresso_registration_form_edit_question', |
|
67 | - $item->ID() |
|
68 | - )) { |
|
69 | - $actions = array( |
|
70 | - 'edit' => '<a href="' . $edit_link . '" title="' |
|
71 | - . __('Edit Question', 'event_espresso') . '">' |
|
72 | - . __('Edit', 'event_espresso') . '</a>', |
|
73 | - ); |
|
74 | - } |
|
64 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
65 | + 'ee_edit_question', |
|
66 | + 'espresso_registration_form_edit_question', |
|
67 | + $item->ID() |
|
68 | + )) { |
|
69 | + $actions = array( |
|
70 | + 'edit' => '<a href="' . $edit_link . '" title="' |
|
71 | + . __('Edit Question', 'event_espresso') . '">' |
|
72 | + . __('Edit', 'event_espresso') . '</a>', |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | - if (! $system_question |
|
77 | - && $this->_view != 'trash' |
|
78 | - && EE_Registry::instance()->CAP->current_user_can( |
|
79 | - 'ee_delete_question', |
|
80 | - 'espresso_registration_form_trash_question', |
|
81 | - $item->ID() |
|
82 | - )) { |
|
83 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
84 | - . __('Trash Question', 'event_espresso') . '">' |
|
85 | - . __('Trash', 'event_espresso') . '</a>'; |
|
86 | - } |
|
76 | + if (! $system_question |
|
77 | + && $this->_view != 'trash' |
|
78 | + && EE_Registry::instance()->CAP->current_user_can( |
|
79 | + 'ee_delete_question', |
|
80 | + 'espresso_registration_form_trash_question', |
|
81 | + $item->ID() |
|
82 | + )) { |
|
83 | + $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
84 | + . __('Trash Question', 'event_espresso') . '">' |
|
85 | + . __('Trash', 'event_espresso') . '</a>'; |
|
86 | + } |
|
87 | 87 | |
88 | - if ($this->_view == 'trash') { |
|
89 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
90 | - 'ee_delete_question', |
|
91 | - 'espresso_registration_form_restore_question', |
|
92 | - $item->ID() |
|
93 | - )) { |
|
94 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
95 | - . __('Restore Question', 'event_espresso') . '">' |
|
96 | - . __('Restore', 'event_espresso') . '</a>'; |
|
97 | - } |
|
98 | - if ($item->count_related('Answer') === 0 |
|
99 | - && EE_Registry::instance()->CAP->current_user_can( |
|
100 | - 'ee_delete_question', |
|
101 | - 'espresso_registration_form_delete_questions', |
|
102 | - $item->ID() |
|
103 | - )) { |
|
104 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
105 | - . __('Delete Question Permanently', 'event_espresso') . '">' |
|
106 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
107 | - } |
|
108 | - } |
|
109 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
110 | - 'ee_edit_questions', |
|
111 | - 'espresso_registration_form_edit_question' |
|
112 | - )) { |
|
113 | - $actions['duplicate'] = '<a href="' . $duplicate_link . '" title="' |
|
114 | - . __('Duplicate Question', 'event_espresso') . '">' |
|
115 | - . __('Duplicate', 'event_espresso') . '</a>'; |
|
116 | - } |
|
88 | + if ($this->_view == 'trash') { |
|
89 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
90 | + 'ee_delete_question', |
|
91 | + 'espresso_registration_form_restore_question', |
|
92 | + $item->ID() |
|
93 | + )) { |
|
94 | + $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
95 | + . __('Restore Question', 'event_espresso') . '">' |
|
96 | + . __('Restore', 'event_espresso') . '</a>'; |
|
97 | + } |
|
98 | + if ($item->count_related('Answer') === 0 |
|
99 | + && EE_Registry::instance()->CAP->current_user_can( |
|
100 | + 'ee_delete_question', |
|
101 | + 'espresso_registration_form_delete_questions', |
|
102 | + $item->ID() |
|
103 | + )) { |
|
104 | + $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
105 | + . __('Delete Question Permanently', 'event_espresso') . '">' |
|
106 | + . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
107 | + } |
|
108 | + } |
|
109 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
110 | + 'ee_edit_questions', |
|
111 | + 'espresso_registration_form_edit_question' |
|
112 | + )) { |
|
113 | + $actions['duplicate'] = '<a href="' . $duplicate_link . '" title="' |
|
114 | + . __('Duplicate Question', 'event_espresso') . '">' |
|
115 | + . __('Duplicate', 'event_espresso') . '</a>'; |
|
116 | + } |
|
117 | 117 | |
118 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
119 | - 'ee_edit_question', |
|
120 | - 'espresso_registration_form_edit_question', |
|
121 | - $item->ID() |
|
122 | - ) |
|
123 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
124 | - : $item->display_text(); |
|
125 | - $content .= $this->row_actions($actions); |
|
126 | - return $content; |
|
127 | - } |
|
118 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
119 | + 'ee_edit_question', |
|
120 | + 'espresso_registration_form_edit_question', |
|
121 | + $item->ID() |
|
122 | + ) |
|
123 | + ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
124 | + : $item->display_text(); |
|
125 | + $content .= $this->row_actions($actions); |
|
126 | + return $content; |
|
127 | + } |
|
128 | 128 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $system_question = $item->is_system_question(); |
27 | 27 | $actions = array(); |
28 | 28 | |
29 | - if (! defined('REG_ADMIN_URL')) { |
|
29 | + if ( ! defined('REG_ADMIN_URL')) { |
|
30 | 30 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
31 | 31 | } |
32 | 32 | |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | $item->ID() |
68 | 68 | )) { |
69 | 69 | $actions = array( |
70 | - 'edit' => '<a href="' . $edit_link . '" title="' |
|
71 | - . __('Edit Question', 'event_espresso') . '">' |
|
72 | - . __('Edit', 'event_espresso') . '</a>', |
|
70 | + 'edit' => '<a href="'.$edit_link.'" title="' |
|
71 | + . __('Edit Question', 'event_espresso').'">' |
|
72 | + . __('Edit', 'event_espresso').'</a>', |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | - if (! $system_question |
|
76 | + if ( ! $system_question |
|
77 | 77 | && $this->_view != 'trash' |
78 | 78 | && EE_Registry::instance()->CAP->current_user_can( |
79 | 79 | 'ee_delete_question', |
80 | 80 | 'espresso_registration_form_trash_question', |
81 | 81 | $item->ID() |
82 | 82 | )) { |
83 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
84 | - . __('Trash Question', 'event_espresso') . '">' |
|
85 | - . __('Trash', 'event_espresso') . '</a>'; |
|
83 | + $actions['delete'] = '<a href="'.$trash_link.'" title="' |
|
84 | + . __('Trash Question', 'event_espresso').'">' |
|
85 | + . __('Trash', 'event_espresso').'</a>'; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | if ($this->_view == 'trash') { |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | 'espresso_registration_form_restore_question', |
92 | 92 | $item->ID() |
93 | 93 | )) { |
94 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
95 | - . __('Restore Question', 'event_espresso') . '">' |
|
96 | - . __('Restore', 'event_espresso') . '</a>'; |
|
94 | + $actions['restore'] = '<a href="'.$restore_link.'" title="' |
|
95 | + . __('Restore Question', 'event_espresso').'">' |
|
96 | + . __('Restore', 'event_espresso').'</a>'; |
|
97 | 97 | } |
98 | 98 | if ($item->count_related('Answer') === 0 |
99 | 99 | && EE_Registry::instance()->CAP->current_user_can( |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | 'espresso_registration_form_delete_questions', |
102 | 102 | $item->ID() |
103 | 103 | )) { |
104 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
105 | - . __('Delete Question Permanently', 'event_espresso') . '">' |
|
106 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
104 | + $actions['delete'] = '<a href="'.$delete_link.'" title="' |
|
105 | + . __('Delete Question Permanently', 'event_espresso').'">' |
|
106 | + . __('Delete Permanently', 'event_espresso').'</a>'; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | if (EE_Registry::instance()->CAP->current_user_can( |
110 | 110 | 'ee_edit_questions', |
111 | 111 | 'espresso_registration_form_edit_question' |
112 | 112 | )) { |
113 | - $actions['duplicate'] = '<a href="' . $duplicate_link . '" title="' |
|
114 | - . __('Duplicate Question', 'event_espresso') . '">' |
|
115 | - . __('Duplicate', 'event_espresso') . '</a>'; |
|
113 | + $actions['duplicate'] = '<a href="'.$duplicate_link.'" title="' |
|
114 | + . __('Duplicate Question', 'event_espresso').'">' |
|
115 | + . __('Duplicate', 'event_espresso').'</a>'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $content = EE_Registry::instance()->CAP->current_user_can( |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | 'espresso_registration_form_edit_question', |
121 | 121 | $item->ID() |
122 | 122 | ) |
123 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
123 | + ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->display_text().'</a></strong>' |
|
124 | 124 | : $item->display_text(); |
125 | 125 | $content .= $this->row_actions($actions); |
126 | 126 | return $content; |
@@ -30,231 +30,231 @@ |
||
30 | 30 | { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct($admin_page) |
|
34 | - { |
|
35 | - parent::__construct($admin_page); |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - protected function _setup_data() |
|
40 | - { |
|
41 | - $this->_data = $this->_view != 'trash' |
|
42 | - ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, false) |
|
43 | - : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, false); |
|
44 | - $this->_all_data_count = $this->_view != 'trash' |
|
45 | - ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, true) |
|
46 | - : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, true); |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - protected function _set_properties() |
|
51 | - { |
|
52 | - $this->_wp_list_args = array( |
|
53 | - 'singular' => __('question group', 'event_espresso'), |
|
54 | - 'plural' => __('question groups', 'event_espresso'), |
|
55 | - 'ajax' => true, // for now, |
|
56 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
57 | - ); |
|
58 | - |
|
59 | - $this->_columns = array( |
|
60 | - 'cb' => '<input type="checkbox" />', |
|
61 | - 'id' => __('ID', 'event_espresso'), |
|
62 | - 'name' => __('Group Name', 'event_espresso'), |
|
63 | - 'description' => __('Description', 'event_espresso'), |
|
64 | - 'show_group_name' => __('Show Name', 'event_espresso'), |
|
65 | - 'show_group_desc' => __('Show Desc', 'event_espresso'), |
|
66 | - ); |
|
67 | - |
|
68 | - $this->_sortable_columns = array( |
|
69 | - 'id' => array('QSG_ID' => false), |
|
70 | - 'name' => array('QSG_name' => false), |
|
71 | - ); |
|
72 | - |
|
73 | - $this->_hidden_columns = array( |
|
74 | - 'id', |
|
75 | - ); |
|
76 | - |
|
77 | - $this->_ajax_sorting_callback = 'update_question_group_order'; |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - // not needed |
|
82 | - protected function _get_table_filters() |
|
83 | - { |
|
84 | - return array(); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - protected function _add_view_counts() |
|
89 | - { |
|
90 | - $this->_views['all']['count'] = $this->_admin_page->get_question_groups( |
|
91 | - $this->_per_page, |
|
92 | - $this->_current_page, |
|
93 | - true |
|
94 | - ); |
|
95 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
96 | - 'ee_delete_question_groups', |
|
97 | - 'espresso_registration_form_trash_question_group' |
|
98 | - )) { |
|
99 | - $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( |
|
100 | - $this->_per_page, |
|
101 | - $this->_current_page, |
|
102 | - true |
|
103 | - ); |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - public function column_cb($item) |
|
109 | - { |
|
110 | - $system_group = $item->get('QSG_system'); |
|
111 | - $has_questions_with_answers = $item->has_questions_with_answers(); |
|
112 | - $lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers |
|
113 | - ? 'ee-lock-icon ee-alternate-color' |
|
114 | - : 'ee-lock-icon ee-system-lock'; |
|
115 | - return $system_group > 0 |
|
116 | - || ($system_group === 0 |
|
117 | - && $this->_view == 'trash' |
|
118 | - && $has_questions_with_answers |
|
119 | - ) |
|
120 | - || ! EE_Registry::instance()->CAP->current_user_can( |
|
121 | - 'ee_delete_question_groups', |
|
122 | - 'espresso_registration_form_trash_question_groups', |
|
123 | - $item->ID() |
|
124 | - ) |
|
125 | - ? '<span class="' . $lock_icon . '"></span>' |
|
126 | - . sprintf( |
|
127 | - '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', |
|
128 | - $item->ID() |
|
129 | - ) |
|
130 | - : sprintf( |
|
131 | - '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', |
|
132 | - $item->ID() |
|
133 | - ); |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - public function column_id(EE_Question_Group $item) |
|
138 | - { |
|
139 | - $content = $item->ID(); |
|
140 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
141 | - return $content; |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - public function column_name(EE_Question_Group $item) |
|
146 | - { |
|
147 | - $actions = array(); |
|
148 | - |
|
149 | - // return $item->name(); |
|
150 | - if (! defined('REG_ADMIN_URL')) { |
|
151 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
152 | - } |
|
153 | - |
|
154 | - $edit_query_args = array( |
|
155 | - 'action' => 'edit_question_group', |
|
156 | - 'QSG_ID' => $item->ID(), |
|
157 | - ); |
|
158 | - |
|
159 | - $trash_query_args = array( |
|
160 | - 'action' => 'trash_question_group', |
|
161 | - 'QSG_ID' => $item->ID(), |
|
162 | - ); |
|
163 | - |
|
164 | - $restore_query_args = array( |
|
165 | - 'action' => 'restore_question_group', |
|
166 | - 'QSG_ID' => $item->ID(), |
|
167 | - ); |
|
168 | - |
|
169 | - $delete_query_args = array( |
|
170 | - 'action' => 'delete_question_group', |
|
171 | - 'QSG_ID' => $item->ID(), |
|
172 | - ); |
|
173 | - |
|
174 | - |
|
175 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
176 | - $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
177 | - $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
178 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
179 | - |
|
180 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
181 | - 'ee_edit_question_group', |
|
182 | - 'espresso_registration_form_edit_question_group', |
|
183 | - $item->ID() |
|
184 | - )) { |
|
185 | - $actions = array( |
|
186 | - 'edit' => '<a href="' . $edit_link . '" title="' |
|
187 | - . esc_attr__('Edit Question Group', 'event_espresso') . '">' |
|
188 | - . __('Edit', 'event_espresso') . '</a>', |
|
189 | - ); |
|
190 | - } |
|
191 | - if ($item->get('QSG_system') < 1 |
|
192 | - && $this->_view != 'trash' |
|
193 | - && EE_Registry::instance()->CAP->current_user_can( |
|
194 | - 'ee_delete_question_group', |
|
195 | - 'espresso_registration_form_trash_question_group', |
|
196 | - $item->ID() |
|
197 | - )) { |
|
198 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
199 | - . esc_attr__('Delete Question Group', 'event_espresso') . '">' |
|
200 | - . __('Trash', 'event_espresso') . '</a>'; |
|
201 | - } |
|
202 | - |
|
203 | - if ($this->_view == 'trash') { |
|
204 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
205 | - 'ee_delete_question_group', |
|
206 | - 'espresso_registration_form_restore_question_group', |
|
207 | - $item->ID() |
|
208 | - )) { |
|
209 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
210 | - . esc_attr__('Restore Question Group', 'event_espresso') . '">' |
|
211 | - . __('Restore', 'event_espresso') . '</a>'; |
|
212 | - } |
|
213 | - |
|
214 | - if (! $item->has_questions_with_answers() |
|
215 | - && EE_Registry::instance()->CAP->current_user_can( |
|
216 | - 'ee_delete_question_group', |
|
217 | - 'espresso_registration_form_delete_question_group', |
|
218 | - $item->ID() |
|
219 | - )) { |
|
220 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
221 | - . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' |
|
222 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
223 | - } |
|
224 | - } |
|
225 | - |
|
226 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
227 | - 'ee_edit_question_group', |
|
228 | - 'espresso_registration_form_edit_question_group', |
|
229 | - $item->ID() |
|
230 | - ) |
|
231 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' |
|
232 | - : $item->name(); |
|
233 | - $content .= $this->row_actions($actions); |
|
234 | - return $content; |
|
235 | - } |
|
236 | - |
|
237 | - |
|
238 | - public function column_identifier(EE_Question_Group $item) |
|
239 | - { |
|
240 | - return $item->identifier(); |
|
241 | - } |
|
242 | - |
|
243 | - |
|
244 | - public function column_description(EE_Question_Group $item) |
|
245 | - { |
|
246 | - return $item->desc(); |
|
247 | - } |
|
248 | - |
|
249 | - |
|
250 | - public function column_show_group_name(EE_Question_Group $item) |
|
251 | - { |
|
252 | - return $this->_yes_no[ $item->show_group_name() ]; |
|
253 | - } |
|
254 | - |
|
255 | - |
|
256 | - public function column_show_group_desc(EE_Question_Group $item) |
|
257 | - { |
|
258 | - return $this->_yes_no[ $item->show_group_desc() ]; |
|
259 | - } |
|
33 | + public function __construct($admin_page) |
|
34 | + { |
|
35 | + parent::__construct($admin_page); |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + protected function _setup_data() |
|
40 | + { |
|
41 | + $this->_data = $this->_view != 'trash' |
|
42 | + ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, false) |
|
43 | + : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, false); |
|
44 | + $this->_all_data_count = $this->_view != 'trash' |
|
45 | + ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, true) |
|
46 | + : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, true); |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + protected function _set_properties() |
|
51 | + { |
|
52 | + $this->_wp_list_args = array( |
|
53 | + 'singular' => __('question group', 'event_espresso'), |
|
54 | + 'plural' => __('question groups', 'event_espresso'), |
|
55 | + 'ajax' => true, // for now, |
|
56 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
57 | + ); |
|
58 | + |
|
59 | + $this->_columns = array( |
|
60 | + 'cb' => '<input type="checkbox" />', |
|
61 | + 'id' => __('ID', 'event_espresso'), |
|
62 | + 'name' => __('Group Name', 'event_espresso'), |
|
63 | + 'description' => __('Description', 'event_espresso'), |
|
64 | + 'show_group_name' => __('Show Name', 'event_espresso'), |
|
65 | + 'show_group_desc' => __('Show Desc', 'event_espresso'), |
|
66 | + ); |
|
67 | + |
|
68 | + $this->_sortable_columns = array( |
|
69 | + 'id' => array('QSG_ID' => false), |
|
70 | + 'name' => array('QSG_name' => false), |
|
71 | + ); |
|
72 | + |
|
73 | + $this->_hidden_columns = array( |
|
74 | + 'id', |
|
75 | + ); |
|
76 | + |
|
77 | + $this->_ajax_sorting_callback = 'update_question_group_order'; |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + // not needed |
|
82 | + protected function _get_table_filters() |
|
83 | + { |
|
84 | + return array(); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + protected function _add_view_counts() |
|
89 | + { |
|
90 | + $this->_views['all']['count'] = $this->_admin_page->get_question_groups( |
|
91 | + $this->_per_page, |
|
92 | + $this->_current_page, |
|
93 | + true |
|
94 | + ); |
|
95 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
96 | + 'ee_delete_question_groups', |
|
97 | + 'espresso_registration_form_trash_question_group' |
|
98 | + )) { |
|
99 | + $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( |
|
100 | + $this->_per_page, |
|
101 | + $this->_current_page, |
|
102 | + true |
|
103 | + ); |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + public function column_cb($item) |
|
109 | + { |
|
110 | + $system_group = $item->get('QSG_system'); |
|
111 | + $has_questions_with_answers = $item->has_questions_with_answers(); |
|
112 | + $lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers |
|
113 | + ? 'ee-lock-icon ee-alternate-color' |
|
114 | + : 'ee-lock-icon ee-system-lock'; |
|
115 | + return $system_group > 0 |
|
116 | + || ($system_group === 0 |
|
117 | + && $this->_view == 'trash' |
|
118 | + && $has_questions_with_answers |
|
119 | + ) |
|
120 | + || ! EE_Registry::instance()->CAP->current_user_can( |
|
121 | + 'ee_delete_question_groups', |
|
122 | + 'espresso_registration_form_trash_question_groups', |
|
123 | + $item->ID() |
|
124 | + ) |
|
125 | + ? '<span class="' . $lock_icon . '"></span>' |
|
126 | + . sprintf( |
|
127 | + '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', |
|
128 | + $item->ID() |
|
129 | + ) |
|
130 | + : sprintf( |
|
131 | + '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', |
|
132 | + $item->ID() |
|
133 | + ); |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + public function column_id(EE_Question_Group $item) |
|
138 | + { |
|
139 | + $content = $item->ID(); |
|
140 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
141 | + return $content; |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + public function column_name(EE_Question_Group $item) |
|
146 | + { |
|
147 | + $actions = array(); |
|
148 | + |
|
149 | + // return $item->name(); |
|
150 | + if (! defined('REG_ADMIN_URL')) { |
|
151 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
152 | + } |
|
153 | + |
|
154 | + $edit_query_args = array( |
|
155 | + 'action' => 'edit_question_group', |
|
156 | + 'QSG_ID' => $item->ID(), |
|
157 | + ); |
|
158 | + |
|
159 | + $trash_query_args = array( |
|
160 | + 'action' => 'trash_question_group', |
|
161 | + 'QSG_ID' => $item->ID(), |
|
162 | + ); |
|
163 | + |
|
164 | + $restore_query_args = array( |
|
165 | + 'action' => 'restore_question_group', |
|
166 | + 'QSG_ID' => $item->ID(), |
|
167 | + ); |
|
168 | + |
|
169 | + $delete_query_args = array( |
|
170 | + 'action' => 'delete_question_group', |
|
171 | + 'QSG_ID' => $item->ID(), |
|
172 | + ); |
|
173 | + |
|
174 | + |
|
175 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
176 | + $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
177 | + $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
178 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
179 | + |
|
180 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
181 | + 'ee_edit_question_group', |
|
182 | + 'espresso_registration_form_edit_question_group', |
|
183 | + $item->ID() |
|
184 | + )) { |
|
185 | + $actions = array( |
|
186 | + 'edit' => '<a href="' . $edit_link . '" title="' |
|
187 | + . esc_attr__('Edit Question Group', 'event_espresso') . '">' |
|
188 | + . __('Edit', 'event_espresso') . '</a>', |
|
189 | + ); |
|
190 | + } |
|
191 | + if ($item->get('QSG_system') < 1 |
|
192 | + && $this->_view != 'trash' |
|
193 | + && EE_Registry::instance()->CAP->current_user_can( |
|
194 | + 'ee_delete_question_group', |
|
195 | + 'espresso_registration_form_trash_question_group', |
|
196 | + $item->ID() |
|
197 | + )) { |
|
198 | + $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
199 | + . esc_attr__('Delete Question Group', 'event_espresso') . '">' |
|
200 | + . __('Trash', 'event_espresso') . '</a>'; |
|
201 | + } |
|
202 | + |
|
203 | + if ($this->_view == 'trash') { |
|
204 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
205 | + 'ee_delete_question_group', |
|
206 | + 'espresso_registration_form_restore_question_group', |
|
207 | + $item->ID() |
|
208 | + )) { |
|
209 | + $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
210 | + . esc_attr__('Restore Question Group', 'event_espresso') . '">' |
|
211 | + . __('Restore', 'event_espresso') . '</a>'; |
|
212 | + } |
|
213 | + |
|
214 | + if (! $item->has_questions_with_answers() |
|
215 | + && EE_Registry::instance()->CAP->current_user_can( |
|
216 | + 'ee_delete_question_group', |
|
217 | + 'espresso_registration_form_delete_question_group', |
|
218 | + $item->ID() |
|
219 | + )) { |
|
220 | + $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
221 | + . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' |
|
222 | + . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
223 | + } |
|
224 | + } |
|
225 | + |
|
226 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
227 | + 'ee_edit_question_group', |
|
228 | + 'espresso_registration_form_edit_question_group', |
|
229 | + $item->ID() |
|
230 | + ) |
|
231 | + ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' |
|
232 | + : $item->name(); |
|
233 | + $content .= $this->row_actions($actions); |
|
234 | + return $content; |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + public function column_identifier(EE_Question_Group $item) |
|
239 | + { |
|
240 | + return $item->identifier(); |
|
241 | + } |
|
242 | + |
|
243 | + |
|
244 | + public function column_description(EE_Question_Group $item) |
|
245 | + { |
|
246 | + return $item->desc(); |
|
247 | + } |
|
248 | + |
|
249 | + |
|
250 | + public function column_show_group_name(EE_Question_Group $item) |
|
251 | + { |
|
252 | + return $this->_yes_no[ $item->show_group_name() ]; |
|
253 | + } |
|
254 | + |
|
255 | + |
|
256 | + public function column_show_group_desc(EE_Question_Group $item) |
|
257 | + { |
|
258 | + return $this->_yes_no[ $item->show_group_desc() ]; |
|
259 | + } |
|
260 | 260 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'espresso_registration_form_trash_question_groups', |
123 | 123 | $item->ID() |
124 | 124 | ) |
125 | - ? '<span class="' . $lock_icon . '"></span>' |
|
125 | + ? '<span class="'.$lock_icon.'"></span>' |
|
126 | 126 | . sprintf( |
127 | 127 | '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', |
128 | 128 | $item->ID() |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public function column_id(EE_Question_Group $item) |
138 | 138 | { |
139 | 139 | $content = $item->ID(); |
140 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
140 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
141 | 141 | return $content; |
142 | 142 | } |
143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $actions = array(); |
148 | 148 | |
149 | 149 | // return $item->name(); |
150 | - if (! defined('REG_ADMIN_URL')) { |
|
150 | + if ( ! defined('REG_ADMIN_URL')) { |
|
151 | 151 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
152 | 152 | } |
153 | 153 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | $item->ID() |
184 | 184 | )) { |
185 | 185 | $actions = array( |
186 | - 'edit' => '<a href="' . $edit_link . '" title="' |
|
187 | - . esc_attr__('Edit Question Group', 'event_espresso') . '">' |
|
188 | - . __('Edit', 'event_espresso') . '</a>', |
|
186 | + 'edit' => '<a href="'.$edit_link.'" title="' |
|
187 | + . esc_attr__('Edit Question Group', 'event_espresso').'">' |
|
188 | + . __('Edit', 'event_espresso').'</a>', |
|
189 | 189 | ); |
190 | 190 | } |
191 | 191 | if ($item->get('QSG_system') < 1 |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | 'espresso_registration_form_trash_question_group', |
196 | 196 | $item->ID() |
197 | 197 | )) { |
198 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
199 | - . esc_attr__('Delete Question Group', 'event_espresso') . '">' |
|
200 | - . __('Trash', 'event_espresso') . '</a>'; |
|
198 | + $actions['delete'] = '<a href="'.$trash_link.'" title="' |
|
199 | + . esc_attr__('Delete Question Group', 'event_espresso').'">' |
|
200 | + . __('Trash', 'event_espresso').'</a>'; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | if ($this->_view == 'trash') { |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | 'espresso_registration_form_restore_question_group', |
207 | 207 | $item->ID() |
208 | 208 | )) { |
209 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
210 | - . esc_attr__('Restore Question Group', 'event_espresso') . '">' |
|
211 | - . __('Restore', 'event_espresso') . '</a>'; |
|
209 | + $actions['restore'] = '<a href="'.$restore_link.'" title="' |
|
210 | + . esc_attr__('Restore Question Group', 'event_espresso').'">' |
|
211 | + . __('Restore', 'event_espresso').'</a>'; |
|
212 | 212 | } |
213 | 213 | |
214 | - if (! $item->has_questions_with_answers() |
|
214 | + if ( ! $item->has_questions_with_answers() |
|
215 | 215 | && EE_Registry::instance()->CAP->current_user_can( |
216 | 216 | 'ee_delete_question_group', |
217 | 217 | 'espresso_registration_form_delete_question_group', |
218 | 218 | $item->ID() |
219 | 219 | )) { |
220 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
221 | - . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' |
|
222 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
220 | + $actions['delete'] = '<a href="'.$delete_link.'" title="' |
|
221 | + . esc_attr__('Delete Question Group Permanently', 'event_espresso').'">' |
|
222 | + . __('Delete Permanently', 'event_espresso').'</a>'; |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'espresso_registration_form_edit_question_group', |
229 | 229 | $item->ID() |
230 | 230 | ) |
231 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' |
|
231 | + ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' |
|
232 | 232 | : $item->name(); |
233 | 233 | $content .= $this->row_actions($actions); |
234 | 234 | return $content; |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | |
250 | 250 | public function column_show_group_name(EE_Question_Group $item) |
251 | 251 | { |
252 | - return $this->_yes_no[ $item->show_group_name() ]; |
|
252 | + return $this->_yes_no[$item->show_group_name()]; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
256 | 256 | public function column_show_group_desc(EE_Question_Group $item) |
257 | 257 | { |
258 | - return $this->_yes_no[ $item->show_group_desc() ]; |
|
258 | + return $this->_yes_no[$item->show_group_desc()]; |
|
259 | 259 | } |
260 | 260 | } |
@@ -28,155 +28,155 @@ |
||
28 | 28 | class Registration_Form_Questions_Overview_Help_Tour extends EE_Help_Tour |
29 | 29 | { |
30 | 30 | |
31 | - protected function _set_tour_properties() |
|
32 | - { |
|
33 | - $this->_label = __('Questions Overview Tour', 'event_espresso'); |
|
34 | - $this->_slug = $this->_is_caf ? 'questions-overview-caf-joyride' : 'questions-overview-joyride'; |
|
35 | - } |
|
31 | + protected function _set_tour_properties() |
|
32 | + { |
|
33 | + $this->_label = __('Questions Overview Tour', 'event_espresso'); |
|
34 | + $this->_slug = $this->_is_caf ? 'questions-overview-caf-joyride' : 'questions-overview-joyride'; |
|
35 | + } |
|
36 | 36 | |
37 | - protected function _set_tour_stops() |
|
38 | - { |
|
39 | - $this->_stops = array( |
|
40 | - 10 => array( |
|
41 | - 'content' => $this->_start(), |
|
42 | - ), |
|
43 | - 30 => array( |
|
44 | - 'id' => 'display_text', |
|
45 | - 'content' => $this->_display_text_stop(), |
|
46 | - 'options' => array( |
|
47 | - 'tipLocation' => 'top', |
|
48 | - 'tipAdjustmentX' => -5, |
|
49 | - 'tipAdjustmentY' => -25, |
|
50 | - ), |
|
51 | - ), |
|
52 | - 40 => array( |
|
53 | - 'id' => 'admin_label', |
|
54 | - 'content' => $this->_admin_label_stop(), |
|
55 | - 'options' => array( |
|
56 | - 'tipLocation' => 'top', |
|
57 | - 'tipAdjustmentX' => 20, |
|
58 | - 'tipAdjustmentY' => -25, |
|
59 | - ), |
|
60 | - ), |
|
61 | - 50 => array( |
|
62 | - 'id' => 'type', |
|
63 | - 'content' => $this->_type_stop(), |
|
64 | - 'options' => array( |
|
65 | - 'tipLocation' => 'top', |
|
66 | - 'tipAdjustmentX' => -5, |
|
67 | - 'tipAdjustmentY' => -25, |
|
68 | - ), |
|
69 | - ), |
|
70 | - 60 => array( |
|
71 | - 'id' => 'values', |
|
72 | - 'content' => $this->_values_stop(), |
|
73 | - 'options' => array( |
|
74 | - 'tipLocation' => 'top', |
|
75 | - 'tipAdjustmentX' => -5, |
|
76 | - 'tipAdjustmentY' => -25, |
|
77 | - ), |
|
78 | - ), |
|
79 | - 70 => array( |
|
80 | - 'id' => 'required', |
|
81 | - 'content' => $this->_required_stop(), |
|
82 | - 'options' => array( |
|
83 | - 'tipLocation' => 'top', |
|
84 | - 'tipAdjustmentY' => -20, |
|
85 | - 'tipAdjustmentX' => -15, |
|
86 | - ), |
|
87 | - ), |
|
88 | - 80 => array( |
|
89 | - 'class' => 'bulkactions', |
|
90 | - 'content' => $this->_bulk_actions_stop(), |
|
91 | - 'options' => array( |
|
92 | - 'tipLocation' => 'top', |
|
93 | - 'tipAdjustmentY' => -30, |
|
94 | - 'tipAdjustmentX' => -15, |
|
95 | - ), |
|
96 | - ), |
|
97 | - 90 => array( |
|
98 | - 'id' => 'event-espresso_page_espresso_registration_form-search-input', |
|
99 | - 'content' => $this->_search_stop(), |
|
100 | - 'options' => array( |
|
101 | - 'tipLocation' => 'left', |
|
102 | - 'tipAdjustmentY' => -50, |
|
103 | - 'tipAdjustmentX' => -15, |
|
104 | - ), |
|
105 | - ), |
|
106 | - 100 => array( |
|
107 | - 'id' => 'add-new-question', |
|
108 | - 'content' => $this->_add_new_question_stop(), |
|
109 | - 'options' => array( |
|
110 | - 'tipLocation' => 'right', |
|
111 | - 'tipAdjustmentY' => -50, |
|
112 | - 'tipAdjustmentX' => 15, |
|
113 | - ), |
|
114 | - ), |
|
115 | - ); |
|
116 | - } |
|
37 | + protected function _set_tour_stops() |
|
38 | + { |
|
39 | + $this->_stops = array( |
|
40 | + 10 => array( |
|
41 | + 'content' => $this->_start(), |
|
42 | + ), |
|
43 | + 30 => array( |
|
44 | + 'id' => 'display_text', |
|
45 | + 'content' => $this->_display_text_stop(), |
|
46 | + 'options' => array( |
|
47 | + 'tipLocation' => 'top', |
|
48 | + 'tipAdjustmentX' => -5, |
|
49 | + 'tipAdjustmentY' => -25, |
|
50 | + ), |
|
51 | + ), |
|
52 | + 40 => array( |
|
53 | + 'id' => 'admin_label', |
|
54 | + 'content' => $this->_admin_label_stop(), |
|
55 | + 'options' => array( |
|
56 | + 'tipLocation' => 'top', |
|
57 | + 'tipAdjustmentX' => 20, |
|
58 | + 'tipAdjustmentY' => -25, |
|
59 | + ), |
|
60 | + ), |
|
61 | + 50 => array( |
|
62 | + 'id' => 'type', |
|
63 | + 'content' => $this->_type_stop(), |
|
64 | + 'options' => array( |
|
65 | + 'tipLocation' => 'top', |
|
66 | + 'tipAdjustmentX' => -5, |
|
67 | + 'tipAdjustmentY' => -25, |
|
68 | + ), |
|
69 | + ), |
|
70 | + 60 => array( |
|
71 | + 'id' => 'values', |
|
72 | + 'content' => $this->_values_stop(), |
|
73 | + 'options' => array( |
|
74 | + 'tipLocation' => 'top', |
|
75 | + 'tipAdjustmentX' => -5, |
|
76 | + 'tipAdjustmentY' => -25, |
|
77 | + ), |
|
78 | + ), |
|
79 | + 70 => array( |
|
80 | + 'id' => 'required', |
|
81 | + 'content' => $this->_required_stop(), |
|
82 | + 'options' => array( |
|
83 | + 'tipLocation' => 'top', |
|
84 | + 'tipAdjustmentY' => -20, |
|
85 | + 'tipAdjustmentX' => -15, |
|
86 | + ), |
|
87 | + ), |
|
88 | + 80 => array( |
|
89 | + 'class' => 'bulkactions', |
|
90 | + 'content' => $this->_bulk_actions_stop(), |
|
91 | + 'options' => array( |
|
92 | + 'tipLocation' => 'top', |
|
93 | + 'tipAdjustmentY' => -30, |
|
94 | + 'tipAdjustmentX' => -15, |
|
95 | + ), |
|
96 | + ), |
|
97 | + 90 => array( |
|
98 | + 'id' => 'event-espresso_page_espresso_registration_form-search-input', |
|
99 | + 'content' => $this->_search_stop(), |
|
100 | + 'options' => array( |
|
101 | + 'tipLocation' => 'left', |
|
102 | + 'tipAdjustmentY' => -50, |
|
103 | + 'tipAdjustmentX' => -15, |
|
104 | + ), |
|
105 | + ), |
|
106 | + 100 => array( |
|
107 | + 'id' => 'add-new-question', |
|
108 | + 'content' => $this->_add_new_question_stop(), |
|
109 | + 'options' => array( |
|
110 | + 'tipLocation' => 'right', |
|
111 | + 'tipAdjustmentY' => -50, |
|
112 | + 'tipAdjustmentX' => 15, |
|
113 | + ), |
|
114 | + ), |
|
115 | + ); |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | - protected function _start() |
|
120 | - { |
|
121 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
122 | - $content .= '<p>' |
|
123 | - . __( |
|
124 | - 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
125 | - 'event_espresso' |
|
126 | - ) . '</p>'; |
|
119 | + protected function _start() |
|
120 | + { |
|
121 | + $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
122 | + $content .= '<p>' |
|
123 | + . __( |
|
124 | + 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
125 | + 'event_espresso' |
|
126 | + ) . '</p>'; |
|
127 | 127 | |
128 | - return $content; |
|
129 | - } |
|
128 | + return $content; |
|
129 | + } |
|
130 | 130 | |
131 | - protected function _display_text_stop() |
|
132 | - { |
|
133 | - return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
134 | - } |
|
131 | + protected function _display_text_stop() |
|
132 | + { |
|
133 | + return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
134 | + } |
|
135 | 135 | |
136 | - protected function _admin_label_stop() |
|
137 | - { |
|
138 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
139 | - } |
|
136 | + protected function _admin_label_stop() |
|
137 | + { |
|
138 | + return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
139 | + } |
|
140 | 140 | |
141 | - protected function _type_stop() |
|
142 | - { |
|
143 | - return '<p>' |
|
144 | - . __( |
|
145 | - 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
146 | - 'event_espresso' |
|
147 | - ) . '</p>'; |
|
148 | - } |
|
141 | + protected function _type_stop() |
|
142 | + { |
|
143 | + return '<p>' |
|
144 | + . __( |
|
145 | + 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
146 | + 'event_espresso' |
|
147 | + ) . '</p>'; |
|
148 | + } |
|
149 | 149 | |
150 | - protected function _values_stop() |
|
151 | - { |
|
152 | - return '<p>' |
|
153 | - . __( |
|
154 | - 'View stored values for checkboxes, radio buttons, and select boxes.', |
|
155 | - 'event_espresso' |
|
156 | - ) . '</p>'; |
|
157 | - } |
|
150 | + protected function _values_stop() |
|
151 | + { |
|
152 | + return '<p>' |
|
153 | + . __( |
|
154 | + 'View stored values for checkboxes, radio buttons, and select boxes.', |
|
155 | + 'event_espresso' |
|
156 | + ) . '</p>'; |
|
157 | + } |
|
158 | 158 | |
159 | - protected function _required_stop() |
|
160 | - { |
|
161 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
162 | - } |
|
159 | + protected function _required_stop() |
|
160 | + { |
|
161 | + return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
162 | + } |
|
163 | 163 | |
164 | - protected function _bulk_actions_stop() |
|
165 | - { |
|
166 | - return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
|
167 | - } |
|
164 | + protected function _bulk_actions_stop() |
|
165 | + { |
|
166 | + return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
|
167 | + } |
|
168 | 168 | |
169 | - protected function _search_stop() |
|
170 | - { |
|
171 | - return '<p>' |
|
172 | - . __( |
|
173 | - 'Search through questions. The following sources will be searched: Name of Question (display text).', |
|
174 | - 'event_espresso' |
|
175 | - ) . '</p>'; |
|
176 | - } |
|
169 | + protected function _search_stop() |
|
170 | + { |
|
171 | + return '<p>' |
|
172 | + . __( |
|
173 | + 'Search through questions. The following sources will be searched: Name of Question (display text).', |
|
174 | + 'event_espresso' |
|
175 | + ) . '</p>'; |
|
176 | + } |
|
177 | 177 | |
178 | - protected function _add_new_question_stop() |
|
179 | - { |
|
180 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
181 | - } |
|
178 | + protected function _add_new_question_stop() |
|
179 | + { |
|
180 | + return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
181 | + } |
|
182 | 182 | } |
@@ -118,24 +118,24 @@ discard block |
||
118 | 118 | |
119 | 119 | protected function _start() |
120 | 120 | { |
121 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
121 | + $content = '<h3>'.__('Questions Overview', 'event_espresso').'</h3>'; |
|
122 | 122 | $content .= '<p>' |
123 | 123 | . __( |
124 | 124 | 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
125 | 125 | 'event_espresso' |
126 | - ) . '</p>'; |
|
126 | + ).'</p>'; |
|
127 | 127 | |
128 | 128 | return $content; |
129 | 129 | } |
130 | 130 | |
131 | 131 | protected function _display_text_stop() |
132 | 132 | { |
133 | - return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
133 | + return '<p>'.__('View available questions.', 'event_espresso').'</p>'; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | protected function _admin_label_stop() |
137 | 137 | { |
138 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
138 | + return '<p>'.__('View the admin label for your questions.', 'event_espresso').'</p>'; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | protected function _type_stop() |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | . __( |
145 | 145 | 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
146 | 146 | 'event_espresso' |
147 | - ) . '</p>'; |
|
147 | + ).'</p>'; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | protected function _values_stop() |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | . __( |
154 | 154 | 'View stored values for checkboxes, radio buttons, and select boxes.', |
155 | 155 | 'event_espresso' |
156 | - ) . '</p>'; |
|
156 | + ).'</p>'; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | protected function _required_stop() |
160 | 160 | { |
161 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
161 | + return '<p>'.__('View if a question is required.', 'event_espresso').'</p>'; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | protected function _bulk_actions_stop() |
165 | 165 | { |
166 | - return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
|
166 | + return '<p>'.__('Perform bulk actions to multiple questions.', 'event_espresso').'</p>'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | protected function _search_stop() |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | . __( |
173 | 173 | 'Search through questions. The following sources will be searched: Name of Question (display text).', |
174 | 174 | 'event_espresso' |
175 | - ) . '</p>'; |
|
175 | + ).'</p>'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | protected function _add_new_question_stop() |
179 | 179 | { |
180 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
180 | + return '<p>'.__('Click here to add a new question.', 'event_espresso').'</p>'; |
|
181 | 181 | } |
182 | 182 | } |
@@ -17,151 +17,151 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - protected function _setup_data() |
|
21 | - { |
|
22 | - $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
23 | - $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
24 | - $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
25 | - $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
26 | - } |
|
27 | - |
|
28 | - |
|
29 | - protected function _set_properties() |
|
30 | - { |
|
31 | - $this->_wp_list_args = array( |
|
32 | - 'singular' => __('ticket', 'event_espresso'), |
|
33 | - 'plural' => __('tickets', 'event_espresso'), |
|
34 | - 'ajax' => true, |
|
35 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
36 | - ); |
|
37 | - |
|
38 | - $this->_columns = array( |
|
39 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
40 | - 'TKT_name' => __('Name', 'event_espresso'), |
|
41 | - 'TKT_description' => __('Description', 'event_espresso'), |
|
42 | - 'TKT_qty' => __('Quantity', 'event_espresso'), |
|
43 | - 'TKT_uses' => __('Datetimes', 'event_espresso'), |
|
44 | - 'TKT_min' => __('Minimum', 'event_espresso'), |
|
45 | - 'TKT_max' => __('Maximum', 'event_espresso'), |
|
46 | - 'TKT_price' => __('Price', 'event_espresso'), |
|
47 | - 'TKT_taxable' => __('Taxable', 'event_espresso'), |
|
48 | - ); |
|
49 | - |
|
50 | - $this->_sortable_columns = array( |
|
51 | - // TRUE means its already sorted |
|
52 | - 'TKT_name' => array('TKT_name' => true), |
|
53 | - 'TKT_description' => array('TKT_description' => false), |
|
54 | - 'TKT_qty' => array('TKT_qty' => false), |
|
55 | - 'TKT_uses' => array('TKT_uses' => false), |
|
56 | - 'TKT_min' => array('TKT_min' => false), |
|
57 | - 'TKT_max' => array('TKT_max' => false), |
|
58 | - 'TKT_price' => array('TKT_price' => false), |
|
59 | - ); |
|
60 | - |
|
61 | - $this->_hidden_columns = array(); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - protected function _get_table_filters() |
|
66 | - { |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _add_view_counts() |
|
71 | - { |
|
72 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | - $this->_views['trashed']['count'] = $this->_trashed_count; |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - public function column_cb($item) |
|
78 | - { |
|
79 | - return $item->ID() === 1 |
|
80 | - ? '<span class="ee-lock-icon"></span>' |
|
81 | - : sprintf( |
|
82 | - '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
83 | - $item->ID() |
|
84 | - ); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - public function column_TKT_name($item) |
|
89 | - { |
|
90 | - // build row actions |
|
91 | - $actions = array(); |
|
92 | - |
|
93 | - // trash links |
|
94 | - if ($item->ID() !== 1) { |
|
95 | - if ($this->_view == 'all') { |
|
96 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
97 | - 'action' => 'trash_ticket', |
|
98 | - 'TKT_ID' => $item->ID(), |
|
99 | - ), EVENTS_ADMIN_URL); |
|
100 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
101 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
102 | - . __('Trash', 'event_espresso') . '</a>'; |
|
103 | - } else { |
|
104 | - // restore price link |
|
105 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
106 | - 'action' => 'restore_ticket', |
|
107 | - 'TKT_ID' => $item->ID(), |
|
108 | - ), EVENTS_ADMIN_URL); |
|
109 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
110 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
111 | - . __('Restore', 'event_espresso') . '</a>'; |
|
112 | - // delete price link |
|
113 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
114 | - 'action' => 'delete_ticket', |
|
115 | - 'TKT_ID' => $item->ID(), |
|
116 | - ), EVENTS_ADMIN_URL); |
|
117 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
118 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
119 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
120 | - } |
|
121 | - } |
|
122 | - |
|
123 | - return $item->get('TKT_name') . $this->row_actions($actions); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - public function column_TKT_description($item) |
|
128 | - { |
|
129 | - return $item->get('TKT_description'); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - public function column_TKT_qty($item) |
|
134 | - { |
|
135 | - return $item->get_pretty('TKT_qty', 'text'); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - public function column_TKT_uses($item) |
|
140 | - { |
|
141 | - return $item->get_pretty('TKT_uses', 'text'); |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - public function column_TKT_min($item) |
|
146 | - { |
|
147 | - return $item->get('TKT_min'); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - public function column_TKT_max($item) |
|
152 | - { |
|
153 | - return $item->get_pretty('TKT_max', 'text'); |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - public function column_TKT_price($item) |
|
158 | - { |
|
159 | - return EEH_Template::format_currency($item->get('TKT_price')); |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - public function column_TKT_taxable($item) |
|
164 | - { |
|
165 | - return $item->get('TKT_taxable') ? __('Yes', 'event_espresso') : __('No', 'event_espresso'); |
|
166 | - } |
|
20 | + protected function _setup_data() |
|
21 | + { |
|
22 | + $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
23 | + $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
24 | + $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
25 | + $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
26 | + } |
|
27 | + |
|
28 | + |
|
29 | + protected function _set_properties() |
|
30 | + { |
|
31 | + $this->_wp_list_args = array( |
|
32 | + 'singular' => __('ticket', 'event_espresso'), |
|
33 | + 'plural' => __('tickets', 'event_espresso'), |
|
34 | + 'ajax' => true, |
|
35 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
36 | + ); |
|
37 | + |
|
38 | + $this->_columns = array( |
|
39 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
40 | + 'TKT_name' => __('Name', 'event_espresso'), |
|
41 | + 'TKT_description' => __('Description', 'event_espresso'), |
|
42 | + 'TKT_qty' => __('Quantity', 'event_espresso'), |
|
43 | + 'TKT_uses' => __('Datetimes', 'event_espresso'), |
|
44 | + 'TKT_min' => __('Minimum', 'event_espresso'), |
|
45 | + 'TKT_max' => __('Maximum', 'event_espresso'), |
|
46 | + 'TKT_price' => __('Price', 'event_espresso'), |
|
47 | + 'TKT_taxable' => __('Taxable', 'event_espresso'), |
|
48 | + ); |
|
49 | + |
|
50 | + $this->_sortable_columns = array( |
|
51 | + // TRUE means its already sorted |
|
52 | + 'TKT_name' => array('TKT_name' => true), |
|
53 | + 'TKT_description' => array('TKT_description' => false), |
|
54 | + 'TKT_qty' => array('TKT_qty' => false), |
|
55 | + 'TKT_uses' => array('TKT_uses' => false), |
|
56 | + 'TKT_min' => array('TKT_min' => false), |
|
57 | + 'TKT_max' => array('TKT_max' => false), |
|
58 | + 'TKT_price' => array('TKT_price' => false), |
|
59 | + ); |
|
60 | + |
|
61 | + $this->_hidden_columns = array(); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + protected function _get_table_filters() |
|
66 | + { |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _add_view_counts() |
|
71 | + { |
|
72 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | + $this->_views['trashed']['count'] = $this->_trashed_count; |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + public function column_cb($item) |
|
78 | + { |
|
79 | + return $item->ID() === 1 |
|
80 | + ? '<span class="ee-lock-icon"></span>' |
|
81 | + : sprintf( |
|
82 | + '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
83 | + $item->ID() |
|
84 | + ); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + public function column_TKT_name($item) |
|
89 | + { |
|
90 | + // build row actions |
|
91 | + $actions = array(); |
|
92 | + |
|
93 | + // trash links |
|
94 | + if ($item->ID() !== 1) { |
|
95 | + if ($this->_view == 'all') { |
|
96 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
97 | + 'action' => 'trash_ticket', |
|
98 | + 'TKT_ID' => $item->ID(), |
|
99 | + ), EVENTS_ADMIN_URL); |
|
100 | + $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
101 | + . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
102 | + . __('Trash', 'event_espresso') . '</a>'; |
|
103 | + } else { |
|
104 | + // restore price link |
|
105 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
106 | + 'action' => 'restore_ticket', |
|
107 | + 'TKT_ID' => $item->ID(), |
|
108 | + ), EVENTS_ADMIN_URL); |
|
109 | + $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
110 | + . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
111 | + . __('Restore', 'event_espresso') . '</a>'; |
|
112 | + // delete price link |
|
113 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
114 | + 'action' => 'delete_ticket', |
|
115 | + 'TKT_ID' => $item->ID(), |
|
116 | + ), EVENTS_ADMIN_URL); |
|
117 | + $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
118 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
119 | + . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
120 | + } |
|
121 | + } |
|
122 | + |
|
123 | + return $item->get('TKT_name') . $this->row_actions($actions); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + public function column_TKT_description($item) |
|
128 | + { |
|
129 | + return $item->get('TKT_description'); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + public function column_TKT_qty($item) |
|
134 | + { |
|
135 | + return $item->get_pretty('TKT_qty', 'text'); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + public function column_TKT_uses($item) |
|
140 | + { |
|
141 | + return $item->get_pretty('TKT_uses', 'text'); |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + public function column_TKT_min($item) |
|
146 | + { |
|
147 | + return $item->get('TKT_min'); |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + public function column_TKT_max($item) |
|
152 | + { |
|
153 | + return $item->get_pretty('TKT_max', 'text'); |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + public function column_TKT_price($item) |
|
158 | + { |
|
159 | + return EEH_Template::format_currency($item->get('TKT_price')); |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + public function column_TKT_taxable($item) |
|
164 | + { |
|
165 | + return $item->get('TKT_taxable') ? __('Yes', 'event_espresso') : __('No', 'event_espresso'); |
|
166 | + } |
|
167 | 167 | } |
@@ -97,30 +97,30 @@ |
||
97 | 97 | 'action' => 'trash_ticket', |
98 | 98 | 'TKT_ID' => $item->ID(), |
99 | 99 | ), EVENTS_ADMIN_URL); |
100 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
101 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
102 | - . __('Trash', 'event_espresso') . '</a>'; |
|
100 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' |
|
101 | + . esc_attr__('Move Ticket to trash', 'event_espresso').'">' |
|
102 | + . __('Trash', 'event_espresso').'</a>'; |
|
103 | 103 | } else { |
104 | 104 | // restore price link |
105 | 105 | $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
106 | 106 | 'action' => 'restore_ticket', |
107 | 107 | 'TKT_ID' => $item->ID(), |
108 | 108 | ), EVENTS_ADMIN_URL); |
109 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
110 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
111 | - . __('Restore', 'event_espresso') . '</a>'; |
|
109 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' |
|
110 | + . esc_attr__('Restore Ticket', 'event_espresso').'">' |
|
111 | + . __('Restore', 'event_espresso').'</a>'; |
|
112 | 112 | // delete price link |
113 | 113 | $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
114 | 114 | 'action' => 'delete_ticket', |
115 | 115 | 'TKT_ID' => $item->ID(), |
116 | 116 | ), EVENTS_ADMIN_URL); |
117 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
118 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
119 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
117 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' |
|
118 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso').'">' |
|
119 | + . __('Delete Permanently', 'event_espresso').'</a>'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - return $item->get('TKT_name') . $this->row_actions($actions); |
|
123 | + return $item->get('TKT_name').$this->row_actions($actions); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 |
@@ -12,15 +12,15 @@ |
||
12 | 12 | class Extend_Events_Admin_List_Table extends Events_Admin_List_Table |
13 | 13 | { |
14 | 14 | |
15 | - protected function _column_name_action_setup(EE_Event $item) |
|
16 | - { |
|
17 | - $export_query_args = array( |
|
18 | - 'action' => 'export_events', |
|
19 | - 'EVT_ID' => $item->ID(), |
|
20 | - ); |
|
21 | - $export_event_link = EE_Admin_Page::add_query_args_and_nonce($export_query_args, EVENTS_ADMIN_URL); |
|
15 | + protected function _column_name_action_setup(EE_Event $item) |
|
16 | + { |
|
17 | + $export_query_args = array( |
|
18 | + 'action' => 'export_events', |
|
19 | + 'EVT_ID' => $item->ID(), |
|
20 | + ); |
|
21 | + $export_event_link = EE_Admin_Page::add_query_args_and_nonce($export_query_args, EVENTS_ADMIN_URL); |
|
22 | 22 | |
23 | - $actions = parent::_column_name_action_setup($item); |
|
24 | - return $actions; |
|
25 | - } |
|
23 | + $actions = parent::_column_name_action_setup($item); |
|
24 | + return $actions; |
|
25 | + } |
|
26 | 26 | } |
@@ -15,17 +15,17 @@ |
||
15 | 15 | class Extend_EE_Attendee_Contact_List_Table extends EE_Attendee_Contact_List_Table |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_properties() |
|
19 | - { |
|
20 | - parent::_set_properties(); |
|
21 | - $this->_bottom_buttons = array( |
|
22 | - 'contact_list_report' => array( |
|
23 | - 'route' => 'contact_list_report', |
|
24 | - 'extra_request' => |
|
25 | - array( |
|
26 | - 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
27 | - ), |
|
28 | - ), |
|
29 | - ); |
|
30 | - } |
|
18 | + protected function _set_properties() |
|
19 | + { |
|
20 | + parent::_set_properties(); |
|
21 | + $this->_bottom_buttons = array( |
|
22 | + 'contact_list_report' => array( |
|
23 | + 'route' => 'contact_list_report', |
|
24 | + 'extra_request' => |
|
25 | + array( |
|
26 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
27 | + ), |
|
28 | + ), |
|
29 | + ); |
|
30 | + } |
|
31 | 31 | } |
@@ -13,115 +13,115 @@ |
||
13 | 13 | class Extend_EE_Registrations_List_Table extends EE_Registrations_List_Table |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @param EE_Registration $item |
|
18 | - * @return string |
|
19 | - * @throws EE_Error |
|
20 | - * @throws InvalidArgumentException |
|
21 | - * @throws ReflectionException |
|
22 | - * @throws InvalidDataTypeException |
|
23 | - * @throws InvalidInterfaceException |
|
24 | - */ |
|
25 | - public function column__REG_date(EE_Registration $item) |
|
26 | - { |
|
27 | - $date_linked = parent::column__REG_date($item); |
|
28 | - $actions = array(); |
|
29 | - // Build row actions |
|
30 | - $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
31 | - 'action' => 'event_registrations', |
|
32 | - 'event_id' => $item->event_ID(), |
|
33 | - ), REG_ADMIN_URL); |
|
34 | - $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( |
|
35 | - 'ee_read_registration', |
|
36 | - 'espresso_registrations_registration_checkins', |
|
37 | - $item->ID() |
|
38 | - ) && EE_Registry::instance()->CAP->current_user_can( |
|
39 | - 'ee_read_checkins', |
|
40 | - 'espresso_registrations_registration_checkins' |
|
41 | - ) |
|
42 | - ? '<a href="' . $check_in_url . '"' |
|
43 | - . ' title="' . esc_attr__( |
|
44 | - 'The Check-In List allows you to easily toggle check-in status for this event', |
|
45 | - 'event_espresso' |
|
46 | - ) |
|
47 | - . '">' . esc_html__('View Check-ins', 'event_espresso') . '</a>' |
|
48 | - : esc_html__('View Check-ins', 'event_espresso'); |
|
16 | + /** |
|
17 | + * @param EE_Registration $item |
|
18 | + * @return string |
|
19 | + * @throws EE_Error |
|
20 | + * @throws InvalidArgumentException |
|
21 | + * @throws ReflectionException |
|
22 | + * @throws InvalidDataTypeException |
|
23 | + * @throws InvalidInterfaceException |
|
24 | + */ |
|
25 | + public function column__REG_date(EE_Registration $item) |
|
26 | + { |
|
27 | + $date_linked = parent::column__REG_date($item); |
|
28 | + $actions = array(); |
|
29 | + // Build row actions |
|
30 | + $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
31 | + 'action' => 'event_registrations', |
|
32 | + 'event_id' => $item->event_ID(), |
|
33 | + ), REG_ADMIN_URL); |
|
34 | + $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( |
|
35 | + 'ee_read_registration', |
|
36 | + 'espresso_registrations_registration_checkins', |
|
37 | + $item->ID() |
|
38 | + ) && EE_Registry::instance()->CAP->current_user_can( |
|
39 | + 'ee_read_checkins', |
|
40 | + 'espresso_registrations_registration_checkins' |
|
41 | + ) |
|
42 | + ? '<a href="' . $check_in_url . '"' |
|
43 | + . ' title="' . esc_attr__( |
|
44 | + 'The Check-In List allows you to easily toggle check-in status for this event', |
|
45 | + 'event_espresso' |
|
46 | + ) |
|
47 | + . '">' . esc_html__('View Check-ins', 'event_espresso') . '</a>' |
|
48 | + : esc_html__('View Check-ins', 'event_espresso'); |
|
49 | 49 | |
50 | - return sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions)); |
|
51 | - } |
|
50 | + return sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions)); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * column_default |
|
56 | - * |
|
57 | - * @param \EE_Registration $item |
|
58 | - * @return string |
|
59 | - * @throws EE_Error |
|
60 | - * @throws InvalidArgumentException |
|
61 | - * @throws InvalidDataTypeException |
|
62 | - * @throws InvalidInterfaceException |
|
63 | - * @throws ReflectionException |
|
64 | - */ |
|
65 | - public function column_DTT_EVT_start(EE_Registration $item) |
|
66 | - { |
|
67 | - $remove_defaults = array('default_where_conditions' => 'none'); |
|
68 | - $ticket = $item->ticket(); |
|
69 | - $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
|
70 | - $EVT_ID = $item->event_ID(); |
|
71 | - $datetimes_for_display = array(); |
|
72 | - foreach ($datetimes as $datetime) { |
|
73 | - $datetime_string = ''; |
|
74 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
75 | - 'ee_read_checkin', |
|
76 | - 'espresso_registrations_registration_checkins', |
|
77 | - $item->ID() |
|
78 | - )) { |
|
79 | - // open "a" tag and "href" |
|
80 | - $datetime_string .= '<a href="'; |
|
81 | - // checkin URL |
|
82 | - $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
83 | - array( |
|
84 | - 'action' => 'event_registrations', |
|
85 | - 'event_id' => $EVT_ID, |
|
86 | - 'DTT_ID' => $datetime->ID(), |
|
87 | - ), |
|
88 | - REG_ADMIN_URL |
|
89 | - ); |
|
90 | - // close "href" |
|
91 | - $datetime_string .= '"'; |
|
92 | - // open "title" tag |
|
93 | - $datetime_string .= ' title="'; |
|
94 | - // link title text |
|
95 | - $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso'); |
|
96 | - // close "title" tag and end of "a" tag opening |
|
97 | - $datetime_string .= '">'; |
|
98 | - // link text |
|
99 | - $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
100 | - // close "a" tag |
|
101 | - $datetime_string .= '</a>'; |
|
102 | - } else { |
|
103 | - $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
104 | - } |
|
105 | - // add a "View Registrations" link that filters list by event AND datetime |
|
106 | - $datetime_string .= $this->row_actions( |
|
107 | - array( |
|
108 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
109 | - array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
|
110 | - REG_ADMIN_URL |
|
111 | - ) |
|
112 | - . '" title="' . sprintf( |
|
113 | - esc_attr__( |
|
114 | - 'Filter this list to only show registrations for this datetime %s', |
|
115 | - 'event_espresso' |
|
116 | - ), |
|
117 | - $datetime->name() |
|
118 | - ) . '">' |
|
119 | - . esc_html__('View Registrations', 'event_espresso') |
|
120 | - . '</a>', |
|
121 | - ) |
|
122 | - ); |
|
123 | - $datetimes_for_display[] = $datetime_string; |
|
124 | - } |
|
125 | - return $this->generateDisplayForDateTimes($datetimes_for_display); |
|
126 | - } |
|
54 | + /** |
|
55 | + * column_default |
|
56 | + * |
|
57 | + * @param \EE_Registration $item |
|
58 | + * @return string |
|
59 | + * @throws EE_Error |
|
60 | + * @throws InvalidArgumentException |
|
61 | + * @throws InvalidDataTypeException |
|
62 | + * @throws InvalidInterfaceException |
|
63 | + * @throws ReflectionException |
|
64 | + */ |
|
65 | + public function column_DTT_EVT_start(EE_Registration $item) |
|
66 | + { |
|
67 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
68 | + $ticket = $item->ticket(); |
|
69 | + $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
|
70 | + $EVT_ID = $item->event_ID(); |
|
71 | + $datetimes_for_display = array(); |
|
72 | + foreach ($datetimes as $datetime) { |
|
73 | + $datetime_string = ''; |
|
74 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
75 | + 'ee_read_checkin', |
|
76 | + 'espresso_registrations_registration_checkins', |
|
77 | + $item->ID() |
|
78 | + )) { |
|
79 | + // open "a" tag and "href" |
|
80 | + $datetime_string .= '<a href="'; |
|
81 | + // checkin URL |
|
82 | + $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
83 | + array( |
|
84 | + 'action' => 'event_registrations', |
|
85 | + 'event_id' => $EVT_ID, |
|
86 | + 'DTT_ID' => $datetime->ID(), |
|
87 | + ), |
|
88 | + REG_ADMIN_URL |
|
89 | + ); |
|
90 | + // close "href" |
|
91 | + $datetime_string .= '"'; |
|
92 | + // open "title" tag |
|
93 | + $datetime_string .= ' title="'; |
|
94 | + // link title text |
|
95 | + $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso'); |
|
96 | + // close "title" tag and end of "a" tag opening |
|
97 | + $datetime_string .= '">'; |
|
98 | + // link text |
|
99 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
100 | + // close "a" tag |
|
101 | + $datetime_string .= '</a>'; |
|
102 | + } else { |
|
103 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
104 | + } |
|
105 | + // add a "View Registrations" link that filters list by event AND datetime |
|
106 | + $datetime_string .= $this->row_actions( |
|
107 | + array( |
|
108 | + 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
109 | + array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
|
110 | + REG_ADMIN_URL |
|
111 | + ) |
|
112 | + . '" title="' . sprintf( |
|
113 | + esc_attr__( |
|
114 | + 'Filter this list to only show registrations for this datetime %s', |
|
115 | + 'event_espresso' |
|
116 | + ), |
|
117 | + $datetime->name() |
|
118 | + ) . '">' |
|
119 | + . esc_html__('View Registrations', 'event_espresso') |
|
120 | + . '</a>', |
|
121 | + ) |
|
122 | + ); |
|
123 | + $datetimes_for_display[] = $datetime_string; |
|
124 | + } |
|
125 | + return $this->generateDisplayForDateTimes($datetimes_for_display); |
|
126 | + } |
|
127 | 127 | } |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | 'ee_read_checkins', |
40 | 40 | 'espresso_registrations_registration_checkins' |
41 | 41 | ) |
42 | - ? '<a href="' . $check_in_url . '"' |
|
43 | - . ' title="' . esc_attr__( |
|
42 | + ? '<a href="'.$check_in_url.'"' |
|
43 | + . ' title="'.esc_attr__( |
|
44 | 44 | 'The Check-In List allows you to easily toggle check-in status for this event', |
45 | 45 | 'event_espresso' |
46 | 46 | ) |
47 | - . '">' . esc_html__('View Check-ins', 'event_espresso') . '</a>' |
|
47 | + . '">'.esc_html__('View Check-ins', 'event_espresso').'</a>' |
|
48 | 48 | : esc_html__('View Check-ins', 'event_espresso'); |
49 | 49 | |
50 | 50 | return sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions)); |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | // add a "View Registrations" link that filters list by event AND datetime |
106 | 106 | $datetime_string .= $this->row_actions( |
107 | 107 | array( |
108 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
108 | + 'event_datetime_filter' => '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
109 | 109 | array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
110 | 110 | REG_ADMIN_URL |
111 | 111 | ) |
112 | - . '" title="' . sprintf( |
|
112 | + . '" title="'.sprintf( |
|
113 | 113 | esc_attr__( |
114 | 114 | 'Filter this list to only show registrations for this datetime %s', |
115 | 115 | 'event_espresso' |
116 | 116 | ), |
117 | 117 | $datetime->name() |
118 | - ) . '">' |
|
118 | + ).'">' |
|
119 | 119 | . esc_html__('View Registrations', 'event_espresso') |
120 | 120 | . '</a>', |
121 | 121 | ) |