123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="page-content">
- <div class="row" style="margin:0px">
- <div class="col-xs-12">
- <!-- PAGE CONTENT BEGINS -->
- <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
- <div class="row">
- <div class="col-xs-10">
- <form method="get" id="form1" action="<?php echo $this->createUrl("junior/product_stu",array("cid" => $classId,"eid"=>$examId,"type"=>$type));?>">
- <div class="dataTables_length" style="margin: 6px 0px;">
- <div class="dataTables_length">
- <label><input type="text" class="form-control input-sm" placeholder="请输入学生姓名" name="sname" value="<?php echo $sname;?>"></label>
- <button style="padding:4px 12px;"class="label-primary-s bth-s">搜索</button>
- </div>
- </div>
- </form>
- </div>
- <div class="col-xs-2">
- <div class="dataTables_filter" id="dynamic-table_filter" style="padding-top:15px">
- <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrint">
- <i style="font-style: normal;" class="fa fa-print"></i> 下载
- </a>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-xs-12" style="font-weight:bold;padding:0px 15px">
- <?php echo isset($name)?$name:'';?>
- </div>
- </div>
- <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
- <thead>
- <tr>
- <th class="center">
- <input type="checkbox" class="ace selectAll">
- </th>
- <th>序号</th>
- <th>名称</th>
- <th>学生名称</th>
- <th>学生编号</th>
- <th>PDF</th>
- <th>下载功能</th>
- </tr>
- </thead>
- <tbody>
- <?php if(isset($list) && $list):foreach($list as $k=>$rt):?>
- <tr>
- <td class="center">
- <?php if (($rt['is_pdf'] == 1)) { ?>
- <input type="checkbox" class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
- <?php } else { ?>
- <input type="checkbox" disabled='disabled' class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
- <?php } ?>
- </td>
- <td><?php echo $k;?></td>
- <td><?php echo $rt['name'];?></td>
- <td><?php echo $rt['stu_name'];?></td>
- <td><?php echo $rt['stu_id'];?></td>
- <td>
- <?php if ($rt['is_pdf'] == 0): ?>
- <span class="label label-sm label-danger" style="font-size:12px">未生成</span> <!--红-->
- <?php elseif ($rt['is_pdf'] == 1): ?>
- <span class="label label-sm label-success" style="font-size:12px">已生成</span><!--绿-->
- <?php elseif ($rt['is_pdf'] == 9): ?>
- <span class="label label-sm" style="font-size:12px;background-color:gray;">已删除</span><!--灰-->
- <?php else: ?>
- <span class="label label-sm" style="font-size:12px;background-color:gray;">未知状态</span><!--灰-->
- <?php endif; ?>
- </td>
- <td>
- <?php
- if(isset($limitstu)){
- if($limitstu==0){
- echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
- }elseif($limitstu==-1){
- echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
- }else{
- // if(isset($limitstu[$rt['stu_id']])){
- if(is_array($limitstu) && in_array($rt['stu_id'],$limitstu,true)){
- echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
- }else{
- echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
- }
- }
- }else{
- echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
- }
- ?>
- </td>
- </tr>
- <?php endforeach;else:?>
- <tr><td colspan="6">暂无数据!</td></tr>
- <?php endif;?>
- </tbody>
- </table>
- </div>
- <input type="hidden" name="examId" id="examId" value="<?php echo $examId;?>" />
- <input type="hidden" name="classId" id="classId" value="<?php echo $classId;?>" />
- <!-- PAGE CONTENT ENDS -->
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- html = ""+
- '<div style="padding:20px 30px 0px 30px">'+
- '<div style="padding:8px 0;">请复制下方链接下载<?php echo $desc;?>。</div>'+
- '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
- '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>'+
- '</div>'+
- '</div>'+
- "";
- $(function(){
- // 全选\反选
- $(".selectAll").on('click',function(event){
- if ($(this).prop("checked")) {
- var s_obj = $(".myselect");
- var s_len = s_obj.length;
- for (var i=0;i<s_len;i++) {
- if (!s_obj[i].disabled) {
- s_obj[i].checked=true;
- }
- }
- } else {
- $(".myselect").prop("checked",false);
- }
- });
- //
- //
- $("#selectPrint").click(function(){
- var examId = $("#examId").val();
- var classId = $("#classId").val();
- // 判断是否有选中
- if (!$("input[class='ace myselect']").is(':checked')) {
- layer.msg('请至少选择一个学生!');return false;
- }
- layer.msg("您确定下载产品吗?", {
- time: 0,
- btn: ['确定', '取消'],
- yes: function(index){
- layer.close(index);
- var result = [];
- $(".myselect").each(function(m,n){
- if ($(this).prop('checked')) {
- if ($(this).val() && $(this).attr("stnm")) {
- result.push($(this).val());
- }
- }
- })
- if (result.length < 1) {
- layer.msg('未找到要下载的学生!');return false;
- }
- $.ajax({
- url: "<?php echo $this->createUrl('productdownexam/getUrl');?>",
- type: "GET",
- dataType: "json",
- data: {"examId": examId,"classId":classId, "studentsIds":result, "type":<?php echo $type;?>},
- timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
- beforeSend:function(){
- layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
- },
- error: function (jqXHR, textStatus, errorThrown) {
- if(textStatus=="timeout"){
- $.ajax({
- type:'GET',
- url: "<?php echo $this->createUrl("productdownexam/addTask");?>",
- data: {"examId": examId,"classId":classId, "studentsIds":result, "type":<?php echo $type;?>},
- dataType: "json",
- success:function (data) {
- layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
- icon: 1,
- yes:function(){
- layer.closeAll();
- }
- });
- }
- })
- }else {
- layer.msg('返回失败!',{
- icon: 5
- }, function(){
- layer.closeAll();
- });
- }
- },
- success: function (data){
- layer.closeAll();
- if(data.success == 1||data.success == 2){
- layer.open({
- type: 1,
- area: ['550px', '220px'],
- title: "下载产品",
- content: html,
- success: function(index, layerObj){
- jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="'+data.downloadPath+'" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
- jQuery("#confirm, #cancel").on("click", function(){
- layer.close(layerObj);
- });
- jQuery("#copy").on("click", function(){
- jQuery("#url").select();
- });
- },
- end: function(){
- }
- });
- }else if(data.success == 3){
- layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
- icon: 1,
- yes:function(){
- layer.closeAll();
- }
- });
- }
- else if(data.success == 0){
- layer.msg(data.message, {"time": 3000});
- }
- },
- });
- }
- });
- });
- })
- </script>
|