stu.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <div class="main-content-inner">
  2. <!-- 导航栏开始-->
  3. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  4. <!-- 导航栏结束-->
  5. <div class="page-content">
  6. <div class="row" style="margin:0px">
  7. <div class="col-xs-12">
  8. <!-- PAGE CONTENT BEGINS -->
  9. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  10. <div class="row">
  11. <div class="col-xs-10">
  12. <form method="get" id="form1" action="<?php echo $this->createUrl("magic/stu",array("mw_id" => $mw_id));?>">
  13. <div class="dataTables_length" style="margin: 6px 0px;">
  14. <div class="dataTables_length">
  15. <label><input type="text" class="form-control input-sm" placeholder="请输入学生姓名" name="sname" value="<?php echo $sname;?>"></label>
  16. <button style="padding:4px 12px;"class="label-primary-s bth-s">搜索</button>
  17. </div>
  18. </div>
  19. </form>
  20. </div>
  21. <div class="col-xs-2">
  22. <div class="dataTables_filter" id="dynamic-table_filter" style="padding-top:15px">
  23. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrint">
  24. <i style="font-style: normal;" class="fa fa-print"></i> 下载
  25. </a>
  26. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrintToolsChb">
  27. <i style="font-style: normal;" class="fa fa-print"></i> 打印
  28. </a>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="row">
  33. <div class="col-xs-12" style="font-weight:bold;padding:0px 15px">
  34. <?php echo isset($name)?$name:'';?>
  35. </div>
  36. </div>
  37. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  38. <thead>
  39. <tr>
  40. <th class="center">
  41. <input type="checkbox" class="ace selectAll">
  42. </th>
  43. <th>序号</th>
  44. <th>词汇宝名称</th>
  45. <th>学生名称</th>
  46. <th>学生编号</th>
  47. <th>词汇宝PDF</th>
  48. <th>检测卡</th>
  49. <th>批改后PDF</th>
  50. <th>下载功能</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. <?php if(isset($list) && $list):foreach($list as $k=>$rt):?>
  55. <tr>
  56. <td class="center">
  57. <?php if (($rt['is_pdf'] == 1)) { ?>
  58. <input type="checkbox" class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  59. <?php } else { ?>
  60. <input type="checkbox" disabled='disabled' class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  61. <?php } ?>
  62. </td>
  63. <td><?php echo $k;?></td>
  64. <td><?php echo $rt['name'];?></td>
  65. <td><?php echo $rt['stu_name'];?></td>
  66. <td><?php echo $rt['stu_id'];?></td>
  67. <td>
  68. <?php if ($rt['is_pdf'] == 0): ?>
  69. <span class="label label-sm label-danger" style="font-size:12px">未生成</span> <!--红-->
  70. <?php elseif ($rt['is_pdf'] == 1): ?>
  71. <span class="label label-sm label-success" style="font-size:12px">已生成</span><!--绿-->
  72. <?php elseif ($rt['is_pdf'] == 9): ?>
  73. <span class="label label-sm" style="font-size:12px;background-color:gray;">已删除</span><!--灰-->
  74. <?php else: ?>
  75. <span class="label label-sm" style="font-size:12px;background-color:gray;">未知状态</span><!--灰-->
  76. <?php endif; ?>
  77. </td>
  78. <td>
  79. <?php if ($rt['is_marking'] == 0): ?>
  80. <span class="label label-sm label-danger" style="font-size:12px">未批改</span> <!--红-->
  81. <?php else: ?>
  82. <span class="label label-sm label-success" style="font-size:12px">已批改</span><!--绿-->
  83. <?php endif; ?>
  84. </td>
  85. <td>
  86. <?php if ($rt['is_card_pdf'] == 0): ?>
  87. <span class="label label-sm label-danger" style="font-size:12px">未生成</span> <!--红-->
  88. <?php elseif ($rt['is_card_pdf'] == 1): ?>
  89. <span class="label label-sm label-success" style="font-size:12px">已生成</span><!--绿-->
  90. <?php elseif ($rt['is_card_pdf'] == 9): ?>
  91. <span class="label label-sm" style="font-size:12px;background-color:gray;">已删除</span><!--灰-->
  92. <?php else: ?>
  93. <span class="label label-sm" style="font-size:12px;background-color:gray;">未知状态</span><!--灰-->
  94. <?php endif; ?>
  95. </td>
  96. <td>
  97. <?php
  98. if(isset($limitstu)){
  99. if($limitstu==0){
  100. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  101. }elseif($limitstu==-1){
  102. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  103. }else{
  104. // if(isset($limitstu[$rt['stu_id']])){
  105. if(is_array($limitstu) && in_array($rt['stu_id'],$limitstu,true)){
  106. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  107. }else{
  108. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  109. }
  110. }
  111. }else{
  112. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  113. }
  114. ?>
  115. </td>
  116. </tr>
  117. <?php endforeach;else:?>
  118. <tr><td colspan="6">暂无数据!</td></tr>
  119. <?php endif;?>
  120. </tbody>
  121. </table>
  122. </div>
  123. <input type="hidden" name="weekId" id="weekId" value="<?php echo $mw_id;?>" />
  124. <!-- PAGE CONTENT ENDS -->
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  130. <script type="text/javascript">
  131. //type = "<?php // echo $type;?>";
  132. //if(type == "isp"){
  133. // type = 2;
  134. // improveName = "个性化学习方案";
  135. //}
  136. //else if(type == "studytrend"){
  137. // type = 3;
  138. // improveName = "个性化学习宝";
  139. //}
  140. //else if(type == "third_isp"){
  141. // type = 3;
  142. // improveName = "个性化学习宝";
  143. //}
  144. //else{
  145. // type = 0;
  146. //}
  147. html = ""+
  148. '<div style="padding:20px 30px 0px 30px">'+
  149. '<div style="padding:8px 0;">请复制下方链接下载词汇宝。</div>'+
  150. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  151. '<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>'+
  152. '</div>'+
  153. '</div>'+
  154. "";
  155. $(function(){
  156. // 全选\反选
  157. $(".selectAll").on('click',function(event){
  158. if ($(this).prop("checked")) {
  159. var s_obj = $(".myselect");
  160. var s_len = s_obj.length;
  161. for (var i=0;i<s_len;i++) {
  162. if (!s_obj[i].disabled) {
  163. s_obj[i].checked=true;
  164. }
  165. }
  166. } else {
  167. $(".myselect").prop("checked",false);
  168. }
  169. });
  170. //
  171. //
  172. $("#selectPrint").click(function(){
  173. var weekId = $("#weekId").val();
  174. // 判断是否有选中
  175. if (!$("input[class='ace myselect']").is(':checked')) {
  176. layer.msg('请至少选择一个学生!');return false;
  177. }
  178. layer.msg("您确定下载词汇宝吗?", {
  179. time: 0,
  180. btn: ['确定', '取消'],
  181. yes: function(index){
  182. layer.close(index);
  183. var result = [];
  184. $(".myselect").each(function(m,n){
  185. if ($(this).prop('checked')) {
  186. if ($(this).val() && $(this).attr("stnm")) {
  187. result.push($(this).val());
  188. }
  189. }
  190. })
  191. if (result.length < 1) {
  192. layer.msg('未找到要下载的学生!');return false;
  193. }
  194. $.ajax({
  195. url: "<?php echo $this->createUrl('productdownload/getMagicWordFile');?>",
  196. type: "GET",
  197. dataType: "json",
  198. data: {"mw_id": weekId, "studentsIds":result},
  199. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  200. beforeSend:function(){
  201. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  202. },
  203. error: function (jqXHR, textStatus, errorThrown) {
  204. if(textStatus=="timeout"){
  205. $.ajax({
  206. type:'GET',
  207. url: "<?php echo $this->createUrl("productdownload/addMagicWordTask");?>",
  208. data: {"mw_id": weekId, "studentsIds":result},
  209. dataType: "json",
  210. success:function (data) {
  211. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  212. icon: 1,
  213. yes:function(){
  214. layer.closeAll();
  215. }
  216. });
  217. }
  218. })
  219. }else {
  220. layer.msg('返回失败!',{
  221. icon: 5
  222. }, function(){
  223. layer.closeAll();
  224. });
  225. }
  226. },
  227. success: function (data){
  228. layer.closeAll();
  229. if(data.success == 1||data.success == 2){
  230. layer.open({
  231. type: 1,
  232. area: ['550px', '220px'],
  233. title: "下载词汇宝",
  234. content: html,
  235. success: function(index, layerObj){
  236. 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>');
  237. jQuery("#confirm, #cancel").on("click", function(){
  238. layer.close(layerObj);
  239. });
  240. jQuery("#copy").on("click", function(){
  241. jQuery("#url").select();
  242. });
  243. },
  244. end: function(){
  245. }
  246. });
  247. }else if(data.success == 3){
  248. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  249. icon: 1,
  250. yes:function(){
  251. layer.closeAll();
  252. }
  253. });
  254. }
  255. else if(data.success == 0){
  256. layer.msg(data.message, {"time": 3000});
  257. }
  258. },
  259. });
  260. }
  261. });
  262. });
  263. })
  264. </script>