echo excel_get_header($t_export_title); echo excel_get_titles_row(); $f_bug_arr = explode(',', $f_export); $t_columns = excel_get_columns(); do { # pre-cache custom column data columns_plugin_cache_issue_data($t_result); foreach ($t_result as $t_row) { if (is_blank($f_export) || in_array($t_row->id, $f_bug_arr)) { echo excel_get_start_row(); foreach ($t_columns as $t_column) { $t_custom_field = column_get_custom_field_name($t_column); if ($t_custom_field !== null) { echo excel_format_custom_field($t_row->id, $t_row->project_id, $t_custom_field); } else { if (column_is_plugin_column($t_column)) { echo excel_format_plugin_column_value($t_column, $t_row); } else { $t_function = 'excel_format_' . $t_column; echo $t_function($t_row); } } } echo excel_get_end_row(); } #in_array } #for loop # Get the next page if we are not processing the last one # @@@ Note that since we are not using a transaction, there is a risk that we get a duplicate record or we miss # one due to a submit or update that happens in parallel.
# Fixed for a problem in Excel where it prompts error message "SYLK: File Format Is Not Valid" # See Microsoft Knowledge Base Article - 323626 # http://support.microsoft.com/default.aspx?scid=kb;en-us;323626&Product=xlw $t_first_three_chars = utf8_substr($t_header, 0, 3); if (strcmp($t_first_three_chars, 'ID' . $t_sep) == 0) { $t_header = str_replace('ID' . $t_sep, 'Id' . $t_sep, $t_header); } # end of fix echo $t_header; # export the rows foreach ($t_rows as $t_row) { $t_first_column = true; foreach ($t_columns as $t_column) { if (!$t_first_column) { echo $t_sep; } else { $t_first_column = false; } if (column_get_custom_field_name($t_column) !== null || column_is_plugin_column($t_column)) { ob_start(); $t_column_value_function = 'print_column_value'; helper_call_custom_function($t_column_value_function, array($t_column, $t_row, COLUMNS_TARGET_CSV_PAGE)); $t_value = ob_get_clean(); echo csv_escape_string($t_value); } else { $t_function = 'csv_format_' . $t_column; echo $t_function($t_row); } } echo $t_nl; }