Trouble adding date_submitted column to View All page

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
mpaskevi
Posts: 3
Joined: 07 Apr 2006, 12:00

Trouble adding date_submitted column to View All page

Post 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
Narcissus
Developer
Posts: 338
Joined: 17 Feb 2005, 09:45

Post 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!
mpaskevi
Posts: 3
Joined: 07 Apr 2006, 12:00

Post 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
rpistor
Posts: 1
Joined: 02 Apr 2007, 23:34

Trouble adding date_submitted column to View All page

Post 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
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post 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
Migrate your MantisBT to the MantisHub Cloud
Post Reply