/**
  * Enqueues scripts and styles common to any batch job, and creates 
  * a job from the request data, and stores the response in the
  * $this->_job_step_response property
  * @return \EventEspressoBatchRequest\Helpers\JobStepResponse
  */
 protected function _enqueue_batch_job_scripts_and_styles_and_start_job()
 {
     wp_register_script('progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array('jquery'));
     wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION);
     wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array('progress_bar'));
     //just copy the bits of EE admin's eei18n that we need in the JS
     wp_localize_script('batch_runner', 'eei18n', array('ajax_url' => WP_AJAX_URL, 'is_admin' => (bool) is_admin()));
     $job_handler_classname = stripslashes($_GET['job_handler']);
     $request_data = array_diff_key($_REQUEST, array_flip(array('action', 'page', 'ee', 'batch')));
     $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
     //eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport'
     $job_response = $batch_runner->create_job($job_handler_classname, $request_data);
     //remember the response for later. We need it to display the page body
     $this->_job_step_response = $job_response;
     return $job_response;
 }
 /**
  * Loads a page for running a batch job that creates and downloads a file, 
  * and then sends the user back to wherever they were before
  */
 protected function batch_file_create()
 {
     //creates a job based on the request variable
     $job_handler_classname = str_replace('\\\\', '\\', $this->_req_data['job_handler']);
     $request_data = array_diff_key($this->_req_data, array_flip(array('action', 'page')));
     $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
     //eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport'
     $job_response = $batch_runner->create_job($job_handler_classname, $request_data);
     wp_localize_script('support_batch_file_runner', 'ee_job_response', $job_response->to_array());
     wp_localize_script('support_batch_file_runner', 'ee_job_i18n', array('download_and_redirecting' => sprintf(__('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'), '<a href="' . $this->_req_data['redirect_url'] . '">', '</a>'), 'redirect_url' => $this->_req_data['redirect_url']));
     echo EEH_Template::locate_template(EE_SUPPORT_ADMIN . 'templates' . DS . 'admin_batch_file_runner.template.html', array('filename' => EEH_File::get_filename_from_filepath($job_response->job_parameters()->extra_datum('filepath'))));
 }