Location: PHPKode > projects > PHP Project Manager > index.php
<?php
include "includes/header.php";
?>
<!-- VIEW TASK BREAKDOWN -->
<h2>View Task List</h2>
<div id="main_table">
	<table cellspacing="0" cellpadding="2">
		<tr>
			<th class="tablehead" width="8%">Create Date</th>
			<th class="tablehead" style="text-align:left" width="20%">Task</th>
			<th class="tablehead" style="text-align:left" width="20%">Project</th>
			<th class="tablehead" width="14%">Status</th>
			<th class="tablehead" width="10%">Target Date</th>
			<th class="tablehead" width="10%">Time Taken (mins)</th>
			<th class="tablehead" width="12%">Total Time</th>
			<th class="tablehead" width="5%">Amount Due</th>
			<th class="tablehead" width="3%">&nbsp;</th>
			<th class="tablehead" width="3%">&nbsp;</th>
		</tr>
<?php
include 'scripts/db.php';

   // connect to mysql
   $connection=mysql_connect($hostName,$username,$password)
   or die("Unable to connect to SQL Server");
   // connect to database
	mysql_select_db($databaseName,$connection)
	or die("Unable to select database");
		
	// query
	$query = "SELECT * from ".$d_ext."tasks ORDER BY Task_Target_Date;";

	// run query
	$result=mysql_query($query, $connection)
	or die("Unable to run query on database");
	// fetch results
	$rowCheck=0;
	for ($rowCounter = 0;$row = @ mysql_fetch_array($result);$rowCounter++) 
	{
	//  Don't Display Archive or Suspended Tasks
	if (($row['Task_Status']<>"Archive")&($row['Task_Status']<>"Suspended"))
	{
	echo "\n<form method=\"post\" action=\"scripts/updatetask.php\">";		
	if(($rowCheck%2)==1)
	$color_class="class1";
	else
	$color_class="class2";
	echo "<tr>";
	$rowCheck++;	
	$create_date=date_sort($row['Task_Date_Created']);
	echo "\n<td class=\"".$color_class."\">" . $create_date . "</td>";
	echo "\n<td class=\"".$color_class."\" style=\"text-align:left;\" title=\"" . stripslashes($row['Task_Description']) . "\"><a href=\"viewtask.php?id=" . $row['Task_Ref']."\">" . stripslashes($row['Task_Name']) . "</a></td>";
	echo "\n<td class=\"".$color_class."\" style=\"text-align:left;\"><a href=\"viewproject.php?id=".stripslashes($row['Task_Project_ID'])."\">" . stripslashes($row['Task_Project_ID']) . "</a></td>";	
	echo "\n<td class=\"".$color_class."\"><select id=\"task_status\" name=\"task_status\">";
	load_statuses($row['Task_Status']);
	echo "\n</select></td>";
	$target=$row['Task_Target_Date'];
	$day=substr($target,8,2);
	$mth=substr($target,5,2);
	$year=substr($target,2,2);
	$target_date=$day."/".$mth."/".$year;
	$today = date("Y-m-d");
	echo "\n<td class=\"".$color_class."\"	><input";
	$today = date("Y-m-d"); 
	if ($target<$today) echo " class=\"past_target\"";
	if ($target==$today) echo " class=\"due_today\"";
	$target_date=date_sort($row['Task_Target_Date']);
	echo " id=\"task_target\" name=\"task_target\" type=\"text\" size=\"7\" maxlength=\"8\" value=\"" . $target_date . "\" /></td>";
	echo "\n<td class=\"".$color_class."\"><input id=\"task_time\" name=\"task_time\" type=\"text\" size=\"4\" value=\"0\" maxlength=\"5\" /></td>";
	$hrs=floor($row['Task_Time_Spent']/60);
	$mins=$row['Task_Time_Spent']%60;
	echo "\n<td class=\"".$color_class."\">" . $hrs . "h:" . $mins . "m";
	echo "<input type=\"hidden\" id=\"task_id\" name=\"task_id\" value=\"" . $row['Task_Ref'] . "\" />";
	echo "<input type=\"hidden\" id=\"task_total\" name=\"task_total\" value=\"" . $row['Task_Time_Spent'] . "\" />";
	echo "<input type=\"hidden\" id=\"task_project\" name=\"task_project\" value=\"" . $row['Task_Project_ID'] . "\" />";
	echo "</td>";
	$Task_Due=($row['Flat_fee']+($row['Hourly_rate']*($row['Task_Time_Spent']/60)));
	$Task_Due=number_format($Task_Due, 2, '.', '');
	echo "\n<td class=\"".$color_class."\">" . $Task_Due;
	echo "</td>";
	echo "\n<td class=\"".$color_class."\"><input type=\"image\" src=\"images/button_update.gif\" style=\"margin-right:5px;border:0;\" alt=\"Update\" /></td>";
	if($row['Task_Time_Spent']==0)
	echo "\n<td class=\"".$color_class."\"><img src=\"images/button_delete.gif\" alt=\"Delete\" onclick=\"delete_task(" . $row['Task_Ref'] . ");\" /></td>";
	else echo "\n<td class=\"".$color_class."\">&nbsp;</td>";
	echo "\n</tr>\n</form>";
	
	}
	}
	// close database connection
	mysql_close($connection);
?>	
	</table>
</div>
<!--/ VIEW TASK BREAKDOWN -->
</div>
<!--/ MAIN CONTENT AREA -->
<?php
include "includes/footer.php";
?>
Return current item: PHP Project Manager