mainly_stu.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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("print/selectStuByMainly",array("monthId" => $monthId));?>">
  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. </div>
  27. </div>
  28. </div>
  29. <div class="row">
  30. <div class="col-xs-12" style="font-weight:bold;padding:0px 15px">
  31. <?php echo isset($name)?$name:'';?>
  32. </div>
  33. </div>
  34. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  35. <thead>
  36. <tr>
  37. <th class="center">
  38. <input type="checkbox" class="ace selectAll">
  39. </th>
  40. <th>序号</th>
  41. <th>个性化学习宝名称</th>
  42. <th>学生名称</th>
  43. <th>学生编号</th>
  44. <th>个性化学习宝PDF</th>
  45. <th>下载功能</th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. <?php if(isset($list) && $list):foreach($list as $k=>$rt):?>
  50. <tr>
  51. <td class="center">
  52. <?php if (($rt['is_pdf'] == 1)) { ?>
  53. <input type="checkbox" class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  54. <?php } else { ?>
  55. <input type="checkbox" disabled='disabled' class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  56. <?php } ?>
  57. </td>
  58. <td><?php echo $k;?></td>
  59. <td><?php echo $rt['name'];?></td>
  60. <td><?php echo $rt['stu_name'];?></td>
  61. <td><?php echo $rt['stu_id'];?></td>
  62. <td>
  63. <?php if ($rt['is_pdf'] == 0): ?>
  64. <span class="label label-sm label-danger" style="font-size:12px">未生成</span> <!--红-->
  65. <?php elseif ($rt['is_pdf'] == 1): ?>
  66. <span class="label label-sm label-success" style="font-size:12px">已生成</span><!--绿-->
  67. <?php else: ?>
  68. <span class="label label-sm" style="font-size:12px;background-color:gray;">未知状态</span><!--灰-->
  69. <?php endif; ?>
  70. </td>
  71. <td>
  72. <?php
  73. if(isset($limitstu)){
  74. if($limitstu==0){
  75. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  76. }elseif($limitstu==-1){
  77. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  78. }else{
  79. // if(isset($limitstu[$rt['stu_id']])){
  80. if(is_array($limitstu) && in_array($rt['stu_id'],$limitstu)){
  81. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  82. }else{
  83. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  84. }
  85. }
  86. }else{
  87. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  88. }
  89. ?>
  90. </td>
  91. </tr>
  92. <?php endforeach;else:?>
  93. <tr><td colspan="6">暂无数据!</td></tr>
  94. <?php endif;?>
  95. </tbody>
  96. </table>
  97. </div>
  98. <input type="hidden" name="monthId" id="monthId" value="<?php echo $monthId;?>" />
  99. <!-- PAGE CONTENT ENDS -->
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <script type="text/javascript">
  105. //type = "<?php // echo $type;?>";
  106. //if(type == "isp"){
  107. // type = 2;
  108. // improveName = "个性化学习方案";
  109. //}
  110. //else if(type == "studytrend"){
  111. // type = 3;
  112. // improveName = "个性化学习宝";
  113. //}
  114. //else if(type == "third_isp"){
  115. // type = 3;
  116. // improveName = "个性化学习宝";
  117. //}
  118. //else{
  119. // type = 0;
  120. //}
  121. html = ""+
  122. '<div style="padding:20px 30px 0px 30px">'+
  123. '<div style="padding:8px 0;">请复制下方链接下载个性化学习宝。</div>'+
  124. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  125. '<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>'+
  126. '</div>'+
  127. '</div>'+
  128. "";
  129. $(function(){
  130. // 全选\反选
  131. $(".selectAll").on('click',function(event){
  132. if ($(this).prop("checked")) {
  133. var s_obj = $(".myselect");
  134. var s_len = s_obj.length;
  135. for (var i=0;i<s_len;i++) {
  136. if (!s_obj[i].disabled) {
  137. s_obj[i].checked=true;
  138. }
  139. }
  140. } else {
  141. $(".myselect").prop("checked",false);
  142. }
  143. });
  144. //
  145. //
  146. $("#selectPrint").click(function(){
  147. var monthId = $("#monthId").val();
  148. // 判断是否有选中
  149. if (!$("input[class='ace myselect']").is(':checked')) {
  150. layer.msg('请至少选择一个学生!');return false;
  151. }
  152. layer.msg('您确定下载个性化学习方案吗?', {
  153. time: 0,
  154. btn: ['确定', '取消'],
  155. yes: function(index){
  156. layer.close(index);
  157. var result = [];
  158. $(".myselect").each(function(m,n){
  159. if ($(this).prop('checked')) {
  160. if ($(this).val() && $(this).attr("stnm")) {
  161. result.push($(this).val());
  162. }
  163. }
  164. })
  165. if (result.length < 1) {
  166. layer.msg('未找到要下载的学生!');return false;
  167. }
  168. result = result.join(",");
  169. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  170. // 更试卷打印时间
  171. startTime = (new Date()).getTime();
  172. showTip = true;
  173. tipShowed = false;
  174. toPromptTime = 3000;
  175. window.interval = setInterval(function(){
  176. execTime = (new Date()).getTime() - startTime;
  177. if(execTime > toPromptTime && showTip && !tipShowed){
  178. msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  179. tipShowed = true;
  180. }
  181. }, 1000);
  182. jQuery.get(
  183. "<?php echo $this->createUrl("print/getEnglishFileMonth");?>",
  184. {"monthId": monthId, "studentsIds":result},
  185. function(data){
  186. console.log(data);
  187. data = JSON.parse(data);
  188. if(data.success == 1||data.success == 2){
  189. layer.open({
  190. type: 1,
  191. area: ['550px', '220px'],
  192. title: "下载个性化学习宝",
  193. content: html,
  194. success: function(index, layerObj){
  195. clearInterval(window.interval);
  196. layer.close(msgIndex);
  197. 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>')
  198. jQuery("#confirm, #cancel").on("click", function(){
  199. layer.close(layerObj);
  200. });
  201. jQuery("#copy").on("click", function(){
  202. jQuery("#url").select();
  203. });
  204. },
  205. end: function(){
  206. }
  207. });
  208. }
  209. else{
  210. clearInterval(window.interval);
  211. msgIndex = layer.msg(data.message, {"time": 3000});
  212. }
  213. }
  214. );
  215. }
  216. });
  217. });
  218. })
  219. </script>