change.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <script type="text/javascript">
  2. jQuery(document).ready(function(){
  3. jQuery(".changeSemester").click(function(){
  4. document.semesterId = jQuery(this).attr("semesterId");
  5. document.semesterName = jQuery(this).parent().parent().siblings(".semesterName").html();
  6. $('#examModal').fadeIn();
  7. });
  8. $('.close_1').click(function(){
  9. $('#examModal').fadeOut();
  10. $('input[name=Graduation]').attr('checked',false);
  11. });
  12. $('.sumbit').click(function(){
  13. var RetainClass=$('input[name=RetainClass]').is(':checked');
  14. var Graduation=$('input[name=Graduation]').is(':checked');
  15. var classUp=$('input[name=classUp]').is(':checked');
  16. var gradeDirector=$('input[name=gradeDirector]:checked').val();
  17. if(RetainClass==true){
  18. RetainClass=1;
  19. }else{
  20. RetainClass=0
  21. }
  22. if(Graduation==true){
  23. Graduation=1;
  24. }else{
  25. Graduation=0
  26. }
  27. classNameArr=[];
  28. if(classUp==true){
  29. classUp=1;
  30. //读取班级改名
  31. classNameObj=$('.new_class_name');
  32. classNameCheck=[];
  33. for(var i=0;i<classNameObj.length;i++){
  34. oldName=classNameObj.eq(i).attr('old_name');
  35. newName=classNameObj.eq(i).val();
  36. if(newName==''){
  37. layer.msg('班级名称不能为空');
  38. return false;
  39. }
  40. if(oldName==newName){
  41. layer.msg(oldName+':升班后名称没有变化,请重新编辑');
  42. return false;
  43. }
  44. if($.inArray(newName,classNameCheck)!=-1){
  45. layer.msg(newName+':名称重复,请重新编辑');
  46. return false;
  47. }
  48. classNameCheck.push(newName);
  49. classNameArr.push(classNameObj.eq(i).attr('id')+'///'+newName);
  50. }
  51. }else{
  52. classUp=0
  53. }
  54. semesterId=document.semesterId;
  55. if(Graduation==1){
  56. layer.confirm('注意,当前操作勾选了【删除毕业生】,切换学期以后会删除毕业班学生,请注意数据备份。\n' +
  57. '可通过“导出学生”功能备份学生数据。', {
  58. btn: ['确定', '取消'] //按钮
  59. },function(){
  60. $(this).attr('disabled',true);
  61. changeSemester(semesterId,RetainClass,Graduation,classUp,classNameArr,gradeDirector)
  62. })
  63. }else{
  64. if(classUp==1){
  65. layer.confirm('注意,当前操作勾选了【批量升班】,没有勾选【存了毕业学期】,确定继续吗?', {
  66. btn: ['确定', '取消'] //按钮
  67. }, function () {
  68. $(this).attr('disabled',true);
  69. changeSemester(semesterId,RetainClass,Graduation,classUp,classNameArr,gradeDirector)
  70. })
  71. }else{
  72. $(this).attr('disabled',true);
  73. changeSemester(semesterId,RetainClass,Graduation,classUp,classNameArr,gradeDirector)
  74. }
  75. }
  76. function changeSemester(semesterId,RetainClass,Graduation,classUp,classNameArr,gradeDirector){
  77. layer.msg('正在切换,请稍候。。。',{"time": 0});
  78. $.ajax({
  79. url:'<?php echo $this->createUrl('semester/changesemesteract')?>',
  80. type:'POST',
  81. data:{'semesterId':semesterId,'RetainClass':RetainClass,'Graduation':Graduation,'classUp':classUp,classNameArr:classNameArr,gradeDirector:gradeDirector},
  82. dataType:'json',
  83. success:function(res){
  84. if(res.code==2001){
  85. layer.msg('不能切换之前的学期');
  86. }else if(res.code==2002){
  87. layer.msg('不在可切换的学期范围');
  88. }else if(res.code==2003){
  89. layer.msg('班级创建失败');
  90. }else if(res.code==1002){
  91. layer.msg('切换学期失败');
  92. }else if(res.code==3001){
  93. layer.msg('切换学期失败,数据表重复,请联系技术支持处理')
  94. }else if(res.code==0){
  95. layer.msg('切换学期成功');
  96. window.location.href='<?php echo $this->createUrl('semester/change')?>';
  97. }else{
  98. layer.msg('切换学期失败');
  99. }
  100. }
  101. });
  102. }
  103. });
  104. });
  105. </script>
  106. <div class="main-content-inner">
  107. <!-- 导航栏开始-->
  108. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  109. <!-- 导航栏结束-->
  110. <div class="page-content" tyle="margin-top:15px;">
  111. <div class="row" style="margin:0px;">
  112. <div class="col-xs-12">
  113. <!-- PAGE CONTENT BEGINS -->
  114. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  115. <div class="row" style="margin-bottom: 10px;">
  116. <div class="dataTables_length" style="margin: 6px 0px;">
  117. <div class="col-xs-12">
  118. <form action="">
  119. <input class="form-control input-sm" type="text" name="word" value="<?php echo $word;?>" placeholder="输入学期名称或学年搜索" />
  120. <!--<input type="submit" value="搜索" />-->
  121. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  122. </form>
  123. </div>
  124. </div>
  125. </div>
  126. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  127. <thead>
  128. <tr>
  129. <!-- <th>ID</th> -->
  130. <th>学期名称</th>
  131. <th>学年</th>
  132. <th>开始时间</th>
  133. <th>结束时间</th>
  134. <th>学期状态</th>
  135. <th>操作</th>
  136. </tr>
  137. </thead>
  138. <tbody>
  139. <?php if(!empty($list)):foreach($list as $cl):?>
  140. <tr>
  141. <!-- <td><?php echo $cl->semester_id;?></td> -->
  142. <td class="semesterName"><?php echo $cl->semester_name;?></td>
  143. <td><?php echo $cl->school_year;?></td>
  144. <td><?php echo date('Y-m-d',$cl->start_time);?></td>
  145. <td><?php echo date('Y-m-d',$cl->end_time);?></td>
  146. <td class="hidden-480">
  147. <?php if($cl->status == 1){?>
  148. <span class="label label-sm label-primary">当前学期</span>
  149. <?php }else if($this->schoolManager->isFutureSemester($cl->semester_id)){?>
  150. <span class="label label-sm label-warning">未开始学期</span>
  151. <?php }else{?>
  152. <span class="label label-sm label-success">已完成学期</span>
  153. <?php }?>
  154. </td>
  155. <td>
  156. <div class="hidden-sm hidden-xs action-buttons">
  157. <?php if(($this->schoolManager->isFutureSemester($cl->semester_id) || Yii::app()->session["role"] == 2) && $cl->status == 0){?>
  158. <!--<a class="green changeSemester" title="切换到该学期" semesterId="<?php echo $cl->semester_id;?>" href="javascript:;">切换到该学期</a>-->
  159. <span class="iconfont addbx click-delete changeSemester" title="切换到该学期" semesterId="<?php echo $cl->semester_id;?>" >
  160. <i class="ace-icon fa fa-refresh bigger-120"></i>
  161. </span>
  162. <?php }else{?>
  163.  -
  164. <?php }?>
  165. </div>
  166. </td>
  167. </tr>
  168. <?php endforeach;else:?>
  169. <tr><td colspan="6">暂无数据!</td></tr>
  170. <?php endif;?>
  171. </tbody>
  172. </table>
  173. <?php if(!empty($page_total)):?>
  174. <div class="row">
  175. <div class="col-xs-6">
  176. <!-- <div class="dataTables_info" id="dynamic-table_info" role="status" aria-live="polite">Showing 1 to 10 of 23 entries</div> -->
  177. </div>
  178. <div class="col-xs-6">
  179. <div class="dataTables_paginate paging_simple_numbers">
  180. <?php
  181. $this->widget('CLinkPager', array(
  182. 'header' => '',
  183. //'selectedPageCssClass' => 'active2', //当前页的class
  184. //'hiddenPageCssClass' => 'disabled2', //禁用页的class
  185. 'firstPageLabel' => '首页',
  186. 'lastPageLabel' => '末页',
  187. 'prevPageLabel' => '上一页',
  188. 'nextPageLabel' => '下一页',
  189. 'pages' => $pages,
  190. 'maxButtonCount'=> 5,
  191. ));
  192. ?><?php echo '共:'.$page_total.'条';?>
  193. </div>
  194. </div>
  195. </div>
  196. <?php endif;?>
  197. </div>
  198. <!-- PAGE CONTENT ENDS -->
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. <style>
  204. /*弹出层*/
  205. .confirmbox {
  206. background: #fff;
  207. border: 1px solid #cccccc;
  208. border-radius: 3px;
  209. padding: 40px 40px 30px;
  210. text-align: center;
  211. position: fixed;
  212. left: 50%;
  213. top: 50%;
  214. transform: translate(-50%, -50%);
  215. z-index: 99;
  216. }
  217. .confirmbox-mask {
  218. background: rgba(0, 0, 0, .7);
  219. left: 0;
  220. right: 0;
  221. top: 0;
  222. bottom: 0;
  223. z-index: 99;
  224. position: fixed;
  225. }
  226. button {
  227. border: none;
  228. background: #2977ff;
  229. width: 80px;
  230. height: 26px;
  231. border-radius: 3px;
  232. font-size: 14px;
  233. color: #fff;
  234. outline: none;
  235. cursor: pointer;
  236. }
  237. button.save {
  238. display: block;
  239. margin: 40px auto;
  240. }
  241. .confirmbox .confirmbox-btns {
  242. margin-top: 40px;
  243. }
  244. .class-modal {
  245. width: 720px;
  246. background: #fff;
  247. // border-radius: 5px;
  248. position: absolute;
  249. top: 50%;
  250. left: 50%;
  251. transform: translate(-50%, -50%);
  252. }
  253. .class-modal-head {
  254. font-size: 14px;
  255. background:#2977ff;
  256. color:#fff;
  257. height:25px;
  258. line-height: 25px;
  259. padding: 0 0 0 15px;
  260. }
  261. .class-modal-body {
  262. overflow: auto;
  263. padding:15px;
  264. }
  265. .class-modal-body .classes {
  266. margin-bottom: 20px;
  267. }
  268. .class-modal-body .classes > div {
  269. display: inline-block;
  270. max-width: 640px;
  271. vertical-align: top;
  272. }
  273. .class-modal-body .classes a {
  274. text-decoration: none;
  275. display: inline-block;
  276. margin: 0 5px 5px;
  277. color: #136bfb;
  278. font-size: 14px;
  279. }
  280. .class-modal-body .classes a.active {
  281. color: #fc091b
  282. }
  283. .class-modal .icon-close{
  284. position: absolute;
  285. right: 20px;
  286. top: 2px;
  287. color:#fff;
  288. }
  289. .class_btn{
  290. text-align: center;
  291. }
  292. .confirmbox-mask p{
  293. word-wrap : break-word ;
  294. }
  295. .icon-close{
  296. cursor: pointer;
  297. }
  298. .model-input{
  299. border:1px solid #ccc;
  300. margin-top:10px;
  301. }
  302. .model-input label{
  303. margin:0 15px;
  304. }
  305. .class_area{
  306. height:300px;
  307. overflow:auto;
  308. }
  309. .class_up_info{
  310. width:140px;
  311. padding:15px;
  312. font-size:13px;
  313. }
  314. .class_up_1{
  315. width:270px;
  316. padding:10px 15px 10px 10px;
  317. border-left:1px solid #aaa;
  318. }
  319. .class_up_2{
  320. width:260px;
  321. padding:10px 10px 10px 15px;
  322. }
  323. .class_up_1 input,.class_up_2 input{
  324. width:100px;
  325. padding:0 10px;
  326. }
  327. .class_up_1 td,.class_up_2 td{
  328. text-align: center;
  329. padding:3px 0;
  330. }
  331. .first_input{
  332. padding:10px;
  333. }
  334. /* Tooltip 容器 */
  335. .tooltipclass {
  336. display: inline-block;
  337. }
  338. /* Tooltip 文本 */
  339. .tooltipclass .tooltiptext {
  340. visibility: hidden;
  341. width: 160px;
  342. background-color: #555;
  343. color: #fff;
  344. padding: 5px;
  345. border-radius: 6px;
  346. font-size:11px;
  347. text-align: left;
  348. /* 定位 */
  349. position: absolute;
  350. z-index: 1;
  351. }
  352. /* 鼠标移动上去后显示提示框 */
  353. .tooltipclass:hover .tooltiptext {
  354. visibility: visible;
  355. }
  356. </style>
  357. <!-- 弹窗 -->
  358. <div class="confirmbox-mask" style="display: none" id="examModal">
  359. <div class="class-modal">
  360. <i class="icon close_1 icon-close">×</i>
  361. <div class="class-modal-head">切换学期</div>
  362. <div class="class-modal-body">
  363. <div class="model-input first_input">
  364. <label> <input type="checkbox" class="RetainClass" checked disabled name="RetainClass" value="1">&nbsp;保留班级和学生</label>
  365. <label> <input type="checkbox" class="Graduation" name="Graduation" value="1">&nbsp;删除毕业生</label>
  366. <label> <input type="checkbox" class="classUp" name="classUp" value="1">&nbsp;批量升班</label>
  367. </div>
  368. <div class="model-input grade_director_area" style="display: none">
  369. <label> <input type="radio" class="gradeDirector" name="gradeDirector" checked value="1">&nbsp;年级主任同步升班
  370. <span class="tooltipclass">&nbsp;<img src="/images/icon-warning-red.png">
  371. <span class="tooltiptext">
  372. 已升班的班级内年级主任进行升级,如高一年级主任升为高二年级主任
  373. </span></span>
  374. </label>
  375. <label> <input type="radio" class="gradeDirector" name="gradeDirector" value="2">&nbsp;年级主任不同步升班
  376. <span class="tooltipclass">&nbsp;<img src="/images/icon-warning-red.png">
  377. <span class="tooltiptext">
  378. 已升班的班级内将自动去除年级主任,新学期需重新添加班级的年级主任
  379. </span></span>
  380. </label>
  381. </div>
  382. <div class="model-input class_area" style="display: none">
  383. <div class="fl class_up_info">
  384. <img src="/images/warn-icon.png">注意:<br>
  385. 1、批量升班可将本学期高一/高二班级分别升为新学期高二/高三班级;<br>
  386. 2、请对应修改升班后的新学期班级名称,且名称不能重复;<br>
  387. 3、升班后教师与学生一起升班,不支持回退,请谨慎操作!
  388. </div>
  389. <div class="fl class_up_1">
  390. <table>
  391. <tr>
  392. <td colspan="3" align="center">行政班</td>
  393. </tr>
  394. <tr>
  395. <td>本学期班级</td>
  396. <td style="width:60px;"></td>
  397. <td>新学期班级</td>
  398. </tr>
  399. <?php
  400. if(isset($classes[1])){
  401. foreach ($classes[1] as $class){
  402. echo '<tr>';
  403. echo '<td>'.$class['class_name'].'</td>';
  404. echo '<td style="width:60px;">——</td>';
  405. echo '<td><input type="text" id="'.$class['class_id'].'" old_name="'.$class['class_name'].'" class="new_class_name" name="class[]" value="'.$class['class_name'].'"></td>';
  406. echo '</tr>';
  407. }
  408. }
  409. ?>
  410. </table>
  411. </div>
  412. <div class="fl class_up_2">
  413. <table>
  414. <tr>
  415. <td colspan="3" align="center">教学班</td>
  416. </tr>
  417. <tr>
  418. <td>本学期班级</td>
  419. <td style="width:60px;"></td>
  420. <td>新学期班级</td>
  421. </tr>
  422. <?php
  423. if(isset($classes[2])){
  424. foreach ($classes[2] as $class){
  425. echo '<tr>';
  426. echo '<td>'.$class['class_name'].'</td>';
  427. echo '<td style="width:60px;">——</td>';
  428. echo '<td><input type="text" id="'.$class['class_id'].'" old_name="'.$class['class_name'].'" class="new_class_name" name="class[]" value="'.$class['class_name'].'"></td>';
  429. echo '</tr>';
  430. }
  431. }
  432. ?>
  433. </table>
  434. </div>
  435. </div>
  436. </div>
  437. <div class="class-modal-body red">
  438. 操作须知:<br>
  439. <?php if(Yii::app()->params['section']!=0):?>
  440. 1、切换后,旧学期将不存在学生数据;请在完成所有考试和产品后再切换学期。<br>
  441. 2、寒假后切换学期,不要勾选【删除毕业生】、【批量升班】,直接切换即可。<br>
  442. 3、暑假后切换学期,高三学生已经毕业,可勾选【删除毕业生】,需谨慎操作。<br>
  443. 4、需要批量将高一升高二,高二升高三,请勾选【批量升班】。<br>
  444. 注意:切换新学期后,将不能再切换回以前的学期,请确认!
  445. <?php else:?>
  446. 1、切换后,旧学期将不存在学生数据;请在完成所有考试和产品后再切换学期。<br>
  447. 2、寒假后切换学期,不要勾选【删除毕业生】、【批量升班】,直接切换即可。<br>
  448. 3、暑假后切换学期,九年级学生已经毕业,可勾选【删除毕业生】,需谨慎操作。<br>
  449. 4、需要批量将七年级升八年级,八年级升九年级,请勾选【批量升班】。<br>
  450. 注意:切换新学期后,将不能再切换回以前的学期,请确认!
  451. <?php endif;?>
  452. </div>
  453. <p class="class_btn">
  454. <button type="button" class="sumbit">确定</button>
  455. <button type="button" class="close_1">取消</button>
  456. </p>
  457. </div>
  458. </div>
  459. <script type="text/javascript">
  460. function changeProvince(pid) {
  461. if (!pid) return;
  462. $.post("<?php echo $this->createUrl('school/area');?>",{pid:pid},function(data){
  463. var p = eval("("+data+")");
  464. if (p.flag) {
  465. var cityObj = $("#city");
  466. cityObj.show();
  467. cityObj.empty();
  468. var html;
  469. html = "<option value=''>请选择市</option>";
  470. $.each(p.getArray,function(i,n){
  471. html += "<option <?php if(!empty($cityId) && $cityId=="+n.region_id+"){echo 'selected';}?> value='"+n.region_id+"'>" + n.region_name + "</option>";
  472. });
  473. cityObj.append(html);
  474. } else {
  475. alert("获取数据失败!");
  476. }
  477. });
  478. }
  479. function changeCity(pid,flag) {
  480. if (!pid) return;
  481. $.post("<?php echo $this->createUrl('coach/area');?>",{pid:pid,flag:flag},function(data){
  482. var p = eval("("+data+")");
  483. if (p.flag) {
  484. var cityObj = $("#county");
  485. var schObj = $("#schoolId");
  486. //cityObj.show();
  487. // 市县select
  488. cityObj.empty();
  489. var html;
  490. html = "<option value=''>请选择区县</option>";
  491. $.each(p.getArray,function(i,n){
  492. html += "<option value='"+n.region_id+"'>" + n.region_name + "</option>";
  493. });
  494. cityObj.append(html);
  495. // 学校select
  496. var str;
  497. schObj.empty();
  498. $.each(p.schoolArr,function(i,n){
  499. str += "<option value='"+n.school_id+"'>" + n.school_name + "</option>";
  500. });
  501. schObj.append(str);
  502. } else {
  503. alert("获取数据失败!");
  504. }
  505. });
  506. }
  507. function changeCounty(aid,flag) {
  508. if (!aid) return;
  509. $.post("<?php echo $this->createUrl('coach/area');?>",{pid:aid,flag:flag},function(data){
  510. var p = eval("("+data+")");
  511. if (p.flag) {
  512. var schObj = $("#schoolId");
  513. // 学校select
  514. var str;
  515. schObj.empty();
  516. $.each(p.schoolArr,function(i,n){
  517. str += "<option value='"+n.school_id+"'>" + n.school_name + "</option>";
  518. });
  519. schObj.append(str);
  520. } else {
  521. alert("获取数据失败!");
  522. }
  523. });
  524. }
  525. $('.classUp').click(function(){
  526. if($('input[name=classUp]').is(':checked')){
  527. $('.class_area').show();
  528. $('.grade_director_area').show();
  529. }else{
  530. $('.class_area').hide();
  531. $('.grade_director_area').hide();
  532. }
  533. });
  534. </script>