<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamPlan_Detail.aspx.cs"
    Inherits="RM.Web.Training.ExamPlan.ExamPlan_Detail" %>

<%@ Register Src="~/UserControl/LoadButton.ascx" TagName="LoadButton" TagPrefix="uc2" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>
        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamPlan_Detail_Title")%></title>
    <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <style type="text/css" id="style1">
        a { color: Blue; }
        td { text-align: center; }
        h2 { color: Blue; }
        h1 { text-align: center; }
        .UserCom { width: 80px; height: 60px; padding: 15px; text-align: center; border: 1px dashed #ccc; float: left; }
        #CenterMain { width:575px; height:100%; padding-left:15px; padding-top:5px; overflow: auto; float:left; border-right:1px dashed black;}
        #RightMain{width:50%;height:100%;margin:0 auto; overflow:auto;float:left;}
            </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="btnbartitle">
        <div>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("TrainingPlan_Title")%>
            -
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamPlan_Detail_ztqkbb")%>
        </div>
    </div>
    <div class="btnbarcontetn">
        <div style="text-align: right">
            <uc2:LoadButton ID="LoadButton1" runat="server" />
        </div>
    </div>
    <!--左侧图标-->
    <div id="CenterMain">
    </div>
    <!--右侧内容-->
    <div id="RightMain">
        <div class="div-body" id="div-body" style="margin: 0 10px; border: 0;">
            <h2>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Jbxx")%>
            </h2>
            <%=panbase %>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamPlan_Detail_spzrs")%>：<span
                id="sum">0</span> <span id="sumloading">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("UserRight_chuli")%></span>
            <h2>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_info")%></h2>
            <table id="table1" class="example" style="background-color: White;">
                <thead>
                    <tr>
                        <td style="width: 250px; height: 16px; line-height: 16px;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-sjm")%>
                        </td>
                        <td style="height: 16px; line-height: 16px;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-sjlx")%>
                        </td>
                        <td style="height: 16px; line-height: 16px;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-kssj")%>
                        </td>
                        <td style="height: 16px; line-height: 16px;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-sjzf")%>
                        </td>
                        <td style="height: 16px; line-height: 16px;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-jgfs")%>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <%=gecslist %>
                </tbody>
            </table>
            <h2>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Teach_sjxy")%></h2>
            <table id="table2" class="example" style="background-color: White;">
                <thead>
                    <tr>
                        <td style="width: 250px; height: 16px; line-height: 16px;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamPlan_Detail_guishu")%>
                        </td>
                        <td style="height: 16px; line-height: 16px;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamPlan_Detail_canyu")%>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <%=getuserlist %>
                </tbody>
            </table>
        </div>
    </div>
    </form>
    <script src="/Themes/Scripts/LodopFuncs.js" type="text/javascript"></script>
    <script type="text/javascript">
        //阻止考试
        function stoptest(value, obj) {
            if (value == 1) {
                //允许考试
                UserStop(4, $("#" + obj).attr("id"));
                $("#" + obj).attr("onclick", "showSelectMain(0,'" + obj + "')");
                $("#" + obj).find("img").attr("src", "/Themes/Images/32/125.png");
                $("#" + obj).find("img").attr("title", "正在考试");
            } else {
                UserStop(3, $("#" + obj).attr("id"));
                $("#" + obj).attr("onclick", "showSelectMain(1,'" + obj + "')");
                $("#" + obj).find("img").attr("src", "/Themes/Images/32/468.png");
                $("#" + obj).find("img").attr("title", "禁止考试");
            }
            $(".aui_state_highlight ", parent.document).click();
        }
        ///显示
        function showSelectMain(value, obj) {

            var str = "<input type=\"button\" onclick=\"document.getElementById('main').contentWindow.stoptest('" + value + "','" + obj + "');\" style=\"argin-left:20px;\" value=\"阻止考试\"/>";
            //value=1时 已被禁止
            if (value == 1) {
                str = "<input type=\"button\" onclick=\"document.getElementById('main').contentWindow.stoptest('" + value + "','" + obj + "');\" style=\"argin-left:20px;\" value=\"允许考试\"/>";
            } else if (value == 5) {
                str = "";
            }
            //获取信息学员
            $.get("/Training/ExamPlan/NewGetExamPlanUserList.ashx",
                { Key: QueryString("key"), status: "6", examid: QueryString("epkey"), userid: obj },
                function (data) {
                    if (data != "[]") {
                        var dataObj = eval("(" + data + ")"); //转换为json对象 
                        str = "<div>姓名 : " + dataObj[0].Result_ToUserName + "<br/>考试时间 : " + JsonDate(dataObj[0].Result_CreateDate) + "<br/>分数 : " + dataObj[0].Result_SumScore + "<br/></div>" + str;
                        showFaceMsg(str);
                    }
                    else {
                        showFaceMsg(str);
                    }
                });
        }
        $(function () {
            //把分页定位到屏幕下面
            divresize(60);
            //加载全部用户列表
            $.get("/Training/ExamPlan/NewGetExamPlanUserList.ashx",
                { Key: QueryString("key"), status: "0" },
                function (data) {
                    if (data) {
                        var dataObj = eval("(" + data + ")"); //转换为json对象 
                        var strhtml = "";
                        $.each(dataObj, function (i, item) {
                            strhtml += ("<div id=" + item.User_ID + " onclick=\"showSelectMain(0,'" + item.User_ID + "');\" class=\"UserCom\"> <img src=\"/Themes/Images/32/124.png\" title='未参与考试' /><br /><span>" + item.User_Name + "</span></div>");
                        });
                        $("#CenterMain").html(strhtml);
                        UserHavingTest();
                        UserGoTest();
                        GetUserStop();
                    } else {
                        $("#CenterMain").html("没有查询到内部人员的相关数据");
                    }
                });
        });
        //加载正在考试学员
        function UserHavingTest() {
            $.get("/Training/ExamPlan/NewGetExamPlanUserList.ashx",
                { Key: QueryString("key"), status: "1", examid: QueryString("epkey") },
                function (data) {
                    if (data) {
                        var dataObj = eval("(" + data + ")"); //转换为json对象 
                        var strhtml = "";
                        $.each(dataObj, function (i, item) {
                            $("#" + item.User_ID).find("img").attr("src", "/Themes/Images/32/125.png");
                            $("#" + item.User_ID).find("img").attr("title", "正在考试");
                        });
                    }
                });
        }
        //加载已完成考试学员
        function UserGoTest() {
            $.get("/Training/ExamPlan/NewGetExamPlanUserList.ashx",
                { Key: QueryString("key"), status: "2", examid: QueryString("epkey") },
                function (data) {
                    if (data) {
                        var dataObj = eval("(" + data + ")"); //转换为json对象 
                        var strhtml = "";
                        $.each(dataObj, function (i, item) {
                            $("#" + item.User_ID).find("img").attr("src", "/Themes/Images/32/455.png");
                            $("#" + item.User_ID).find("img").attr("title", "已完成");
                            $("#" + item.User_ID).attr("onclick", "showSelectMain(5,'" + item.User_ID + "')");

                        });
                    }
                });
        }
        //删除或则加入学员
        function UserStop(value, userid) {
            $.get("/Training/ExamPlan/NewGetExamPlanUserList.ashx",
                { Key: QueryString("key"), status: value, examid: QueryString("epkey"), userid: userid },
                function (data) {
                    if (data == 1) {
                        // Loading(true); main.window.location.reload(); return false;
                    } else {
                        alert("操作失败");
                    }
                });
        }
        //获取禁止的所有学员
        function GetUserStop() {
            $.get("/Training/ExamPlan/NewGetExamPlanUserList.ashx",
                { Key: QueryString("key"), status: "5", examid: QueryString("epkey") },
                function (data) {
                    if (data) {
                        var dataObj = eval("(" + data + ")"); //转换为json对象 
                        var strhtml = "";
                        $.each(dataObj, function (i, item) {
                            $("#" + dataObj[i]).attr("onclick", "showSelectMain(1,'" + dataObj[i] + "')");
                            $("#" + dataObj[i]).find("img").attr("src", "/Themes/Images/32/468.png");
                            $("#" + dataObj[i]).find("img").attr("title", "禁止考试");
                        });
                    }
                });
        }
        function JsonDate(obj) {
            var data = "/Date(1345517741000)/";
            var date = new Date(parseInt(data.replace("/Date(", "").replace(")/", ""), 10));
            return date.getFullYear() + "-" + (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-" + (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " " + (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":" + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes());
        }
        //打印
        var LODOP; //声明为全局变量 
        function printer() {
            CreateOneFormPage();
            LODOP.PREVIEW();
        }
        function CreateOneFormPage() {
            LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
            LODOP.PRINT_INIT("培训计划报表");
            LODOP.SET_PRINT_STYLE("FontSize", 18);
            LODOP.SET_PRINT_STYLE("Bold", 1);
            LODOP.ADD_PRINT_TEXT(50, 231, 360, 59, "打印页面部分内容");
            var strStyleCSS = "<link href='/Themes/Styles/Site.css' type='text/css' rel='stylesheet'>";
            strStyleCSS += "<style>" + document.getElementById("style1").innerHTML + "</style>";
            var strBodyStyle = "<style>table{width:100%;border: 1 solid #000000;border-collapse:collapse }td {border: 1 solid #000000;border-collapse:collapse }</style>";
            LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', strStyleCSS + strBodyStyle + document.getElementById("div-body").innerHTML);
        };
    </script>
</body>
</html>
