sheet_chang.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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/class_student_product", array("type" => $type));?>">
  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="student_name" value="<?php echo $student_name;?>"></label>
  16. <button style="padding:4px 12px;"class="label-primary-s bth-s">搜索</button>
  17. </div>
  18. </div>
  19. <input type="hidden" name="cid" value="<?php echo $class_id;?>" />
  20. <input type="hidden" name="type" value="<?php echo $type;?>" />
  21. </form>
  22. </div>
  23. <div class="col-xs-2">
  24. <div class="dataTables_filter" id="dynamic-table_filter" style="padding-top:15px">
  25. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrint">
  26. <i style="font-style: normal;" class="fa fa-print"></i> 下载
  27. </a>
  28. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrintToolsJieDuan">
  29. <i style="font-style: normal;" class="fa fa-print"></i> 打印
  30. </a>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="row">
  35. <div class="col-xs-12" style="font-weight:bold;padding:0px 15px">
  36. <?php switch($type){
  37. case 1:echo $semester_name."期中阶段复习个性化学习宝";break;
  38. case 2:echo $semester_name."期末阶段复习个性化学习宝";break;
  39. case 3:echo $semester_name."总复习个性化学习宝";break;
  40. }?>
  41. </div>
  42. </div>
  43. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  44. <thead>
  45. <tr>
  46. <th class="center">
  47. <!--<label class="pos-rel">
  48. <input type="checkbox" class="ace selectAll">
  49. <span class="lbl"></span>
  50. </label>-->
  51. <input type="checkbox" class="ace selectAll">
  52. </th>
  53. <th>个性化学习宝名称</th>
  54. <th>学生名称</th>
  55. <th>学生编号</th>
  56. <th>是否生成</th>
  57. <th>下载功能</th>
  58. </tr>
  59. </thead>
  60. <tbody>
  61. <?php if(!empty($student)):foreach($student as $rt):?>
  62. <tr>
  63. <td class="center">
  64. <?php if($rt->is_outer){ ?>
  65. <input type="checkbox" class="ace myselect" value="<?php echo $rt->student_id;?>" stnm="<?php echo $rt->realname;?>">
  66. <?php } ?>
  67. </td>
  68. <td> <?php switch($type){
  69. case 1:echo $class_name.$rt->realname."期中阶段复习个性化学习宝";break;
  70. case 2:echo $class_name.$rt->realname."期末阶段复习个性化学习宝";break;
  71. case 3:echo $class_name.$rt->realname."总复习个性化学习宝";break;
  72. case 4:echo $class_name.$rt->realname."期中阶段复习个性化学习宝";break;
  73. case 5:echo $class_name.$rt->realname."期末阶段复习个性化学习宝";break;
  74. case 6:echo $class_name.$rt->realname."总复习个性化学习宝";break;
  75. }?></td>
  76. <td><?php echo $rt->realname;?></td>
  77. <td><?php echo $rt->student_id;?></td>
  78. <td>
  79. <?php if (isset($student_products[$rt->student_id])){
  80. ?>
  81. <span class="label label-sm label-success" style="font-size:12px">已生成</span>
  82. <?php
  83. }else{
  84. ?>
  85. <span class="label label-sm label-danger" style="font-size:12px">未生成</span>
  86. <?php
  87. } ?>
  88. </td>
  89. <?php // if(YII_ENV === "development"){ ?>
  90. <td>
  91. <?php if($rt->is_outer){ ?>
  92. <span class="label label-sm label-success" style="font-size:12px">已开通</span>
  93. <?php }else{ ?>
  94. <span class="label label-sm label-danger" style="font-size:12px">未开通</span>
  95. <?php } ?>
  96. </td>
  97. <?php // } ?>
  98. </tr>
  99. <?php endforeach;else:?>
  100. <tr><td colspan="6">暂无数据!</td></tr>
  101. <?php endif;?>
  102. </tbody>
  103. </table>
  104. <?php if(!empty($page_count)){?>
  105. <div class="row">
  106. <div class="col-xs-6">
  107. &nbsp;
  108. </div>
  109. <div class="col-xs-6">
  110. <div class="dataTables_paginate paging_simple_numbers">
  111. <?php
  112. $this->widget('CLinkPager', array(
  113. 'header' => '',
  114. 'firstPageLabel'=> '首页',
  115. 'lastPageLabel' => '末页',
  116. 'prevPageLabel' => '上一页',
  117. 'nextPageLabel' => '下一页',
  118. 'pages' => $pages,
  119. 'maxButtonCount'=> 5,
  120. ));
  121. echo '共:'.($page_count).'条';
  122. ?>
  123. </div>
  124. </div>
  125. </div>
  126. <?php }?>
  127. </div>
  128. <input type="hidden" name="classId" id="classId" value="<?php echo $class_id;?>" />
  129. <input type="hidden" name="type" id="type" value="<?php echo $type;?>" />
  130. <!-- PAGE CONTENT ENDS -->
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. <?php require_once "_print.php"?>
  136. <script type="text/javascript">
  137. type = "<?php echo $type;?>";
  138. if(type == 1){
  139. type = 1;
  140. improveName = "期中阶段复习个性化学习宝";
  141. }
  142. else if(type == 2){
  143. type = 2;
  144. improveName = "期末阶段复习个性化学习宝";
  145. }
  146. else{
  147. type = 3;
  148. improveName = "总复习个性化学习宝";
  149. }
  150. html = ""+
  151. '<div style="padding:20px 30px 0px 30px">'+
  152. '<div style="padding:8px 0;">请复制下方链接下载'+improveName+'。</div>'+
  153. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  154. '<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>'+
  155. '</div>'+
  156. '</div>'+
  157. "";
  158. $(function(){
  159. // 全选\反选
  160. $(".selectAll").click(function(){
  161. if ($(this).prop("checked")) {
  162. var s_obj = $(".myselect");
  163. var s_len = s_obj.length;
  164. for (var i=0;i<s_len;i++) {
  165. if (!s_obj[i].disabled) {
  166. s_obj[i].checked=true;
  167. }
  168. }
  169. } else {
  170. $(".myselect").prop("checked",false);
  171. }
  172. });
  173. $("#selectPrint").click(function(){
  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 classId = $("#classId").val();
  184. var type = $("#type").val();
  185. if (!classId || !type) {
  186. layer.msg('参数错误!');return false;
  187. }
  188. var result = [];
  189. $(".myselect").each(function(m,n){
  190. if ($(this).prop('checked')) {
  191. if ($(this).val() && $(this).attr("stnm")) {
  192. result.push($(this).val());
  193. }
  194. }
  195. })
  196. if (result.length < 1) {
  197. layer.msg('未找到要下载的学生!');return false;
  198. }
  199. if(type>3){
  200. type=(type-3);
  201. }
  202. $.ajax({
  203. url: "<?php echo $this->createUrl('productdownload/download_student_product');?>",
  204. type: "GET",
  205. dataType: "json",
  206. data: { "classId": classId, "type": type, "studentsIds":result},
  207. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  208. beforeSend:function(){
  209. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  210. },
  211. error: function (jqXHR, textStatus, errorThrown) {
  212. if(textStatus=="timeout"){
  213. $.ajax({
  214. type:'GET',
  215. url: "<?php echo $this->createUrl("productdownload/addSpTask");?>",
  216. data: { "classId": classId, "type": type, "studentsIds":result},
  217. dataType: "json",
  218. success:function (data) {
  219. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  220. icon: 1,
  221. yes:function(){
  222. layer.closeAll();
  223. }
  224. });
  225. }
  226. })
  227. }else {
  228. layer.msg('返回失败!',{
  229. icon: 5
  230. }, function(){
  231. layer.closeAll();
  232. });
  233. }
  234. },
  235. success: function (data){
  236. layer.closeAll();
  237. if(data.success == 1||data.success == 2){
  238. layer.open({
  239. type: 1,
  240. area: ['550px', '220px'],
  241. title: "下载个性化学习宝",
  242. content: html,
  243. success: function(index, layerObj){
  244. 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>');
  245. jQuery("#confirm, #cancel").on("click", function(){
  246. layer.close(layerObj);
  247. });
  248. jQuery("#copy").on("click", function(){
  249. jQuery("#url").select();
  250. });
  251. },
  252. end: function(){
  253. }
  254. });
  255. }else if(data.success == 3){
  256. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  257. icon: 1,
  258. yes:function(){
  259. layer.closeAll();
  260. }
  261. });
  262. }
  263. else if(data.success == 0){
  264. layer.msg(data.message, {"time": 3000});
  265. }
  266. },
  267. });
  268. }
  269. });
  270. });
  271. })
  272. </script>