php项⽬实战流程_⼀个完整的php流程管理实例代码分享1. 添加新流程页⾯:
请选择流程节点:
session_start();
include("../DBDA.class.php");
$db = new DBDA();
$suser ="select * from users";
$auser = $db->Query($suser);
foreach($auser as $v)
{
echo " {$v[2]} ";
}
>
$attr = array();
if(!empty($_SESSION["user"]))
{
$attr = $_SESSION["user"];
}
foreach($attr as $k=>$v)如何运行php项目
{
$sname = "select name from users where uid='{$v}'";
$name = $db->StrQuery($sname);
echo "
{$k}--{$name}--
";
}
>
请输⼊流程名称:
$("#jiedian").click(function(){
//取选中的⽤户名
var uid ="";
var rd = $(".rd");
for(var i=0;i
{
if(rd.eq(i).prop("checked"))
{
uid = rd.eq(i).val();
}
}
$.ajax({
url:"chuli.php",
data:{uid:uid,type:0}, type:"POST", dataType:"TEXT",
success: function(data){ window.location.href="add.php"; }
});
})
$(".shanchu").click(function(){ var sy = $(this).attr("bs");
$.ajax({
url:"chuli.php",
data:{sy:sy,type:1}, type:"POST", dataType:"TEXT",
success: function(data){ window.location.href="add.php"; }
});
})
$("#xinjian").click(function(){
var name = $("#name").val(); $.ajax({
url:"chuli.php",
data:{name:name,type:2}, type:"POST", dataType:"TEXT",
success: function(data){
window.location.href="add.php";
}
});
})
2. 添加新流程(及其他)处理页⾯:<?php session_start();
include("../DBDA.class.php");
$db = new DBDA();
$type = $_POST["type"];
switch($type)
{
case 0:
$uid = $_POST["uid"];
if(empty($_SESSION["user"]))
{
$_SESSION["user"] = array($uid);
}
else
{
$attr = $_SESSION["user"];
$attr[] = $uid;
$_SESSION["user"] = $attr;
}
break;
case 1:
$sy = $_POST["sy"];
$attr = $_SESSION["user"];
unset($attr[$sy]);
$attr = array_values($attr);
$_SESSION["user"] = $attr;
break;
case 2:
$name = $_POST["name"];
$code = time();
$slc = "insert into liucheng values('{$code}','{$name}')"; //liucheng 名字 代号
$db->Query($slc,0);
$attr = array();
if(!empty($_SESSION["user"]))
{
$attr = $_SESSION["user"];
}
foreach($attr as $k=>$v)
{
$sfp = "insert into flowpath values('','{$code}','{$v}','{$k}')"; //flowpath 流程具体经过哪些⼈
$db->Query($sfp,0);
}
break;
case 3:
$code = $_POST["code"];
$nr = $_POST["nr"];
$uid = $_SESSION["uid"];
$rq = time();
$sql = "insert into userflow values('','{$code}','{$uid}','{$nr}',0,'{$rq}',0)"; //userflow 流程具体内容,名字,发起⼈
$db->Query($sql,0); //,内容,是否通过,事件,进⾏到哪⼀步
break;
}
3. 登录后主页⾯:
发起者发起时间流程名称流程内容是否结束操作session_start();
include("../DBDA.class.php");
$db = new DBDA();
$uid = $_SESSION["uid"];
$sql = "select * from userflow";
$attr = $db->Query($sql);
foreach($attr as $v)
{
$v[1];//流程代号
$v[6]; //流程⾛到哪了
//根据流程代号和当前登录者⽤户名查orders
$szai="select count(*) from flowpath where code='{$v[1]}' and uids='{$uid}'"; $n = $db->StrQuery($szai);
//该⼈员在该流程下
if($n>0)
{
$sorder = "select orders from flowpath where code='{$v[1]}' and uids='{$uid}'"; $order = $db->StrQuery($sorder);
if($v[6]>=$order)
{
$str = "";
if($v[6]==$order)
{
$str = "";
}
else
{
$str = "已处理";
}
echo "
{$v[2]}{$v[5]}{$v[1]}{$v[3]}{$v[4]}{$str}";
}
}
}
>
4. 发起流程页⾯:
发起流程
请选择要发起的流程:
include("../DBDA.class.php");
$db = new DBDA();
$sql = "select * from liucheng";
$attr = $db->Query($sql);
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论