Location: PHPKode > projects > Work project > workproject/assignement.php
<?
include ("include_config.inc");
include ("include_profile_name.inc");
include ("include_project_name.inc");
include ("include_log_file.inc");
include ("include_delete_task.inc");
include ("include_delete_project.inc");
include ("include_delete_profile.inc");
include ("include_update_user.inc"); 
include ("include_delete_user.inc");
include ("include_list_user.inc");
include ("include_state_name.inc");
include ("include_user_name.inc");
include ("include_workload_project.inc");
include ("include_dates_project.inc");
include ("include_help.inc");
include ("include_display_comment.inc");
include ("include_state_prospect.inc");
include ("include_delete_prospect.inc");
include ("include_prospect_name.inc");
include ("include_button.inc");

if ( isset( $HTTP_COOKIE_VARS[$g_string_cookie] ) ) {
	$g_string_cookie_val         = $HTTP_COOKIE_VARS[$g_string_cookie];
	write_log_user ($filename_log, "Cookie created 1.1: ".$g_string_cookie." -- ".$g_string_cookie_val);
}
if ( isset( $HTTP_COOKIE_VARS[$g_project_cookie] ) ) {
	$g_project_cookie_val        = $HTTP_COOKIE_VARS[$g_project_cookie];
	write_log_user ($filename_log, "Cookie created 2.1: ".$g_project_cookie." -- ".$g_project_cookie_val);
}

/* check the login for user */
login_cookie_check();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Assignement</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<? include ("include_css.inc"); ?>

</head>
<body>

<?
write_log_user ($filename_log, "Beginning of Display Activity page. ----------------------");

/* database connection */
$link= mysql_connect($g_hostname, $g_db_username, $g_db_password) or die("could not connect");
$result = mysql_select_db($g_database_name);

/* read of the user connected */
$connected_user = user_connected();
$profile_connected_user = user_profile($connected_user);
$name_connected_user = user_name($connected_user,$g_database_name);
$name_profile_connected_user = profile_name($profile_connected_user);

if ( $select_user == '') {
	#write_log_user ($filename_log, "1 ".$select_user);
	$result = mysql_query(
	"SELECT DISTINCT a.USERID, a.USERNAME, a.SURNAME, a.MATRICULE, UNIX_TIMESTAMP(b.TASK_DATE_END_DONE) as TASK_DATE_END_DONE 
		from USER a, TASK b, PROJECT c, PROSPECT_USER d
		WHERE ((a.USERID=b.USER_CODE_ASSIGNED and b.PROJECT_CODE=c.PROJECT_CODE and c.PROJECT_ADMIN=2) 
				or (a.USERID=d.USERID) or (a.USERID=b.USER_CODE_ASSIGNED and b.PROJECT_CODE IS NULL))
		order by a.USERNAME, b.TASK_DATE_END_DONE") 
	or $error = mysql_error();
	#the staff projects: making up, holidays, RTT, ... are taking in account
	write_log_user ($filename_log, "SELECT DISTINCT a.USERID, a.USERNAME, a.SURNAME, a.MATRICULE, UNIX_TIMESTAMP(b.TASK_DATE_END_DONE) as TASK_DATE_END_DONE 
		from USER a, TASK b, PROJECT c, PROSPECT_USER d
		WHERE ((a.USERID=b.USER_CODE_ASSIGNED and b.PROJECT_CODE=c.PROJECT_CODE and c.PROJECT_ADMIN=2) 
				or (a.USERID=d.USERID) or (a.USERID=b.USER_CODE_ASSIGNED and b.PROJECT_CODE IS NULL))
		order by a.USERNAME, b.TASK_DATE_END_DONE" );

} else {
	#write_log_user ($filename_log, "2 ".$select_user);
	$result = mysql_query(
	"SELECT DISTINCT a.USERID, a.USERNAME, a.SURNAME, a.MATRICULE, UNIX_TIMESTAMP(b.TASK_DATE_END_DONE) as TASK_DATE_END_DONE 
		from USER a, TASK b, PROJECT c, PROSPECT_USER d
		WHERE a.userid=$select_user and ((a.USERID=b.USER_CODE_ASSIGNED and b.PROJECT_CODE=c.PROJECT_CODE and c.PROJECT_ADMIN=2) 
				or (a.USERID=d.USERID) or (a.USERID=b.USER_CODE_ASSIGNED and b.PROJECT_CODE IS NULL))
		order by a.USERNAME, b.TASK_DATE_END_DONE") 
	or $error = mysql_error();
	
}


 
if ($error) {
	write_log_user ($filename_log, " error select assignement: ".$error);
	$data = " ".$error." ";
} else {
	$total_rows = mysql_numrows($result);
	$counter = 0;
?>		
<table><tr><td><img src="<? echo $g_icon_company; ?>" border=0></td></tr></table>
<br>
<table align="center" cellpadding="2" cellspacing="2">
<TR>
<TD class="title" colspan="2">Assignements</TD>
</tr>
<tr>
<td>Date: </TD><td><? echo date('d-m-Y'); ?></td>
</TR>
</table>
<br>

<table class="around" border=1 align="center" STYLE="table-layout:fixed" WIDTH=800 cellspacing="2" cellpadding="2">
<TR>
<TD class="list" align="center">Username</TD>
<TD class="list" align="center">Surname</TD>
<!-- <TD class="list" align="center">Matricule</TD> -->
<TD class="list" align="center" width="120">Current projects</TD>
<TD class="list" align="center">Availability date</TD>
<TD class="list" align="center" width="200">Planned Prospect</TD>
</tr>		
<?
		while( $counter < $total_rows ) {
			$userid = mysql_result($result,$counter,USERID);		
			$username = mysql_result($result,$counter,USERNAME);
			$surname = mysql_result($result,$counter,SURNAME);
			#$matricule = mysql_result($result,$counter,MATRICULE);			
			$date_end = mysql_result($result,$counter,TASK_DATE_END_DONE);			
			
			if ( $username == "") {
				$counter = $counter + 1;
				continue;
			}
			if ( $userid != $userid_ex and $userid_ex != "") {
				write_log_user ($filename_log, " username: ".$username_ex." surname: ".$surname_ex);			
				echo "<tr>";
				echo "<td>".$username_ex."</td>";
				echo "<td>".$surname_ex."</td>";
				#echo "<td>".$matricule_ex."</td>";
				echo "<td width='120'>". project_list($userid_ex)."</td>";				
				echo "<td>". strftime($g_date_format, $date_end_final) ."</td>";
				echo "<td width='200'>". prospect_list($userid_ex)."</td>";	
				echo "</tr>";
				$date_end_final ="";
			}
 			
			$username_ex = $username;
			$surname_ex = $surname;
			$matricule_ex = $matricule;
			$userid_ex = $userid;
			if ( $date_end >= $date_end_final ) $date_end_final = $date_end;
			
			$counter = $counter + 1;
		}
		# write the last user
		echo "<tr>";
		echo "<td>".$username_ex."</td>";
		echo "<td>".$surname_ex."</td>";
		#echo "<td>".$matricule_ex."</td>";
		echo "<td width='120'>". project_list($userid_ex)."</td>";			
		echo "<td>". strftime($g_date_format, $date_end_final) ."</td>";
		echo "<td width='200'>". prospect_list($userid_ex)."</td>";	
		echo "</tr>";
	}
?>

<br>
<br>
<table align="center">
<tr>
<td>
<form>
<? button("Print","Print the assignements","window.print();"); ?>
</form>

</td>
</tr>
</table>

</BODY>
</HTML>
Return current item: Work project