pastacdemicrs.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <style>
  2. .loading-pop{position: fixed;left: 0;top: 0;bottom: 0;right: 0;background: rgba(0,0,0,0.5);z-index: 200;}
  3. .loading-pop-msg{color: #fff;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);font-size: 22px;letter-spacing: 4px;}
  4. </style>
  5. <link rel="stylesheet" href="/css/paperManage.css">
  6. <div class="main-content-inner">
  7. <!-- 导航栏开始-->
  8. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  9. <!-- 导航栏结束-->
  10. <div class="page-content" style="margin-top:15px;">
  11. <div class="select-cons">
  12. <form method="get" id="form1" action="<?php echo $this->createUrl("export/Pastacdemicrs");?>">
  13. <select id="semester" name="semester">
  14. <?php foreach ($sem_arr as $sem_id => $sem_name):?>
  15. <option value="<?php echo $sem_id;?>" <?php if($current_sem_id == $sem_id) echo "selected";?>><?php echo $sem_name;?></option>
  16. <?php endforeach;?>
  17. </select>
  18. <select id="grade" name="grade">
  19. <option value=0>请选择年级</option>
  20. <option value="1" <?php if($current_grade_id == 1) echo "selected";?>>高一</option>
  21. <option value="2" <?php if($current_grade_id == 2) echo "selected";?>>高二</option>
  22. <option value="3" <?php if($current_grade_id == 3) echo "selected";?>>高三</option>
  23. </select>
  24. <select id="class" name="class">
  25. <?php if ($class_arr):?>
  26. <option value=0 >请选择班级</option>
  27. <?php foreach ($class_arr as $class_id => $class_name): ?>
  28. <option value="<?php echo $class_id; ?>" <?php if($current_class_id == $class_id) echo "selected";?>><?php echo $class_name; ?></option>
  29. <?php endforeach; ?>
  30. <?php else: ?>
  31. <option value=0 >请选择班级</option>
  32. <?php endif;?>
  33. </select>
  34. <div class="test-name">
  35. <input type="text" placeholder="请输入考试名称" name='exam_name' class="test-name-msg" value="<?php if ($current_exam_name) echo $current_exam_name;?>">
  36. </div>
  37. <div class="search-btn">
  38. <input type="button" value="搜索" id="search">
  39. </div>
  40. </form>
  41. </div>
  42. <div class="hte-tables">
  43. <table class="history-teacher-exolaincase" cellspacing="0" cellpadding="0" >
  44. <thead>
  45. <td class="paper-title">试卷名称</td>
  46. <td class="paper-class">班级</td>
  47. <td class="paper-status">状态</td>
  48. <td class="paper-opt">操作</td>
  49. </thead>
  50. <?php if (!$exam_data):?>
  51. <tr><td colspan="4">暂无已完成阅卷的考试!</td></tr>
  52. <?php else:?>
  53. <?php foreach($exam_data as $exam_id=>$v):?>
  54. <tr>
  55. <td><?php echo $v['exam_name'];?></td>
  56. <td><?php echo $v['class_name'];?></td>
  57. <td><?php echo $v['status'];?></td>
  58. <td><img src="/images/download.png" alt="" class="download-img"><a onclick="downpdf(this,<?php echo "'".$exam_id."'" ?>, <?php echo "'".$v['class_id']."'"; ?>)" href="javascript:void(0);">教学宝下载</a></td>
  59. </tr>
  60. <?php endforeach;?>
  61. <?php endif;?>
  62. </table>
  63. <?php if(!empty($page_total)):?>
  64. <div class="row">
  65. <div class="col-xs-6">
  66. &nbsp;
  67. </div>
  68. <div class="col-xs-6">
  69. <div class="dataTables_paginate paging_simple_numbers">
  70. <?php
  71. $this->widget('CLinkPager', array(
  72. 'header' => '',
  73. 'firstPageLabel'=> '首页',
  74. 'lastPageLabel' => '末页',
  75. 'prevPageLabel' => '上一页',
  76. 'nextPageLabel' => '下一页',
  77. 'pages' => $pager,
  78. 'maxButtonCount'=> 5,
  79. ));
  80. echo '共:'.$page_total.'条';
  81. ?>
  82. </div>
  83. </div>
  84. </div>
  85. <?php endif;?>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="loading-pop" style="display:none;">
  90. <div class="loading-pop-msg">正在生成中,请稍候···</div>
  91. </div>
  92. <script type="text/javascript">
  93. //搜索按钮
  94. $("#search").click(function(){
  95. $("#form1").submit();
  96. });
  97. //根据学期选择
  98. $("#semester").change(function(){
  99. var gradeObj = $("#grade");
  100. var html = "<option value=0>请选择年级</option><option value='1'>高一</option><option value='2'>高二</option><option value='3'>高三</option></option>";
  101. gradeObj.empty();
  102. gradeObj.append(html);
  103. var classObj = $("#class");
  104. var html = "<option value=0>请选择班级</option>";
  105. classObj.empty();
  106. classObj.append(html);
  107. });
  108. // 根据年级筛选班级
  109. $("#grade").change(function(){
  110. var grade = $(this).val();
  111. if (!grade) {
  112. var classObj = $("#class");
  113. var html = "<option value=0>请选择班级</option>";
  114. classObj.empty();
  115. classObj.append(html);
  116. return;
  117. }
  118. var semester_id = $("#semester").val();
  119. $.post(
  120. '<?php echo $this->createUrl("export/getGradeClass");?>',{"grade": grade,"semester_id":semester_id},function(data){
  121. data = JSON.parse(data);
  122. if(data.success == 1){
  123. var classObj = $("#class");
  124. var html = "<option value=0>全部班级</option>";
  125. classObj.empty();
  126. $.each(data.message,function(i,n){
  127. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  128. });
  129. classObj.append(html);
  130. }
  131. }
  132. );
  133. });
  134. // 下拉列表模拟
  135. $('.inp-text').click(function(){
  136. if ($(this).next().is(':hidden')){
  137. $(this).next().show();
  138. } else {
  139. $(this).next().hide();
  140. }
  141. });
  142. // 点下拉列表选项
  143. $('.select-con li').click(function(){
  144. $(this).closest('.select-con').hide();
  145. $(this).closest('.prev-class').find('.inp-text').text($(this).text());
  146. $(this).closest('.prev-class').find('.hid-class-msg').val($(this).attr("id"));
  147. });
  148. // 点击空白处下拉列表消失
  149. $(document).click(function(e){
  150. var targetNode = $(e.target).closest(".inp-text");
  151. if (targetNode.length>0){
  152. return;
  153. }else{
  154. $(".select-con").hide();
  155. }
  156. });
  157. function downpdf(self,examId, classId) {
  158. $(".loading-pop").show();
  159. $.get("<?php echo $this->createUrl("export/academicr") ?>", {examId: examId, classId: classId,'isFromPast':1}, function(data) {
  160. var m = JSON.parse(data);
  161. if (m.status == 0)
  162. {
  163. if (m.is_create == 1) { //直接获取已经生成的文件
  164. setTimeout(function() {
  165. $(".loading-pop").hide();
  166. }, 500);
  167. } else {
  168. $(self).parent().prev().text('已生成'); //表示文件未生成,生成一下
  169. $(".loading-pop").hide();
  170. }
  171. location.href="<?php echo $this->createUrl("export/down_load")?>?examId="+examId;
  172. } else
  173. {
  174. setTimeout(function() {
  175. $(".loading-pop").hide();
  176. }, 500);
  177. alert(m.error);
  178. }
  179. });
  180. }
  181. </script>