HTML for a Project Management Application - Source Code for the Page (
Page 3 of 4 )
And here's the code for the entire page, including the PHP portion of it:
viewproject
<?php
include "dbcon.php";
include "functions.php";
//initialise variables
$alert =false;
// retrieve information based on the user id, that we set in the login page:
if(isset($_GET['pid'])){
//clean pid
if(!is_numeric($_GET['pid'])){
//the value received is not numeric. redirect the user to login
header("location:login.php");
}
//otherwise clean the received value for query use
//get projects
$projectID = mysql_escape_string($_GET['pid']);
$getproject= "SELECT * FROM projects WHERE pid = '".$projectID."'";
$results = mysql_query($getproject);
$projectdetails = mysql_fetch_assoc($results);
//get project files
$getfiles = "SELECT * FROM files WHERE p_id = '".$projectID."'";
$file_res = mysql_query($getfiles);
if(!$file_res){
echo mysql_error();
}else{
$num_files = mysql_num_rows($file_res);
}
//get project members
$getmembers = "SELECT name FROM staff WHERE p_id = '".$projectID."'";
$staff_res = mysql_query($getmembers);
if(!$staff_res){
echo mysql_error();
}else{
$num_staff = mysql_num_rows($staff_res);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/PM_Main.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Project Management::View Project</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="Templates/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0">
<tr>
<td width="33%"> </td>
<td width="28%"> </td>
<td width="39%">Logged in: <!-- InstanceBeginEditable name="login" --><? echo $_SESSION['name'];?> | <a href="logout.php">Logout</a><!-- InstanceEndEditable --></td>
</tr>
<tr>
<td colspan="3" bgcolor="#6699CC" class="headertxt">Project Management Software </td>
</tr>
<tr>
<td colspan="3"><!-- InstanceBeginEditable name="main" -->
<table width="100%" border="0">
<tr>
<td colspan="2" class="loginheader"><div align="left">Project Name: <?php echo $projectdetails['title'];?> </div></td>
</tr>
<tr>
<td width="44%"> </td>
<td width="56%" ></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0">
<tr>
<td colspan="2"><b>Project Details</b> </td>
</tr>
<tr>
<td>Owner</td>
<td><?php echo $_SESSION['name'];?> </td>
</tr>
<tr>
<td>Due Date </td>
<td><?php
if($projectdetails['due_dt'] > $td){
$alert = true;
}
echo $projectdetails['due_dt'];?> </td>
</tr>
<tr>
<td>Status</td>
<td><?php echo $projectdetails['status'];?></td>
</tr>
<tr>
<td>Project Description</td>
<td><?php echo $projectdetails['project_description'];?></td>
</tr>
</table></td>
<td rowspan="2" valign="top"><table width="83%" border="0" align="right">
<tr>
<td><b>Project Files:</b> </td>
</tr>
<?php if($num_files > 0){
while($row = mysql_fetch_assoc($file_res)){
?>
<tr>
<td><?php echo $row['filename'];?></td>
</tr>
<?php }
}else{
?>
<tr>
<td><p>There are no files stored for this project</p></td>
</tr>
<?php
}
?>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0">
<tr>
<td><b>Project Staff</b> </td>
</tr>
<?php
if($num_staff > 0){
while($rowstaff = mysql_fetch_assoc($staff_res)){
?>
<tr>
<td><?php echo $rowstaff['name'] ?> </td>
</tr>
<?php
}
}else{
?>
<tr>
<td><p>There are no other staff members registered for this project</p></td>
</tr>
<?php
}
?>
</table></td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td colspan="3"><!-- InstanceBeginEditable name="nav" --> <table width="100%" border="0">
<tr>
<td><a href="edit_project.php?pid=<?php echo $projectdetails['pid'];?>">Edit Project</a> |<a href="add_project.php">Add Project</a> | <a href="add_file.php?pid=<?php echo $projectdetails['pid'];?>">Add Files to this Project </a> |<a href="view_tasks.php?pid=<?php echo $projectdetails['pid'];?
>">View Tasks for this Project</a> | <a href="add_task.php?pid=<?php echo $projectdetails['pid'];?>">Add a Task to this Project</a> | <a href="add_staff.php?pid=<?php echo $projectdetails['pid'];?>">Add Staff to the Project</a> | <a href="admin/login.php">Administrators Corner</a>|<a href="main.php">View Project List</a></td>
</tr>
</table><!-- InstanceEndEditable --></td>
</tr>
<tr>
<td align="right" class="cright" colspan="3">copyright © 2007 PM </td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>