stu.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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("special/stu",array("gp_id" => $gp_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="selectPrintToolsZtb">
  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. </tr>
  50. </thead>
  51. <tbody>
  52. <?php if(isset($list) && $list):foreach($list as $k=>$rt):?>
  53. <tr>
  54. <td class="center">
  55. <?php if (($rt['is_pdf'] == 1)) { ?>
  56. <input type="checkbox" class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  57. <?php } else { ?>
  58. <input type="checkbox" disabled='disabled' class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  59. <?php } ?>
  60. </td>
  61. <td><?php echo $k;?></td>
  62. <td><?php echo $rt['name'];?></td>
  63. <td><?php echo $rt['stu_name'];?></td>
  64. <td><?php echo $rt['stu_id'];?></td>
  65. <td>
  66. <?php if ($rt['is_pdf'] == 0 || $rt['is_pdf'] == 90): ?>
  67. <span class="label label-sm label-danger" style="font-size:12px">未生成</span> <!--红-->
  68. <?php elseif ($rt['is_pdf'] == 1): ?>
  69. <span class="label label-sm label-success" style="font-size:12px">已生成</span><!--绿-->
  70. <?php elseif ($rt['is_pdf'] == 9): ?>
  71. <span class="label label-sm" style="font-size:12px;background-color:gray;">已删除</span><!--灰-->
  72. <?php else: ?>
  73. <span class="label label-sm" style="font-size:12px;background-color:gray;">未知状态</span><!--灰-->
  74. <?php endif; ?>
  75. </td>
  76. <td>
  77. <?php
  78. if(isset($limitstu)){
  79. if($limitstu==0){
  80. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  81. }elseif($limitstu==-1){
  82. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  83. }else{
  84. // if(isset($limitstu[$rt['stu_id']])){
  85. if(is_array($limitstu) && in_array($rt['stu_id'],$limitstu,true)){
  86. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  87. }else{
  88. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  89. }
  90. }
  91. }else{
  92. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  93. }
  94. ?>
  95. </td>
  96. </tr>
  97. <?php endforeach;else:?>
  98. <tr><td colspan="6">暂无数据!</td></tr>
  99. <?php endif;?>
  100. </tbody>
  101. </table>
  102. </div>
  103. <input type="hidden" name="weekId" id="weekId" value="<?php echo $gp_id;?>" />
  104. <input type="hidden" name="classId" id="classId" value="<?php echo $class_id;?>" />
  105. <input type="hidden" name="type" id="type" value="<?php echo $type;?>" />
  106. <!-- PAGE CONTENT ENDS -->
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  112. <script type="text/javascript">
  113. html = ""+
  114. '<div style="padding:20px 30px 0px 30px">'+
  115. '<div style="padding:8px 0;">请复制下方链接下载专题宝。</div>'+
  116. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  117. '<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>'+
  118. '</div>'+
  119. '</div>'+
  120. "";
  121. $(function(){
  122. // 全选\反选
  123. $(".selectAll").on('click',function(event){
  124. if ($(this).prop("checked")) {
  125. var s_obj = $(".myselect");
  126. var s_len = s_obj.length;
  127. for (var i=0;i<s_len;i++) {
  128. if (!s_obj[i].disabled) {
  129. s_obj[i].checked=true;
  130. }
  131. }
  132. } else {
  133. $(".myselect").prop("checked",false);
  134. }
  135. });
  136. //
  137. //
  138. $("#selectPrint").click(function(){
  139. var weekId = $("#weekId").val();
  140. var classId = $("#classId").val();
  141. var type = $("#type").val();
  142. // 判断是否有选中
  143. if (!$("input[class='ace myselect']").is(':checked')) {
  144. layer.msg('请至少选择一个学生!');return false;
  145. }
  146. layer.msg("您确定下载专题宝吗?", {
  147. time: 0,
  148. btn: ['确定', '取消'],
  149. yes: function(index){
  150. layer.close(index);
  151. var result = [];
  152. $(".myselect").each(function(m,n){
  153. if ($(this).prop('checked')) {
  154. if ($(this).val() && $(this).attr("stnm")) {
  155. result.push($(this).val());
  156. }
  157. }
  158. })
  159. if (result.length < 1) {
  160. layer.msg('未找到要下载的学生!');return false;
  161. }
  162. $.ajax({
  163. url: "<?php echo $this->createUrl('productdowngeneral/getUrl');?>",
  164. type: "GET",
  165. dataType: "json",
  166. data: {"gpId": weekId,"classId":classId,"type":type,"studentsIds":result},
  167. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  168. beforeSend:function(){
  169. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  170. },
  171. error: function (jqXHR, textStatus, errorThrown) {
  172. if(textStatus=="timeout"){
  173. $.ajax({
  174. type:'GET',
  175. url: "<?php echo $this->createUrl("productdowngeneral/addTask");?>",
  176. data: {"gpId": weekId,"classId":classId,"type":type,"studentsIds":result},
  177. dataType: "json",
  178. success:function (data) {
  179. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  180. icon: 1,
  181. yes:function(){
  182. layer.closeAll();
  183. }
  184. });
  185. }
  186. })
  187. }else {
  188. layer.msg('返回失败!',{
  189. icon: 5
  190. }, function(){
  191. layer.closeAll();
  192. });
  193. }
  194. },
  195. success: function (data){
  196. layer.closeAll();
  197. if(data.success == 1||data.success == 2){
  198. layer.open({
  199. type: 1,
  200. area: ['550px', '220px'],
  201. title: "下载专题宝",
  202. content: html,
  203. success: function(index, layerObj){
  204. 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>');
  205. jQuery("#confirm, #cancel").on("click", function(){
  206. layer.close(layerObj);
  207. });
  208. jQuery("#copy").on("click", function(){
  209. jQuery("#url").select();
  210. });
  211. },
  212. end: function(){
  213. }
  214. });
  215. }else if(data.success == 3){
  216. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  217. icon: 1,
  218. yes:function(){
  219. layer.closeAll();
  220. }
  221. });
  222. }
  223. else if(data.success == 0){
  224. layer.msg(data.message, {"time": 3000});
  225. }
  226. },
  227. });
  228. }
  229. });
  230. });
  231. })
  232. </script>