<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/
//联系人    qq:874689017
include_once( "inc/auth.inc.php" );
include_once( "inc/utility_all.php" );
include_once( "inc/utility_flow.php" );
include_once( "inc/utility_file.php" );
include_once( "inc/mobile_seal/seal_data.php" );
include_once( "../../prcs_role.php" );
include_once( "inc/workflow/inc/common.inc.php" );
include_once( "inc/workflow/inc/workflow.inc.php" );
include_once( "inc/workflow/tform/twork_export.class.php" );
include_once( "inc/workflow/inc/workpriv.inc.php" );
$HTML_PAGE_TITLE = _( "导出" );
include_once( "inc/header.inc.php" );
$archive_time = $_GET['archive_time'];
//HTML=1&RUN_ID=479&FLOW_ID=134&PRCS_ID=&FLOW_PRCS=&archive_time=&FLOW_VIEW=1234
//$RUN_ID=447;
//$FLOW_ID=132;
$FLOW_VIEW="12345";
if ( $archive_time != "" && $archive_time != "undefined" )
{$use_databases = "td_oa_archive.";
}
else
{$use_databases = "";$archive_time = "";
}
$role_str = run_role( $RUN_ID, 0, $archive_time );
$PRIV_TYPE_STR = getflowprivofmanage( $FLOW_ID, $_SESSION['LOGIN_USER_ID'], $_SESSION['LOGIN_DEPT_ID'], $_SESSION['LOGIN_USER_PRIV'], $_SESSION['LOGIN_DEPT_ID_OTHER'], $_SESSION['LOGIN_USER_PRIV_OTHER'] );setcookie( "FLOW_VIEW_COOKIE", $FLOW_VIEW, time( ) + 259200000 );
$flag_hidden_type = 1;
$table_flow_run_prcs = $use_databases."flow_run_prcs".$archive_time;
if ( $PRCS_ID == NULL || $PRCS_ID == "" )
{if ( find_id( $role_str, 1 ) || find_id( $role_str, 3 ) || find_id( $role_str, 5 ) || find_id( $role_str, 9 ) || find_id( $role_str, 10 ) || find_id( $role_str, 11 ) ){$PRCS_ID = 0;$flag_hidden_type = 0;}else if ( find_id( $role_str, 2 ) || find_id( $role_str, 4 ) || find_id( $role_str, 6 ) ){$query = "select prcs_id from ".$table_flow_run_prcs."\r\n                   where id = (\r\n                   select MAX(id) from ".$table_flow_run_prcs." where run_id = '".$RUN_ID."'\r\n                   AND (user_id = '".$_SESSION['LOGIN_USER_ID']."'\r\n                   or FIND_IN_SET('".$_SESSION['LOGIN_USER_ID']."',OTHER_USER))) ";$cursor = exequery( TD::conn( ), $query );if ( $row = mysql_fetch_array( $cursor ) ){$PRCS_ID = $row['prcs_id'];}$flag_hidden_type = 1;}else if ( find_id( $role_str, 8 ) || find_id( $role_str, 7 ) ){$PRCS_ID = 0;$flag_hidden_type = 2;}
}
if ( find_id( $role_str, 8 ) )
{$query = "select 1 from APP_LOG where MODULE = '7' and OPP_ID = '".$RUN_ID."' and USER_ID = '".$_SESSION['LOGIN_USER_ID']."'";$cursor = exequery( TD::conn( ), $query );if ( !( $row = mysql_fetch_array( $cursor ) ) ){$CUR_TIME = date( "Y-m-d H:i:s", time( ) );$query1 = "insert into APP_LOG(USER_ID,TIME,MODULE,OPP_ID,TYPE) values ('".$_SESSION['LOGIN_USER_ID'].( "','".$CUR_TIME."','7','{$RUN_ID}','1')" );exequery( TD::conn( ), $query1 );}
}
if ( $flag_hidden_type == 0 )
{$secret_fields = "";
}
else if ( $flag_hidden_type == 1 )
{$query = "select FLOW_PRCS from ".$table_flow_run_prcs." where RUN_ID = '".$RUN_ID."' and PRCS_ID = '".$PRCS_ID."' limit 1";$cursor = exequery( TD::conn( ), $query );if ( $row = mysql_fetch_array( $cursor ) ){$FLOW_PRCS = $row['FLOW_PRCS'];}$table_flow_prcocess = $use_databases."flow_process".$archive_time;$secret_fields = "";$query = "select HIDDEN_ITEM from ".$table_flow_prcocess." where FLOW_ID = '".$FLOW_ID."' and PRCS_ID = '".$FLOW_PRCS."' ";$cursor = exequery( TD::conn( ), $query );if ( $row = mysql_fetch_array( $cursor ) ){$secret_fields = $row['HIDDEN_ITEM'];}
}
else if ( $flag_hidden_type == 2 )
{$table_flow_prcocess = $use_databases."flow_process".$archive_time;$secret_fields = "";$query = "select HIDDEN_ITEM from ".$table_flow_prcocess." where FLOW_ID = '".$FLOW_ID."' ";$cursor = exequery( TD::conn( ), $query );while ( $row = mysql_fetch_array( $cursor ) ){$secret_fields .= $row['HIDDEN_ITEM'].",";}$secret_fields = td_trim( $secret_fields );$secret_fields = str_remove_dup( $secret_fields );
}
$archive_time = $_GET['archive_time'];
if ( $archive_time != "" && $archive_time != "undefined" )
{$use_databases = "td_oa_archive.";
}
else
{$use_databases = "";$archive_time = "";
}
$query = "select RUN_NAME from ".$use_databases."flow_run".$archive_time." where RUN_ID = '".$RUN_ID."' ";
$cursor = exequery( TD::conn( ), $query );
while ( $row = mysql_fetch_array( $cursor ) )
{$RUN_NAME = $row['RUN_NAME'];
}
ob_start( );
echo "<script>\r\n\r\n//定义全局变量\r\nvar g_run_id = \"";
echo $RUN_ID;
echo "\";       //流水号\r\nvar g_flow_id = \"";
echo $FLOW_ID;
echo "\";     //流程ID\r\nvar g_prcs_id = \"";
echo $PRCS_ID;
echo "\";     //实际流程步骤序号\r\nvar g_form_view = 2;                 //打印表单\r\nvar doPrint = \"";
echo $doPrint;
echo "\";\r\nvar printView = \"";
echo $printView;
echo "\";\r\n</script>\r\n\r\n<body style=\"background:none;margin: 0;\" topmargin=\"5\">\r\n<div  id='bodyScroll' >\r\n";
$query = "SELECT DEL_FLAG from ".$use_databases."FLOW_RUN".$archive_time.( " WHERE RUN_ID='".$RUN_ID."'" );
$cursor = exequery( TD::conn( ), $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{$DEL_FLAG = $ROW['DEL_FLAG'];
}
if ( $DEL_FLAG == 1 )
{message( "", _( "此流程已经被删除!" ) );
}
$config = array("db" => $use_databases,"archive_time" => $archive_time,"secret_fields" => $secret_fields,"export_type" => "html"
);
$PRINT_FLAG = 1;
$HTML = 1;
$doc_content = "";
if ( strstr( $FLOW_VIEW, "1" ) )
{echo "<style type=\"text/css\"> ".$CSS."</style>";echo "<form name=\"form1\" method=\"post\" action=\"\">";$obj_work_export = new TWorkExport( $FLOW_ID, $RUN_ID, $PRCS_ID, $FLOW_PRCS, $config );echo $obj_work_export->get_form_html( );echo "</form>";$arr_files = $obj_work_export->get_form_files( );$arr_files_count = count( $arr_files );$arr_files_count /= 2;$arr_files = array_slice( $arr_files, $arr_files_count );
}
if ( strstr( $FLOW_VIEW, "2" ) )
{echo "<br>";include_once( "../../list/public_attach.php" );
}
if ( strstr( $FLOW_VIEW, "3" ) )
{echo "<br>";include_once( "../../list/personal_sign.php" );
}
if ( strstr( $FLOW_VIEW, "4" ) )
{echo "<br>";include_once( "../../list/flow_view/view_list.php" );
}
if ( strstr( $FLOW_VIEW, "5" ) )
{echo "<br>";include_once( "../../list/flow_view/view_user.php" );
}
$doc_content = ob_get_contents( );
ob_end_clean( );
$RUN_NAME = str_replace( ":", "_", $RUN_NAME );
$RUN_NAME = str_replace( "\"", "", $RUN_NAME );
$RUN_NAME = str_replace( "<", "", $RUN_NAME );
$RUN_NAME = str_replace( ">", "", $RUN_NAME );
$RUN_NAME = str_replace( "|", "", $RUN_NAME );
$RUN_NAME = str_replace( "*", "", $RUN_NAME );
$RUN_NAME = str_replace( "?", "", $RUN_NAME );
$RUN_NAME = str_replace( "/", "", $RUN_NAME );
$RUN_NAME = str_replace( "\\", "", $RUN_NAME );echo "<html><head>";echo "<title>".$RUN_NAME."</title>";echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".MYOA_CHARSET."\">";echo "</head>";echo $doc_content;ob_end_clean();/************************************************************************///创建目录
//$powneronfile="../../../../powneronfile";
$powneronfile="D:/MYOA/webroot/powneronfile";
if (!file_exists($powneronfile)){
mkdir($powneronfile);  //如果没有的话创建webroot下的powneronfile
}
$mulu=$powneronfile."/".$RUN_ID."";  //powneronfile下按流水号创建文件夹
if (!file_exists($mulu)){
mkdir($mulu);
}/************************************************************************/$run_name = "";
$run_time = "";$query = "SELECT * from flow_data_".$FLOW_ID." where run_id = '".$RUN_ID."' limit 1";
$cursor = exequery( TD::conn(), $query );
if( $ROW = mysql_fetch_array( $cursor ) )
{   $run_name = $ROW["run_name"];$run_time = $ROW["begin_time"];$begin_user = $ROW["begin_user"];
}$query7="select BYNAME from user where USER_ID='$begin_user' limit 1";
$cursor7=exequery(TD::conn(),$query7);
while($row7=mysql_fetch_array($cursor7)){$byname=$row7["BYNAME"];}//$folder_name="[".$RUN_ID."]".$RUN_NAME;
$folder_name=$RUN_ID."-".$RUN_NAME;
/********  工作流表单中的附件*****************/
$query4="show COLUMNS from flow_data_".$FLOW_ID;
//echo $query4."<br>";
$cursor4=exequery(TD::conn(),$query4);
while($row4=mysql_fetch_array($cursor4)){$ziduan=$row4["Field"];//echo $ziduan."<br>";$ziduan_arr=explode("_",$ziduan);if($ziduan_arr[2]=="key"){//echo $ziduan."<br>";$wenjian_name=$ziduan_arr[0]."_".$ziduan_arr[1];$wenjian_id=$ziduan_arr[0]."_".$ziduan_arr[1]."_".$ziduan_arr[2];$query6="select ".$wenjian_id.",".$wenjian_name." from flow_data_".$FLOW_ID." where run_id='$RUN_ID'";   //echo $query6."<br>";//将OA流程中表单中的附件获取出来,必须用数组拆分
$cursor6 = exequery( TD::conn(), $query6 );
while( $ROW6 = mysql_fetch_array( $cursor6 ) ){$att_arr=explode(",",$ROW6[$wenjian_id]);$att_name_arr=explode("*",$ROW6[$wenjian_name]);for($i=0;$i<count($att_arr)-1;$i++){$yuan_name1 = attach_real_path($att_arr[$i], $att_name_arr[$i], $MODULE = "" );  //每一个附件copy一次$to_name1 = $mulu."/".$att_name_arr[$i].""; //$yuan_name1 = attach_real_path("2682@1511_1589471134", "哈电国际--通达OA实施方案--通达OA孙忠海.docx", $MODULE = "" );//$to_name1 = "../../../../powneronfile/".$RUN_ID."/哈电国际--通达OA实施方案--通达OA孙忠海.docx";copy($yuan_name1,$to_name1);  //每次只能是一个文件$file_size=filesize($to_name1); $file_name=$att_name_arr[$i];$file_ext=substr(strrchr($file_name, '.'), 1);$query5="INSERT INTO `powneronfile` (`flow_id`, `run_id`, `file_path`,`file_name`,`file_ext`,`file_size`,`create_user`, `t_flag`) VALUES ('$FLOW_ID', '$RUN_ID','".$RUN_ID."/".$att_name_arr[$i]."','$file_name','$file_ext','$file_size','$byname','0')";exequery(TD::conn(),$query5);}}  //end  while } // end if($ziduan_arr[2]=="key"){}
/********  工作流表单中的附件
//将工作流中的附件备份到其他目录下
$query1="select * from flow_data_".$FLOW_ID." where run_id='$RUN_ID'";   //将OA流程中表单中的附件获取出来,必须用数组拆分
$cursor1 = exequery( TD::conn(), $query1 );
while( $ROW1 = mysql_fetch_array( $cursor1 ) )
{   //echo $ROW1["data_22"]; echo "<br>";//echo $ROW1["data_22_key"]; echo "<br>";
$att_arr=explode(",",$ROW1["data_22_key"]);
$att_name_arr=explode("*",$ROW1["data_22"]);
for($i=0;$i<count($att_arr)-1;$i++){$yuan_name1 = attach_real_path($att_arr[$i], $att_name_arr[$i], $MODULE = "" );  //每一个附件copy一次$to_name1 = "../../../../powneronfile/".$RUN_ID."/".$att_name_arr[$i]."";    //$yuan_name1 = attach_real_path("2682@1511_1589471134", "哈电国际--通达OA实施方案--通达OA孙忠海.docx", $MODULE = "" );//$to_name1 = "../../../../powneronfile/".$RUN_ID."/哈电国际--通达OA实施方案--通达OA孙忠海.docx";//echo $yuan_name1; echo "<br>";//echo $to_name1; echo "<br>";copy($yuan_name1,$to_name1);  //每次只能是一个文件}}****/
//查询公共附件
$query = "SELECT * from flow_run_attach where run_id = '".$RUN_ID."'";
$cursor = exequery( TD::conn(), $query );
while( $ROW = mysql_fetch_array( $cursor ) )
{   $yuan_name = attach_real_path($ROW["ATTACHMENT_ID"], $ROW["ATTACHMENT_NAME"], $MODULE = "" );  //flow_run_attach是单个附件存储的$to_name = $mulu."/".$ROW["ATTACHMENT_NAME"].""; copy($yuan_name,$to_name);//插入到中间表//$file_name=$ROW["ATTACHMENT_NAME"];//$query2="INSERT INTO `hola_oa_file` (`flow_id`, `run_id`, `folder_name`,`file_path`,`file_name`, `t_flag`) VALUES ('$FLOW_ID', '$RUN_ID','$folder_name','".$RUN_ID."/".$ROW["ATTACHMENT_NAME"]."','$file_name','0')";//插入到中间表$file_name=$ROW["ATTACHMENT_NAME"];$file_size=filesize($to_name); $file_ext=substr(strrchr($file_name, '.'), 1);$query2="INSERT INTO `powneronfile` (`flow_id`, `run_id`, `file_path`,`file_name`,`file_ext`,`file_size`,`create_user`, `t_flag`) VALUES ('$FLOW_ID', '$RUN_ID','".$RUN_ID."/".$ROW["ATTACHMENT_NAME"]."','$file_name','$file_ext','$file_size','$byname','0')";exequery(TD::conn(),$query2);}//将工作流中的数据添加到数据表中
$biaodan=$RUN_ID."_".$RUN_NAME."[表单].html";
$path=$mulu."/".$biaodan;
wirtefile ($path,$doc_content);
//插入到中间表//$query3="INSERT INTO `hola_oa_file` (`flow_id`, `run_id`, `folder_name`, `file_path`,`file_name`, `t_flag`) VALUES ('$FLOW_ID', '$RUN_ID','$folder_name', '".$RUN_ID."/".$biaodan."','$biaodan','0')";$file_name=$biaodan;$file_size=filesize($path); $file_ext=substr(strrchr($file_name, '.'), 1);$query3="INSERT INTO `powneronfile` (`flow_id`, `run_id`, `file_path`,`file_name`,`file_ext`,`file_size`,`create_user`, `t_flag`) VALUES ('$FLOW_ID', '$RUN_ID','".$RUN_ID."/".$biaodan."','$file_name','$file_ext','$file_size','$byname','0')";exequery(TD::conn(),$query3);function wirtefile ($fn,$data)
{
$fp=fopen($fn,"wb");
fwrite($fp,$data);
fclose($fp);}
?>

通达OA工作流插件--保存OA流程中的所有附件+流程表单到指定目录(2013adv,2015,2016)相关推荐

  1. 基于jeecgboot的flowable流程支持退回到发起人节点表单修改功能

    因为目前系统不支持用户退回到第一个用户任务节点的表单修改功能,这样有些需求需要能修改功能,所以这次支持这种功能. 1.后端代码 主要是判断是否是开始节点的第一个用户任务节点,要是就进行标志传送 代码如 ...

  2. validate中submitHandler采用ajaxsubmit导致表单重复提交

    validate中submitHandler采用ajaxsubmit导致表单重复提交 在这几日的表单验证实践中,由于我的三个form都放在一个页面上,所以在submit上采用的是ajax方式来提交表单 ...

  3. vue中添加附件以及表单内表格动态添加的功能实现

    vue前端表单自动生成地址 form-generator vue中添加附件以及表单内表格动态添加的功能实现 页面展示 <el-col :span="12"><el ...

  4. 解决在Vue中使用axios用form表单出现的问题

    vue中使用Axios第三方库,采用形式提交,参数格式为multipart /格式数据 ,请求参数变为对象格式的解决办法.(推荐第二种方法) 提交数据的四种编码方式 一,应用/ X WWW的窗体-ur ...

  5. Vue3中使用Vform3(自定义表单工具)

    一.关于Vform的简单介绍和使用 1.介绍 VForm是一款基于Vue 2/Vue 3的低代码表单,支持Element UI.iView两种UI库,定位为前端开发人员提供快速搭建表单.实现表单交互和 ...

  6. html中表单元素中的单选框,Html表单元素及表单元素详解

    大纲 1.认识表单 2.认识表单元素 3.表单元素的分类 4.表单元素--文本框 5.表单元素button 6.表单元素--单选.多选 7.表单元素--select 8.表单元素--textarea ...

  7. SpringMVC中实现的token,防表单重复提交

    一:首先创建一个token处理类  ,这里的类名叫 TokenHandler private static Logger logger = Logger.getLogger(TokenHandler. ...

  8. php中的全局变量$_POST收集表单数据

    < !-- php中的$POST被广泛的用于手机表单数据,在HTML中from的标签指定的该属性是method="post" 下面我们将显示一个输入的字段,以及一个提交的按钮 ...

  9. html中嵌套iframe页面_selenium表单切换(iframe)

    在做web自动化的过程中会遇到一些弹出的登录页面,定位后,执行程序发现还是出现报错,其实定位可能没有问题,而是表单再作怪,也就是iframe iframe iframe是HTML标签,作用是文档中的文 ...

  10. 网页与APP中那些优美的登陆表单

    我从Dribbble收集了20个漂亮的登陆表单案例.希望你看后能从中受益,并对你以后的登陆表单设计有帮助.设计一个登陆表单是非常容易,但大多设计都很糟糕.毫无亮点.无论如何,这篇Dribbble案例集 ...

最新文章

  1. matlab中prismastic,魅力值是什么意思
  2. node.js 多异步之间的协作方案
  3. 在vue项目中引入高德地图及其UI组件的方法
  4. 一篇非常有用的文章-《台湾清华彭明辉教授的研究生手册》
  5. FLEX中的MDI窗口包--flexmdi
  6. python在工厂中的应用_什么是工厂函数?Python 中工厂函数怎么理解?
  7. which 命令
  8. DS系列服务器硬盘扇区,硬盘基本知识(磁道、扇区、柱面、磁头数、簇、MBR、DBR)...
  9. Serverless 实战 —— Serverless 架构揭秘与静态网站部署实战
  10. 樊昌信 通信原理第七版 第十一章 思考题答案
  11. 运筹学基础及其matlab,【官方直发】 运筹学基础及其MATLAB应用
  12. table表格头部和前几列固定js
  13. import math
  14. 第三代CAN-XL通信技术CiA 610有什么特点
  15. FlexBox 行间距
  16. 微信小程序——生命周期
  17. 使用python绘画蟒蛇
  18. 深度学习常见数据集汇总
  19. 电脑ps计算机磨皮,用PS磨皮详解教程 -电脑资料
  20. 基于MATLAB卡尔曼滤波器实现动态人物的跟踪检测

热门文章

  1. ue转换文件格式linux,关于windows与unix之间文件格式转换问题。UE编辑器中(CR/LF)问题...
  2. 中科院各大计算所详细介绍
  3. OpenERP中商品销售的处理及案例解析
  4. ip地址是计算机设备在网络上的地址,如何查看主机ip 如何查看与自己电脑相连设备的IP地址...
  5. 数值积分——梯形公式和Simpson公式
  6. 什么是漏极开路【转】
  7. 华为交换机设置ACL时间控制
  8. HTML5软件设计大赛,我院成功举行第十七届山东省大学生软件设计大赛 HTML5创意应用命题决赛...
  9. 英特尔无线蓝牙启动服务器,如何在英特尔Edison上部署蓝牙安全网关
  10. 《蜗居》触动人心灵的100个瞬间