@@ -15,403 +15,403 @@ |
||
| 15 | 15 | class EE_SPCO_JSON_Response |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 21 | - protected $_errors = ''; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 26 | - protected $_unexpected_errors = ''; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var string |
|
| 30 | - */ |
|
| 31 | - protected $_attention = ''; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 36 | - protected $_success = ''; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @var string |
|
| 40 | - */ |
|
| 41 | - protected $_plz_select_method_of_payment = ''; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @var string |
|
| 45 | - */ |
|
| 46 | - protected $_redirect_url = ''; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @var string |
|
| 50 | - */ |
|
| 51 | - protected $_registration_time_limit = ''; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @var string |
|
| 55 | - */ |
|
| 56 | - protected $_redirect_form = ''; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @var string |
|
| 60 | - */ |
|
| 61 | - protected $_reg_step_html = ''; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * @var string |
|
| 65 | - */ |
|
| 66 | - protected $_method_of_payment = ''; |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @var float |
|
| 70 | - */ |
|
| 71 | - protected $_payment_amount; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @var array |
|
| 75 | - */ |
|
| 76 | - protected $_return_data = array(); |
|
| 77 | - |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @var array |
|
| 81 | - */ |
|
| 82 | - protected $_validation_rules = array(); |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * class constructor |
|
| 87 | - */ |
|
| 88 | - public function __construct() |
|
| 89 | - { |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * __toString |
|
| 95 | - * |
|
| 96 | - * allows you to simply echo or print an EE_SPCO_JSON_Response object to produce a JSON encoded string |
|
| 97 | - * ie: $json_response = new EE_SPCO_JSON_Response(); |
|
| 98 | - * echo $json_response; |
|
| 99 | - * |
|
| 100 | - * @access public |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - public function __toString() |
|
| 104 | - { |
|
| 105 | - $JSON_response = array(); |
|
| 106 | - // grab notices |
|
| 107 | - $notices = EE_Error::get_notices(false); |
|
| 108 | - $this->set_attention(isset($notices['attention']) ? $notices['attention'] : ''); |
|
| 109 | - $this->set_errors(isset($notices['errors']) ? $notices['errors'] : ''); |
|
| 110 | - $this->set_success(isset($notices['success']) ? $notices['success'] : ''); |
|
| 111 | - // add notices to JSON response, but only if they exist |
|
| 112 | - if ($this->attention()) { |
|
| 113 | - $JSON_response['attention'] = $this->attention(); |
|
| 114 | - } |
|
| 115 | - if ($this->errors()) { |
|
| 116 | - $JSON_response['errors'] = $this->errors(); |
|
| 117 | - } |
|
| 118 | - if ($this->unexpected_errors()) { |
|
| 119 | - $JSON_response['unexpected_errors'] = $this->unexpected_errors(); |
|
| 120 | - } |
|
| 121 | - if ($this->success()) { |
|
| 122 | - $JSON_response['success'] = $this->success(); |
|
| 123 | - } |
|
| 124 | - // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
|
| 125 | - if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
| 126 | - $JSON_response['success'] = null; |
|
| 127 | - } |
|
| 128 | - // set redirect_url, IF it exists |
|
| 129 | - if ($this->redirect_url()) { |
|
| 130 | - $JSON_response['redirect_url'] = $this->redirect_url(); |
|
| 131 | - } |
|
| 132 | - // set registration_time_limit, IF it exists |
|
| 133 | - if ($this->registration_time_limit()) { |
|
| 134 | - $JSON_response['registration_time_limit'] = $this->registration_time_limit(); |
|
| 135 | - } |
|
| 136 | - // set payment_amount, IF it exists |
|
| 137 | - if ($this->payment_amount() !== null) { |
|
| 138 | - $JSON_response['payment_amount'] = $this->payment_amount(); |
|
| 139 | - } |
|
| 140 | - // grab generic return data |
|
| 141 | - $return_data = $this->return_data(); |
|
| 142 | - // add billing form validation rules |
|
| 143 | - if ($this->validation_rules()) { |
|
| 144 | - $return_data['validation_rules'] = $this->validation_rules(); |
|
| 145 | - } |
|
| 146 | - // set reg_step_html, IF it exists |
|
| 147 | - if ($this->reg_step_html()) { |
|
| 148 | - $return_data['reg_step_html'] = $this->reg_step_html(); |
|
| 149 | - } |
|
| 150 | - // set method of payment, IF it exists |
|
| 151 | - if ($this->method_of_payment()) { |
|
| 152 | - $return_data['method_of_payment'] = $this->method_of_payment(); |
|
| 153 | - } |
|
| 154 | - // set "plz_select_method_of_payment" message, IF it exists |
|
| 155 | - if ($this->plz_select_method_of_payment()) { |
|
| 156 | - $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment(); |
|
| 157 | - } |
|
| 158 | - // set redirect_form, IF it exists |
|
| 159 | - if ($this->redirect_form()) { |
|
| 160 | - $return_data['redirect_form'] = $this->redirect_form(); |
|
| 161 | - } |
|
| 162 | - // and finally, add return_data array to main JSON response array, IF it contains anything |
|
| 163 | - // why did we add some of the above properties to the return data array? |
|
| 164 | - // because it is easier and cleaner in the Javascript to deal with this way |
|
| 165 | - if (! empty($return_data)) { |
|
| 166 | - $JSON_response['return_data'] = $return_data; |
|
| 167 | - } |
|
| 168 | - // filter final array |
|
| 169 | - $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response); |
|
| 170 | - // return encoded array |
|
| 171 | - return (string) wp_json_encode($JSON_response); |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * @param string $attention |
|
| 177 | - */ |
|
| 178 | - public function set_attention($attention) |
|
| 179 | - { |
|
| 180 | - $this->_attention = $attention; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * @return string |
|
| 186 | - */ |
|
| 187 | - public function attention() |
|
| 188 | - { |
|
| 189 | - return $this->_attention; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * @param string $errors |
|
| 195 | - */ |
|
| 196 | - public function set_errors($errors) |
|
| 197 | - { |
|
| 198 | - $this->_errors = $errors; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * @return string |
|
| 204 | - */ |
|
| 205 | - public function errors() |
|
| 206 | - { |
|
| 207 | - return $this->_errors; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * @return string |
|
| 213 | - */ |
|
| 214 | - public function unexpected_errors() |
|
| 215 | - { |
|
| 216 | - return $this->_unexpected_errors; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - |
|
| 220 | - /** |
|
| 221 | - * @param string $unexpected_errors |
|
| 222 | - */ |
|
| 223 | - public function set_unexpected_errors($unexpected_errors) |
|
| 224 | - { |
|
| 225 | - $this->_unexpected_errors = $unexpected_errors; |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * @param string $success |
|
| 231 | - */ |
|
| 232 | - public function set_success($success) |
|
| 233 | - { |
|
| 234 | - $this->_success = $success; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * @return string |
|
| 240 | - */ |
|
| 241 | - public function success() |
|
| 242 | - { |
|
| 243 | - return $this->_success; |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - |
|
| 247 | - /** |
|
| 248 | - * @param string $method_of_payment |
|
| 249 | - */ |
|
| 250 | - public function set_method_of_payment($method_of_payment) |
|
| 251 | - { |
|
| 252 | - $this->_method_of_payment = $method_of_payment; |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * @return string |
|
| 258 | - */ |
|
| 259 | - public function method_of_payment() |
|
| 260 | - { |
|
| 261 | - return $this->_method_of_payment; |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * @return float |
|
| 267 | - */ |
|
| 268 | - public function payment_amount() |
|
| 269 | - { |
|
| 270 | - return $this->_payment_amount; |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * @param float $payment_amount |
|
| 276 | - * @throws EE_Error |
|
| 277 | - */ |
|
| 278 | - public function set_payment_amount($payment_amount) |
|
| 279 | - { |
|
| 280 | - $this->_payment_amount = (float) $payment_amount; |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * @param string $next_step_html |
|
| 286 | - */ |
|
| 287 | - public function set_reg_step_html($next_step_html) |
|
| 288 | - { |
|
| 289 | - $this->_reg_step_html = $next_step_html; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * @return string |
|
| 295 | - */ |
|
| 296 | - public function reg_step_html() |
|
| 297 | - { |
|
| 298 | - return $this->_reg_step_html; |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * @param string $redirect_form |
|
| 304 | - */ |
|
| 305 | - public function set_redirect_form($redirect_form) |
|
| 306 | - { |
|
| 307 | - $this->_redirect_form = $redirect_form; |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - |
|
| 311 | - /** |
|
| 312 | - * @return string |
|
| 313 | - */ |
|
| 314 | - public function redirect_form() |
|
| 315 | - { |
|
| 316 | - return ! empty($this->_redirect_form) ? $this->_redirect_form : false; |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - |
|
| 320 | - /** |
|
| 321 | - * @param string $plz_select_method_of_payment |
|
| 322 | - */ |
|
| 323 | - public function set_plz_select_method_of_payment($plz_select_method_of_payment) |
|
| 324 | - { |
|
| 325 | - $this->_plz_select_method_of_payment = $plz_select_method_of_payment; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - |
|
| 329 | - /** |
|
| 330 | - * @return string |
|
| 331 | - */ |
|
| 332 | - public function plz_select_method_of_payment() |
|
| 333 | - { |
|
| 334 | - return $this->_plz_select_method_of_payment; |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - |
|
| 338 | - /** |
|
| 339 | - * @param string $redirect_url |
|
| 340 | - */ |
|
| 341 | - public function set_redirect_url($redirect_url) |
|
| 342 | - { |
|
| 343 | - $this->_redirect_url = $redirect_url; |
|
| 344 | - } |
|
| 345 | - |
|
| 346 | - |
|
| 347 | - /** |
|
| 348 | - * @return string |
|
| 349 | - */ |
|
| 350 | - public function redirect_url() |
|
| 351 | - { |
|
| 352 | - return $this->_redirect_url; |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - |
|
| 356 | - /** |
|
| 357 | - * @return string |
|
| 358 | - */ |
|
| 359 | - public function registration_time_limit() |
|
| 360 | - { |
|
| 361 | - return $this->_registration_time_limit; |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - |
|
| 365 | - /** |
|
| 366 | - * @param string $registration_time_limit |
|
| 367 | - */ |
|
| 368 | - public function set_registration_time_limit($registration_time_limit) |
|
| 369 | - { |
|
| 370 | - $this->_registration_time_limit = $registration_time_limit; |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - |
|
| 374 | - /** |
|
| 375 | - * @param array $return_data |
|
| 376 | - */ |
|
| 377 | - public function set_return_data($return_data) |
|
| 378 | - { |
|
| 379 | - $this->_return_data = array_merge($this->_return_data, $return_data); |
|
| 380 | - } |
|
| 381 | - |
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * @return array |
|
| 385 | - */ |
|
| 386 | - public function return_data() |
|
| 387 | - { |
|
| 388 | - return $this->_return_data; |
|
| 389 | - } |
|
| 390 | - |
|
| 391 | - |
|
| 392 | - /** |
|
| 393 | - * @param array $validation_rules |
|
| 394 | - */ |
|
| 395 | - public function add_validation_rules(array $validation_rules = array()) |
|
| 396 | - { |
|
| 397 | - if (is_array($validation_rules) && ! empty($validation_rules)) { |
|
| 398 | - $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules); |
|
| 399 | - } |
|
| 400 | - } |
|
| 401 | - |
|
| 402 | - |
|
| 403 | - /** |
|
| 404 | - * @return array | bool |
|
| 405 | - */ |
|
| 406 | - public function validation_rules() |
|
| 407 | - { |
|
| 408 | - return ! empty($this->_validation_rules) ? $this->_validation_rules : false; |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - |
|
| 412 | - public function echoAndExit() |
|
| 413 | - { |
|
| 414 | - echo $this; |
|
| 415 | - exit(); |
|
| 416 | - } |
|
| 18 | + /** |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | + protected $_errors = ''; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | + protected $_unexpected_errors = ''; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var string |
|
| 30 | + */ |
|
| 31 | + protected $_attention = ''; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | + protected $_success = ''; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @var string |
|
| 40 | + */ |
|
| 41 | + protected $_plz_select_method_of_payment = ''; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @var string |
|
| 45 | + */ |
|
| 46 | + protected $_redirect_url = ''; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @var string |
|
| 50 | + */ |
|
| 51 | + protected $_registration_time_limit = ''; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @var string |
|
| 55 | + */ |
|
| 56 | + protected $_redirect_form = ''; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @var string |
|
| 60 | + */ |
|
| 61 | + protected $_reg_step_html = ''; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * @var string |
|
| 65 | + */ |
|
| 66 | + protected $_method_of_payment = ''; |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @var float |
|
| 70 | + */ |
|
| 71 | + protected $_payment_amount; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @var array |
|
| 75 | + */ |
|
| 76 | + protected $_return_data = array(); |
|
| 77 | + |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @var array |
|
| 81 | + */ |
|
| 82 | + protected $_validation_rules = array(); |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * class constructor |
|
| 87 | + */ |
|
| 88 | + public function __construct() |
|
| 89 | + { |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * __toString |
|
| 95 | + * |
|
| 96 | + * allows you to simply echo or print an EE_SPCO_JSON_Response object to produce a JSON encoded string |
|
| 97 | + * ie: $json_response = new EE_SPCO_JSON_Response(); |
|
| 98 | + * echo $json_response; |
|
| 99 | + * |
|
| 100 | + * @access public |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + public function __toString() |
|
| 104 | + { |
|
| 105 | + $JSON_response = array(); |
|
| 106 | + // grab notices |
|
| 107 | + $notices = EE_Error::get_notices(false); |
|
| 108 | + $this->set_attention(isset($notices['attention']) ? $notices['attention'] : ''); |
|
| 109 | + $this->set_errors(isset($notices['errors']) ? $notices['errors'] : ''); |
|
| 110 | + $this->set_success(isset($notices['success']) ? $notices['success'] : ''); |
|
| 111 | + // add notices to JSON response, but only if they exist |
|
| 112 | + if ($this->attention()) { |
|
| 113 | + $JSON_response['attention'] = $this->attention(); |
|
| 114 | + } |
|
| 115 | + if ($this->errors()) { |
|
| 116 | + $JSON_response['errors'] = $this->errors(); |
|
| 117 | + } |
|
| 118 | + if ($this->unexpected_errors()) { |
|
| 119 | + $JSON_response['unexpected_errors'] = $this->unexpected_errors(); |
|
| 120 | + } |
|
| 121 | + if ($this->success()) { |
|
| 122 | + $JSON_response['success'] = $this->success(); |
|
| 123 | + } |
|
| 124 | + // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
|
| 125 | + if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
| 126 | + $JSON_response['success'] = null; |
|
| 127 | + } |
|
| 128 | + // set redirect_url, IF it exists |
|
| 129 | + if ($this->redirect_url()) { |
|
| 130 | + $JSON_response['redirect_url'] = $this->redirect_url(); |
|
| 131 | + } |
|
| 132 | + // set registration_time_limit, IF it exists |
|
| 133 | + if ($this->registration_time_limit()) { |
|
| 134 | + $JSON_response['registration_time_limit'] = $this->registration_time_limit(); |
|
| 135 | + } |
|
| 136 | + // set payment_amount, IF it exists |
|
| 137 | + if ($this->payment_amount() !== null) { |
|
| 138 | + $JSON_response['payment_amount'] = $this->payment_amount(); |
|
| 139 | + } |
|
| 140 | + // grab generic return data |
|
| 141 | + $return_data = $this->return_data(); |
|
| 142 | + // add billing form validation rules |
|
| 143 | + if ($this->validation_rules()) { |
|
| 144 | + $return_data['validation_rules'] = $this->validation_rules(); |
|
| 145 | + } |
|
| 146 | + // set reg_step_html, IF it exists |
|
| 147 | + if ($this->reg_step_html()) { |
|
| 148 | + $return_data['reg_step_html'] = $this->reg_step_html(); |
|
| 149 | + } |
|
| 150 | + // set method of payment, IF it exists |
|
| 151 | + if ($this->method_of_payment()) { |
|
| 152 | + $return_data['method_of_payment'] = $this->method_of_payment(); |
|
| 153 | + } |
|
| 154 | + // set "plz_select_method_of_payment" message, IF it exists |
|
| 155 | + if ($this->plz_select_method_of_payment()) { |
|
| 156 | + $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment(); |
|
| 157 | + } |
|
| 158 | + // set redirect_form, IF it exists |
|
| 159 | + if ($this->redirect_form()) { |
|
| 160 | + $return_data['redirect_form'] = $this->redirect_form(); |
|
| 161 | + } |
|
| 162 | + // and finally, add return_data array to main JSON response array, IF it contains anything |
|
| 163 | + // why did we add some of the above properties to the return data array? |
|
| 164 | + // because it is easier and cleaner in the Javascript to deal with this way |
|
| 165 | + if (! empty($return_data)) { |
|
| 166 | + $JSON_response['return_data'] = $return_data; |
|
| 167 | + } |
|
| 168 | + // filter final array |
|
| 169 | + $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response); |
|
| 170 | + // return encoded array |
|
| 171 | + return (string) wp_json_encode($JSON_response); |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * @param string $attention |
|
| 177 | + */ |
|
| 178 | + public function set_attention($attention) |
|
| 179 | + { |
|
| 180 | + $this->_attention = $attention; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * @return string |
|
| 186 | + */ |
|
| 187 | + public function attention() |
|
| 188 | + { |
|
| 189 | + return $this->_attention; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * @param string $errors |
|
| 195 | + */ |
|
| 196 | + public function set_errors($errors) |
|
| 197 | + { |
|
| 198 | + $this->_errors = $errors; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @return string |
|
| 204 | + */ |
|
| 205 | + public function errors() |
|
| 206 | + { |
|
| 207 | + return $this->_errors; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * @return string |
|
| 213 | + */ |
|
| 214 | + public function unexpected_errors() |
|
| 215 | + { |
|
| 216 | + return $this->_unexpected_errors; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + |
|
| 220 | + /** |
|
| 221 | + * @param string $unexpected_errors |
|
| 222 | + */ |
|
| 223 | + public function set_unexpected_errors($unexpected_errors) |
|
| 224 | + { |
|
| 225 | + $this->_unexpected_errors = $unexpected_errors; |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * @param string $success |
|
| 231 | + */ |
|
| 232 | + public function set_success($success) |
|
| 233 | + { |
|
| 234 | + $this->_success = $success; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * @return string |
|
| 240 | + */ |
|
| 241 | + public function success() |
|
| 242 | + { |
|
| 243 | + return $this->_success; |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * @param string $method_of_payment |
|
| 249 | + */ |
|
| 250 | + public function set_method_of_payment($method_of_payment) |
|
| 251 | + { |
|
| 252 | + $this->_method_of_payment = $method_of_payment; |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * @return string |
|
| 258 | + */ |
|
| 259 | + public function method_of_payment() |
|
| 260 | + { |
|
| 261 | + return $this->_method_of_payment; |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * @return float |
|
| 267 | + */ |
|
| 268 | + public function payment_amount() |
|
| 269 | + { |
|
| 270 | + return $this->_payment_amount; |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * @param float $payment_amount |
|
| 276 | + * @throws EE_Error |
|
| 277 | + */ |
|
| 278 | + public function set_payment_amount($payment_amount) |
|
| 279 | + { |
|
| 280 | + $this->_payment_amount = (float) $payment_amount; |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * @param string $next_step_html |
|
| 286 | + */ |
|
| 287 | + public function set_reg_step_html($next_step_html) |
|
| 288 | + { |
|
| 289 | + $this->_reg_step_html = $next_step_html; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * @return string |
|
| 295 | + */ |
|
| 296 | + public function reg_step_html() |
|
| 297 | + { |
|
| 298 | + return $this->_reg_step_html; |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * @param string $redirect_form |
|
| 304 | + */ |
|
| 305 | + public function set_redirect_form($redirect_form) |
|
| 306 | + { |
|
| 307 | + $this->_redirect_form = $redirect_form; |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + |
|
| 311 | + /** |
|
| 312 | + * @return string |
|
| 313 | + */ |
|
| 314 | + public function redirect_form() |
|
| 315 | + { |
|
| 316 | + return ! empty($this->_redirect_form) ? $this->_redirect_form : false; |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + |
|
| 320 | + /** |
|
| 321 | + * @param string $plz_select_method_of_payment |
|
| 322 | + */ |
|
| 323 | + public function set_plz_select_method_of_payment($plz_select_method_of_payment) |
|
| 324 | + { |
|
| 325 | + $this->_plz_select_method_of_payment = $plz_select_method_of_payment; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + |
|
| 329 | + /** |
|
| 330 | + * @return string |
|
| 331 | + */ |
|
| 332 | + public function plz_select_method_of_payment() |
|
| 333 | + { |
|
| 334 | + return $this->_plz_select_method_of_payment; |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + |
|
| 338 | + /** |
|
| 339 | + * @param string $redirect_url |
|
| 340 | + */ |
|
| 341 | + public function set_redirect_url($redirect_url) |
|
| 342 | + { |
|
| 343 | + $this->_redirect_url = $redirect_url; |
|
| 344 | + } |
|
| 345 | + |
|
| 346 | + |
|
| 347 | + /** |
|
| 348 | + * @return string |
|
| 349 | + */ |
|
| 350 | + public function redirect_url() |
|
| 351 | + { |
|
| 352 | + return $this->_redirect_url; |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + |
|
| 356 | + /** |
|
| 357 | + * @return string |
|
| 358 | + */ |
|
| 359 | + public function registration_time_limit() |
|
| 360 | + { |
|
| 361 | + return $this->_registration_time_limit; |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + |
|
| 365 | + /** |
|
| 366 | + * @param string $registration_time_limit |
|
| 367 | + */ |
|
| 368 | + public function set_registration_time_limit($registration_time_limit) |
|
| 369 | + { |
|
| 370 | + $this->_registration_time_limit = $registration_time_limit; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + |
|
| 374 | + /** |
|
| 375 | + * @param array $return_data |
|
| 376 | + */ |
|
| 377 | + public function set_return_data($return_data) |
|
| 378 | + { |
|
| 379 | + $this->_return_data = array_merge($this->_return_data, $return_data); |
|
| 380 | + } |
|
| 381 | + |
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * @return array |
|
| 385 | + */ |
|
| 386 | + public function return_data() |
|
| 387 | + { |
|
| 388 | + return $this->_return_data; |
|
| 389 | + } |
|
| 390 | + |
|
| 391 | + |
|
| 392 | + /** |
|
| 393 | + * @param array $validation_rules |
|
| 394 | + */ |
|
| 395 | + public function add_validation_rules(array $validation_rules = array()) |
|
| 396 | + { |
|
| 397 | + if (is_array($validation_rules) && ! empty($validation_rules)) { |
|
| 398 | + $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules); |
|
| 399 | + } |
|
| 400 | + } |
|
| 401 | + |
|
| 402 | + |
|
| 403 | + /** |
|
| 404 | + * @return array | bool |
|
| 405 | + */ |
|
| 406 | + public function validation_rules() |
|
| 407 | + { |
|
| 408 | + return ! empty($this->_validation_rules) ? $this->_validation_rules : false; |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + |
|
| 412 | + public function echoAndExit() |
|
| 413 | + { |
|
| 414 | + echo $this; |
|
| 415 | + exit(); |
|
| 416 | + } |
|
| 417 | 417 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $JSON_response['success'] = $this->success(); |
| 123 | 123 | } |
| 124 | 124 | // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
| 125 | - if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
| 125 | + if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
| 126 | 126 | $JSON_response['success'] = null; |
| 127 | 127 | } |
| 128 | 128 | // set redirect_url, IF it exists |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // and finally, add return_data array to main JSON response array, IF it contains anything |
| 163 | 163 | // why did we add some of the above properties to the return data array? |
| 164 | 164 | // because it is easier and cleaner in the Javascript to deal with this way |
| 165 | - if (! empty($return_data)) { |
|
| 165 | + if ( ! empty($return_data)) { |
|
| 166 | 166 | $JSON_response['return_data'] = $return_data; |
| 167 | 167 | } |
| 168 | 168 | // filter final array |
@@ -15,64 +15,64 @@ discard block |
||
| 15 | 15 | class Registration_Form_Questions_Overview_Help_Tour extends EE_Help_Tour |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - protected function _set_tour_properties() |
|
| 19 | - { |
|
| 20 | - $this->_label = __('Questions Overview Tour', 'event_espresso'); |
|
| 21 | - $this->_slug = $this->_is_caf ? 'questions-overview-caf-joyride' : 'questions-overview-joyride'; |
|
| 22 | - } |
|
| 18 | + protected function _set_tour_properties() |
|
| 19 | + { |
|
| 20 | + $this->_label = __('Questions Overview Tour', 'event_espresso'); |
|
| 21 | + $this->_slug = $this->_is_caf ? 'questions-overview-caf-joyride' : 'questions-overview-joyride'; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - protected function _set_tour_stops() |
|
| 25 | - { |
|
| 26 | - $this->_stops = array( |
|
| 27 | - 10 => array( |
|
| 28 | - 'content' => $this->_start(), |
|
| 29 | - ), |
|
| 30 | - 30 => array( |
|
| 31 | - 'id' => 'display_text', |
|
| 32 | - 'content' => $this->_display_text_stop(), |
|
| 33 | - 'options' => array( |
|
| 34 | - 'tipLocation' => 'top', |
|
| 35 | - 'tipAdjustmentX' => -5, |
|
| 36 | - 'tipAdjustmentY' => -25, |
|
| 37 | - ), |
|
| 38 | - ), |
|
| 39 | - 40 => array( |
|
| 40 | - 'id' => 'admin_label', |
|
| 41 | - 'content' => $this->_admin_label_stop(), |
|
| 42 | - 'options' => array( |
|
| 43 | - 'tipLocation' => 'top', |
|
| 44 | - 'tipAdjustmentX' => 20, |
|
| 45 | - 'tipAdjustmentY' => -25, |
|
| 46 | - ), |
|
| 47 | - ), |
|
| 48 | - 50 => array( |
|
| 49 | - 'id' => 'type', |
|
| 50 | - 'content' => $this->_type_stop(), |
|
| 51 | - 'options' => array( |
|
| 52 | - 'tipLocation' => 'top', |
|
| 53 | - 'tipAdjustmentX' => -5, |
|
| 54 | - 'tipAdjustmentY' => -25, |
|
| 55 | - ), |
|
| 56 | - ), |
|
| 57 | - 60 => array( |
|
| 58 | - 'id' => 'values', |
|
| 59 | - 'content' => $this->_values_stop(), |
|
| 60 | - 'options' => array( |
|
| 61 | - 'tipLocation' => 'top', |
|
| 62 | - 'tipAdjustmentX' => -5, |
|
| 63 | - 'tipAdjustmentY' => -25, |
|
| 64 | - ), |
|
| 65 | - ), |
|
| 66 | - 70 => array( |
|
| 67 | - 'id' => 'required', |
|
| 68 | - 'content' => $this->_required_stop(), |
|
| 69 | - 'options' => array( |
|
| 70 | - 'tipLocation' => 'top', |
|
| 71 | - 'tipAdjustmentY' => -20, |
|
| 72 | - 'tipAdjustmentX' => -15, |
|
| 73 | - ), |
|
| 74 | - ), |
|
| 75 | - /*80 => array( |
|
| 24 | + protected function _set_tour_stops() |
|
| 25 | + { |
|
| 26 | + $this->_stops = array( |
|
| 27 | + 10 => array( |
|
| 28 | + 'content' => $this->_start(), |
|
| 29 | + ), |
|
| 30 | + 30 => array( |
|
| 31 | + 'id' => 'display_text', |
|
| 32 | + 'content' => $this->_display_text_stop(), |
|
| 33 | + 'options' => array( |
|
| 34 | + 'tipLocation' => 'top', |
|
| 35 | + 'tipAdjustmentX' => -5, |
|
| 36 | + 'tipAdjustmentY' => -25, |
|
| 37 | + ), |
|
| 38 | + ), |
|
| 39 | + 40 => array( |
|
| 40 | + 'id' => 'admin_label', |
|
| 41 | + 'content' => $this->_admin_label_stop(), |
|
| 42 | + 'options' => array( |
|
| 43 | + 'tipLocation' => 'top', |
|
| 44 | + 'tipAdjustmentX' => 20, |
|
| 45 | + 'tipAdjustmentY' => -25, |
|
| 46 | + ), |
|
| 47 | + ), |
|
| 48 | + 50 => array( |
|
| 49 | + 'id' => 'type', |
|
| 50 | + 'content' => $this->_type_stop(), |
|
| 51 | + 'options' => array( |
|
| 52 | + 'tipLocation' => 'top', |
|
| 53 | + 'tipAdjustmentX' => -5, |
|
| 54 | + 'tipAdjustmentY' => -25, |
|
| 55 | + ), |
|
| 56 | + ), |
|
| 57 | + 60 => array( |
|
| 58 | + 'id' => 'values', |
|
| 59 | + 'content' => $this->_values_stop(), |
|
| 60 | + 'options' => array( |
|
| 61 | + 'tipLocation' => 'top', |
|
| 62 | + 'tipAdjustmentX' => -5, |
|
| 63 | + 'tipAdjustmentY' => -25, |
|
| 64 | + ), |
|
| 65 | + ), |
|
| 66 | + 70 => array( |
|
| 67 | + 'id' => 'required', |
|
| 68 | + 'content' => $this->_required_stop(), |
|
| 69 | + 'options' => array( |
|
| 70 | + 'tipLocation' => 'top', |
|
| 71 | + 'tipAdjustmentY' => -20, |
|
| 72 | + 'tipAdjustmentX' => -15, |
|
| 73 | + ), |
|
| 74 | + ), |
|
| 75 | + /*80 => array( |
|
| 76 | 76 | 'class' => 'bulkactions', |
| 77 | 77 | 'content' => $this->_bulk_actions_stop(), |
| 78 | 78 | 'options' => array( |
@@ -81,84 +81,84 @@ discard block |
||
| 81 | 81 | 'tipAdjustmentX' => -15 |
| 82 | 82 | ) |
| 83 | 83 | ),*/ |
| 84 | - 90 => array( |
|
| 85 | - 'id' => 'event-espresso_page_espresso_registration_form-search-input', |
|
| 86 | - 'content' => $this->_search_stop(), |
|
| 87 | - 'options' => array( |
|
| 88 | - 'tipLocation' => 'left', |
|
| 89 | - 'tipAdjustmentY' => -50, |
|
| 90 | - 'tipAdjustmentX' => -15, |
|
| 91 | - ), |
|
| 92 | - ), |
|
| 93 | - 100 => array( |
|
| 94 | - 'id' => 'add-new-question', |
|
| 95 | - 'content' => $this->_add_new_question_stop(), |
|
| 96 | - 'options' => array( |
|
| 97 | - 'tipLocation' => 'right', |
|
| 98 | - 'tipAdjustmentY' => -50, |
|
| 99 | - 'tipAdjustmentX' => 15, |
|
| 100 | - ), |
|
| 101 | - ), |
|
| 102 | - ); |
|
| 103 | - } |
|
| 84 | + 90 => array( |
|
| 85 | + 'id' => 'event-espresso_page_espresso_registration_form-search-input', |
|
| 86 | + 'content' => $this->_search_stop(), |
|
| 87 | + 'options' => array( |
|
| 88 | + 'tipLocation' => 'left', |
|
| 89 | + 'tipAdjustmentY' => -50, |
|
| 90 | + 'tipAdjustmentX' => -15, |
|
| 91 | + ), |
|
| 92 | + ), |
|
| 93 | + 100 => array( |
|
| 94 | + 'id' => 'add-new-question', |
|
| 95 | + 'content' => $this->_add_new_question_stop(), |
|
| 96 | + 'options' => array( |
|
| 97 | + 'tipLocation' => 'right', |
|
| 98 | + 'tipAdjustmentY' => -50, |
|
| 99 | + 'tipAdjustmentX' => 15, |
|
| 100 | + ), |
|
| 101 | + ), |
|
| 102 | + ); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | - protected function _start() |
|
| 107 | - { |
|
| 108 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
| 109 | - $content .= '<p>' . __( |
|
| 110 | - 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
| 111 | - 'event_espresso' |
|
| 112 | - ) . '</p>'; |
|
| 106 | + protected function _start() |
|
| 107 | + { |
|
| 108 | + $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
| 109 | + $content .= '<p>' . __( |
|
| 110 | + 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
| 111 | + 'event_espresso' |
|
| 112 | + ) . '</p>'; |
|
| 113 | 113 | |
| 114 | - return $content; |
|
| 115 | - } |
|
| 114 | + return $content; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - protected function _display_text_stop() |
|
| 118 | - { |
|
| 119 | - return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
| 120 | - } |
|
| 117 | + protected function _display_text_stop() |
|
| 118 | + { |
|
| 119 | + return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - protected function _admin_label_stop() |
|
| 123 | - { |
|
| 124 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
| 125 | - } |
|
| 122 | + protected function _admin_label_stop() |
|
| 123 | + { |
|
| 124 | + return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - protected function _type_stop() |
|
| 128 | - { |
|
| 129 | - return '<p>' . __( |
|
| 130 | - 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
| 131 | - 'event_espresso' |
|
| 132 | - ) . '</p>'; |
|
| 133 | - } |
|
| 127 | + protected function _type_stop() |
|
| 128 | + { |
|
| 129 | + return '<p>' . __( |
|
| 130 | + 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
| 131 | + 'event_espresso' |
|
| 132 | + ) . '</p>'; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - protected function _values_stop() |
|
| 136 | - { |
|
| 137 | - return '<p>' . __( |
|
| 138 | - 'View stored values for checkboxes, radio buttons, and select boxes.', |
|
| 139 | - 'event_espresso' |
|
| 140 | - ) . '</p>'; |
|
| 141 | - } |
|
| 135 | + protected function _values_stop() |
|
| 136 | + { |
|
| 137 | + return '<p>' . __( |
|
| 138 | + 'View stored values for checkboxes, radio buttons, and select boxes.', |
|
| 139 | + 'event_espresso' |
|
| 140 | + ) . '</p>'; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - protected function _required_stop() |
|
| 144 | - { |
|
| 145 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
| 146 | - } |
|
| 143 | + protected function _required_stop() |
|
| 144 | + { |
|
| 145 | + return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - /* protected function _bulk_actions_stop() { |
|
| 148 | + /* protected function _bulk_actions_stop() { |
|
| 149 | 149 | return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
| 150 | 150 | } */ |
| 151 | 151 | |
| 152 | - protected function _search_stop() |
|
| 153 | - { |
|
| 154 | - return '<p>' . __( |
|
| 155 | - 'Search through questions. The following sources will be searched: Name of Question (display text).', |
|
| 156 | - 'event_espresso' |
|
| 157 | - ) . '</p>'; |
|
| 158 | - } |
|
| 152 | + protected function _search_stop() |
|
| 153 | + { |
|
| 154 | + return '<p>' . __( |
|
| 155 | + 'Search through questions. The following sources will be searched: Name of Question (display text).', |
|
| 156 | + 'event_espresso' |
|
| 157 | + ) . '</p>'; |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - protected function _add_new_question_stop() |
|
| 161 | - { |
|
| 162 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
| 163 | - } |
|
| 160 | + protected function _add_new_question_stop() |
|
| 161 | + { |
|
| 162 | + return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
| 163 | + } |
|
| 164 | 164 | } |
@@ -105,44 +105,44 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | protected function _start() |
| 107 | 107 | { |
| 108 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
| 109 | - $content .= '<p>' . __( |
|
| 108 | + $content = '<h3>'.__('Questions Overview', 'event_espresso').'</h3>'; |
|
| 109 | + $content .= '<p>'.__( |
|
| 110 | 110 | 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
| 111 | 111 | 'event_espresso' |
| 112 | - ) . '</p>'; |
|
| 112 | + ).'</p>'; |
|
| 113 | 113 | |
| 114 | 114 | return $content; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | protected function _display_text_stop() |
| 118 | 118 | { |
| 119 | - return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
| 119 | + return '<p>'.__('View available questions.', 'event_espresso').'</p>'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | protected function _admin_label_stop() |
| 123 | 123 | { |
| 124 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
| 124 | + return '<p>'.__('View the admin label for your questions.', 'event_espresso').'</p>'; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function _type_stop() |
| 128 | 128 | { |
| 129 | - return '<p>' . __( |
|
| 129 | + return '<p>'.__( |
|
| 130 | 130 | 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
| 131 | 131 | 'event_espresso' |
| 132 | - ) . '</p>'; |
|
| 132 | + ).'</p>'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | protected function _values_stop() |
| 136 | 136 | { |
| 137 | - return '<p>' . __( |
|
| 137 | + return '<p>'.__( |
|
| 138 | 138 | 'View stored values for checkboxes, radio buttons, and select boxes.', |
| 139 | 139 | 'event_espresso' |
| 140 | - ) . '</p>'; |
|
| 140 | + ).'</p>'; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | protected function _required_stop() |
| 144 | 144 | { |
| 145 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
| 145 | + return '<p>'.__('View if a question is required.', 'event_espresso').'</p>'; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /* protected function _bulk_actions_stop() { |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | protected function _search_stop() |
| 153 | 153 | { |
| 154 | - return '<p>' . __( |
|
| 154 | + return '<p>'.__( |
|
| 155 | 155 | 'Search through questions. The following sources will be searched: Name of Question (display text).', |
| 156 | 156 | 'event_espresso' |
| 157 | - ) . '</p>'; |
|
| 157 | + ).'</p>'; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | protected function _add_new_question_stop() |
| 161 | 161 | { |
| 162 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
| 162 | + return '<p>'.__('Click here to add a new question.', 'event_espresso').'</p>'; |
|
| 163 | 163 | } |
| 164 | 164 | } |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | { |
| 17 | 17 | |
| 18 | 18 | |
| 19 | - public function __construct(EE_Admin_Page $admin_page) |
|
| 20 | - { |
|
| 21 | - parent::__construct($admin_page); |
|
| 22 | - } |
|
| 19 | + public function __construct(EE_Admin_Page $admin_page) |
|
| 20 | + { |
|
| 21 | + parent::__construct($admin_page); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | - protected function _set_hooks_properties() |
|
| 26 | - { |
|
| 27 | - $this->_name = 'messages'; |
|
| 28 | - } |
|
| 25 | + protected function _set_hooks_properties() |
|
| 26 | + { |
|
| 27 | + $this->_name = 'messages'; |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -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 | } |