コード例 #1
0
ファイル: my_view_inc.php プロジェクト: khinT/mantisbt-master
    ?>
</div>
		</div>
	</td>
	<tr class="nopad">
	<?php 
    #*********  custom field value
    # Custom Fields
    $t_custom_fields_found = false;
    $t_related_custom_field_ids = custom_field_get_linked_ids($t_bug->project_id);
    $g_show_only_custom_fields = config_get('show_only_custom_fields');
    //** print_r($g_show_only_custom_fields);
    $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_HOME_VIEW_PAGE, false, $t_current_user_id);
    // $t_cond = in_array($t_def_custom,$t_columns)===TRUE;
    $t_config_table = db_get_table('mantis_config_table');
    $b_helper_user_exists = helper_user_exists($t_current_user_id, $t_config_table);
    if ($b_helper_user_exists) {
        foreach ($t_columns as $t_column_name) {
            foreach ($t_related_custom_field_ids as $key => $t_id) {
                if (!custom_field_has_read_access($t_id, $t_bug->id)) {
                    continue;
                }
                $t_custom_fields_found = true;
                $t_def = custom_field_get_definition($t_id);
                $t_def_custom = 'custom_' . strtolower($t_def['name']);
                if ($t_def_custom === $t_column_name) {
                    echo '<td class="custom_field pad1 center" title="', string_display(lang_get_defaulted($t_def['name'])), '">', print_custom_field_value($t_def, $t_id, $t_bug->id), '</td>';
                }
            }
        }
    } else {
コード例 #2
0
$t_config_table = db_get_table('mantis_config_table');
$t_related_custom_field_ids = custom_field_get_linked_ids($t_project_id);
$g_show_only_custom_fields = config_get('show_only_custom_fields');
foreach ($g_show_only_custom_fields as $t_display_id) {
    foreach ($t_related_custom_field_ids as $key => $t_id) {
        $t_custom_fields_found = true;
        $t_def = custom_field_get_definition($t_id);
        if ($key + 1 === $t_display_id) {
            $t_valid_columns[] = 'custom_' . strtolower($t_def['name']);
        }
    }
}
//  $t_columns = columns_get_custom_fields( $t_project_id );
/* TODO: sneaky here if user has messed with custom_fields for their references and turn everything back on full cfs, let them see all.
	If user has never touched the custom_fields, the field only shows the valid fields. There could be a better way but config_key $g_hide_custom_fields is an independent value data and may override the config data for fields display. */
$t_columns = helper_user_exists($t_user_id, $t_config_table) ? helper_get_columns_to_view(COLUMNS_TARGET_HOME_VIEW_PAGE, false, $t_user_id) : $t_valid_columns;
$t_home_view_columns = implode(', ', $t_columns);
$t_columns = helper_get_columns_to_view(COLUMNS_TARGET_CSV_PAGE, false, $t_user_id);
$t_csv = implode(', ', $t_columns);
/* $t_related_custom_field_ids = custom_field_get_linked_ids( 0 );

	// preparing data
	$cf_data = [];
	foreach( $t_related_custom_field_ids as $key => $t_id ) {
		$t_def = custom_field_get_definition( $t_id );
		// array_push($cf_data, array("id" => $key, "field_name" => lang_get_defaulted( $t_def['name'] ) ));
		$cf_data[$key]='custom_' . $t_def['name'];
	}
	echo '<br/> $cf_data : ';
	print_r($cf_data).'<br/>';
	$t_json_home_view = json_encode($cf_data, JSON_PRETTY_PRINT);
コード例 #3
0
function custom_function_default_get_columns_to_view($p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_user_id = null)
{
    $t_project_id = helper_get_current_project();
    $t_boo = true;
    $t_config_table = db_get_table('mantis_config_table');
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE) {
        $t_columns = config_get('csv_columns', '', $p_user_id, $t_project_id);
    } else {
        if ($p_columns_target == COLUMNS_TARGET_EXCEL_PAGE) {
            $t_columns = config_get('excel_columns', '', $p_user_id, $t_project_id);
        } else {
            if ($p_columns_target == COLUMNS_TARGET_VIEW_PAGE) {
                $t_columns = config_get('view_issues_page_columns', '', $p_user_id, $t_project_id);
            } else {
                if ($p_columns_target == COLUMNS_TARGET_PRINT_PAGE) {
                    $t_columns = config_get('print_issues_page_columns', '', $p_user_id, $t_project_id);
                } else {
                    $t_columns = helper_user_exists($p_user_id, $t_config_table) ? config_get('home_view_columns', '', $p_user_id, $t_project_id) : columns_get_custom_fields($t_project_id);
                    $t_boo = false;
                }
            }
        }
    }
    $t_columns_get = $t_boo ? columns_get_all($t_project_id) : columns_get_custom_fields($t_project_id);
    $t_columns = columns_remove_invalid($t_columns, $t_columns_get);
    return $t_columns;
}