$exp = '';
        if (epl_get_element_m($row->price_id, '_epl_price_pack_type', $event_details) == 'time') {
            $mem_l = epl_get_element_m($row->price_id, '_epl_price_pack_time_length', $event_details);
            $mem_lt = epl_get_element_m($row->price_id, '_epl_price_pack_time_length_type', $event_details);
            $start = strtotime($row->regis_date);
            $until = strtotime("+ {$mem_l} {$mem_lt}", $start);
            if ($until < EPL_DATE) {
                $exp = epl_wrap(epl__("Expired"), '<span class="epl_font_red"> - ', '</span>');
            }
            $_r['package'] = epl__('Until') . ' ' . epl_formatted_date($until) . $exp;
        } else {
            $remaining = $pack_size - $_r['use_count'];
            if ($remaining <= 0) {
                $exp = epl_wrap(epl__("Credits used up"), ' <span class="epl_font_red">', '</span>');
            }
            $_r['package'] = $pack_size . $exp;
            $_r['use_count'] = "{$_r['use_count']}/{$_r['package']}";
        }
    }
    $_form = $erptm->get_form_data_array($row->field_id, $row->value);
    $_r = array_merge($_r, epl_process_fields_for_display($_form));
    $this->epl->epl_table->add_row(array_values($_r));
}
epl_sort_array_by_array($avail_fields, $_form);
$header = array_merge($header, epl_get_field_labels(array_intersect_key($avail_fields, $_form)));
$this->epl->epl_table->set_heading($header);
echo $this->epl->epl_table->generate();
?>


            } else {
                $_row = array_intersect_key($full, $default_row);
            }
            $_f += epl_process_fields_for_display($_row);
        }
    }
    if (epl_is_empty_array($_f)) {
        $_f = $default_row;
    }
    $this->epl->epl_table->add_row(array_values($_combned + $_a + $_f));
    $new_record = false;
    $form_counter++;
}
//construct header row
$header = array(epl__('Regis ID'), epl__('Regis Date'), epl__('Status'), epl__('Event'), epl__('Purchase'), epl__('Discount Code'), epl__('Grand Total'), epl__('Paid'), epl__('Date'), epl__('Time'));
$header = array_merge($header, epl_get_field_labels(array_intersect_key($avail_fields, $default_row)));
$this->epl->epl_table->set_heading($header);
echo $this->epl->epl_table->generate();
?>

<script type="text/javascript">

    jQuery(document).ready(function($) {
        
        do_datatable('#<?php 
echo $table_id;
?>
');

                        				
    });
 function view_names2()
 {
     if (!is_user_logged_in()) {
         exit;
     }
     global $event_details, $wpdb;
     $registrations = $wpdb->get_results("\n                    SELECT rf.* \n                    FROM {$wpdb->epl_regis_form_data} rf\n                        INNER JOIN {$wpdb->epl_registration} r\n                            ON r.regis_id=rf.regis_id\n                        WHERE 1=1 AND (r.status = 2 OR r.status = 5) \n                        AND field_id <> ''\n                        GROUP BY value\n                        ORDER BY id\n                        ");
     $avail_fields = epl_get_list_of_available_fields();
     $default_row = array_fill_keys(array_keys($avail_fields), null);
     $tmpl = array('table_open' => '<table border="1" cellpadding="0" cellspacing="0" class="epl_daily_schedule_table  dataTable" id="">');
     $this->epl->epl_table->set_template($tmpl);
     foreach ($registrations as $r) {
         if (strpos($r->field_id, EPL_PLUGIN_DB_DELIM)) {
             $fields = explode(EPL_PLUGIN_DB_DELIM, $r->field_id);
             $values = explode(EPL_PLUGIN_DB_DELIM, $r->value);
         } else {
             $fields = array($r->field_id);
             $values = array($r->value);
         }
         $full = array_combine($fields, $values);
         if (!$limited) {
             $_row = array_merge($default_row, $full);
         } else {
             $_row = array_intersect_key($full, $default_row);
         }
         $this->epl->epl_table->add_row(array_values($_row));
         //echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename( __FILE__ ) . " > " . print_r( $_row, true ) . "</pre>";
     }
     $header = epl_get_field_labels(array_intersect_key($avail_fields, $default_row));
     $this->epl->epl_table->set_heading($header);
     echo $this->epl->epl_table->generate();
 }
<?php 
$epl = EPL_Base::get_instance();
$delim = EPL_db_model::get_instance()->delim;
$tmpl = array('table_open' => '<table border="1" cellpadding="0" cellspacing="0" class="epl_lookup_result_table">');
$this->epl->epl_table->set_template($tmpl);
$header = epl_get_field_labels($avail_fields);
$_row = array_fill_keys(array_keys($avail_fields), null);
foreach ($lookup_list as $r) {
    if (strpos($r->field_id, $delim)) {
        $fields = explode($delim, $r->field_id);
        $values = explode($delim, $r->value);
    } else {
        $fields = $r->field_id;
        $values = $r->value;
    }
    $raw = array_combine($fields, $values);
    $row = array_merge($_row, $raw);
    $row = epl_process_fields_for_display($row, $avail_fields);
    $raw['user_id'] = $r->user_id;
    $regis_link = epl_anchor(admin_url('post.php?post=' . $r->regis_id . '&action=edit'), $r->regis_key);
    $select_link = '<a href="#" class="epl_lookup_row_select">Select</a><span class="form_data" style="display:none;">' . json_encode($raw) . '</span>' . ($r->user_id > 0 ? " ({$r->user_id})" : '');
    array_unshift($row, $select_link);
    array_unshift($row, $regis_link);
    $epl->epl_table->add_row($row);
}
array_unshift($header, '');
array_unshift($header, '');
$epl->epl_table->set_heading($header);
echo $epl->epl_table->generate();
            $_r += epl_process_fields_for_display($_row);
        }
        //append the primary regis form data
    }
    $this->epl->epl_table->add_row(array_values($_r));
    $new_record = false;
    $form_counter++;
}
//construct header row
$header = array();
$header[] = epl__('Regis ID');
$header[] = epl__('Regis Date');
$header[] = epl__('Status');
$header[] = epl__('Purchase');
$header[] = epl__('Amount');
$header[] = epl__('TotalPaid');
$header[] = epl__('Discount Code');
$header[] = epl__('Discount Amount');
if (epl_get_regis_setting('epl_enable_donation') == 10) {
    $header[] = epl__('Donation');
}
$header[] = epl__('Date');
$header[] = epl__('Time');
epl_sort_array_by_array($avail_fields, array_flip($fields));
$header = array_merge($header, array_values(epl_get_field_labels(array_intersect_key($ticket_buyer_avail_fields, array_flip($tb_only_fields)))));
$header = array_merge($header, epl_get_field_labels(array_intersect_key($avail_fields, array_flip($fields))));
//$footer = $this->epl->epl_util->remove_array_vals( array_keys( $header ) );
//$footer[4] = epl_get_formatted_curr( $total_revenue );
//$this->epl->epl_table->set_footer( array_values( $footer ) );
$this->epl->epl_table->set_heading($header);
echo $this->epl->epl_table->generate();