Example #1
0
auth_ensure_user_authenticated();
$f_export = gpc_get_string('export', '');
helper_begin_long_process();
$t_export_title = excel_get_default_filename();
$t_short_date_format = config_get('short_date_format');
# This is where we used to do the entire actual filter ourselves
$t_page_number = gpc_get_int('page_number', 1);
$t_per_page = 100;
$t_result = filter_get_bug_rows($t_page_number, $t_per_page, $t_page_count, $t_bug_count);
if ($t_result === false) {
    print_header_redirect('view_all_set.php?type=0&print=1');
}
header('Content-Type: application/vnd.ms-excel; charset=UTF-8');
header('Pragma: public');
header('Content-Disposition: attachment; filename="' . urlencode(file_clean_name($t_export_title)) . '.xml"');
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)) {
require_api('excel_api.php');
helper_begin_long_process();
$t_filename = excel_get_default_filename();
$t_date_format = config_get('normal_date_format');
$f_project_id = gpc_get_int('project_id');
$f_cost = gpc_get_int('cost');
$f_from = gpc_get_string('from');
$f_to = gpc_get_string('to');
billing_ensure_reporting_access($f_project_id);
$t_show_cost = ON == config_get('time_tracking_with_billing') && $f_cost != 0;
$t_billing_rows = billing_get_for_project($f_project_id, $f_from, $f_to, $f_cost);
$t_show_realname = config_get('show_realname') == ON;
header('Content-Type: application/vnd.ms-excel; charset=UTF-8');
header('Pragma: public');
header('Content-Disposition: attachment; filename="' . urlencode(file_clean_name($t_filename)) . '.xml"');
echo excel_get_header($t_filename);
echo excel_get_start_row();
echo excel_format_column_title(lang_get('issue_id'));
echo excel_format_column_title(lang_get('project_name'));
echo excel_format_column_title(lang_get('category'));
echo excel_format_column_title(lang_get('summary'));
if ($t_show_realname) {
    echo excel_format_column_title(lang_get('realname'));
} else {
    echo excel_format_column_title(lang_get('username'));
}
echo excel_format_column_title(lang_get('timestamp'));
echo excel_format_column_title(lang_get('minutes'));
echo excel_format_column_title(lang_get('time_tracking_time_spent'));
if ($t_show_cost) {
    echo excel_format_column_title('cost');