ListWf.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. require "../".LoadLang("pub/fun.php");
  7. $link=db_connect();
  8. $empire=new mysqlquery();
  9. $editor=1;
  10. //验证用户
  11. $lur=is_login();
  12. $logininid=$lur['userid'];
  13. $loginin=$lur['username'];
  14. $loginrnd=$lur['rnd'];
  15. $loginlevel=$lur['groupid'];
  16. $loginadminstyleid=$lur['adminstyleid'];
  17. //ehash
  18. $ecms_hashur=hReturnEcmsHashStrAll();
  19. //验证权限
  20. CheckLevel($logininid,$loginin,$classid,"workflow");
  21. //增加工作流
  22. function AddWorkflow($add,$userid,$username){
  23. global $empire,$dbtbpre;
  24. if(!$add[wfname])
  25. {
  26. printerror('EmptyWorkflow','history.go(-1)');
  27. }
  28. //验证权限
  29. CheckLevel($userid,$username,$classid,"workflow");
  30. $add[myorder]=(int)$add[myorder];
  31. $addtime=time();
  32. $add['wfname']=hRepPostStr($add['wfname'],1);
  33. $add['wftext']=hRepPostStr($add['wftext'],1);
  34. $add['canedit']=(int)$add['canedit'];
  35. $username=hRepPostStr($username,1);
  36. $sql=$empire->query("insert into {$dbtbpre}enewsworkflow(wfname,wftext,myorder,addtime,adduser,canedit) values('$add[wfname]','$add[wftext]','$add[myorder]','$addtime','$username','$add[canedit]');");
  37. $wfid=$empire->lastid();
  38. if($sql)
  39. {
  40. //操作日志
  41. insert_dolog("wfid=".$wfid."<br>wfname=".$add[wfname]);
  42. printerror("AddWorkflowSuccess","AddWf.php?enews=AddWorkflow".hReturnEcmsHashStrHref2(0));
  43. }
  44. else
  45. {printerror("DbError","history.go(-1)");}
  46. }
  47. //修改工作流
  48. function EditWorkflow($add,$userid,$username){
  49. global $empire,$dbtbpre;
  50. $wfid=(int)$add[wfid];
  51. if(!$wfid||!$add[wfname])
  52. {
  53. printerror('EmptyWorkflow','history.go(-1)');
  54. }
  55. //验证权限
  56. CheckLevel($userid,$username,$classid,"workflow");
  57. $add[myorder]=(int)$add[myorder];
  58. $add['wfname']=hRepPostStr($add['wfname'],1);
  59. $add['wftext']=hRepPostStr($add['wftext'],1);
  60. $add['canedit']=(int)$add['canedit'];
  61. $sql=$empire->query("update {$dbtbpre}enewsworkflow set wfname='$add[wfname]',wftext='$add[wftext]',myorder='$add[myorder]',canedit='$add[canedit]' where wfid='$wfid'");
  62. if($sql)
  63. {
  64. //操作日志
  65. insert_dolog("wfid=".$wfid."<br>wfname=".$add[wfname]);
  66. printerror("EditWorkflowSuccess","ListWf.php".hReturnEcmsHashStrHref2(1));
  67. }
  68. else
  69. {printerror("DbError","history.go(-1)");}
  70. }
  71. //删除工作流
  72. function DelWorkflow($add,$userid,$username){
  73. global $empire,$dbtbpre;
  74. $wfid=(int)$add[wfid];
  75. if(!$wfid)
  76. {
  77. printerror('NotDelWorkflowid','history.go(-1)');
  78. }
  79. //验证权限
  80. CheckLevel($userid,$username,$classid,"workflow");
  81. $r=$empire->fetch1("select wfname from {$dbtbpre}enewsworkflow where wfid='$wfid'");
  82. $sql=$empire->query("delete from {$dbtbpre}enewsworkflow where wfid='$wfid'");
  83. $sql2=$empire->query("delete from {$dbtbpre}enewsworkflowitem where wfid='$wfid'");
  84. if($sql&&$sql2)
  85. {
  86. //操作日志
  87. insert_dolog("wfid=".$wfid."<br>wfname=".$r[wfname]);
  88. printerror("DelWorkflowSuccess","ListWf.php".hReturnEcmsHashStrHref2(1));
  89. }
  90. else
  91. {printerror("DbError","history.go(-1)");}
  92. }
  93. $enews=$_POST['enews'];
  94. if(empty($enews))
  95. {$enews=$_GET['enews'];}
  96. if($enews)
  97. {
  98. hCheckEcmsRHash();
  99. }
  100. if($enews=="AddWorkflow")//增加工作流
  101. {
  102. AddWorkflow($_POST,$logininid,$loginin);
  103. }
  104. elseif($enews=="EditWorkflow")//修改工作流
  105. {
  106. EditWorkflow($_POST,$logininid,$loginin);
  107. }
  108. elseif($enews=="DelWorkflow")//删除工作流
  109. {
  110. DelWorkflow($_GET,$logininid,$loginin);
  111. }
  112. $search=$ecms_hashur['ehref'];
  113. $page=(int)$_GET['page'];
  114. $page=RepPIntvar($page);
  115. $start=0;
  116. $line=25;//每页显示条数
  117. $page_line=12;//每页显示链接数
  118. $offset=$page*$line;//总偏移量
  119. $query="select wfid,wfname,addtime,adduser from {$dbtbpre}enewsworkflow";
  120. $totalquery="select count(*) as total from {$dbtbpre}enewsworkflow";
  121. $num=$empire->gettotal($totalquery);//取得总条数
  122. $query=$query." order by myorder,wfid desc limit $offset,$line";
  123. $sql=$empire->query($query);
  124. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  125. $url="<a href=ListWf.php".$ecms_hashur['whehref'].">管理工作流</a>";
  126. ?>
  127. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  128. <html>
  129. <head>
  130. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  131. <title>工作流</title>
  132. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  133. </head>
  134. <body>
  135. <table width="100%" border="0" cellspacing="1" cellpadding="3">
  136. <tr>
  137. <td width="50%">位置:
  138. <?=$url?>
  139. </td>
  140. <td><div align="right" class="emenubutton">
  141. <input type="button" name="Submit5" value="增加工作流" onclick="self.location.href='AddWf.php?enews=AddWorkflow<?=$ecms_hashur['ehref']?>';">
  142. </div></td>
  143. </tr>
  144. </table>
  145. <br>
  146. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  147. <tr class="header">
  148. <td width="5%" height="25"><div align="center">ID</div></td>
  149. <td width="36%" height="25"> <div align="center">工作流名称</div></td>
  150. <td width="14%"><div align="center">增加者</div></td>
  151. <td width="19%"> <div align="center">增加时间</div></td>
  152. <td width="13%"><div align="center">流程节点</div></td>
  153. <td width="13%" height="25"><div align="center">操作</div></td>
  154. </tr>
  155. <?
  156. while($r=$empire->fetch($sql))
  157. {
  158. ?>
  159. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  160. <td height="25"><div align="center">
  161. <?=$r[wfid]?>
  162. </div></td>
  163. <td height="25">
  164. <?=$r[wfname]?>
  165. </td>
  166. <td><div align="center">
  167. <?=$r[adduser]?>
  168. </div></td>
  169. <td><div align="center">
  170. <?=date('Y-m-d H:i:s',$r[addtime])?>
  171. </div></td>
  172. <td> <div align="center"><a href="ListWfItem.php?wfid=<?=$r[wfid]?><?=$ecms_hashur['ehref']?>">管理节点</a></div>
  173. <div align="center"></div></td>
  174. <td height="25"><div align="center">[<a href="AddWf.php?enews=EditWorkflow&wfid=<?=$r[wfid]?><?=$ecms_hashur['ehref']?>">修改</a>]
  175. [<a href="ListWf.php?enews=DelWorkflow&wfid=<?=$r[wfid]?><?=$ecms_hashur['href']?>" onclick="return confirm('确认要删除?');">删除</a>]</div></td>
  176. </tr>
  177. <?
  178. }
  179. ?>
  180. <tr bgcolor="#FFFFFF">
  181. <td height="25" colspan="6">&nbsp;
  182. <?=$returnpage?>
  183. </td>
  184. </tr>
  185. </table>
  186. </body>
  187. </html>
  188. <?
  189. db_close();
  190. $empire=null;
  191. ?>