Location: PHPKode > projects > Internet Task Management System > itms_mysql_build_0111/task.php
<?php

/*
 * ITMS ValleyData source file version 1.0 May 11, 2001
 *
 * Shows information about all tasks user has access to
 *
 *
 * Internet Task Management System: An online system used for recording information about and assigning tasks and processes.
 * Copyright (C) 2001  ValleyData Programming Group
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * See file named "gpl.txt" included with source code or
 * visit http://www.gnu.org/copyleft/gpl.txt on the internet.
 */
$title="Tasks";

include("header.php");

print("<IMG SRC=\"images/current_tasks.jpg\" WIDTH=\"400\" HEIGHT=\"41\" BORDER=\"0\" ALT=\"Current Tasks:\">");

db_open();
db_use();
$query = "SELECT * FROM task_types WHERE group_owned = '0' AND owner='$uid' ORDER BY title";
$result = db_query($query); // display all private tasks

$table_separator_string = "table-separator-even";
$row_separator_num_private = 0;

while($row = db_fetch_row($result))
{
    $row_separator_num_private++;
    if($row_separator_num_private % 2 == 0)
        $table_separator_string = "table-separator-even";
    else
        $table_separator_string = "table-separator-odd";

    $ttid = $row["ttid"];
    $processes_private = get_processes_with_task($ttid);
    $process_size = count($processes_private);
    $processes_string = "";
	$curr = 0;
    foreach($processes_private as $process)
    {
        $curr++;
		if($process_size == $curr)
			$processes_string .= $process["title"];
		else
			$processes_string .= $process["title"] . ", ";
    }
	//Added Columns below for Task Assign, Edit, and Delete Shortcuts - Matt Palmerlee 5/20/2003
    $task_rows_private .= "<tr class=\"$table_separator_string\">\n" .
	"<td><a href=\"task_assign2.php?AT=previous_task&task_type=" . $ttid . "\"><IMG SRC=\"images/assign.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Assign Task\"></a></td>".
	"<td><a href=\"task_edit.php?edit_task_type=" . $ttid . "\"><IMG SRC=\"images/edit.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Edit Task\"></a></td>" .
	"<td><a href=\"task_delete.php?delete_task_type=" . $ttid . "\"><IMG SRC=\"images/delete.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Delete Task\"></a></td></td>" .
	"<td>" . $row["title"] . "</td>\n<td>" . nl2br($row["default_info"]) . "</td>\n<td>" .
    $processes_string . "</td>\n" . "</td>\n</tr>\n";
}

$query = "SELECT * FROM user_groups, task_types " .
"WHERE user_groups.uid = '$uid' AND task_types.group_owned = '1' AND task_types.owner = user_groups.gid ".
"ORDER BY title";

$result = db_query($query); // get all the group-owned tasks user has access to

$table_separator_string = "table-separator-even";
$row_separator_num_group = 0;

while($row = db_fetch_row($result))
{
    $row_separator_num_group++;
    if($row_separator_num_group % 2 == 0)
        $table_separator_string = "table-separator-even";
    else
        $table_separator_string = "table-separator-odd";

    $ttid = $row["ttid"];
    $processes_group = get_processes_with_task($ttid);
    $process_size = count($processes_group);
    $processes_string = "";
	$curr = 0;
    foreach($processes_group as $process)
    {
        $curr++;
		if($process_size == $curr)
			$processes_string .= $process["title"];
		else
			$processes_string .= $process["title"] . ", ";
    }
    $task_owner = get_group_name($row["gid"]);
	//Added Columns below for Task Assign, Edit, and Delete Shortcuts - Matt Palmerlee 5/20/2003
    $task_rows_group .= "<tr class=\"$table_separator_string\">\n".
	"<td><a href=\"task_assign2.php?AT=previous_task&task_type=" . $ttid . "\"><IMG SRC=\"images/assign.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Assign Task\"></a></td>".
	"<td><a href=\"task_edit.php?edit_task_type=" . $ttid . "\"><IMG SRC=\"images/edit.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Edit Task\"></a></td>" .
	"<td><a href=\"task_delete.php?delete_task_type=" . $ttid . "\"><IMG SRC=\"images/delete.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Delete Task\"></a></td></td>" .
	"<td>" . $row["title"] . "</td>\n<td>" . nl2br($row["default_info"]) . "</td>\n<td>$task_owner</td>\n<td>" . $processes_string . "</td>\n" . "</td>\n</tr>\n";
}

?>

<H3>Private Tasks:</H3>
<a href="task_create.php"><IMG SRC="images/task_create.jpg" WIDTH="120" HEIGHT="35" BORDER="0" ALT="Create Task"></a>
<table border="0">
<tr class="table-header">
<td colspan="3">Assign/Edit/Delete</td><td>Name</td><td>Description</td><td>Processes Task is in</td>
</tr>
<?php
if($row_separator_num_private != 0)
{
	print($task_rows_private);
}
else
{
	print("<tr class=\"$table_separator_string\"><td colspan=\"6\">No Private Tasks</td></tr>\n");
}
?>
</table>
<H3>Group Tasks:</H3>
<a href="task_create.php"><IMG SRC="images/task_create.jpg" WIDTH="120" HEIGHT="35" BORDER="0" ALT="Create Task"></a>
<table border="0">
<tr class="table-header">
<td colspan="3">Assign/Edit/Delete</td><td>Name</td><td>Description</td><td>Owned By</td><td>Processes Task is in</td>
</tr>
<?php
if($row_separator_num_group != 0)
	print($task_rows_group);
else
	print("<tr class=\"$table_separator_string\"><td colspan=\"7\">No Group Tasks</td></tr>\n");
?>
</table>
<p>

<?php include("footer.php"); ?>
Return current item: Internet Task Management System