PHP Process Control (new process)

Source: Internet
Author: User

Process Control, is also a widely used in office automation and other internal custom processes and auditing functions. such as leave process Ah, apply for office supplies funds, reimbursement applications Ah, and so on, need layers of approval through to complete (according to the regulations, best not leapfrog, you say yes)

Not accustomed to a blog too long, see, this article we first realize the process of new

Look first.

1. There is a drop-down select User, which can be added sequentially to the node location of the process.

2. Show each node of the process below

3. Fill in the process name, click Save to complete the new process

The database requires three tables, 1. User table 2. Process table 3. Process Node Table

Select Users and Add Nodes button

<Div>Please select User:<SelectID= "SEL">            <?php session_start (); Require ".            /database.class.php ";            $db =new DataBase ();            $sql = "SELECT * from users";            $arr = $db->query ($sql);                foreach ($arr as $v) {echo "<option>{$v [2]}</option>"; }                ?>        </Select><inputtype= "button"ID= "Add"value= "Add to process node"/></Div><BR/><Div>

Add an event to a button

1 $ ("#add"). Click (function () {2 var uid=$ ("#sel"). Val ();3 $.ajax ({4 URL: "addjd.php",5 Data:{uid:uid},6 type: "POST",7 dataType: "TEXT",8 success:function (data) {9                 Ten                  One window.location.href= "newbuild.php"; A                 } -          -          the          -         }) -});

Handling Page addjd.php

1<?PHP2 Session_Start();3 $uid=$_post["UID"];4 if(Empty($_session["UID"]))5 {6     $arr=Array($uid);7     $_session["UID"]=$arr;8     }9 Else{Ten      One     $arr=$_session["UID"]; A     $arr[]=$uid; -     $_session["UID"]=$arr; -      the     } -  -?>

Load node Information

<div><?PHPif(Empty($_session["UID"])){    Echo"You have not added any nodes"; }Else{    $arr 2=$_session["UID"]; foreach($arr 2  as $k=$v)    {        $sql 2= "SELECT name from users where Uid= ' {$v}‘"; $name=$db->query ($sql 2); Echo"<div>{$k}----{$v}<input type= ' button ' value= ' delete ' sy= ' {$k} ' class= ' Yichu '/></div> '; }     }?></div>

Triggered events that are deleted

1$ (". Yichu"). Click (function (){2             varsy=$ ( This). attr ("Sy");3 $.ajax ({4URL: "removejd.php",5 Data:{sy:sy},6Type: "POST",7DataType: "TEXT",8Successfunction(data) {9window.location.href= "newbuild.php";Ten                          One                          A                         } -                      -                  the                  -                 }) -      -      +      -      +});

Removal of processing pages

<? PHP Session_Start (); $sy=$_post["Sy"]; $arr=$_session["UID"]; unset ($arr[$sy]);        // To move an array of divisor elements $arr=array_values($arr// Rebuild index $_session["UID"] =$arr;? >

Saved pages and click events

1 <Div>2Please enter a name for the new process:<inputtype= "text"ID= "Shuru"  /><BR/>3 4 <inputtype= "button"value= "Save"ID= "Save" />5 6 </Div>7 <Script>8 $("#save"). Click (function (){9         varMingcheng=$("#shuru"). Val ();Ten $.ajax ({ One URL:"save.php", A Data:{mingcheng:mingcheng}, - Type:"POST", - DataType:"TEXT", the Success:function(data) -                 { - Alert ("saved successfully") -                     } +              -              +              A             }) at      -      -      -      -      -     }) in  -  to  + </Script>

Saved processing pages

1<?PHP2 Session_Start();3 $name=$_post["Mingcheng"];4 $code= Time();5 6 require".. /database.class.php ";7 $db=NewDataBase ();8 $sql= "INSERT into Liucheng values (' {$code}‘,‘{$name}‘)";9 $db->query ($sql, 0);Ten  One  A $arr=$_session["UID"]; - foreach($arr  as $k=$v) - { the     $sql 2= "INSERT into Flowpath values ('", ' {$code}‘,‘{$v}‘,‘{$k}‘)"; -     $db->query ($sql 2, 0); -     } -  +?>

PHP Process Control (new process)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.