Location: PHPKode > projects > Mozart > Mozart-0.0.4/projectdisplay.php
<?
// called from: projectlist.php
// description: In addition to displaying PROJECT information, it also hits the cross-
//              reference tables to display all information relating to the project.
include("connect.inc");
include("reqlogin.inc");
include("userprefs.inc");

$ProjectSQL = "SELECT * FROM project WHERE proj_id = '$id'"; 
$Project    = mysql_query($ProjectSQL); 
$myrow      = mysql_fetch_array($Project);

print("<html>");
printf("<title>Mozart: Project Detail for %s, Case No. %s</title>", $myrow["name"], $myrow["number"]);
?>
<body bgcolor=<? echo $bgcolor ?> text=<? echo $txtcolor ?>>
<center>
<? include("links.inc"); ?>
<br><br>
<?
// get TYPE associated with this PROJECT
$type    = $myrow["type"];
$TypeSQL = "SELECT type_name FROM types WHERE type_id = '$type'";
$Type    = mysql_query($TypeSQL);
$typerow = mysql_fetch_array($Type);

// get status from TYPE table associated with the PROJECT
$status    = $myrow["status"];
$StatusSQL = "SELECT type_name FROM types WHERE type_id = '$status'";
$Status    = mysql_query($StatusSQL);
$statusrow = mysql_fetch_array($Status);

// get system_id from users table based on owner id
$owner     = $myrow["owner"];
$OwnerSQL  = "SELECT system_id FROM users WHERE user_id = '$owner'";
$Ownerid   = mysql_query($OwnerSQL);
$ownerid   = mysql_fetch_array($Ownerid);

print("<table border=0 cellspacing=0 cellpadding=5>");
printf("<tr><td><b>Name</b></td><td><i>%s</i></td></tr>", $myrow["name"]); 
printf("<tr><td><b>Number</b></td><td>%s</td></tr>", $myrow["number"]);
printf("<tr><td><b>Status</b></td><td>%s</td></tr>", $statusrow["type_name"]);
printf("<tr><td><b>Type</b></td><td>%s</td></tr>", $typerow["type_name"]);
printf("<tr><td><b>Owner</b></td><td>%s</td></tr>", $ownerid["system_id"]);
printf("<tr><td><b>Opened</b></td><td>%s-%s-%s</td></tr>", $myrow["mon_opened"], $myrow["day_opened"], $myrow["yr_opened"]);

if ($myrow["mon_closed"]) {
    printf("<tr><td><b>Closed</b></td><td>%s-%s-%s</td></tr>", $myrow["mon_closed"], $myrow["day_closed"], $myrow["yr_closed"]);
}

printf("<tr><td><b>Notes</b></td><td>%s</td></tr>", $myrow["notes"]);

// get all open associated todo items
print("<tr><td><b>Active To Do's</b></td></tr>");
$GetTodoSQL = "SELECT system_id, priority, information FROM users, todo, todoxproj WHERE xproj_id = '$id' AND xtodo_id = todo_id AND user_id = todo.owner AND complete = ' ' ORDER BY priority, system_id";
$GetTodo = mysql_query($GetTodoSQL);
while($gettodo = mysql_fetch_array($GetTodo)) {
   printf("<tr><td>%s</td><td>%s - %s</td></tr>", $gettodo["system_id"], $gettodo["priority"], $gettodo["information"]);
}

// get all associated appointment items
print("<tr><td><b>Appointments</b></td></tr>");
$GetProjSQL = "SELECT distinct system_id, appointment.information, month, day, year, time FROM users, appointment, project, apptxproj WHERE xproj_id = '$id' AND xproj_id = proj_id AND appt_id = xappt_id AND user_id = appointment.owner ORDER by month, day, year, time";
$GetProj = mysql_query($GetProjSQL);
while ($getproj = mysql_fetch_array($GetProj)) {
   printf("<tr><td>%s %s-%s-%s %s</td><td>%s</td></tr>", $getproj["system_id"], $getproj["month"], $getproj["day"], $getproj["year"], $getproj["time"], $getproj["information"]);
}

// get all completed associated todo items
print("<tr><td><b>Closed To Do's</b></td></tr>");
$GetTodoSQL = "SELECT system_id, priority, information FROM users, todo, todoxproj WHERE xproj_id = '$id' AND xtodo_id = todo_id AND user_id = todo.owner AND complete != ' ' ORDER BY priority, system_id";
$GetTodo = mysql_query($GetTodoSQL);
while($gettodo = mysql_fetch_array($GetTodo)) {
   printf("<tr><td>%s</td><td>%s - %s</td></tr>", $gettodo["system_id"], $gettodo["priority"], $gettodo["information"]);
}

print("</table>");
include("links.inc"); 
?>
</center>
</body>
</html>
Return current item: Mozart