function epl_attendee_list()
 {
     $event_id = $_REQUEST['event_id'];
     $_totals = $this->ecm->get_event_regis_snapshot($_REQUEST['event_id']);
     //echo "<pre class='prettyprint'>" . print_r( $_totals, true ) . "</pre>";
     $this->ecm->set_event_regis_post_ids($_REQUEST['event_id']);
     global $event_details;
     $event_title = $event_details['post_title'];
     $filename = str_replace(" ", "-", $event_title) . "_" . date("m-d-Y");
     header('Content-Encoding: UTF-8');
     header('Content-Type: application/csv;charset=UTF-8');
     header("Content-Disposition: attachment; filename={$filename}.csv");
     header("Pragma: no-cache");
     header("Expires: 0");
     echo "";
     //BOM to make other utf-8 chars work
     //$this->ecm->setup_event_details( $event_id );
     $this->get_values();
     //echo "<pre class='prettyprint'>" . print_r($event_details, true). "</pre>";
     $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']);
     $event_addit_forms = isset($event_details['_epl_addit_regis_forms']) && $event_details['_epl_addit_regis_forms'] != '' ? array_flip($event_details['_epl_addit_regis_forms']) : array();
     //find the list of all forms
     $available_forms = $this->ecm->get_list_of_available_forms();
     $available_fields = $this->ecm->get_list_of_available_fields();
     //isolate the forms that are selected inside the event
     $ticket_buyer_forms = array_intersect_key($available_forms, $event_ticket_buyer_forms);
     $addit_forms = array_intersect_key($available_forms, $event_addit_forms);
     //This will combine all the fields in all the forms so that we can construct a header row.
     $tickey_buyer_fields = array();
     foreach ($ticket_buyer_forms as $_form_id => $_form_info) {
         $tickey_buyer_fields += $_form_info['epl_form_fields'];
     }
     $event_addit_fields = array();
     foreach ($addit_forms as $_form_id => $_form_info) {
         $event_addit_fields += $_form_info['epl_form_fields'];
     }
     $epl_fields_inside_form = array_flip($tickey_buyer_fields);
     //get the field ids inside the form
     $epl_addit_fields_inside_form = array_flip($event_addit_fields);
     //get the field ids inside the form
     //when creating a form in form manager, the user may rearrange fields.  Find their desired order
     $epl_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_fields_inside_form);
     $epl_addit_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_addit_fields_inside_form);
     $epl_fields_to_display = $epl_fields_to_display + $epl_addit_fields_to_display;
     $csv_row = '';
     $header_row = array();
     $header_pulled = false;
     $row = array();
     $header_row[] = '';
     $header_row[] = 'Regis ID';
     $header_row[] = 'Event Date';
     $header_row[] = 'Time';
     $header_row[] = 'Ticket';
     $header_row[] = 'Status';
     $header_row[] = 'Payment Method';
     $header_row[] = 'Total';
     $header_row[] = 'Amount Paid';
     $regis_ids = $this->ecm->get_event_regis_post_ids(false);
     foreach ($regis_ids as $regis_id => $att_count) {
         $regis_data = $this->ecm->get_post_meta_all($regis_id);
         $regis_date = implode(' & ', array_intersect_key($event_details['_epl_start_date'], array_flip((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id])));
         $regis_time = implode(' & ', array_intersect_key($event_details['_epl_start_time'], array_flip((array) $regis_data['_epl_dates']['_epl_start_time'][$event_id])));
         $ticket_labels = array();
         $ticket_labels[0] = $att_count;
         $purchased_tickets = (array) $regis_data['_epl_dates']['_att_quantity'][$event_id];
         $start = 1;
         foreach ($purchased_tickets as $price_id => $qty) {
             $_qty = current($qty);
             if ($_qty > 0) {
                 $ticket_labels = array_pad($ticket_labels, $start + $_qty, $event_details['_epl_price_name'][$price_id]);
                 $start += $_qty;
             }
         }
         $regis_status = isset($regis_data['_epl_regis_status']) ? $this->ind_fields['_epl_regis_status']['options'][$regis_data['_epl_regis_status']] : '';
         $payment_method = isset($regis_data['_epl_payment_method']) && $regis_data['_epl_payment_method'] != '' ? $this->ind_fields['_epl_payment_method']['options'][$regis_data['_epl_payment_method']] : '';
         $grand_total = epl_get_formatted_curr(epl_nz($regis_data['_epl_grand_total'], 0.0));
         $amount_paid = epl_get_formatted_curr(epl_nz($regis_data['_epl_payment_amount'], 0.0));
         for ($i = 0; $i <= $att_count; $i++) {
             $attendee_info = $regis_data['_epl_attendee_info'];
             if ($i == 0) {
                 $row[] = 'Registrant';
             } else {
                 $row[] = 'Attendee';
                 $grand_total = '';
                 $amount_paid = '';
                 $regis_status = '';
                 $payment_method = '';
             }
             $row[] = $regis_data['__epl']['_regis_id'];
             $row[] = epl_escape_csv_val($regis_date);
             $row[] = $regis_time;
             $row[] = epl_escape_csv_val($ticket_labels[$i]);
             //$regis_price;
             $row[] = $regis_status;
             $row[] = epl_escape_csv_val($payment_method);
             $row[] = epl_escape_csv_val($grand_total);
             $row[] = epl_escape_csv_val($amount_paid);
             foreach ($epl_fields_to_display as $field_id => $field_atts) {
                 if (!$header_pulled) {
                     $header_row[] = $field_atts['label'];
                 }
                 $value = '';
                 $value = isset($attendee_info[$field_id][$event_id][$i]) ? $attendee_info[$field_id][$event_id][$i] : '';
                 if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') {
                     if ($field_atts['epl_field_choice_value'][$value] == '') {
                         $value = isset($field_atts['epl_field_choice_text'][$value]) ? $field_atts['epl_field_choice_text'][$value] : '';
                     }
                 } elseif ($field_atts['input_type'] == 'checkbox') {
                     $value = implode(',', array_intersect_key($field_atts['epl_field_choice_text'], array_flip((array) $value)));
                 } else {
                     $value = html_entity_decode(htmlspecialchars_decode($attendee_info[$field_id][$event_id][$i]));
                 }
                 $row[] = epl_escape_csv_val($value);
                 // . ',';
             }
             $header_pulled = true;
             $csv_row .= implode(",", $row) . "\r\n";
             $row = array();
         }
     }
     echo implode(",", $header_row) . "\r\n";
     echo $csv_row;
     exit;
     if ($event_addit_forms != '') {
         $additional_forms = array_intersect_key($available_forms, $event_addit_forms);
     }
     $attendee_info = $this->regis_meta['_epl_attendee_info'];
     return "<pre>{$event_regis_post_ids} " . print_r($row, true) . "</pre>";
 }
 function form_data($regis_id, $_regis_key, $event_id, $tickets_to_show = null)
 {
     global $event_details, $regis_details, $wpdb;
     $attendee_info = $regis_details['__epl'][$_regis_key]['_attendee_info'];
     if ($this->debug) {
         echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($attendee_info, true) . "</pre>";
     }
     $event_ticket_buyer_forms = array_flip(epl_get_element('_epl_primary_regis_forms', $event_details, array()));
     $event_addit_forms = epl_get_element('_epl_addit_regis_forms', $event_details) ? array_flip($event_details['_epl_addit_regis_forms']) : array();
     if (version_compare(epl_regis_plugin_version(), '1.4', '>=') && epl_sc_is_enabled() && epl_get_setting('epl_sc_options', 'epl_sc_forms_to_use') == 1) {
         $sc_event_ticket_buyer_forms = array_flip(epl_get_setting('epl_sc_options', 'epl_sc_primary_regis_forms', array()));
         $event_ticket_buyer_forms = $sc_event_ticket_buyer_forms;
         // + $event_ticket_buyer_forms;
         $event_addit_forms = array_flip(epl_get_setting('epl_sc_options', 'epl_sc_addit_regis_forms', array()));
     }
     if (empty($event_ticket_buyer_forms)) {
         $event_ticket_buyer_forms = array('4e8b3920c839b' => 1);
     }
     /*
      * find price forms if any.
      */
     $price_forms = epl_get_element('_epl_price_forms', $event_details, array());
     $_price_forms = array();
     foreach ($price_forms as $k => $v) {
         $_price_forms += $v;
     }
     //find the list of all forms
     $available_forms = $this->ecm->get_list_of_available_forms();
     $available_fields = $this->ecm->get_list_of_available_fields();
     //isolate the ticket buyer forms that are selected inside the event
     $ticket_buyer_forms = array_intersect_key($available_forms, $event_ticket_buyer_forms);
     //isolate the additional forms for attendees.
     $addit_forms = array_intersect_key($available_forms, array_merge($event_addit_forms, $_price_forms));
     //This will combine all the fields in all the forms so that we can construct a header row.
     $tickey_buyer_fields = array();
     foreach ($ticket_buyer_forms as $_form_id => $_form_info) {
         $tickey_buyer_fields = array_merge($tickey_buyer_fields, $_form_info['epl_form_fields']);
     }
     //combine all the fields from the attendee forms
     $event_addit_fields = array();
     foreach ($addit_forms as $_form_id => $_form_info) {
         //$event_addit_fields += $_form_info['epl_form_fields'];
         $event_addit_fields = array_merge($event_addit_fields, $_form_info['epl_form_fields']);
     }
     $epl_fields_inside_form = array_flip($tickey_buyer_fields);
     //get the field ids inside the form
     $epl_addit_fields_inside_form = array_flip($event_addit_fields);
     //get the field ids inside the form
     //when creating a form in form manager, the user may rearrange fields.  Find their desired order
     $epl_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_fields_inside_form);
     $epl_addit_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_addit_fields_inside_form);
     //final list of all the fields to display
     //$epl_fields_to_display = $epl_fields_to_display + $epl_addit_fields_to_display;
     $ins = array();
     $ins['regis_id'] = $regis_id;
     $ins['event_id'] = $event_id;
     $ins['field_id'] = array();
     $ins['input_slug'] = array();
     $ins['value'] = array();
     if (!$this->primary_pulled) {
         //################################### Ticket buyer form data ############################################
         if ($this->debug) {
             echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($epl_fields_to_display, true) . "</pre>";
         }
         $form_data_array_tmp = array();
         foreach ($epl_fields_to_display as $field_id => $field_atts) {
             //1.3 stores in [field id][event id][0]
             //2.0 stores in [field id][0]
             //if ( epl_sc_is_enabled() && isset( $attendee_info[$field_id][0] ) ) {
             if (isset($attendee_info[$field_id][0])) {
                 $value = epl_get_element(0, $attendee_info[$field_id]);
             } else {
                 $value = isset($attendee_info[$field_id]) ? epl_get_element(0, $attendee_info[$field_id][$event_id]) : '';
             }
             $raw_value = $value;
             if ($field_atts['input_slug'] == 'email') {
                 $email_list[$regis_post_id] = $value;
                 if ($regis_post_id && $regis_post_id != $this_regis_post_id) {
                     unset($email_list[$regis_post_id]);
                 }
             }
             if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') {
                 $value = $raw_value;
                 //(isset( $field_atts['epl_field_choice_text'][$value] ) && $field_atts['epl_field_choice_text'][$value] !== '') ? $field_atts['epl_field_choice_text'][$value] : $value;
             } elseif ($field_atts['input_type'] == 'checkbox') {
                 if (!epl_is_empty_array($field_atts['epl_field_choice_value'])) {
                     $value = implode(',', (array) $raw_value);
                 } elseif (is_array($value)) {
                     $value = implode(',', $raw_value);
                 }
             }
             //if ( $value != '' ) {
             $ins['field_id'][] = $field_id;
             $ins['input_slug'][] = $field_atts['input_slug'];
             $ins['form_no'] = $this->form_no;
             $ins['value'][] = str_replace($this->delim, " ", $value);
             //$wpdb->insert( $wpdb->epl_regis_form_data, $ins );
             //}
         }
         $ins['field_id'] = implode($this->delim, $ins['field_id']);
         $ins['input_slug'] = implode($this->delim, $ins['input_slug']);
         $ins['form_no'] = $this->form_no;
         $ins['value'] = implode($this->delim, $ins['value']);
         if ($this->debug) {
             echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($ins, true) . "</pre>";
         }
         $wpdb->insert($wpdb->epl_regis_form_data, $ins);
         //###################  End Ticket Buyer Data #########################################
     }
     //$this->primary_pulled = true;
     $ins['event_id'] = $event_id;
     $ins['field_id'] = array();
     $ins['input_slug'] = array();
     $ins['value'] = array();
     $counter = 0;
     $att_counter = 1;
     foreach ($tickets_to_show as $ticket_id => $ticket_quantities) {
         if (is_array($ticket_quantities)) {
             $tmp_price_inner_keys = array_keys($ticket_quantities);
             $ticket_qty = array_sum($ticket_quantities);
         }
         if ($ticket_qty == 0) {
             continue;
         }
         if (epl_is_empty_array($price_forms)) {
         }
         if ($this->debug) {
             echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($epl_addit_fields_to_display, true) . "</pre>";
         }
         foreach ($ticket_quantities as $ticket_qty_id => $quantities) {
             if (version_compare($version, '1.2.9', '<')) {
                 $counter = 1;
             }
             for ($i = 0; $i < $quantities; $i++) {
                 $this->form_no++;
                 //not good, runs every time in the loop
                 /* if ( $pack_regis && $attendance_dates = epl_get_element( "_pack_attendance_dates_{$event_id}_{$ticket_id}_" . ($i + 1), $regis_data, null ) ) {
                 
                                       $pack_count = count( $attendance_dates );
                                       $attendance_date_number = array_search( $date_id, array_keys( $attendance_dates ) ) + 1;
                                       }
                 
                                       if ( $pack_regis && $date_id && !isset( $attendance_dates[$date_id] ) ) {
                                       break;
                                       continue;
                                       } */
                 $ticket_label = epl_escape_csv_val(epl_get_element($ticket_id, $event_details['_epl_price_name']));
                 if (epl_is_date_level_price()) {
                     $reserved_date_key = $ticket_qty_id;
                     $reserved_dates = epl_get_element_m($ticket_qty_id, '_epl_start_date', $event_details);
                 }
                 if (epl_is_date_level_time()) {
                     $reserved_time_key = $reserved_times[$ticket_qty_id];
                     $reserved_times_display = epl_get_element_m($reserved_time_key, '_epl_start_time', $event_details);
                 }
                 $ins['field_id'] = array();
                 $ins['input_slug'] = array();
                 $ins['value'] = array();
                 foreach ($epl_addit_fields_to_display as $field_id => $field_atts) {
                     $value = '';
                     //if ( $this->debug )
                     //  echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename( __FILE__ ) . " > " . print_r( epl_get_num_events_in_cart(), true ) . "</pre>";
                     //new v1.2.b9+
                     //if ( epl_sc_is_enabled() || isset( $attendee_info[$field_id][0] ) ) { //if this, price specific forms will get the primary form vals also
                     if (epl_sc_is_enabled()) {
                         $value = epl_get_element(0, $attendee_info[$field_id]);
                     } else {
                         $value = isset($attendee_info[$field_id]) ? epl_get_element(0, $attendee_info[$field_id][$event_id]) : '';
                     }
                     if (isset($attendee_info[$field_id][$event_id][$ticket_id])) {
                         $value = epl_get_element($counter, $attendee_info[$field_id][$event_id][$ticket_id]);
                     } elseif (isset($attendee_info[$field_id][$event_id][$counter])) {
                         $value = $attendee_info[$field_id][$event_id][$counter];
                     }
                     $raw_value = $value;
                     if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') {
                         $value = $raw_value;
                         //(isset( $field_atts['epl_field_choice_text'][$value] ) && $field_atts['epl_field_choice_text'][$value] !== '') ? $field_atts['epl_field_choice_text'][$value] : $value;
                     } elseif ($field_atts['input_type'] == 'checkbox') {
                         if (!epl_is_empty_array($field_atts['epl_field_choice_value'])) {
                             $value = implode(',', (array) $raw_value);
                         } elseif (!epl_is_empty_array($value)) {
                             $value = implode(',', $raw_value);
                         } else {
                             $value = html_entity_decode(htmlspecialchars_decode($value));
                         }
                     }
                     /* else {
                     
                                               $value = html_entity_decode( htmlspecialchars_decode( $value ) );
                                               } */
                     // if ( $value != '' ) { //FOR NOW, WILL ENTER EMPTY ROW IN THE TABLE, WILL HELP TRACK COUNTS
                     $ins['field_id'][] = $field_id;
                     $ins['input_slug'][] = $field_atts['input_slug'];
                     $ins['form_no'] = $this->form_no;
                     $ins['value'][] = str_replace($this->delim, " ", $value);
                     //$wpdb->insert( $wpdb->epl_regis_form_data, $ins );
                     //}
                 }
                 //if ( !epl_is_empty_array( $ins['field_id'] ) ) {
                 // echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($ins, true). "</pre>";
                 $ins['field_id'] = implode($this->delim, $ins['field_id']);
                 $ins['input_slug'] = implode($this->delim, $ins['input_slug']);
                 $ins['form_no'] = $this->form_no;
                 $ins['value'] = implode($this->delim, $ins['value']);
                 if ($this->debug) {
                     echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " >counter:{$counter} , ticket_id: {$ticket_id} " . print_r($ins, true) . "</pre>";
                 }
                 $wpdb->insert($wpdb->epl_regis_form_data, $ins);
                 //}
                 $counter++;
                 $att_counter++;
             }
         }
     }
 }
 function epl_excel_attendee_list()
 {
     $event_id = $_REQUEST['event_id'];
     $_totals = $this->get_event_regis_snapshot($_REQUEST['event_id']);
     //echo "<pre class='prettyprint'>" . print_r( $_totals, true ) . "</pre>";
     $this->set_event_regis_post_ids($_REQUEST['event_id']);
     global $event_details;
     //epl_log( "debug", "<pre>" . __LINE__ . '> ' . print_r($event_details, true ) . "</pre>" );
     $event_title = $event_details['post_title'];
     $filename = str_replace(" ", "-", $event_title) . "_" . date_i18n("m-d-Y");
     /* header( "Content-type: application/x-msdownload; charset=UTF-8", true, 200 );
        header( "Content-Disposition: attachment; filename={$filename}.csv" );
        header( "Pragma: no-cache" );
        header( "Expires: 0" ); */
     //$this->setup_event_details( $event_id );
     $this->get_values();
     //echo "<pre class='prettyprint'>" . print_r($event_details, true). "</pre>";
     $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']);
     $event_addit_forms = isset($event_details['_epl_addit_regis_forms']) && $event_details['_epl_addit_regis_forms'] != '' ? array_flip($event_details['_epl_addit_regis_forms']) : array();
     //find the list of all forms
     $available_forms = $this->get_list_of_available_forms();
     $available_fields = $this->get_list_of_available_fields();
     //isolate the forms that are selected inside the event
     $ticket_buyer_forms = array_intersect_key($available_forms, $event_ticket_buyer_forms);
     $addit_forms = array_intersect_key($available_forms, $event_addit_forms);
     //This will combine all the fields in all the forms so that we can construct a header row.
     $tickey_buyer_fields = array();
     foreach ($ticket_buyer_forms as $_form_id => $_form_info) {
         $tickey_buyer_fields += $_form_info['epl_form_fields'];
     }
     $event_addit_fields = array();
     foreach ($addit_forms as $_form_id => $_form_info) {
         $event_addit_fields += $_form_info['epl_form_fields'];
     }
     $epl_fields_inside_form = array_flip($tickey_buyer_fields);
     //get the field ids inside the form
     $epl_addit_fields_inside_form = array_flip($event_addit_fields);
     //get the field ids inside the form
     //when creating a form in form manager, the user may rearrange fields.  Find their desired order
     $epl_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_fields_inside_form);
     $epl_addit_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_addit_fields_inside_form);
     $epl_fields_to_display = $epl_fields_to_display + $epl_addit_fields_to_display;
     $csv_row = '';
     $header_row = array();
     $header_pulled = false;
     $row = array();
     $header_row[] = '';
     $header_row[] = epl__('Registration ID');
     //$header_row[] = epl__( 'Regis Date' );
     //$header_row[] = epl__( 'Event Date' );
     //$header_row[] = epl__( 'Time' );
     $header_row[] = epl__('Ticket');
     $header_row[] = epl__('Status');
     $header_row[] = epl__('Payment Method');
     $header_row[] = epl__('Total');
     $header_row[] = epl__('Amount Paid');
     $regis_ids = $this->get_event_regis_post_ids(false);
     //as of 1.1, the dates are stored as timestamps.
     //This will format the date for display based on the settings admin date format.
     foreach ($event_details['_epl_start_date'] as $k => &$v) {
         $v = epl_admin_date_display($v);
     }
     $_d = array();
     foreach ($regis_ids as $regis_id => $att_count) {
         //$regis_data = $this->get_post_meta_all( $regis_id );
         $regis_data = $this->setup_regis_details($regis_id);
         // epl_log( "debug", "<pre>" . __LINE__ . '> ' . print_r($regis_data, true ) . "</pre>" );
         //Sometime there may be incomplete db records.  These will cause issues below.
         //In those cases, skip and move to the next item
         if (!isset($regis_data['_epl_dates']['_epl_start_date'][$event_id])) {
             continue;
         }
         $event_times = $regis_data['_epl_dates']['_epl_start_time'][$event_id];
         $event_prices = $regis_data['_epl_dates']['_epl_start_time'][$event_id];
         $regis_date = implode(' & ', array_intersect_key($event_details['_epl_start_date'], array_flip((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id])));
         $regis_time = implode(' & ', array_intersect_key($event_details['_epl_start_time'], array_flip((array) $regis_data['_epl_dates']['_epl_start_time'][$event_id])));
         $date_labels = array();
         $date_labels[0] = '';
         $time_labels = array();
         $time_labels[0] = '';
         $ticket_labels = array();
         $ticket_labels[0] = $att_count;
         $purchased_tickets = (array) $regis_data['_epl_dates']['_att_quantity'][$event_id];
         $start = 1;
         foreach ($purchased_tickets as $price_id => $qty) {
             $_qty = is_array($qty) ? array_sum($qty) : $qty;
             //current( $qty );
             if ($_qty > 0) {
                 $date_label[] = current((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id]);
                 if (epl_get_element('_epl_pricing_type', $event_details) == 10) {
                     if (in_array($event_details['_epl_price_parent_time_id'][$price_id], (array) $regis_data['_epl_dates']['_epl_start_time'][$event_id])) {
                         $time_labels = array_pad($time_labels, $start + $_qty, epl_get_element($event_details['_epl_price_parent_time_id'][$price_id], $event_details['_epl_start_time']));
                     } else {
                         $time_labels = array_pad($time_labels, $start + $_qty, '');
                     }
                 }
                 $ticket_labels = array_pad($ticket_labels, $start + $_qty, $event_details['_epl_price_name'][$price_id]);
                 $start += $_qty;
             }
         }
         $_r = array();
         $regis_status = isset($regis_data['_epl_regis_status']) ? $this->ind_fields['_epl_regis_status']['options'][$regis_data['_epl_regis_status']] : '';
         $payment_method = isset($regis_data['_epl_payment_method']) && $regis_data['_epl_payment_method'] != '' ? $this->ind_fields['_epl_payment_method']['options'][$regis_data['_epl_payment_method']] : '';
         $grand_total = epl_get_formatted_curr(epl_nz($regis_data['_epl_grand_total'], 0.0));
         $amount_paid = epl_get_formatted_curr(epl_nz($regis_data['_epl_payment_amount'], 0.0));
         for ($i = 0; $i <= $att_count; $i++) {
             $registrant = false;
             $attendee_info = $regis_data['_epl_attendee_info'];
             if ($i == 0) {
                 $registrant = true;
                 $row[] = epl__('Registrant');
             } else {
                 $row[] = epl_get_element('_epl_addit_regis_form_counter_label', $event_details, epl__('Attendee'));
                 //$grand_total = '';
                 //$amount_paid = '';
                 //$regis_status = '';
                 //$payment_method = '';
             }
             $row[] = $regis_data['__epl']['_regis_id'];
             //$row[] = $regis_data['post_date'];
             //$row[] = epl_escape_csv_val( $regis_date );
             //$row[] = $regis_time; //(epl_is_date_level_time ( ))?$regis_time:$time_labels[$i]; //
             $row[] = htmlspecialchars_decode($ticket_labels[$i]);
             //$regis_price;
             $row[] = $regis_status;
             $row[] = $payment_method;
             $row[] = epl_get_currency_symbol($grand_total);
             $row[] = $amount_paid;
             foreach ($epl_fields_to_display as $field_id => $field_atts) {
                 if (!$header_pulled) {
                     $header_row[] = epl_escape_csv_val(html_entity_decode(htmlspecialchars_decode($field_atts['label']), ENT_QUOTES));
                 }
                 $value = '';
                 $value = isset($attendee_info[$field_id][$event_id][$i]) ? $attendee_info[$field_id][$event_id][$i] : '';
                 if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') {
                     $value = isset($field_atts['epl_field_choice_text'][$value]) && $field_atts['epl_field_choice_text'][$value] != '' ? $field_atts['epl_field_choice_text'][$value] : $value;
                 } elseif ($field_atts['input_type'] == 'checkbox') {
                     $value = implode(',', array_intersect_key($field_atts['epl_field_choice_text'], array_flip((array) $value)));
                 } else {
                     $value = html_entity_decode(htmlspecialchars_decode(epl_get_element($i, $attendee_info[$field_id][$event_id])), ENT_QUOTES);
                 }
                 $row[] = htmlentity_decode($value, ENT_QUOTES);
                 //decode special chars (Swedish, Nordic)
                 //array_walk( $row, create_function( '&$item', '$item = utf8_decode($item);' ) );
             }
             $header_pulled = true;
             if (!$registrant) {
                 $_d[] = $row;
             }
             //$csv_row .= implode( ",", $row ) . "\r\n";
             $row = array();
         }
     }
     $filename = epl__('Attendee List') . ', ' . $event_title . ", " . date_i18n("F j, Y");
     $this->excel_file_generator($header_row, $_d, $filename);
     //echo implode( ",", $header_row ) . "\r\n";
     //echo $csv_row;
     exit;
 }