<?php
include( "menu.inc" );
include( "func.inc" );
$t = getmsg( 19, $lang );
if( !head( $t[0], '', $xid, $xpar )) exit;

# select date of last submitted project  
if( !$id = mysql_query( "select max(submit) from metatext
	where status = 'fin'" )) {
	echo "Error No. 2: ".mysql_errno().": ".mysql_error();
	exit;
}
if( !$row = mysql_fetch_array( $id )){
	$maxdt == "";
}
else{
	$maxdt = dt_de( $row[ 0 ]);
}
echo "<font $_fontbulk>\n";
eval( "\$x = \"$t[1]\";" );
echo "<p>".add_xid( $x, $xid )."</p>\n";
if( empty( $maxdt )){
	echo "<h3>$t[2]</h3>";
	foot();
	exit;
}
else{
	eval( "\$x = \"$t[3]\";" );
	echo "<h3>$x</h3>";
}
echo "<center>\n<table bgcolor='$_bg3' cellpadding=4>\n";
echo "<tr bgcolor='$_bg2'><td colspan=2>\n";
echo "<font $_fontbulk>\n";
echo "$t[4]</font></td>\n";
echo "<td>\n<font $_fontbulk>\n";
echo "$t[5]</font></td>\n";
echo "<td>\n<font $_fontbulk>\n";
echo "$t[6]</font></td>\n";
echo "<td align='center'>\n<font $_fontbulk>\n";
echo "$t[7]</font></td></tr>\n";

# select project data
if( !$id = mysql_query( "select * from metatext
	where status='fin'
	order by submit desc" )) {
	echo "Error No. 4: ".mysql_errno().": ".mysql_error();
	exit;
}
while( $row = mysql_fetch_array( $id )){
	$proj_id = $row[ "proj_id" ];
	$titlabb = $row[ "titlabb" ];
	$vers_id = $row[ "vers_id" ];
	$submit = date_de( $row[ "submit" ]);
	$title = $row[ "title" ];
	$link = "proj/".strtolower($titlabb)."/index.phtml";
	$link = lnkxid( $link, $xid );

	# select number of project members  
	if( !$nid = mysql_query( "select count(memb_id) from projmemb
		where proj_id = $proj_id" )) {
		echo "Error No. 5: ".mysql_errno().": ".mysql_error();
		exit;
	}
	$numact = 0;
	if( $nrow = mysql_fetch_array( $nid )) $numact = $nrow[ 0 ];

	echo "<tr><td width=200>\n";
	echo "<font $_fontbulk>\n";
	echo "<b><a href='$link'>$titlabb</a></b></font></td>\n";
	echo "<td>\n<font $_fontbulk>\n";
	echo "<b>$vers_id</b></font></td>\n";
	echo "<td>\n<font $_fontbulk>\n";
	echo "$submit</font></td>\n";
	echo "<td width=290>\n<font $_fontbulk>\n";
	echo "$title</font></td>\n";
	echo "<td align='center'>\n<font $_fontbulk>\n";
	echo "$numact</font></td></tr>\n";
}

echo "</table>\n</font><br><br>\n";
foot()
?>
