通达OA公共文件柜文件存储到本地磁盘

<?php
set_time_limit(0);
include_once "inc/auth.inc.php";
include_once "inc/utility_all.php";
include_once "inc/utility_file.php";
include_once "inc/utility_org.php";
//exit;
$HTML_PAGE_TITLE = _("文件柜目录");
include_once "inc/header.inc.php";
?>

<style  type="text/css">
#tr1 td{
	padding:5px;
	}
.tr2 td{
	padding-left:4px;
	padding-right:3px;
	line-height:20px;
	}	
</style>
<script type="text/javascript" src="/inc/js_lang.php"></script>  

<script type="text/javascript" src="<?=MYOA_JS_SERVER?>/static/js/attach.js"></script>  
<script src="<?=MYOA_JS_SERVER?>/static/js/module.js?v=<?=MYOA_SYS_VERSION?>"></script>
<script src="<?=MYOA_JS_SERVER?>/module/DatePicker/WdatePicker.js"></script>
<script>

function delete_file(FILE_SORT,SORT_ID)
{
	//alert(id);
    msg='<?=_("确认要删除该项吗?")?>';
    if(window.confirm(msg))
    {
        URL="delete.php?FILE_SORT=" + FILE_SORT +"&SORT_ID="+SORT_ID;
        window.location=URL;
    }
}
 function chaxun(){
	document.form1.action="public_folder.php";
	document.form1.target="";
	document.form1.submit();
	}
function daochu(){
	//alert("对不起,我还没有做好,请耐心等待");
	//return false;
	document.form1.action="chaxundaochu.php";
	document.form1.target="_blank";
	document.form1.submit();
	}		
</script>
<?


$SORT_ID=$_REQUEST["SORT_ID"];
$mingcheng=$_REQUEST["mingcheng"];
 //$mingcheng;
//global $str;
$str="";
if($mingcheng!=""){
	$str.=" and subject like '%$mingcheng%' ";
	}
if($SORT_ID==0){
	echo "请选择指定文件夹查看!";
	exit;
	}
//echo $SORT_ID."<br>";
$FILE_SORT=$_REQUEST["FILE_SORT"];
$SORT_PATH_NAME = get_file_folder_path($SORT_ID);
$wjgstr=list_dept($SORT_ID).$SORT_ID;
//echo $wjgstr."<br>";
$query3="select * from file_content where 1=1 ".$str." and sort_id in ($wjgstr)";
$cursor3=exequery(TD::conn(),$query3);
$num3=mysql_num_rows($cursor3);
//echo $num3."<br>";

?>
<table border="0" width="98%" align="center" cellspacing="0" cellpadding="3" class="small"  style="font-family:微软雅黑,宋体">
  <tr>
    <td class="Big"><img align="absMiddle" src="<?=MYOA_STATIC_SERVER?>/static/images/menu/infofind.gif"><span class="big4"> <?=_("有效文件目录")?>&nbsp;<?=$SORT_PATH_NAME?>&nbsp;&nbsp;&nbsp;<a href="daochu.php?FILE_SORT=<?=$FILE_SORT?>&SORT_ID=<?=$SORT_ID?>" target="_blank">全部导出</a>&nbsp;&nbsp;&nbsp;文件数量:<?=$num3?>
    
    
<form enctype="multipart/form-data" action="index1.php"  method="post" name="form1">
    文件名称:
    <input type="text" name="mingcheng" class="BigInput" value="<?=$mingcheng?>"/>
    <input type="hidden" name="SORT_ID" value="<?=$SORT_ID?>" />
     <input type="hidden" name="FILE_SORT" value="<?=$FILE_SORT?>" />
       <input type="button"  onClick="chaxun();" value="<?=_("查询")?>" class="BigButton">&nbsp;&nbsp;
       
             <input type="button" onClick="daochu();" value="<?=_("导出")?>" class="BigButton">&nbsp;&nbsp;
       </form>
    </td>
  </tr>
</table>

<?

?>
<table border="1px" cellpadding="0px" cellspacing="0px" width="98%" align="center" bordercolor="#eeeeee" style="font-size:12px"> 
 <tr style="font-size:13px; font-weight:bold; height:30px; font-family:微软雅黑,宋体,Arial Narrow,'Times New Roman', Times, serif; line-height:22px;" id="tr1">
      <td width="25%" align="center" nowrap bgcolor="#0099FF" style="cursor:hand;" >目录</td>
      <td width="25%" align="center" nowrap bgcolor="#0099FF" style="cursor:hand;" >文件名称</td>
       <td width="30%" align="center" nowrap bgcolor="#0099FF" style="cursor:hand;" >附件</td>
        <td width="10%" align="center" nowrap bgcolor="#0099FF" style="cursor:hand;" >创建人</td>
       <td width="10%" align="center" nowrap bgcolor="#0099FF" style="cursor:hand;" >发布日期</td></tr>
       <?
	   $query2="select content_id,sort_id,subject,send_time,attachment_id,attachment_name,creater from file_content where  sort_id='$SORT_ID' ".$str." order by CONTENT_NO asc";	
					$cursor2=exequery(TD::conn(),$query2);
					while($b=mysql_fetch_array($cursor2)){
						$content_id=$b["content_id"];
						$attachment_id=$b["attachment_id"];
						$attachment_name=$b["attachment_name"];
							$subject=$b["subject"];
						?>
						 <tr height="30px;" onMouseOver="this.style.background='#33CCFF'" onMouseOut="this.style.background='#FFFFFF'" class="tr2" >
   <td align="left"  style="cursor:hand;" ><?=$SORT_PATH_NAME?></td>
      <td align="left"  style="cursor:hand;" ><a href="../file_folder/read.php?SORT_ID=<?=$SORT_ID?>&FILE_SORT=1&CONTENT_ID=<?=$content_id?>" target="_blank"><?=$b["subject"]?></a></td>
      
        <td align="center" style="cursor:hand;" >
       <?
        if($attachment_id=="")  
         echo _("无附件");  
      else  
         echo attach_link($attachment_id,$attachment_name,1,0,1,0,0,1,0,0);   ?></td>
          <td align="center" nowrap  style="cursor:hand;" ><?=substr(getUsernameById($b["creater"]),0,-1)?></td>
   <td align="center" nowrap style="cursor:hand;" ><?=$b["send_time"]?></td>
     
  					<?
						}
	   ?>
       
       
       
       
       
    
<?
$SORT_PATH_NAME = get_file_folder_path($SORT_ID);

$wenjianjia="D:/".$SORT_PATH_NAME;
if (!file_exists($wenjianjia)){
mkdir($wenjianjia);  //如果没有的话创建
}
$query2="select content_id,sort_id,subject,send_time,attachment_id,attachment_name,creater from file_content where  sort_id='$SORT_ID' ".$str."  order by CONTENT_NO asc";	
					$cursor2=exequery(TD::conn(),$query2);
					while($b=mysql_fetch_array($cursor2)){
						$attachment_id=$b["attachment_id"];
						$attachment_name=$b["attachment_name"];
						$content_id=$b["content_id"];
						$idarr=explode("@",str_replace(",","",$attachment_id));
						$idarr1=explode("_",$idarr[1]);
						$YM=$idarr1[0];
						$attid=$idarr1[1];
						$attname=str_replace("*","",$attachment_name);
						$yuan_name = "D:/MYOA/attach/file_folder/".$YM."/".$attid.".".$attname;
						//echo $attachment_id.$attachment_name;
						//$yuan_name = attach_real_path($attachment_id, $attachment_name, $MODULE = "3" );  //flow_run_attach是单个附件存储的
						echo $yuan_name."<br>";
	$to_name = $wenjianjia."/".$attname;	
	echo $to_name."<br>";
	copy($yuan_name,$to_name);
	sleep(1);
					}

echo list_sort($SORT_ID,"1",0,$str);
?>
</table>
<?
  function list_sort( $PARENT_ID, $SPACE = "1",$num,$str)
{
		
	
	
	
						
		$OUTPUT = "";
		if($num==0){
		$query = "SELECT * from file_sort where sort_parent='".$PARENT_ID."'  and sort_type='5'  order by sort_no asc";
	//	echo $query;
		}
		else {
			$query = "SELECT * from file_sort where  sort_parent='".$PARENT_ID."'   and sort_type='5'    order by sort_no asc";
			}
			//echo $query."<br>";
		$cursor= exequery(TD::conn(),$query);
		while ( $ROW = mysql_fetch_array( $cursor ) )
		{
				++$SORT_COUNT;
				$sort_id = $ROW['SORT_ID'];
				$sort_no = $ROW['SORT_NO'];
				$sort_name = $ROW['SORT_NAME'];
				$SORT_PATH_NAME = get_file_folder_path($sort_id);
				$wenjianjia="D:/".$SORT_PATH_NAME;
if (!file_exists($wenjianjia)){
mkdir($wenjianjia);  //如果没有的话创建
}
				//echo $NEW_USER;
				$query2="select  count(*) from file_sort where sort_parent= ".$sort_id ;
				$cursor2= exequery(TD::conn(),$query2);
				$row2=mysql_fetch_row($cursor2);
				if($row2[0]>0)
				$HAVE_CHILD = 1;
				$num++;
$SORT_PATH_NAME = get_file_folder_path($sort_id);

$wenjianjia="D:/".$SORT_PATH_NAME;
if (!file_exists($wenjianjia)){
mkdir($wenjianjia);  //如果没有的话创建
}
$SORT_PATH_TITLE=$SORT_PATH_NAME;
//if(strlen($SORT_PATH_NAME) > 50)
  // $SORT_PATH_NAME=csubstr($SORT_PATH_NAME, 0, 40)."...";
				
						//$OUTPUT .= "<li class=\"closed\">".$SPACE."**".$sort_id."***".$sort_name."***".$SORT_PATH_NAME;
					$query2="select content_id,sort_id,subject,send_time,attachment_id,attachment_name,creater from file_content where  sort_id='$sort_id' ".$str."  order by CONTENT_NO asc";	
					$cursor2=exequery(TD::conn(),$query2);
					while($b=mysql_fetch_array($cursor2)){
						$attachment_id=$b["attachment_id"];
						$attachment_name=$b["attachment_name"];
						$content_id=$b["content_id"];
						$idarr=explode("@",str_replace(",","",$attachment_id));
						$idarr1=explode("_",$idarr[1]);
						$YM=$idarr1[0];
						$attid=$idarr1[1];
						$attname=str_replace("*","",$attachment_name);
						$yuan_name = "D:/MYOA/attach/file_folder/".$YM."/".$attid.".".$attname;
						//echo $attachment_id.$attachment_name;
						//$yuan_name = attach_real_path($attachment_id, $attachment_name, $MODULE = "3" );  //flow_run_attach是单个附件存储的
						echo $yuan_name."<br>";
	$to_name = $wenjianjia."/".$attname;	
	echo $to_name."<br>";
	copy($yuan_name,$to_name);
	sleep(1);
						?>
						 <tr height="30px;" onMouseOver="this.style.background='#33CCFF'" onMouseOut="this.style.background='#FFFFFF'" class="tr2" >
   <td align="left"  style="cursor:hand;" ><?=$SORT_PATH_NAME?></td>
      <td align="left"  style="cursor:hand;" ><a href="../file_folder/read.php?SORT_ID=<?=$sort_id?>&FILE_SORT=1&CONTENT_ID=<?=$content_id?>" target="_blank"><?=$b["subject"]?></a></td>
      
        <td align="center" style="cursor:hand;" >
       <?
        if($attachment_id=="")  
         echo _("无附件");  
      else  
         echo attach_link($attachment_id,$attachment_name,1,0,1,0,0,1,0,0);   ?></td>
          <td align="center" nowrap  style="cursor:hand;" ><?=substr(getUsernameById($b["creater"]),0,-1)?></td>
   <td align="center" nowrap style="cursor:hand;" ><?=$b["send_time"]?></td>
     
  					<?
						}
							$a=$SPACE;
						if ( $HAVE_CHILD == 1 )
						{	$SPACE.="1";	
								//$OUTPUT .= "<ul id=\"folder_{$sort_id}\">";
								//$OUTPUT .= list_sort( $sort_id, $SPACE,$num);
								list_sort( $sort_id, $SPACE,$num,$str);
								//$OUTPUT .=" </ul>";
						}
						$SPACE=$a;
				$OUTPUT.="</li>";//一定要放到这个地方
		}
		
		//return $OUTPUT;
}


function list_dept( $PARENT_ID)
{
		$OUTPUT ="";
		$PARENT_ID = intval( $PARENT_ID );
		$query = "SELECT SORT_ID from file_sort where sort_parent='".$PARENT_ID."'  and sort_type='5'   order by sort_no ASC";
		$cursor = exequery(TD::conn(), $query );
		while ( $ROW = mysql_fetch_array( $cursor ) )
		{
				++$SORT_COUNT;
				$SORT_ID = $ROW['SORT_ID'];
				$query2 = "SELECT SORT_ID from file_sort where sort_parent='".$SORT_ID."'  and sort_type='5'   order by sort_no ASC";
				$cursor2=exequery(TD::conn(), $query2 );
				$num=mysql_num_rows($cursor2);
			
						$OUTPUT .=$SORT_ID.",";
						if ( $num!=0 and  $num!="")
						{
								$OUTPUT .= list_dept( $SORT_ID);
						}
				
		}
		return $OUTPUT;
}
?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hai7425

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值