-
- <?php
- /*
- * Created on 2008-9-9
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
- $key=iconv('gb2312','utf-8',$_GET['userid']);
- // echo $userid;
- // if($userid==null||""==$userid){
- // exit;
- // }
- require_once './database/operatebean.php';
- $sql="select t.iffresh from iffresh t where t.userid=".$key;
- // $db_conn = OCILogon( "scott", "jx","(DESCRIPTION =(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=jx)))" );
- // $parsed = ociparse($db_conn, $sql);
- // ociexecute($parsed);
- // $nrows = ocifetchstatement($parsed, $results);
- $conn=do_connect();
- $stmt = oci_parse($conn,$sql);
- oci_execute($stmt, OCI_DEFAULT);
- $nrows = ocifetchstatement($stmt, $results);
- $dom = new DOMDocument("1.0","utf-8");
- header("Content-Type: text/xml;");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
- $root = $dom->createElement("contents");
- $dom->appendChild($root);
- $content = $dom->createElement("content");
- $root->appendChild($content);
- $refresh=$dom->createElement("name");
- $content->appendChild($refresh);
- $text = $dom->createTextNode($results["IFFRESH"][0]);
- $refresh->appendChild($text);
- echo $dom->saveXML();
- free_conn($stmt,$conn);
- // OCILogoff($db_conn);
- ?>
- <?php
- /*
- * Created on 2008-9-9
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- *
- */
- require_once './database/operatebean.php';
- /**
- * 获取开始结束时间
- */
- $userid=iconv('gb2312','utf-8',$_GET['userid']);
- $sql="select t.task_name, r.res_name, to_char(a.assn_start_date,'yyyy-mm-dd hh24:mi:ss') as a1,to_char(a.assn_finish_date,'yyyy-mm-dd hh24:mi:ss') as a2,t.task_uid,to_char(b.task_act_start,'yyyy-mm-dd hh24:mi:ss') a3,to_char(b.task_act_finish,'yyyy-mm-dd hh24:mi:ss') a4,b.ifpause from msp_tasks t ,msp_resources r, msp_assignments a,acttime b where a.res_uid=r.res_id and b.task_uid=t.task_uid and a.task_uid=t.task_uid and r.res_id=".$userid." and a.assn_start_date>=(select to_date(sysdate) from dual) order by a.assn_start_date";
- $conn=do_connect();
- $stmt = oci_parse($conn,$sql);
- oci_execute($stmt, OCI_DEFAULT);
- $nrows = ocifetchstatement($stmt, $results);
- $dom = new DOMDocument("1.0","utf-8");
- header("Content-Type: text/xml;");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
- $root = $dom->createElement("contents");
- $dom->appendChild($root);
- for($i = 0; $i < $nrows; $i++){
- $content = $dom->createElement("content");
- $root->appendChild($content);
- $item = $dom->createElement("taskid");
- $content->appendChild($item);
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$results["TASK_UID"][$i]));
- $item->appendChild($text);
- $item = $dom->createElement("name");
- $content->appendChild($item);
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$results["TASK_NAME"][$i]));
- $item->appendChild($text);
- $item = $dom->createElement("executename");
- $content->appendChild($item);
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$results["RES_NAME"][$i]));
- $item->appendChild($text);
- $item = $dom->createElement("begintime");
- $content->appendChild($item);
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$results["A1"][$i]));
- $item->appendChild($text);
- $item = $dom->createElement("endtime");
- $content->appendChild($item);
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$results["A2"][$i]));
- $item->appendChild($text);
- $item = $dom->createElement("task_act_start");
- $content->appendChild($item);
- $a=$results["A3"][$i];
- if($a==null){
- $a="xxx";
- }
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$a));
- $item->appendChild($text);
- $item = $dom->createElement("task_act_end");
- $content->appendChild($item);
- $b=$results["A4"][$i];
- if($b==null){
- $b="xxx";
- }
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$b));
- $item->appendChild($text);
- // $c=;
- // if($c==0){
- // $c=0;
- // }else{
- // $c=1;
- // }
- $item = $dom->createElement("ifpause");
- $content->appendChild($item);
- $text = $dom->createTextNode(iconv('gb2312','utf-8',$results["IFPAUSE"][$i]));
- $item->appendChild($text);
- }
- echo $dom->saveXML();
- free_conn($stmt,$conn);
- //将刷新标志置为0
- $cmd="update iffresh t set t.iffresh=0 where t.userid=".$userid;
- do_update($cmd);
- ?>
- <?php
- /*
- * Created on 2008-9-16
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
- require_once './database/operatebean.php';
- header("Content-Type: text/xml;");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
- $taskid=iconv('gb2312','utf-8',$_GET['taskid']);
- $reason=iconv('gb2312','utf-8',$_GET['reason']);
- $cmd="insert into pausetime (task_uid,task_act_pause_start,task_act_pause_reason) values (".$taskid.",sysdate,'".$reason."')";
- $sql="update acttime t set t.ifpause=1 where t.task_uid=".$taskid;
- do_insert($cmd);
- do_update($sql);
- ?>
- <?php
- /*
- * Created on 2008-9-16
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
- require_once './database/operatebean.php';
- header("Content-Type: text/xml;");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
- $taskid=iconv('gb2312','utf-8',$_GET['taskid']);
- $cmd="update pausetime t set t.task_act_pause_finish=sysdate where t.task_uid=".$taskid." and t.task_act_pause_finish is null";
- // $sql="update acttime t set t.ifpause=0 where t.task_uid=".$taskid;
- do_update($cmd);
- do_update($sql);
- ?>
- <?php
- /*
- * Created on 2008-9-10
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
- require_once './database/operatebean.php';
- header("Content-Type: text/xml;");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
- $taskid=iconv('gb2312','utf-8',$_GET['taskid']);
- $cmd="update acttime t set t.task_act_finish=sysdate where t.task_uid=".$taskid;
- try{
- do_update($cmd);
- }catch(Exception $e){
- echo '结束任务时出现异常: '.$e->getMessage().$e->getCode();
- }
- ?>
- <?php
- /*
- * Created on 2008-9-10
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
- require_once './database/operatebean.php';
- header("Content-Type: text/xml;");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
- $taskid=iconv('gb2312','utf-8',$_GET['taskid']);
- $cmd="update acttime t set t.task_act_start=sysdate where t.task_uid=".$taskid;
- try{
- do_update($cmd);
- }catch(Exception $e){
- echo '结束任务时出现异常: '.$e->getMessage().$e->getCode()."<br>";
- }
- ?>
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">
- <!--
- * Created on 2008-9-12
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- -->
- <head>
- <title>任务分配页面</title>
- <link rel="stylesheet" type="text/css" href="./style/css.css"/>
- <script type="text/javascript">
- var xmlHttp;
- var id;
- var W = screen.width;//取得屏幕分辨率宽度
- var H = screen.height;//取得屏幕分辨率高度
- var taskid;
- function M(id){
- return document.getElementById(id);//用M()方法代替document.getElementById(id)
- }
- function MC(t){
- return document.createElement(t);//用MC()方法代替document.createElement(t)
- };
- //判断浏览器是否为IE
- function isIE(){
- return (document.all && window.ActiveXObject && !window.opera) ? true : false;
- }
- //取得页面的高宽
- function getBodySize(){
- var bodySize = [];
- with(document.documentElement) {
- bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;//如果滚动条的宽度大于页面的宽度,取得滚动条的宽度,否则取页面宽度
- bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;//如果滚动条的高度大于页面的高度,取得滚动条的高度,否则取高度
- }
- return bodySize;
- }
- //创建遮盖层
- function popCoverDiv(){
- if (M("cover_div")) {
- //如果存在遮盖层,则让其显示
- M("cover_div").style.display = 'block';
- } else {
- //否则创建遮盖层
- var coverDiv = MC('div');
- document.body.appendChild(coverDiv);
- coverDiv.id = 'cover_div';
- with(coverDiv.style) {
- position = 'absolute';
- background = '#CCCCCC';
- left = '0px';
- top = '0px';
- var bodySize = getBodySize();
- width = bodySize[0] + 'px'
- height = bodySize[1] + 'px';
- zIndex = 0;
- if (isIE()) {
- filter = "Alpha(Opacity=60)";//IE逆境
- } else {
- opacity = 0.6;
- }
- }
- }
- }
- //让登陆层显示为块
- function showLogin()
- {
- var login=M("login");
- login.style.display = "block";
- }
- //设置DIV层的样式
- function change(){
- var login = M("login");
- login.style.position = "absolute";
- login.style.border = "1px solid #CCCCCC";
- login.style.background ="#F6F6F6";
- var i=0;
- var bodySize = getBodySize();
- login.style.left = (bodySize[0]-i*i*4)/2+"px";
- login.style.top = (bodySize[1]/2-100-i*i)+"px";
- login.style.width = i*i*4 + "px";
- login.style.height = i*i*1.5 + "px";
- popChange(i);
- }
- //让DIV层大小循环增大
- function popChange(i){
- var login = M("login");
- var bodySize = getBodySize();
- login.style.left = (bodySize[0]-i*i*4)/2+"px";
- login.style.top = (bodySize[1]/2-100-i*i)+"px";
- login.style.width = i*i*4 + "px";
- login.style.height = i*i*1.5+ "px";
- if(i<=10){
- i++;
- setTimeout("popChange("+i+")",10);//设置超时10毫秒
- }
- }
- //打开DIV层
- function open(id)
- {
- taskid=id;
- change();
- showLogin();
- popCoverDiv()
- void(0);//不进行任何操作,如:<a href="#">aaa</a>
- }
- //关闭DIV层
- function close(){
- M('login').style.display = 'none';
- M("cover_div").style.display = 'none';
- void(0);
- }
- function a(){
- var ssh=document.getElementById("ddd").value;
- if(ssh==null||ssh=="我要..."){
- ssh="没有填写理由!";
- }
- startpause(taskid,ssh);
- close();
- }
- function trim(str){
- var t = str.replace(/(^/s*)|(/s*$)/g, ""); // 用正则表达式将前后空格
- return t.replace(/(^ *)|( *$)/g, ""); // 用空字符串替代。
- }
- function createXMLHttpRequest(){
- if(window.ActiveXObject){
- xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- else if(window.XMLHttpRequest){
- xmlHttp=new XMLHttpRequest();
- }
- }
- function validate(){
- createXMLHttpRequest();
- //var url="Del1.jsp";
- var url = "process.php?userid="+escape(3);
- xmlHttp.open("GET",url,true);
- xmlHttp.onreadystatechange=callback;
- xmlHttp.send(null);
- }
- function callback(){
- if(xmlHttp.readyState==4){
- show();
- }
- }
- function newvalidate(){
- var url = "refresh.php?userid="+escape(3);
- xmlHttp.open("GET",url,true);
- xmlHttp.onreadystatechange=callback1;
- xmlHttp.setRequestHeader("Connection", "close");
- xmlHttp.send(null);
- }
- function callback1(){
- if(xmlHttp.readyState==4){
- show1();
- }
- }
- function show1(){
- var xmlDoc=xmlHttp.responseXML;
- var yan=xmlDoc.getElementsByTagName("content");
- for(var i=0;i<yan.length;i++){
- var y=yan[0];
- var iffresh=y.childNodes[0].firstChild.data;
- if(iffresh==1){
- alert("有新任务!");
- validate();
- }else{
- setTimeout("newvalidate()",1000);
- //window.setInterval("newvalidate()",60000);
- }
- }
- }
- //开始任务
- function starttask(taskid){
- createXMLHttpRequest();
- var url="starttask.php?taskid="+escape(taskid);
- xmlHttp.open("GET",url,true);
- xmlHttp.onreadystatechange=startback;
- xmlHttp.send(null);
- }
- //任务开始返回结果
- function startback(){
- if(xmlHttp.readyState==4){
- var ss=xmlHttp.responseText;
- alert("任务已经开始");
- validate();
- // alert(ss);
- }
- }
- //结束任务
- function endtask(taskid){
- createXMLHttpRequest();
- var url="endtask.php?taskid="+escape(taskid);
- xmlHttp.open("GET",url,true);
- xmlHttp.onreadystatechange=endback;
- xmlHttp.send(null);
- }
- //任务结束返回结果
- function endback(){
- if(xmlHttp.readyState==4){
- var ss=xmlHttp.responseText;
- alert("任务已经结束");
- validate();
- }
- }
- //暂停开始
- function startpause(taskid,reason){
- createXMLHttpRequest();
- alert(reason);
- var url="pausetaskstart.php?taskid="+escape(taskid)+"&reason="+escape(reason);
- xmlHttp.open("GET",url,true);
- xmlHttp.onreadystatechange=pausestartback;
- xmlHttp.send(null);
- }
- //暂停开始返回结果
- function pausestartback(){
- if(xmlHttp.readyState==4){
- //var ss=xmlHttp.responseText;
- alert("任务已暂停,你可以执行其它任务");
- setTimeout("validate()",500);
- }
- }
- //结束暂停
- function endpause(taskid){
- createXMLHttpRequest();
- var url="pausetaskend.php?taskid="+escape(taskid);
- xmlHttp.open("GET",url,true);
- xmlHttp.onreadystatechange=pauseendback;
- xmlHttp.send(null);
- }
- //暂停结束返回结果
- function pauseendback(){
- if(xmlHttp.readyState==4){
- // var ss=xmlHttp.responseText;
- alert("暂停已经结束,继续执行任务");
- setTimeout("validate()",500);
- }
- }
- function show(){
- var xmlDoc=xmlHttp.responseXML;
- var yan=xmlDoc.getElementsByTagName("content");
- var ta = "<table border=1 cellspacing=0 width=80% align=/"center/" id=ta><tr><td align=/"center/" width=/"100/" background=/"./images/Data_Bg.gif/">任务</td><td align=/"center/" width=/"100/" background=/"./images/Data_Bg.gif/">执行人名称</td><td align=/"center/" background=/"./images/Data_Bg.gif/">任务名称</td><td align=/"center/" background=/"./images/Data_Bg.gif/">开始时间</td><td align=/"center/" background=/"./images/Data_Bg.gif/">完成时间</td><td align=/"center/" background=/"./images/Data_Bg.gif/">开始任务</td><td align=/"center/" background=/"./images/Data_Bg.gif/">暂停任务</td><td align=/"center/" background=/"./images/Data_Bg.gif/">结束任务</td></tr>";
- for(var i=0;i<yan.length;i++){
- var y=yan[i];
- var taskid=y.childNodes[0].firstChild.data;
- var taskname=y.childNodes[1].firstChild.data;
- var executename=y.childNodes[2].firstChild.data;
- var begintime=y.childNodes[3].firstChild.data;
- var endtime=y.childNodes[4].firstChild.data;
- var start=y.childNodes[5].firstChild.data;
- var finish=y.childNodes[6].firstChild.data;
- var ifpause=y.childNodes[7].firstChild.data;
- if(ifpause==null){
- ifpause="0";
- }
- ta+="<tr id=/"aa/"><td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/">"+(i+1)+"</td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/">"+executename+"</td>";
- ta+="<td width=/"400/" align=/"center/" background=/"./images/Data_Bg.gif/">"+taskname+"</td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/">"+begintime+"</td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/">"+endtime+"</td>";
- if(start=="xxx"){
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/"><input type=/"button/" value=/"开始任务/" οnclick=/"starttask('"+taskid+"')/"/></td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/"><input type=/"button/" value=/"开始暂停/" οnclick=/"window.alert('任务没开始,你不能暂停任务!')/"/></td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/"><input type=/"button/" value=/"结束任务/" οnclick=/"window.alert('任务没开始,你不能结束任务!')/"/></td></tr>";
- }else{
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/">"+start+"</td>";
- if(finish=="xxx"){
- if(ifpause=="1"){
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/"><input type=/"button/" value=/"结束暂停/" οnclick=/"endpause('"+taskid+"')/"/></td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/"><input type=/"button/" value=/"结束任务/" οnclick=/"window.alert('暂停没结束,你不能结束任务!')/"/></td></tr>";
- }else if(ifpause=="0"){
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/"><input type=/"button/" value=/"开始暂停/" οnclick=/"window.location.href('javascript:open("+taskid+")')/"/></td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/"><input type=/"button/" value=/"结束任务/" οnclick=/"endtask('"+taskid+"')/"/></td></tr>";
- }
- }else{
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/">任务已结束</td>";
- ta+="<td width=/"100/" align=/"center/" background=/"./images/Data_Bg.gif/">"+finish+"</td></tr>";
- }
- }
- }
- ta+="</table>";
- alert("您好,你今天有"+yan.length+"个任务需要执行!加油!");
- document.getElementById("res").innerHTML=ta;
- setTimeout("newvalidate()",1000);
- }
- </script>
- </head>
- <body οnlοad="validate()">
- <h3 align=center>任务列表</h3>
- <div id="res"></div>
- <div id="login">
- <span>请输入暂停理由</span>
- <div id="panel">
- 理由:<textarea cols="30" rows="5" id="ddd">我要...</textarea>(*50字以内)
- </div>
- <input type="button" value="提交" οnclick="a();"/>
- <a href="javascript:close();">关闭</a>
- </div>
- <hr width="80%">
- <div id=footer align="center">
- <div id=bottom-nav>
- <a href="about.jsp">关于我们</a>
- <span>|</span>
- <a href="zhaoping.jsp">招聘信息</a>
- <span>|</span>
- <a href="feedback.jsp">用户反馈</a>
- <span>|</span>
- <a style="WIDTH: 80px"
- href="touchus.jsp">联系我们</a>
- </div>
- copyright 2008 北京商络财讯数据有限公司版权所有 京ICP备05000888号<br/>
- powered by wangjiangfeng.wangsuhong.liutao
- </div>
- </body>
- </html>
项目中用到的ajax(php)
最新推荐文章于 2024-09-14 11:06:39 发布