通达OA工作流插件和列表控件数据解析:
参考代码如下:
<? include_once("inc/auth.inc.php"); include_once("inc/utility_org.php" ); $HTML_PAGE_TITLE = _("工作流插件测试"); include_once("inc/header.inc.php"); /* * author: 孙忠海 * 15645091570 * QQ:1027167227 */ //$FLOW_ID=341; //$RUN_ID=69222; //$sql="select * from flow_data_".$FLOW_ID." where run_id=".$RUN_ID; //$cur_sql=exequery(TD::conn(),$sql); ?> <body class="bodycolor" style="font-size:12px" topmargin="5"> <? echo $_SESSION["LOGIN_USER_ID"]."<br>"; $query="select * from x_hr_code where parent_no='gangweizhiwu' order by code_no asc"; $cursor=exequery(TD::conn(),$query); while($row=mysql_fetch_array($cursor)){ echo $row["CODE_NAME"].","; } echo "<hr>"; $query="select * from x_hr_code where parent_no='gangweidengji' order by code_no asc"; $cursor=exequery(TD::conn(),$query); while($row=mysql_fetch_array($cursor)){ echo $row["CODE_NAME"].","; } echo "<hr>"; $query="select * from x_hr_code where parent_no='gangji' order by code_no asc"; $cursor=exequery(TD::conn(),$query); while($row=mysql_fetch_array($cursor)){ echo $row["CODE_NAME"].","; } echo "<hr>"; $query2="select data_57 from flow_data_316 where run_id=44436 limit 1"; $cursor2=exequery(TD::conn(),$query2); while($row2=mysql_fetch_array($cursor2)){ $mingxi=$row2['data_57']; } echo $mingxi."<br>"; $mingxi=str_replace("\r",",",$mingxi);//\r是回车 占用两个字符,数据表data_3中存储的是回车,而不是空格,将回车替换为“,”逗号; echo $mingxi."<br>"; $mingxi=substr($mingxi,0,-2);//去掉最后的两个字符,包括逗号 echo $mingxi."<br>"; $arr=explode(",",$mingxi);//使用,逗号拆分,将列表中的每条记录分开` print_r($arr);// echo "<br>"; $count=count($arr);//有多少条记录 echo $count."<br>"; for($i=0;$i<$count;$i++){ $update_str=""; $bianhao=""; $ganweizhiwu=""; $gangweidengji=""; $gangji=""; $arr[$i]=substr($arr[$i],0,-1);//去掉最后一个字符`substr($arr[$i],-1)就可以或得到这个点 echo $arr[$i]."<br>"; $arr[$i]=explode(""`,$arr[$i]);//拆分成二维数组 print_r($arr[$i]); $bianhao=$arr[$i][1]; $gangweizhiwu=GET_CODE_NO($arr[$i][4],"gangweizhiwu");//岗位名称 $gangweidengji=GET_CODE_NO($arr[$i][5],"gangweidengji");//岗位等级 $gangji=GET_CODE_NO($arr[$i][6],"gangji");//岗级 echo "<br>"; echo $bianhao."----".$gangweizhiwu."----".$gangweidengji."-----".$gangji."---"; echo "<hr>"; if($gangweizhiwu!=""){ $update_str=" gangweizhiwu=".$gangweizhiwu.","; } if($gangweidengji!=""){ $update_str.=" gangweidengji=".$gangweidengji.","; } if($gangji!=""){ $update_str.=" gangji=".$gangji.","; } if($bianhao!=""){ $update_str.=" STAFF_NO=".$bianhao." "; $query3="update x_hr_staff_info set ".$update_str." where STAFF_NO=".$bianhao." " ; echo $query3."<br>"; exequery(TD::conn(),$query3); } } function GET_CODE_NO( $CODE_NAME, $PARENT_NO ) { if ( $CODE_NAME == "" || $PARENT_NO == "" ) { return ""; } $query = "SELECT CODE_NO from X_HR_CODE where PARENT_NO='".$PARENT_NO."' and CODE_NAME='$CODE_NAME'"; $cursor = exequery( TD::conn( ), $query ); while ( $ROW = mysql_fetch_array( $cursor ) ) { $CODE_NO = $ROW['CODE_NO']; } return $CODE_NO; } ?> </body></html>
以上就介绍了 通达OA2015版工作流插件和列表控件数据解析,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
相关文章: