📄 user_tasks_reassign.php
字号:
<?php/* * ITMS ValleyData source file version 1.0 May 11, 2001 * * This page allows ITMS administrators to reassign a user's pending tasks * * * * 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="Reassign Tasks";include("header.php");include("adminonly.php");if(isset($reassign_now)) // Test if we want to reassign tasks{ for($i = 0; $i < $num_tasks; $i++) //Loop for each task the user has assigned to them { $ttid = "id" . $i; $reassigntask_touser = "reassigntask_touser" . $i; $ttid = $$ttid; $reassigntask_touser = $$reassigntask_touser; $this_task_name = get_pending_task_name($ttid); if($reassigntask_touser == "*Unassign Task*") //if the task is to be unassigned { db_open(); db_use(); $query = "SELECT * FROM pending_tasks, users WHERE tid='$ttid' AND users.user_id='$userto_reassign'"; $result = db_query($query); while($row = db_fetch_row($result)) { $tid = $ttid; $unassignedBy_email = get_user_email($user_id); //send notification notifyUnassigned( $row["TITLE"], $row["EMAIL"], $row["ASSIGNEDTO"], get_user_name($row["ASSIGNER"]), $unassignedBy_email, $row["INFO"], $row["DUE_DATE"], get_priority_string($row["PRIORITY"]), $row["HTML"]); if($row["ASSIGNER"] != $user_id) //if the assigner is not the current user { $assignedBy_email = get_user_email($row["ASSIGNER"]); notifyUnassigned( $row["TITLE"], $assignedBy_email, $row["ASSIGNEDTO"], get_user_name($row["ASSIGNER"]), $unassignedBy_email, $row["INFO"], $row["DUE_DATE"], get_priority_string($row["PRIORITY"]), $row["HTML"]); } $query = "DELETE FROM pending_tasks WHERE tid = '$tid'"; db_query($query); message_box("$this_task_name has been unassigned."); } } else if($userto_reassign != $reassigntask_touser) //If this task has been selected to be reassigned { $old_to = get_user_email($userto_reassign); $new_to = get_user_email($reassigntask_touser); $old_name = get_user_name($userto_reassign); $new_name = get_user_name($reassigntask_touser); $my_email = get_user_email($user_id); db_open(); db_use(); $query = "UPDATE pending_tasks SET user_id='$reassigntask_touser' WHERE tid='$ttid'"; if(db_query($query)) //Change who the task is assigned to { message_box("$this_task_name has been reassigned to $new_name"); $query = "SELECT tid, title, name, priority, due_date, date_assigned, info FROM pending_tasks, users WHERE pending_tasks.tid='$ttid'"; $result = db_query($query); $row = db_fetch_row($result); $info = $row["INFO"]; $due_date = $row["DUE_DATE"]; $priority = $row["PRIORITY"]; $priority = get_priority_string($priority); //send email notification that the task was unassigned to old assignee notifyUnassigned($this_task_name, $old_to, $old_name, $user, $my_email, $info, $due_date, $priority); //send email noticication that the task was assigned to new assignee notifyAssigned($this_task_name, $new_to, $new_name, $user, $my_email, "", $info, $due_date, $priority); } else { error_out("Couldn't reassign task $this_task_name", "LOG_WARNING"); message_box("Couldn't reassign task: $this_task_name", "error"); } } else message_box("$this_task_name was not reassigned"); }}//end if(isset($reassign_now))print("<IMG SRC=\"images/user_tasks_reassign.jpg\" WIDTH=\"400\" HEIGHT=\"41\" BORDER=\"0\" ALT=\"Reassign Tasks\">");?><H3><B>Reassign<?php if(isset($userto_reassign)){ $userto_reassign_name = get_user_name($userto_reassign); print($userto_reassign_name . "'s ");}?>Tasks</B></H3><table><tr><td> <form METHOD=POST action="user_tasks_reassign.php"> <table> <tr> <td>Available Users for Task Reassignment:</td> </tr> <tr> <td> <?php print("<SELECT NAME=\"userto_reassign\">"); $user_array = get_all_users(); if($user_array) foreach ($user_array as $usr) { $selected=""; if($usr["USER_ID"] == $userto_reassign) $selected = "selected"; print("<option $selected value=\"" . $usr["USER_ID"] . "\">" . $usr["NAME"] . "</option>\n"); } print("</SELECT>"); ?> <INPUT TYPE="submit" value="Select User"> <INPUT TYPE="button" value="Cancel" onClick="location='index.php'"> </td> </table> </form></td></tr></table><?php$PENDING_START = <<<PENDING_START<table><tr><td> <B>Pending Tasks Currently Assigned to $userto_reassign_name:</B> <table border="0"> <tr class="table-header"> <td><a href="user_tasks_reassign.php?orderby=taskname">Task Name</a></td> <td><a href="user_tasks_reassign.php?orderby=assigned">Assigned By</a></td> <td><a href="user_tasks_reassign.php?orderby=priority">Priority</a></td> <td><a href="user_tasks_reassign.php?orderby=duedate">Due Date</a></td> <td>Reassign To</td> </tr> <form name="reassign_tasks" METHOD="POST" ACTION="user_tasks_reassign.php">PENDING_START;$PENDING_END = <<<PENDING_END <tr class="table-header"> <td> </td> <td> </td> <td> </td> <td> </td> <td> <INPUT TYPE="hidden" name="reassign_now" value="reassign_now"> <INPUT TYPE="submit" value="Reassign Tasks" name="reassign"> </td> </tr> </form> </table><br>PENDING_END;if(isset($userto_reassign)) // Test if a user has been picked{ if($orderby == "taskname") { $orderby = "title"; } else if($orderby == "assigned") { $orderby = "name"; } else if($orderby == "priority") { $orderby = "priority DESC"; } else if($orderby == "duedate") { $orderby = "due_date"; } else { $orderby = "due_date"; } db_open(); db_use(); $query = "SELECT tid, title, name, priority, due_date, date_assigned, info FROM pending_tasks, users WHERE pending_tasks.user_id = '$userto_reassign' AND pending_tasks.assigner = users.user_id ORDER BY $orderby"; $result = db_query($query); // Get all pending tasks for the selected user $table_separator_string = "table-separator-even"; $row_separator_num = 0; if($result) { print($PENDING_START); $tnum = 0; while($row = db_fetch_row($result)) // Show the details for each pending task { $row_separator_num++; if($row_separator_num % 2 == 0) $table_separator_string = "table-separator-even"; else $table_separator_string = "table-separator-odd"; $priority = get_priority_string($row["PRIORITY"]); print("<tr class=\"$table_separator_string\">\n"); print(" <td>" . $row["TITLE"] . "</td>\n"); print(" <td>" . $row["NAME"] . "</td>\n"); print(" <td>" . $priority . "</td>\n"); print(" <td>" . convert_date($row["DUE_DATE"]) . "</td>\n"); print("<td><SELECT NAME=\"reassigntask_touser$tnum\">"); // Put "unassign task" option in list box print("<option value=\"*Unassign Task*\"><Unassign Task></option>\n"); $user_array = get_all_users(); if($user_array) foreach ($user_array as $usr) // Put appropriate users in list box { $selected=""; if($usr["USER_ID"] == $userto_reassign) $selected = "selected"; print("<option $selected value=\"" . $usr["USER_ID"] . "\">" . $usr["NAME"] . "</option>\n"); } print("</SELECT></td>"); print("</tr>\n"); print("<tr class=\"$table_separator_string\">\n"); print("<td> </td>"); print("<td colspan=\"4\">Assigned On: " . $row["DATE_ASSIGNED"] . "<br>\n" . $row["INFO"] . "</td>"); print("</tr>"); print("<INPUT TYPE=\"hidden\" name=\"id" . $tnum . "\" value=\"" . $row["TID"] . "\">\n"); $tnum++; } print("<INPUT TYPE=\"hidden\" name=\"num_tasks\" value=\"$tnum\">"); print("<INPUT TYPE=\"hidden\" name=\"userto_reassign\" value=\"$userto_reassign\">"); print($PENDING_END); }}//end if(isset($userto_reassign))include("footer.php");?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -