Location: PHPKode > projects > Work project > workproject/view_user.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_activity.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>Your tasks - View user</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<? include ("include_css.inc"); ?>
<script src="main.js" type="text/javascript"></script>
<script src="tasks.js" type="text/javascript"></script>
<script src="nav.js" type="text/javascript"></script>

</head>
<BODY onload="init()">

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

<?php
write_log_user ($filename_log, "View of user.");

/* 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);
display_connected_user($name_connected_user,$name_profile_connected_user);

if ( $export_calendar == "1" and $select_user != "") {
	#display the calendar or planning of the selected user
	$lastmonth = mktime (0,0,0,date("m")-$g_calendar_month,date("d"),  date("Y"));
	$nextmonth = mktime (0,0,0,date("m")+$g_calendar_month,date("d"),  date("Y"));
	$date_start = date ("Y-m-d",$lastmonth);
	$date_end = date ("Y-m-d",$nextmonth);
	$name_user = user_name($select_user,$g_database_name);
	$calendar = display_calendar_image ($select_user,$name_user, $date_start, $date_end,$detail);
}

/* view user */
$result = mysql_query("SELECT USERID,NAME,USERNAME,SURNAME,EMAIL,PHONE,ADDRESS,TOWN,COUNTRY,PROJECT_CODE,PROFIL_CODE FROM USER WHERE USERID=$select_user");
#$total_rows = mysql_numrows($result);

$USERID = mysql_result($result,$counter,USERID);
$NAME= mysql_result($result,$counter,NAME);
$USERNAME= mysql_result($result,$counter,USERNAME);
$SURNAME= mysql_result($result,$counter,SURNAME);
$EMAIL= mysql_result($result,$counter,EMAIL);
$PHONE= mysql_result($result,$counter,PHONE);
$ADRESS= mysql_result($result,$counter,ADDRESS);
$TOWN= mysql_result($result,$counter,TOWN);
$COUNTRY= mysql_result($result,$counter,COUNTRY);
$PROJECT_CODE= mysql_result($result,$counter,PROJECT_CODE);
$PROFILE_CODE= mysql_result($result,$counter,PROFIL_CODE);

$PROJECT_NAME= project_name($PROJECT_CODE);
$PROFILE_NAME= profile_name($PROFILE_CODE);

$query_keys= "SELECT * from USER_SKILLS where USERID=$select_user order by ID_KEYS";
$result_keys= mysql_query($query_keys) or $error_keys = mysql_error();
$total_rows_keys =0;
if (!$error_keys){
	$total_rows_keys = mysql_num_rows($result_keys);
}
$query_qualif= "SELECT * from USER_QUALIFICATION where USERID=$select_user order by ID_QUALIF";
$result_qualif= mysql_query($query_qualif) or $error_qualif = mysql_error();
$total_rows_qualif =0;
if (!$error_qualif){
	$total_rows_qualif = mysql_num_rows($result_qualif);
}

#mysql_close($link);

?>

<form method="post" name="list" action="<? echo $g_path;?>modify_user.php?select_user=<? echo $select_user;?>">
<input type="hidden" name="filename_log" value="<? echo $filename_log; ?>">
<input type="hidden" name="export_calendar" value="<? echo $export_calendar; ?>">

<TABLE class="around" border=1 align="center" cellspacing="4" cellpadding="4"> 
<tr><td class="title" colspan="6">View user</td></tr>
<tr><td class="input">Login</td><td class="title2"><? echo $NAME; ?></td></tr>
<tr><td class="input">Lastname</td><td><? echo $USERNAME; ?></td>
<td class="input">Surname</td><td><? echo $SURNAME; ?></td></tr>

<tr><td class="input">Email</td><td><? echo $EMAIL; ?></td>
<td class="input">Phone</td><td><? echo $PHONE; ?></td></tr>

<tr><td class="input">Address</td><td><? echo $ADRESS; ?></td>
<td class="input">Town</td><td><? echo $TOWN; ?></td>
<td class="input">Country</td><td><? echo $COUNTRY; ?></td></tr>

<tr><td class="input">Project Name</td>
<td>
<? if ( right_user($connected_user,10) and $PROJECT_NAME != "Not assigned project"){ ?>
<a href="<? echo $g_path; ?>view_project.php?select_project=<? echo $PROJECT_CODE; ?>&filename_log=<?echo $filename_log;?>"><? echo $PROJECT_NAME; ?></a>
<? } else {
echo $PROJECT_NAME;
} ?>
</td>
</tr>
<tr>
<td class="input">Profile Name</td><td><? echo $PROFILE_NAME; ?></td>
<td class="input">Qualification</td>
<?
$counter =0;
if ( $total_rows_qualif > 0){
	while($counter < $total_rows_qualif) {
		$id_qualif = mysql_result($result_qualif,$counter,ID_QUALIF);
		$query_select = "SELECT DESCRIPTION_QUALIF from QUALIFICATION where ID_QUALIF=$id_qualif";
		$result_description = mysql_query($query_select);
		$description = mysql_result($result_description,0,DESCRIPTION_QUALIF);
		echo "<td>".$description."</td>";
		$counter = $counter + 1;
	}
}
?>
</tr>

<tr>
<?
$counter =0;
if ( $total_rows_keys > 0){
	echo "<td class='input'> Ressource keys skills</td>";
	while($counter < $total_rows_keys) {
		$id_keys = mysql_result($result_keys,$counter,ID_KEYS);
		$query_select = "SELECT DESCRIPTION from SKILLS where ID_KEYS=$id_keys";
		$result_description = mysql_query($query_select);
		$description = mysql_result($result_description,0,DESCRIPTION);
		echo "<td>".$description."</td>";
		$counter = $counter + 1;
	}
}
?>
</tr>
</table>

<br>
<table align="center">
<tr>
<? if ( right_user($connected_user,18) ) { ?>
<td>
<a href='<? echo $g_path;?>add_taskuser.php?select_user=<? echo $select_user; ?>'><? button("Add task"); ?></a>
</td>
<? }
if ( right_user($connected_user,4) ) { ?>
<td>
<a href='<? echo $g_path;?>list_taskuser.php?select_user=<? echo $select_user; ?>'><? button("Tasks list"); ?></a>
</td>
<? }
if ( right_user($connected_user,8) ) { 
	if ($profile_connected_user ==1 or $PROFILE_CODE != 1) {
?>

<td>
<? button("Modify","Modify the current user","submit();"); ?>
</td>
<td>
<? if ( right_user($connected_user,20) ){ 
$submit_calendar = "submit_calendar('view_user.php?select_user=$select_user');";
button("Calendar","Export calendar for MS Outlook for the selected user",$submit_calendar);
 } ?>
</td>
<td>
<? if ( right_user($connected_user,22) ){ 
$assign = "submit_assignement($select_user);";
button("Assignement","Display the assignement of the current user",$assign);
 } ?>
</td>
<td>
<img src="<? echo $g_icon_path;?>question.gif" ALT="Help" onClick="show_comment_screen('Help','View a user',20,'');">
</td>
<?  } 
if ( right_user($connected_user,13) ){ ?>
<td>
<a href=<? echo $g_file_log_directory; ?>  title="Log data" > <img src="<? echo $g_icon_path;?>see.gif" border="0"> </a>
</td>
<? } 
} ?>
</tr>
</table>
</form>

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

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