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

/*
 * ITMS ValleyData source file version 1.0 May 11, 2001
 *
 * Shows information about all processes 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="Processes";

include("header.php");

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

db_open();
db_use();
$query = "SELECT * FROM processes WHERE group_owned = '0' AND owner = '$uid' ORDER BY title";
$result = db_query($query); // display processes you have access to

$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";

    $pid = $row["pid"];
    $tasks_private = get_tasks_in_process($pid);
    $task_size = count($tasks_private);
    $tasks_string = "";
	$curr = 0;
    foreach($tasks_private as $task)
    {
        $curr++;
		if($task_size == $curr)
			$tasks_string .= $task["title"];
		else
			$tasks_string .= $task["title"] . ", ";
    }
	//Added Columns below for Process Assign, Edit, and Delete Shortcuts - Matt Palmerlee 5/20/2003
    $process_rows_private .= "<tr class=\"$table_separator_string\">\n" .
	"<td><a href=\"process_assign2.php?process=" . $pid . "\"><IMG SRC=\"images/assign.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Assign Process\"></a></td>".
	"<td><a href=\"process_edit.php?edit_process_id=" . $pid . "\"><IMG SRC=\"images/edit.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Edit Process\"></a></td>" .
	"<td><a href=\"process_delete.php?delete_process_id=" . $pid . "\"><IMG SRC=\"images/delete.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Delete Process\"></a></td></td>" .
	"<td>" . $row["title"] . "</td>\n<td>" . nl2br($row["default_info"]) . "</td>\n<td>" .
    $tasks_string . "</td>\n" . "</td>\n</tr>\n";
}

$query = "SELECT * FROM user_groups, processes " .
"WHERE user_groups.uid = '$uid' AND processes.group_owned = '1' AND processes.owner = user_groups.gid ".
"ORDER BY title";
$result = db_query($query); // get all the processes 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";

    $pid = $row["pid"];
    $tasks_group = get_tasks_in_process($pid);
    $task_size = count($tasks_group);
    $tasks_string = "";
	$curr = 0;
    foreach($tasks_group as $task)
    {
        $curr++;
		if($task_size == $curr)
			$tasks_string .= $task["title"];
		else
			$tasks_string .= $task["title"] . ", ";
    }
    $process_owner = get_group_name($row["gid"]);
	//Added Columns below for Process Assign, Edit, and Delete Shortcuts - Matt Palmerlee 5/20/2003
    $process_rows_group .= "<tr class=\"$table_separator_string\">\n" .
	"<td><a href=\"process_assign2.php?process=" . $pid . "\"><IMG SRC=\"images/assign.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Assign Process\"></a></td>".
	"<td><a href=\"process_edit.php?edit_process_id=" . $pid . "\"><IMG SRC=\"images/edit.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Edit Process\"></a></td>" .
	"<td><a href=\"process_delete.php?delete_process_id=" . $pid . "\"><IMG SRC=\"images/delete.jpg\" WIDTH=\"25\" HEIGHT=\"25\" BORDER=\"0\" ALT=\"Delete Process\"></a></td></td>" .
	"<td>" . $row["title"] . "</td>\n<td>" . nl2br($row["default_info"]) . "</td>\n<td>$process_owner</td>\n<td>" .
    $tasks_string . "</td>\n" . "</td>\n</tr>\n";
}

?>

<H3>Private Processes:</H3>
<a href="process_create.php"><IMG SRC="images/process_create.jpg" WIDTH="150" HEIGHT="35" BORDER="0" ALT="Create Process"></a>
<table border="0">
<tr class="table-header">
<td colspan="3">Assign/Edit/Delete</td><td>Name</td><td>Description</td><td>Tasks in Process</td>
</tr>
<?php
if($row_separator_num_private != 0)
	print($process_rows_private);
else
	print("<tr class=\"$table_separator_string\"><td colspan=\"6\">No Private Processes</td></tr>\n");
?>
</table>
<H3>Group Processes:</H3>
<a href="process_create.php"><IMG SRC="images/process_create.jpg" WIDTH="150" HEIGHT="35" BORDER="0" ALT="Create Process"></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>Tasks in Process</td>
</tr>
<?php
if($row_separator_num_group != 0)
	print($process_rows_group);
else
	print("<tr class=\"$table_separator_string\"><td colspan=\"7\">No Group Processes</td></tr>\n");
?>
</table>
<p>

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