📄 process_create.php
字号:
<?php/* * ITMS ValleyData source file version 1.0 May 11, 2001 * * To create process * * * 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="Create Process";include("header.php");print("<IMG SRC=\"images/create_process.jpg\" WIDTH=\"400\" HEIGHT=\"41\" BORDER=\"0\" ALT=\"Create Process\">");$process_name = trim(make_clean($process_name));$process_info = trim(make_clean($process_info));if(isset($create_process_now)) // if the user has hit the 'create process' button{ if($process_name != "") { //make sure that name isn't taken db_open(); db_use(); $query = "SELECT * FROM processes WHERE title like '$process_name'"; $result = db_query($query); if(db_fetch_row($result)) { message_box("That name is already in use.", "error"); } else { //make sure at least one task is in the process $empty = true; $query = "SELECT ttid FROM task_types"; $result = db_query($query); while($empty && $row = db_fetch_row($result)) { $ttid = $row["TTID"]; $cb = "cb$ttid"; if(isset($$cb)) { $empty = false; } } if(!$empty) { //create the new process $group_owned = ($owner == "group_task") ? "1" : "0"; $owned_by = ($owner == "group_task") ? $group_num : $user_id; $query = "INSERT INTO processes (title, owner, group_owned, default_info) " . "VALUES ('$process_name', '$owned_by', '$group_owned', '$process_info')"; db_query($query); //get the new process' pid $query = "SELECT pid FROM processes WHERE title = '$process_name'"; $result = db_query($query); if($row = db_fetch_row($result)) { $pid = $row["PID"]; $query = "SELECT ttid FROM task_types"; $result = db_query($query); while($row = db_fetch_row($result)) { $ttid = $row["TTID"]; $cb = "cb$ttid"; if(isset($$cb)) { $query = "INSERT INTO process_tasks (pid, ttid) VALUES ('$pid', '$ttid')"; db_query($query); // insert process into DB } } message_box("Process created.", "info"); } else { message_box("There was an error creating the process.", "error"); } } else { message_box("Process must contain at least one task. Process was not created.<br>\n", "error"); } } } else { message_box("Name cannot be blank. Process was not created.<br>\n", "error"); }}?><form method="post" action="process_create.php"><table><tr> <td> Name: <INPUT TYPE="text" NAME="process_name" value="Process Name" size="49"> </td></tr><tr> <td> <TEXTAREA NAME="process_info" ROWS="10" COLS="47">Type Additional Instructions for the Process Here</TEXTAREA> </td></tr><tr> <td> Owner of Process: </td></tr><tr> <td> <INPUT TYPE="radio" NAME="owner" value="group_task" checked>Group Process <SELECT NAME="group_num"> <?php $all_groups = get_all_groups(); foreach($all_groups as $a_group) // display all groups { if(is_user_in_group($user_id, $a_group["GID"])) print("<option value=\"" . $a_group["GID"] . "\">" . $a_group["GROUPNAME"] . "</option>"); } ?> </SELECT> </td><tr> <td> <INPUT TYPE="radio" NAME="owner" value="private_task">Private Process </td></tr><tr> <td> Which tasks do you want in this process: </td></tr></table><table border="0"><tr class="table-header"> <td> Task Name </td> <td> Task Owner </td></tr><?php //display all of the tasks that the user can perform db_open(); db_use(); $queryPrivate = "SELECT title, ttid FROM task_types " . "WHERE group_owned = '0' AND owner = '$user_id' ORDER BY title"; $queryGroup = "SELECT gid, title, ttid FROM user_groups, task_types " . "WHERE user_groups.user_id = '$user_id' AND task_types.group_owned = '1' AND task_types.owner = user_groups.gid ". "ORDER BY title"; $row_separator_num = 0; $resultPrivate = db_query($queryPrivate); // display private task templates while($row = db_fetch_row($resultPrivate)) { $row_separator_num++; if($row_separator_num % 2 == 0) $table_separator_string = "table-separator-even"; else $table_separator_string = "table-separator-odd"; print("<tr class=\"$table_separator_string\">\n"); print("<td><input type=\"checkbox\" name=\"cb" . $row["TTID"] . "\"> " . $row["TITLE"] . "</td>\n"); print("<td>$user</td>\n"); print("</tr>\n"); } $resultGroup = db_query($queryGroup); // display group owned task templates while($row = db_fetch_row($resultGroup)) { $row_separator_num++; if($row_separator_num % 2 == 0) $table_separator_string = "table-separator-even"; else $table_separator_string = "table-separator-odd"; $task_owner = get_group_name($row["GID"]); print("<tr class=\"$table_separator_string\">\n"); print("<td><input type=\"checkbox\" name=\"cb" . $row["TTID"] . "\"> " . $row["TITLE"] . "</td>\n"); print("<td>$task_owner</td>\n"); print("</tr>\n"); }?></table><p><table><tr> <td> <INPUT TYPE="hidden" name="create_process_now" value="true"> <INPUT TYPE="submit" value="Create Process"> </td> <td> <INPUT TYPE="button" value="Finished" onClick="location='index.php'"> </td></tr></table><p></form><?php include("footer.php"); ?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -