Exemplo n.º 1
0
/**
 * Print the title of a column given its name.
 *
 * @param string  $p_column         Custom_xxx for custom field xxx, or otherwise field name as in bug table.
 * @param integer $p_columns_target See COLUMNS_TARGET_* in constant_inc.php.
 * @return void
 */
function custom_function_default_print_column_title($p_column, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_sort, $t_dir;
    $t_custom_field = column_get_custom_field_name($p_column);
    if ($t_custom_field !== null) {
        if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
            echo '<th class="column-custom-' . $t_custom_field . '">';
        }
        $t_field_id = custom_field_get_id_from_name($t_custom_field);
        if ($t_field_id === false) {
            echo '@', $t_custom_field, '@';
        } else {
            $t_def = custom_field_get_definition($t_field_id);
            $t_custom_field = lang_get_defaulted($t_def['name']);
            if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
                print_view_bug_sort_link($t_custom_field, $p_column, $t_sort, $t_dir, $p_columns_target);
                print_sort_icon($t_dir, $t_sort, $p_column);
            } else {
                echo $t_custom_field;
            }
        }
        if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
            echo '</th>';
        }
    } else {
        $t_plugin_columns = columns_get_plugin_columns();
        $t_function = 'print_column_title_' . $p_column;
        if (function_exists($t_function)) {
            $t_function($t_sort, $t_dir, $p_columns_target);
        } else {
            if (isset($t_plugin_columns[$p_column])) {
                $t_column_object = $t_plugin_columns[$p_column];
                print_column_title_plugin($p_column, $t_column_object, $t_sort, $t_dir, $p_columns_target);
            } else {
                echo '<th>';
                print_view_bug_sort_link(column_get_title($p_column), $p_column, $t_sort, $t_dir, $p_columns_target);
                print_sort_icon($t_dir, $t_sort, $p_column);
                echo '</th>';
            }
        }
    }
}
Exemplo n.º 2
0
# Get columns to be exported
$t_columns = csv_get_columns();

# export the titles
$t_first_column = true;
ob_start();
$t_titles = array();
foreach ( $t_columns as $t_column ) {
	if ( !$t_first_column ) {
		echo $t_sep;
	} else {
		$t_first_column = false;
	}

	echo column_get_title( $t_column );
}

echo $t_nl;

$t_header = ob_get_clean();

# 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
Exemplo n.º 3
0
/**
 * Gets an Xml Row that contains all column titles.
 * @returns The xml row.
 */
function excel_get_titles_row()
{
    $t_columns = excel_get_columns();
    $t_ret = '<Row>';
    foreach ($t_columns as $t_column) {
        $t_custom_field = column_get_custom_field_name($t_column);
        if ($t_custom_field !== null) {
            $t_ret .= excel_format_column_title(lang_get_defaulted($t_custom_field));
        } else {
            $t_column_title = column_get_title($t_column);
            $t_ret .= excel_format_column_title($t_column_title);
        }
    }
    $t_ret .= '</Row>';
    return $t_ret;
}
Exemplo n.º 4
0
/**
 * Gets an Xml Row that contains all column titles
 * @param string $p_style_id The optional style id.
 * @returns The xml row.
 */
function excel_get_titles_row($p_style_id = '')
{
    $t_columns = excel_get_columns();
    $t_ret = excel_get_start_row($p_style_id);
    foreach ($t_columns as $t_column) {
        $t_ret .= excel_format_column_title(column_get_title($t_column));
    }
    $t_ret .= '</Row>';
    return $t_ret;
}
Exemplo n.º 5
0
 function get_attachment($bug)
 {
     $attachment = array('fallback' => '');
     $t_columns = (array) plugin_config_get('columns');
     foreach ($t_columns as $t_column) {
         $title = column_get_title($t_column);
         $value = $this->format_value($bug, $t_column);
         if ($title && $value) {
             $attachment['fallback'] .= $title . ': ' . $value . "\n";
             $attachment['fields'][] = array('title' => $title, 'value' => $value, 'short' => !column_is_extended($t_column));
         }
     }
     return $attachment;
 }