classeshomework.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <script type="text/javascript">
  2. jQuery(document).ready(function(){
  3. jQuery("#class").change(function(){
  4. var classId = jQuery(this).val();
  5. location.href = "<?php echo $this->createUrl("vacationhomework/classes?classId=");?>"+classId;
  6. });
  7. });
  8. </script>
  9. <div class="main-content-inner">
  10. <ul class="clearfix main-content-inner-ul">
  11. <li class="pull-left">
  12. <button onclick='location.href="<?php echo $this->createUrl("print/index",array('type'=>'wp'));?>"' class="button button_normal button_group button_arrow <?php if($printType == 'wp'){echo 'button_active';}?>" data-button="red">打印试卷</button>
  13. <img src="/images/line.jpg" style="height:45px;" />
  14. </li>
  15. <li class="pull-left">
  16. <!--<button onclick='' class="button button_normal button_group button_arrow <?php if($printType == 'wtb'){echo 'button_active';}?>" data-button="red">下载错题本</button>-->
  17. <button onclick='location.href="<?php echo $this->createUrl("print/sub_index",array('type'=>'wtb'));?>"' class="button button_normal button_group button_arrow <?php if($printType == 'wtb'){echo 'button_active';}?>" data-button="red">下载错题本</button>
  18. <img src="/images/line.jpg" style="height:45px;" />
  19. </li>
  20. <li class="pull-left">
  21. <!--<button onclick='ccc()' class="button button_normal button_group button_arrow <?php if($printType == 'isp'){echo 'button_active';}?>" data-button="red">下载提分方案</button>-->
  22. <button onclick='location.href="<?php echo $this->createUrl("print/sub_index",array('type'=>'isp'));?>"' class="button button_normal button_group button_arrow <?php if($printType == 'isp'){echo 'button_active';}?>" data-button="red">下载提分方案</button>
  23. <img src="/images/line.jpg" style="height:45px;" />
  24. </li>
  25. <li class="pull-left">
  26. <button onclick='location.href="<?php echo $this->createUrl("export/index");?>"' class="button button_normal button_group button_arrow <?php if($printType == ''){echo 'button_active';}?>" data-button="red">导出报告</button>
  27. <img src="/images/line.jpg" style="height:45px;" />
  28. </li>
  29. <li class="pull-left">
  30. <button onclick='location.href="<?php echo $this->createUrl("vacationhomework/classes");?>"' class="button button_normal button_group button_arrow <?php if($printType == 'vh'){echo 'button_active';}?>" data-button="red">下载暑假作业</button>
  31. <img src="/images/line.jpg" style="height:45px;" />
  32. </li>
  33. <li class="pull-left">
  34. <button onclick='location.href="<?php echo $this->createUrl("cylet/index");?>"' class="button button_normal button_group button_arrow" data-button="red">全学科统考</button>
  35. </li>
  36. </ul>
  37. <div class="page-content">
  38. <div class="row" style="margin:0px;">
  39. <div class="col-xs-12">
  40. <!-- PAGE CONTENT BEGINS -->
  41. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  42. <div class="row">
  43. <form method="get" id="form1" action="<?php echo $this->createUrl("print/index");?>">
  44. <div class="col-xs-12">
  45. <div class="dataTables_length margin-zy">
  46. <input type="hidden" name="type" value="<?php echo $printType;?>" />
  47. <select class="form-control" id="class" name="classId">
  48. <option value="">全部班级</option>
  49. <?php foreach($classes as $class){?>
  50. <option <?php if($classId == $class["class_id"]) echo "selected";?> value="<?php echo $class["class_id"];?>"><?php echo $class["class_name"];?></option>
  51. <?php }?>
  52. </select>
  53. </div>
  54. </div>
  55. </form>
  56. </div>
  57. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  58. <thead>
  59. <tr>
  60. <th>名称</th>
  61. <th>班级</th>
  62. <th>生成时间</th>
  63. <th>操作</th>
  64. </tr>
  65. </thead>
  66. <tbody>
  67. <?php if(!empty($rs)):foreach($rs as $cl):?>
  68. <tr>
  69. <td><?php echo "{$cl['class_name']} {$cl['semester_name']} 暑假作业";?></td>
  70. <td><?php echo $cl['class_name'];?></td>
  71. <td><?php if(!empty($cl['generate_time'])){ echo date('Y-m-d H:i',$cl['generate_time']);}?></td>
  72. <td>
  73. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载暑假作业" onclick="javascript:location.href='<?php echo $this->createUrl('vacationhomework/students?classId=').$cl['class_id'];?>'">&#xe668;</span>
  74. </td>
  75. </tr>
  76. <?php endforeach;else:?>
  77. <tr><td colspan="5">暂无数据!</td></tr>
  78. <?php endif;?>
  79. </tbody>
  80. </table>
  81. <?php if(!empty($page_total)):?>
  82. <div class="row">
  83. <div class="col-xs-6">
  84. &nbsp;
  85. </div>
  86. <div class="col-xs-6">
  87. <div class="dataTables_paginate paging_simple_numbers">
  88. <?php
  89. $this->widget('CLinkPager', array(
  90. 'header' => '',
  91. 'firstPageLabel'=> '首页',
  92. 'lastPageLabel' => '末页',
  93. 'prevPageLabel' => '上一页',
  94. 'nextPageLabel' => '下一页',
  95. 'pages' => $pager,
  96. 'maxButtonCount'=> 5,
  97. ));
  98. echo '共:'.$pager->rowsCount.'条';
  99. ?>
  100. </div>
  101. </div>
  102. </div>
  103. <?php endif;?>
  104. </div>
  105. <!--上传模板弹窗-->
  106. <!-- PAGE CONTENT ENDS -->
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <script src="/js/jquery.ajaxfileupload.js"></script>
  112. <script type="text/javascript">
  113. function ccc(){
  114. layer.msg('敬请期待!', {
  115. time: 0,
  116. btn: ['确定', '取消'],
  117. yes: function(index){
  118. layer.close(index);
  119. return false;
  120. }
  121. });
  122. }
  123. // 确认上传成绩
  124. function uploadConfirm(classId, examId) {
  125. //if (confirm('您确定已上传成绩了吗?')) {
  126. layer.msg('您确定已上传成绩了吗?', {
  127. time: 0,
  128. btn: ['确定', '取消'],
  129. yes: function(index){
  130. layer.close(index);
  131. $.ajax({
  132. url: "<?php echo $this->createUrl('print/uploadConfirm');?>",
  133. type: "POST",
  134. data: {
  135. classId: classId,
  136. examId: examId
  137. },
  138. beforeSend:function(){
  139. // 发送请求显示打印中
  140. layer.msg('确认中...', {icon: 16,time: 20000});
  141. },
  142. dataType: "JSON",
  143. success: function(data) {
  144. if (data.status == 1) {
  145. var index = layer.msg();
  146. layer.close(index);
  147. layer.msg('确认成功!');
  148. location.reload();
  149. } else {
  150. alert(data.error);
  151. }
  152. },
  153. complete:function(){
  154. var index = layer.msg();
  155. layer.close(index);
  156. },
  157. error:function(){
  158. var index = layer.msg();
  159. layer.close(index);
  160. }
  161. });
  162. }
  163. });
  164. //}
  165. }
  166. // 打印错题本
  167. function printBook(cid,eid,type){
  168. if (!cid || !eid || !type) {
  169. layer.msg("打印参数有误");return;
  170. }
  171. var message = '';
  172. var objUrl = '';
  173. if (type == 1) {
  174. message = "您确定要下载该班级错题本嘛!";
  175. objUrl = "<?php echo $this->createUrl('print/downloadwrongtopic');?>";
  176. } else{
  177. message = "您确定要下载该班级提分方案嘛!";
  178. objUrl = "<?php echo $this->createUrl('print/downloadraisescheme');?>";
  179. }
  180. layer.msg(message, {
  181. time: 0,
  182. btn: ['确定', '取消'],
  183. yes: function(index){
  184. layer.close(index);
  185. layer.msg("下载中请稍后...");
  186. // 更试卷打印时间
  187. $.post("<?php echo $this->createUrl('print/updatepaperprinttime');?>", {cid: cid, eid: eid,type:type } );
  188. location.href = objUrl+"/cid/"+cid+"/eid/"+eid;
  189. }
  190. });
  191. }
  192. // 上传试卷模板
  193. function uploadTemplate(eid,name){
  194. if (!eid) {
  195. layer.msg('操作失败!');
  196. return false;
  197. }
  198. $.post("<?php echo $this->createUrl('print/verifyTpl');?>",{eid:eid},function(data){
  199. var obj = JSON.parse(data);
  200. var html ='<div class="layer_notice" style="padding:5px;">';
  201. html +='<table class="table table-striped table-bordered table-hover ">';
  202. html +='<thead class="thin-border-bottom">';
  203. html +='<tr>';
  204. html +='<th>试卷名称</th>';
  205. html +='<th>是否上传</th>';
  206. html +='<th>操作</th>';
  207. html +='</tr>';
  208. html +='</thead>';
  209. html +='<tbody class="content_tbody">';
  210. if (obj.success == 1) {
  211. html +='<td>'+name+'</td><td><span style="color:red;">已上传</span></td><td><input type="file" name="word_file" id="word_file" /></td></tr>';
  212. } else {
  213. html +='<td>'+name+'</td><td id="alreadUpload">未上传</td><td><input type="file" name="word_file" id="word_file" /></td></tr>';
  214. }
  215. html +='</tbody>';
  216. html +='</table>';
  217. html +='<span style="width:582px;display:inline-block;text-align:center;">';
  218. html +='<button class="btn btn-success btn-sm" onclick="uploadWord()"><i class="ace-icon fa fa-check bigger-110"></i>确定</button>';
  219. html +='</span>';
  220. html +='<input type="hidden" id="mpEid" value="'+eid+'">';
  221. html +='</div>';
  222. layer.open({
  223. type: 1,
  224. skin: 'layui-layer-rim', //加上边框
  225. area: ['600px', '300px'], //宽高
  226. content: html
  227. });
  228. });
  229. }
  230. function uploadWord(paramEid) {
  231. var paramEid = $('#mpEid').val();
  232. if (!paramEid) {
  233. layer.msg('没找到周周练ID!');
  234. return false;
  235. }
  236. var obj_file = $("#word_file").val();
  237. if (!obj_file) {
  238. layer.msg('请选择上传文件');
  239. return false;
  240. }
  241. var extStart = obj_file.lastIndexOf('.');
  242. var extName = obj_file.substring(extStart,obj_file.length).toLowerCase();
  243. if (extName != ".dotx") {
  244. layer.msg('模板格式有误,请上传dotx格式word!');
  245. return false;
  246. }
  247. $.ajaxFileUpload({
  248. url: "<?php echo $this->createUrl('print/uploadTpl');?>", //用于文件上传的服务器端请求地址
  249. secureuri: false, //是否需要安全协议,一般设置为false
  250. fileElementId: 'word_file', //文件上传域的ID
  251. dataType: 'text', //返回值类型 一般设置为json
  252. data:{"eid":paramEid},
  253. success: function (data, status){
  254. var obj = JSON.parse(data);
  255. if (obj.success == 1) {
  256. layer.msg(obj.message,{
  257. icon: 1,
  258. }, function(){
  259. layer.closeAll();
  260. });
  261. $("#alreadUpload").html('<span style="color:red;">已上传</span>');
  262. } else {
  263. layer.msg(obj.message,{
  264. icon: 1,
  265. }, function(){
  266. layer.closeAll();
  267. });
  268. }
  269. },
  270. error: function (data, status, e){ //服务器响应失败处理函数
  271. layer.msg('返回失败!',{
  272. icon: 1,
  273. }, function(){
  274. layer.closeAll();
  275. });
  276. }
  277. });
  278. return false;
  279. }
  280. // 搜索事件
  281. $("#search").click(function(){
  282. $("#form1").submit();
  283. });
  284. function print(cid,eid,tid,fg){
  285. if (!cid || !eid) return false;
  286. var msg = '';
  287. if (tid == 0) {
  288. if (fg == 1) {
  289. msg = '打印答题卡';
  290. } else {
  291. msg = '您确定要打印该试卷嘛?';
  292. }
  293. } else if (tid == 1) {
  294. msg = '您确定要打印该错题本嘛?';
  295. } else if (tid == 2) {
  296. msg = '您确定要打印该提分册嘛?';
  297. }
  298. layer.msg(msg, {
  299. time: 0,
  300. btn: ['确定', '取消'],
  301. yes: function(index){
  302. layer.close(index);
  303. ajaxPrint(cid, eid, tid);
  304. }
  305. });
  306. }
  307. function ajaxPrint(cid, eid, tid) {
  308. $.ajax({
  309. url:"<?php echo $this->createUrl('print/ajaxupdate');?>",
  310. type:"post",
  311. data:{cid:cid,eid:eid,tid:tid},
  312. dataType: "json",
  313. beforeSend:function(){
  314. // 发送请求显示打印中
  315. layer.msg('打印中', {icon: 16,time: 20000});
  316. },
  317. success:function(obj){
  318. var index = layer.msg();
  319. layer.close(index);
  320. if (obj.success == 1) {
  321. if (tid == 0) {//console.log(JSON.stringify(obj.message));
  322. evaluationClient.printPaper(JSON.stringify(obj.message));
  323. //alert('提交打印试卷成功!');
  324. } else if (tid == 1) {
  325. evaluationClient.printCTB(JSON.stringify(obj.message));
  326. //alert('提交打印错题本成功!');
  327. } else if (tid == 2) {
  328. evaluationClient.printTFFA(JSON.stringify(obj.message));
  329. //alert('提交打印提分册成功!');
  330. } else {
  331. layer.msg('操作错误!');
  332. }
  333. location.reload();
  334. } else {//alert(obj.message);
  335. layer.msg(obj.message);
  336. }
  337. },
  338. complete:function(){
  339. //layer.msg('打印失败!');
  340. //var index = layer.msg();
  341. //layer.close(index);
  342. },
  343. error:function(){
  344. //var index = layer.msg();
  345. //layer.close(index);
  346. }
  347. });
  348. }
  349. // 生成试卷模板
  350. function createTemplate (eid,flag){
  351. if (!eid) {
  352. layer.msg('未找到周周练id');
  353. }
  354. var msg = '';
  355. if (flag == 2) {
  356. msg = '您确定要下载试卷嘛?';
  357. } else {
  358. msg = '您确定要生成模板嘛?';
  359. }
  360. layer.msg(msg, {
  361. time: 0,
  362. btn: ['确定', '取消'],
  363. yes: function(index){
  364. layer.close(index);
  365. $.post('<?php echo $this->createUrl('print/createtempelate');?>',{eid:eid},function(data){
  366. var obj = JSON.parse(data);
  367. if (obj.success == 1) {
  368. if (flag == 2) {
  369. evaluationClient.CreatePaperTiGan(JSON.stringify(obj.object));
  370. } else {
  371. evaluationClient.createPaper(JSON.stringify(obj.object));
  372. }
  373. } else {
  374. layer.msg(obj.message);
  375. }
  376. });
  377. }
  378. });
  379. }
  380. </script>