Page 1 of 1

Trouble adding date_submitted column to View All page

Posted: 03 Jul 2006, 11:49
by mpaskevi
I would like to display the date submitted on the View Issues page. I have followed the instructions given on this board for custom fields viewing, etc. Therefore, I have altered the custom_function_default_get_columns_to_view () in the custom function api to include the date submitted instead of the category which we do not use.

The output for each fault is a strange value. I have searched the database for these values to no avail.

ex.
Date Submitted:
1151919694
1151917969
1151920052

Any ideas where this value is coming from and how I can properly call the date_submitted value??

Thanks in advance, Michael

Posted: 04 Jul 2006, 23:25
by Narcissus
That value is a timestamp: it needs to be converted via the date function call.

Assuming the timestamp is stored in $date_var and assuming you want to store the value you will eventually display in $date_formatted_var, do something like:

Code: Select all

$date_formatted_var = date( config_get( 'normal_date_format' ), $date_var );
I hope this makes sense and that it helps!

Posted: 05 Jul 2006, 07:39
by mpaskevi
Thank you for your quick reply.

I wonder if you could further specify where such a variable change would take place? I do not see an opportunity to make that change in the custom_function_api.

Thanks, Michael

Trouble adding date_submitted column to View All page

Posted: 02 Apr 2007, 23:41
by rpistor
This post is so old that I doubt you're still waiting for a reply but I figured for people like myself that couldn't find an answer, I'd post one:

In your custom_functions_inc.php file add this function:

Code: Select all

	# --------------------
	# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
	function print_column_date_submitted( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
		global $t_filter;

		$t_date_submitted = date( config_get( 'short_date_format' ), $p_row['date_submitted'] );

		echo '<td class="center">';
		if ( $p_row['date_submitted'] > strtotime( '-'.$t_filter['highlight_changed'].' hours' ) ) {
			printf( '<span class="bold">%s</span>', $t_date_submitted );
		} else {
			echo $t_date_submitted;
		}
		echo '</td>';
	}
This worked for version Mantis 1.0.3

Posted: 03 Apr 2007, 04:12
by vboctor
That is fixed in 1.1.0a1.
http://www.mantisbt.org/bugs/view.php?id=7348

The change in the code base can be found at:
http://mantisbt.cvs.sourceforge.net/man ... 14&r2=1.15