login.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <form action="LoginChuLi.php" method="post"> <div>用户名:<input type="text" name="uid"/></div> <br /> <div>密码 :<input type="text" name="pwd"/></div> <input type="submit" value="登陆" /> </form> </body> </html>
LginChuLi.php
<?php session_start(); $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; include("../../Public/Connect.class.php"); $con = new Connect(); $sql = "select count(*) from Users where UserName = '{$uid}' and Password = '{$pwd}'"; $str = $con->Query_string($sql); if($str==1) { $_SESSION["uid"] = $uid; header("location:Main.php"); } else { header("location:Login.html"); } ?>
Main.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> *{border:0; padding:0; margin:0} .top {800px; height:50px; background:#E9E9E9; color:#00F; margin:0 auto;} .menu { text-align:center; 100px; line-height:50px; float:left;} .menu a{ text-decoration:none;} </style> </head> <body> <h1>主页面</h1> <div class="top"> <div class="menu"><a href="XinJianLC.php">新建流程</a></div> <div class="menu"><a href="FaQi.php">发起流程</a></div> <div class="menu"><a href="ChuLi.php">流程处理</a></div> </div> </body> </html>
XinJianLC.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="../../Public/jquery/jquery-1.12.3.min.js"></script> <title>无标题文档</title> </head> <body> <h1>新建流程</h1> <div>请选择人员代号:</div><br /> <div> <?php session_start(); include('../../Public/Connect.class.php'); $con = new Connect(); $s1 = 'select UserName,Name from users'; $users = $con->Query_array($s1); foreach($users as $u) { echo "<input type='radio' name='user' value ='{$u[0]}' class='user'}/>{$u[1]}"; } ?> </div><br /> <div><input type="button" value="添加节点" id="add"/></div> <br /> <?php if(empty($_SESSION['user'])) { echo '节点人员为空!'; } else { $arr = $_SESSION['user']; foreach($arr as $k=>$v) { $s2 = "select Name from users where UserName = '{$v}'"; $name = $con->Query_string($s2); echo "<div>{$k} {$name} <input type='button' value='删除' name='{$k}' class='del'/></div>"; } } ?> <br /> <div>请输入流程名称:<input type="text" id="lcn" /></div> <br /> <div><input type="button" id="sure" value="添加流程"/></div> <br /> <div><a href="Main.php">返回主页</a></div> </body> </html> <script type="text/javascript"> $(document).ready(function(e) { //添加节点 $("#add").click(function(e) { var uid = $(".user:checked").val(); $.ajax({ url:'addJD.php', data:{uid:uid}, type:'POST', dataType:'TEXT', success: function() { window.location = 'XinJianLC.php'; } }) }); //删除节点 $(".del").click(function(e) { var code = $(this).attr("name"); $.ajax({ url:'delJD.php', data:{code:code}, type:'POST', dataType:'TEXT', success: function() { window.location = 'XinJianLC.php'; } }) }); //添加流程 $("#sure").click(function(e) { var lcn = $("#lcn").val(); $.ajax({ url:"Add.php", data:{lcn:lcn}, type:"POST", dataType:"TEXT", success: function(a) { alert(a); } }) }); }); </script>
AddJd.php
<?php session_start(); $uid = $_POST['uid']; if(empty($_SESSION['user'])) { $att = array($uid); $_SESSION['user'] = $att; } else { $att = $_SESSION['user']; array_push($att,$uid); $_SESSION['user'] = $att; } ?>
DelJD.php
<?php session_start(); $code = $_POST['code']; $arr = $_SESSION['user']; unset($arr[$code]); array_values($arr); $_SESSION['user'] = $arr; ?>
Add.php
<?php session_start(); $lcn = $_POST['lcn']; include('../../Public/Connect.class.php'); $con = new Connect(); if(empty($_SESSION['user'])) { echo '请添加节点人员!'; } else { $arr = $_SESSION['user']; $code = date('YmdHis',time()); $s1 = "insert into liucheng values('{$code}','{$lcn}')"; if($con->Query_string($s1,0)) { foreach($arr as $k=>$v) { $s2 = "insert into flowpath values('','{$code}','{$v}','{$k}')"; $con->Query_string($s2,0); } } echo '添加成功!'; } ?>
FaQi.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="../../Public/jquery/jquery-1.12.3.min.js"></script> <title>无标题文档</title> </head> <body> <h1>发起流程</h1> <div>请选择流程: <select id="lc"> <?php include('../../Public/Connect.class.php'); $con = new Connect(); $s1 = "select * from liucheng"; $arr = $con->Query_array($s1); foreach($arr as $v) { echo "<option value='{$v[0]}'>{$v[1]}</option>"; } ?> </select> </div> <br /> <div>请输入内容:</div> <div><textarea id="nr" style="min-height:200px; min-400px;"></textarea></div> <br /> <div><input type="button" value="提交流程" id="fq" /></div> <br /> <div><a href="Main.php">返回主页</a></div> </body> </html> <script type="text/javascript"> $(document).ready(function(e) { $("#fq").click(function(e) { var code = $("#lc").val(); var nr = $("#nr").val(); $.ajax({ url:"FQcl.php", data:{code:code,nr:nr}, type:"POST", dataType:"TEXT", success: function(data) { alert(data); } }) }); }); </script>
FQcl.php
<?php session_start(); $code = $_POST['code']; $nr = $_POST['nr']; include('../../Public/Connect.class.php'); $con = new Connect(); $uid = $_SESSION['uid']; $rq = date('Y-m-d H:i:s',time()); $s1 = "insert into userflow values('','{$code}','{$uid}','{$nr}',false,'{$rq}',0)"; if($con->Query_array($s1,0)) { echo "提交成功!"; } else { echo "提交失败!"; } ?>
ChuLi.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="../../Public/jquery/jquery-1.12.3.min.js"></script> <title>无标题文档</title> </head> <body> <table cellpadding="0" cellspacing="0" border="1" width="100%"> <tr> <td>流程名称</td> <td>提交用户</td> <td>内容</td> <td>是否结束</td> <td>提交时间</td> <td>操作</td> </tr> <?php session_start(); $uid = $_SESSION['uid']; include('../../Public/Connect.class.php'); $con = new Connect(); $s1 = "select * from userflow"; $arr = $con->Query_array($s1); foreach($arr as $att) { list($ids,$code,$yh,$nr,$isOK,$rq,$where) = $att; //根据用户名和流程代号查出登陆者在流程中的次序 $s2 = "select Orders from flowpath where Uids = '{$uid}' and Code = '{$code}'"; $order = $con->Query_string($s2); if($where>=$order) { //处理流程名称 $s3 = "select Name from liucheng where Code = '{$code}'"; $name = $con->Query_string($s3); //处理提交用户 $s4 = "select Name from users where UserName = '{$yh}'"; $user = $con->Query_string($s4); //处理是否结束 $ok = $isOK?"<span style='color:red'>已结束</span>":"<span>处理中</span>"; //处理操作 $cz = $where==$order?"<a href='shenhe.php?ids={$ids}'>审核</a>":"<span style='color:blue'>已通过</span>"; echo "<tr> <td>{$name}</td> <td>{$user}</td> <td>{$nr}</td> <td>{$ok}</td> <td>$rq</td> <td>{$cz}</td> </tr>"; } } ?> </table> </body> </html>
shenhe.php
<?php $ids = $_GET['ids']; include('../../Public/Connect.class.php'); $con = new Connect(); $s1 = "update userflow set ToWhere = ToWhere+1 where Ids = '{$ids}'"; $con->Query_string($s1,0); //找到流程代号 $s2 = "select Code,ToWhere from userflow where Ids = '{$ids}'"; $arr = $con->Query_array($s2); $code = $arr[0][0]; $where = $arr[0][1]; //根据流程代号查节点个数 $s3 = "select count(*) from flowpath where Code = '{$code}'"; $num = $con->Query_string($s3); if($where>=$num) { $s4 = "update userflow set IsOK = true where Ids = '{$ids}'"; $con->Query_string($s4,0); } header("location:ChuLi.php"); ?>