/** * @Export data for ALL events * @access public * @return void */ function export_categories() { // are any Event IDs set? $query_params = array(); if (isset($this->_req_data['EVT_CAT_ID'])) { // do we have an array of IDs ? if (is_array($this->_req_data['EVT_CAT_ID'])) { // generate an "IN (CSV)" where clause $EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']); $filename = 'event-categories'; $query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs); } else { // generate regular where = clause $EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']); $filename = 'event-category#' . $EVT_CAT_ID; $query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID; } } else { // no IDs means we will d/l the entire table $filename = 'all-categories'; } $tables_to_export = array('Term_Taxonomy' => $query_params); $table_data = $this->_get_export_data_for_models($tables_to_export); $filename = $this->generate_filename($filename); if (!$this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) { EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); } }