level.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
  2. <style>
  3. .btn-garder{
  4. text-decoration: none;background: cornflowerblue;padding: 5px;color: white;margin-left:5px;cursor: pointer;
  5. }
  6. </style>
  7. <script type="text/javascript">
  8. function in_array(search, array) {
  9. for (var i in array) {
  10. if (array[i] == search) {
  11. return true;
  12. }
  13. }
  14. return false;
  15. }
  16. testFlag = "<?php echo $this->testFlag;?>";
  17. customTplsIds = new Array();
  18. var i = 0;
  19. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  20. customTplsIds[i] = "<?php echo $tplId;?>";
  21. i++;
  22. <?php }?>
  23. jQuery(document).ready(function () {
  24. // 根据年级筛选班级
  25. jQuery("#grade").change(function () {
  26. var grade = $(this).val();
  27. if (!grade) return false;
  28. jQuery.post(
  29. '<?php echo $this->createUrl("print/getGradeClass");?>', {"grade": grade}, function (data) {
  30. data = JSON.parse(data);
  31. if (data.success == 1) {
  32. var classObj = $("#class");
  33. var html = "<option value=''>全部班级</option>";
  34. classObj.empty();
  35. $.each(data.message, function (i, n) {
  36. html += "<option value='" + n.class_id + "'>" + n.class_name + "</option>";
  37. });
  38. classObj.append(html);
  39. }
  40. }
  41. );
  42. });
  43. });
  44. </script>
  45. <div class="main-content-inner">
  46. <ul class="clearfix main-content-inner-ul">
  47. <?php if(Yii::app()->session['coachInfo']['leader']==1){?>
  48. <li class="pull-left">
  49. <button onclick='location.href="<?php echo $this->createUrl("semester/index");?>"' class="button button_normal button_group button_arrow" data-button="red">学期管理</button>
  50. <img src="/images/line.jpg" style="height:45px;" />
  51. </li>
  52. <?php }?>
  53. <li class="pull-left">
  54. <button onclick='location.href="<?php echo $this->createUrl("teacher/index");?>"' class="button button_normal button_group button_arrow" data-button="red">教师管理</button>
  55. <img src="/images/line.jpg" style="height:45px;" />
  56. </li>
  57. <li class="pull-left">
  58. <button onclick='location.href="<?php echo $this->createUrl("classes/index");?>"' class="button button_normal button_group button_arrow" data-button="red">班级管理</button>
  59. <img src="/images/line.jpg" style="height:45px;" />
  60. </li>
  61. <li class="pull-left">
  62. <button onclick='location.href="<?php echo $this->createUrl("studentinfo/index");?>"' class="button button_normal button_group button_arrow button_active" data-button="red">学生管理</button>
  63. <img src="/images/line.jpg" style="height:45px;" />
  64. </li>
  65. <li class="pull-left">
  66. <button onclick='location.href="<?php echo $this->createUrl("classes/export");?>"' class="button button_normal button_group button_arrow " data-button="red">导出学生</button>
  67. <img src="/images/line.jpg" style="height:45px;" />
  68. </li>
  69. </ul>
  70. <div class="layout-gap">
  71. <section class="anc-top flex status_1>
  72. <div class="flex-one flex">
  73. <span><h1>学生英语阅读能力等级管理</h1></span>
  74. </div>
  75. </section>
  76. <section>
  77. <div class="x_content">
  78. <div class="row" style="margin:0px;">
  79. <div class="col-xs-12">
  80. <!-- PAGE CONTENT BEGINS -->
  81. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  82. <div class="row">
  83. <div class="dataTables_length margin-zy">
  84. <div class="col-xs-9" style="margin-bottom: 10px;width: 70%">
  85. <form method="get" id="form1" action="<?php echo $this->createUrl("studentinfo/level"); ?>">
  86. <div class="col-xs-12">
  87. <div class="dataTables_length margin-zy clearfix">
  88. <select class="form-control" id="grade" name="grade">
  89. <option value="">年级</option>
  90. <option value="1" <?php if ($grade == 1) echo "selected"; ?>>高一</option>
  91. <option value="2" <?php if ($grade == 2) echo "selected"; ?>>高二</option>
  92. <option value="3" <?php if ($grade == 3) echo "selected"; ?>>高三</option>
  93. </select>
  94. <select class="form-control" id="class" name="classId">
  95. <option value="">全部班级</option>
  96. <?php foreach ($classes as $class) { ?>
  97. <option <?php if ((string)$classId === (string)$class["class_id"]) echo "selected=selected"; ?>
  98. value="<?php echo $class["class_id"]; ?>"><?php echo $class["class_name"]; ?></option>
  99. <?php } ?>
  100. </select>
  101. <input type="text" class="form-control input-sm" placeholder="学生姓名" name="name"
  102. value="<?php echo $studentName; ?>">
  103. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索
  104. </button>
  105. <span >
  106. <a class="btn-garder" onclick="UpdateLevel(1)">+1级</a>
  107. <a class="btn-garder" onclick="UpdateLevel(2)">+2级</a>
  108. <a class="btn-garder" onclick="UpdateLevel(3)">-1级</a>
  109. <a class="btn-garder" onclick="UpdateLevel(4)">-2级</a>
  110. </span>
  111. </div>
  112. </div>
  113. </form>
  114. </div>
  115. <table id="datatable" class="table table-striped table-bordered" style="width:60%;margin-left: 30px;">
  116. <thead>
  117. <tr>
  118. <th><input type="checkbox" class="ace selectAll"/>全选</th>
  119. <th>学生姓名</th>
  120. <th>年级</th>
  121. <th>班级</th>
  122. <th>系统能力等级</th>
  123. <th>人工能力等级</th>
  124. </tr>
  125. </thead>
  126. <tbody>
  127. <?php foreach ($dataList as $loop): ?>
  128. <tr>
  129. <td><input class="myselect" type="checkbox" value="<?php echo $loop['student_id'];?>"></td>
  130. <td><?php echo $loop['realname'] ?></td>
  131. <td><?php if($loop['grade']==1){
  132. echo "高一";
  133. }elseif($loop['grade']==2){
  134. echo "高二";
  135. }else{
  136. echo "高三";
  137. }
  138. ?></td>
  139. <td><?php echo $loop['class_name'] ?></td>
  140. <td><?php echo $loop['english_level_one'] ?></td>
  141. <td> <input class="levelInput" type="text" uid="<?php echo $loop['student_id'];?>" value="<?php echo $loop['english_level_artificial']? $loop['english_level_artificial'] : '';?>"> </td>
  142. </tr>
  143. <?php endforeach; ?>
  144. </tbody>
  145. </table>
  146. <div class="dataTables_paginate paging_simple_numbers" id="datatable-checkbox_paginate">
  147. <div class="row" style="padding-top:10px;">
  148. <div class="col-xs-7">
  149. &nbsp;
  150. </div>
  151. <div class="col-xs-5" style="font-size: 16px">
  152. <div class="dataTables_paginate paging_simple_numbers" style="vertical-align:sub;">
  153. <ul id="yw0" class="yiiPager">
  154. <?php
  155. if($page>1){
  156. echo '<li class="previous"><a href="'.$this->createUrl('studentinfo/level').'?page='.($page-1).'&grade='.$grade.'&classId='.$classId.'&name='.$studentName.'">上一页</a></li>';
  157. }
  158. // for($i=1;$i<=$pages['totalPage'];$i++){
  159. // $url=$this->createUrl('studentinfo/level')."?page=".$i.'&grade_id='.$grade.'&class_id='.$classId.'&student_name='.$studentName;
  160. // if($page==$i){
  161. // echo '<li class="page selected"><a href="#">'.$i.'</a></li>';
  162. // }else{
  163. // echo '<li class="page"><a href="'.$url.'">'.$i.'</a></li>';
  164. // }
  165. // }
  166. if($page<$pages['totalPage']){
  167. echo '<li class="next"><a href="'.$this->createUrl('studentinfo/level').'?page='.($page+1).'&grade='.$grade.'&classId='.$classId.'&name='.$studentName.'">下一页</a></li>';
  168. }
  169. echo '<li class="next"><a href="'.$this->createUrl('studentinfo/level').'?page='.($pages['totalPage']).'&grade='.$grade.'&classId='.$classId.'&name='.$studentName.'">尾页</a></li>';
  170. ?>
  171. </ul>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </section>
  178. </div>
  179. </div>
  180. <script src="/js/jquery-2.2.2.min.js" ></script>
  181. <script src="/js/layer/layer.js"></script>
  182. <script>
  183. // 全选\反选
  184. $(".selectAll").click(function(){
  185. if ($(this).prop("checked")) {
  186. var s_obj = $(".myselect");
  187. var s_len = s_obj.length;
  188. for (var i=0;i<s_len;i++) {
  189. if (!s_obj[i].disabled) {
  190. s_obj[i].checked=true;
  191. }
  192. }
  193. } else {
  194. $(".myselect").prop("checked",false);
  195. }
  196. });
  197. function UpdateLevel(type) {
  198. // 判断是否有选中
  199. if (!$("input[class='myselect']").is(':checked')) {
  200. layer.msg('至少选择一个目标!');
  201. return false;
  202. }
  203. var studentIds = [];
  204. $(".myselect").each(function(m,n){
  205. if ($(this).prop('checked')) {
  206. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  207. studentIds.push($(this).val());
  208. }
  209. }
  210. });
  211. $.ajax({
  212. url: "<?php echo $this->createUrl('studentinfo/ajaxUpdateLevel');?>",
  213. type: "POST",
  214. dataType: "json",
  215. data: {
  216. type:type,
  217. studentIds:studentIds
  218. },
  219. success: function (data) {
  220. if(data.status == 1){
  221. layer.msg('更新成功!', {
  222. time: 2000,
  223. });
  224. window.location.reload();
  225. }else{
  226. layer.msg(data.msg);
  227. }
  228. }
  229. });
  230. }
  231. $('.levelInput').blur(function () {
  232. var level = $(this).val();
  233. var studentIds = [];
  234. studentIds.push($(this).attr('uid'));
  235. if(level == ''){
  236. return false;
  237. }
  238. if (!(/(^[1-9]\d*$)/.test(level)) || level>10) {
  239. layer.msg('请输入1-10内的正整数!');return false;
  240. }
  241. $.ajax({
  242. url: "<?php echo $this->createUrl('studentinfo/ajaxUpdateLevel');?>",
  243. type: "POST",
  244. dataType: "json",
  245. data: {
  246. level:level,
  247. studentIds:studentIds
  248. },
  249. success: function (data) {
  250. if(data.status == 1){
  251. layer.msg('更新成功!', {
  252. time: 1000,
  253. });
  254. window.location.reload();
  255. }else{
  256. layer.msg(data.msg);
  257. }
  258. }
  259. });
  260. })
  261. </script>