exam_list.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <script type="text/javascript">
  2. jQuery(document).ready(function(){
  3. // 根据年级筛选班级
  4. jQuery("#grade").change(function(){
  5. var grade = $(this).val();
  6. if (!grade) return false;
  7. jQuery.post(
  8. '<?php echo $this->createUrl("print/getGradeClass");?>',{"grade": grade},function(data){
  9. data = JSON.parse(data);
  10. if(data.success == 1){
  11. var classObj = $("#class");
  12. var html = "<option value=''>全部班级</option>";
  13. classObj.empty();
  14. $.each(data.message,function(i,n){
  15. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  16. });
  17. classObj.append(html);
  18. }
  19. }
  20. );
  21. });
  22. });
  23. </script>
  24. <style>
  25. /*切换选择*/
  26. .tab-con{
  27. position: relative;
  28. height: 30px;
  29. width: 200px;
  30. background: #F2F2F2;
  31. border: 1px solid #01B677;
  32. border-radius: 15px;
  33. }
  34. .has-sel{
  35. background: #01B677;
  36. color: #fff;
  37. width: 50%;
  38. height: 30px;
  39. border-top-left-radius: 15px;
  40. border-bottom-left-radius: 15px;
  41. text-align: center;
  42. line-height: 30px;
  43. }
  44. .sel-opt{
  45. width: 50%;
  46. position: relative;
  47. color: #01B677;
  48. line-height: 30px;
  49. text-indent: 6px;
  50. cursor: pointer;
  51. }
  52. .sel-opt:after{
  53. content: '';
  54. border-left: 6px solid transparent;
  55. border-right: 6px solid transparent;
  56. border-top: 8px solid #01B677;
  57. position: absolute;
  58. right: 12px;
  59. top: 12px;
  60. }
  61. // .sel-opt select{
  62. // width: 100%;
  63. // height: 30px;
  64. // background: #F2F2F2;
  65. // color: #01B677;
  66. // text-indent: 6px;
  67. // font-size: inherit;
  68. // border-top-right-radius: 15px;
  69. // border-bottom-right-radius: 15px;
  70. // cursor: pointer;
  71. // }
  72. // .sel-opt select option{
  73. // position: relative;
  74. // }
  75. .points{
  76. position: absolute;
  77. top: -2px;
  78. right: 0;
  79. width: 10px;
  80. height: 10px;
  81. background: #F01516;
  82. border-radius: 50%;
  83. }
  84. .sel-cons{
  85. border: 1px solid #01B677;
  86. width: 50%;
  87. position: absolute;
  88. right: 0;
  89. top: 30px;
  90. text-indent: 10px;
  91. display: none;
  92. }
  93. .sc-lis{
  94. line-height: 30px;
  95. cursor: pointer;
  96. }
  97. .sc-lis span{
  98. position: relative;
  99. }
  100. .sc-lis .points{
  101. top: 2px;
  102. right: -16px;
  103. }
  104. .click-sc:focus {
  105. color: #fff;
  106. }
  107. .click-sc:hover {
  108. color: #fff;
  109. }
  110. </style>
  111. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  112. <div class="main-content-inner">
  113. <!-- 导航栏开始-->
  114. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  115. <!-- 导航栏结束-->
  116. <div class="page-content">
  117. <div class="row" style="margin:0px;">
  118. <div class="col-xs-12">
  119. <!-- PAGE CONTENT BEGINS -->
  120. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  121. <div class="row">
  122. <div class="col-xs-4">
  123. <form method="get" id="form1" action="<?php echo $this->createUrl("zhiliao/exam_list");?>">
  124. <div class="col-xs-12">
  125. <div class="dataTables_length margin-zy">
  126. <select class="form-control" id="class" name="classId">
  127. <option value="">全部班级</option>
  128. <?php foreach($classes as $key=>$class){?>
  129. <option <?php if(isset($class[$classId])){echo "selected";}?> value="<?php echo $class[$key]["class_id"];?>"><?php echo $class[$key]["class_name"];?></option>
  130. <?php }?>
  131. </select>
  132. <input type="hidden" value="<?php echo $exam_group_id?>" name="exam_group_id">
  133. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  134. </div>
  135. </div>
  136. </form>
  137. </div>
  138. </div>
  139. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  140. <thead>
  141. <tr>
  142. <th>名称</th>
  143. <th >班级</th>
  144. <th>申请日期</th>
  145. <th >已上传/总数</th>
  146. <th>操作</th>
  147. </tr>
  148. </thead>
  149. <tbody>
  150. <?php if(!empty($printList)):foreach($printList as $cl):?>
  151. <tr>
  152. <td style="max-width:260px">
  153. <?php echo $cl['exam_name'];?>
  154. </td>
  155. <td><?php echo $cl['class_name']?></td>
  156. <td><?php if(!empty($cl['zl_create_time'])){ echo date('Y-m-d H:i',$cl['zl_create_time']);}?></td>
  157. <td><?php echo '<span style="color:#15ae68;font-weight: bold">'.$cl["is_uploaded_count"].'</span>/'.$cl["students_count"];?></td>
  158. <td style="width:265px;">
  159. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生" onclick="javascript:location.href='<?php echo $this->createUrl('zhiliao/change',array('eid'=>$cl['zl_exam_id'],'cid'=>$cl['zl_class_id']));?>'">&#xe668;</span>
  160. </td>
  161. </tr>
  162. <?php endforeach;else:?>
  163. <tr><td colspan="8">暂无数据!</td></tr>
  164. <?php endif;?>
  165. </tbody>
  166. </table>
  167. <?php if(!empty($page_total)):?>
  168. <div class="row">
  169. <div class="col-xs-6">
  170. &nbsp;
  171. </div>
  172. <div class="col-xs-6">
  173. <div class="dataTables_paginate paging_simple_numbers">
  174. <?php
  175. $this->widget('CLinkPager', array(
  176. 'header' => '',
  177. 'firstPageLabel'=> '首页',
  178. 'lastPageLabel' => '末页',
  179. 'prevPageLabel' => '上一页',
  180. 'nextPageLabel' => '下一页',
  181. 'pages' => $pages,
  182. 'maxButtonCount'=> 5,
  183. ));
  184. echo '共:'.$page_total.'条';
  185. ?>
  186. </div>
  187. </div>
  188. </div>
  189. <?php endif;?>
  190. </div>
  191. <!--上传模板弹窗-->
  192. <!-- PAGE CONTENT ENDS -->
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. <script src="/js/jquery.ajaxfileupload.js"></script>
  198. <script type="text/javascript">
  199. $(document).ready(function(){
  200. /*var str = '<div class="points"></div>';
  201. $(".sc-lis").each(function(){
  202. if($(this).find(".points").length>0){
  203. $(".sel-opt").append(str);
  204. }
  205. });*/
  206. $(".sel-opt,.sel-cons").mouseover(function(){
  207. $(".sel-cons").show();
  208. }).mouseout(function(){
  209. $(".sel-cons").hide();
  210. });
  211. $(".sc-lis").click(function(){
  212. var data = {
  213. subjectId : $(this).attr('val')
  214. };
  215. $.post("<?php echo Yii::app()->createUrl('print/setSubjectId')?>",data,function(flags){
  216. if(flags)
  217. {
  218. location.reload();
  219. }else
  220. {
  221. alert('网络异常');
  222. }
  223. });
  224. $('.has-sel').text($(this).text());
  225. $(".sel-cons").hide();
  226. });
  227. $("#delPaperStudentAll").click(function(){
  228. // 判断是否有选中
  229. var studentsIds;
  230. layer.msg('确定删除全部未考试的学生吗?', {
  231. time: 0,
  232. btn: ['确定', '取消'],
  233. yes: function(index){
  234. layer.close(index);
  235. var data={
  236. "exam_group_id":"<?php echo $exam_group_id ?>",
  237. };
  238. jQuery.post(
  239. "<?php echo $this->createUrl("zhiliao/delExamStudentAll?");?>",data,function(data){
  240. var m =JSON.parse(data);
  241. if(m.status==1)
  242. {
  243. var icon = 6;
  244. layer.alert("删除成功", {icon: icon}, function(){
  245. location.replace(location.href);
  246. });
  247. }else if(m.status==2){
  248. var icon = 5;
  249. layer.alert("无未上传成绩的学生", {icon: icon}, function(){
  250. location.replace(location.href);
  251. });
  252. }else{
  253. var icon = 5;
  254. layer.alert("删除失败", {icon: icon}, function(){
  255. location.replace(location.href);
  256. });
  257. }
  258. });
  259. }
  260. });
  261. });
  262. });
  263. function objToJson(obj){
  264. var json = "{ ";
  265. for(var item in obj){
  266. json += "'"+item+"':'"+obj[item]+"',";
  267. }
  268. json += " }";
  269. return json;
  270. }
  271. function ccc(){
  272. layer.msg('敬请期待!', {
  273. time: 0,
  274. btn: ['确定', '取消'],
  275. yes: function(index){
  276. layer.close(index);
  277. return false;
  278. }
  279. });
  280. }
  281. function delExam(odj){
  282. if (!odj) return false;
  283. var classId = odj.getAttribute("w_class_id");
  284. var examId = odj.getAttribute("w_exam_id");
  285. if (!classId || !examId) return false;
  286. var msg = '您确定要删除此班的考试吗?';
  287. layer.msg(msg, {
  288. time: 0,
  289. btn: ['确定', '取消'],
  290. yes: function(index){
  291. layer.close(index);
  292. $.ajax({
  293. url: "<?php echo $this->createUrl('print/delexam');?>",
  294. type: "POST",
  295. dataType: "json",
  296. data: {
  297. examId: examId,
  298. classId:classId
  299. },
  300. success: function (data){
  301. if(data.status == 1){
  302. layer.msg('删除成功',{
  303. icon: 1
  304. }, function(){
  305. layer.closeAll();
  306. location.reload();
  307. });
  308. }else{
  309. layer.msg('删除失败',{
  310. icon: 5
  311. }, function(){
  312. layer.closeAll();
  313. location.reload();
  314. });
  315. }
  316. },
  317. error: function (data, status, e){ //服务器响应失败处理函数
  318. layer.msg('返回失败!',{
  319. icon: 1
  320. }, function(){
  321. layer.closeAll();
  322. });
  323. }
  324. });
  325. }
  326. });
  327. }
  328. // 搜索事件
  329. $("#search").click(function(){
  330. $("#form1").submit();
  331. });
  332. // 隐藏试卷
  333. function oprateExam(examId,flag){
  334. if (examId) {
  335. layer.msg('未找到周周练id');
  336. }
  337. var msg = '您确定要隐藏该试卷吗?';
  338. if (flag == 0) {
  339. msg = '您确定要恢复该试卷吗?';
  340. }
  341. layer.msg(msg, {
  342. time: 0,
  343. btn: ['确定', '取消'],
  344. yes: function(index){
  345. layer.close(index);
  346. $.post('<?php echo $this->createUrl("print/oprateexam");?>',{examId:examId,flag:flag},function(data){
  347. var obj = JSON.parse(data);
  348. if (obj.success == 1) {
  349. location.reload();
  350. } else {
  351. layer.msg(obj.message);
  352. }
  353. });
  354. }
  355. });
  356. }
  357. </script>