index.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <script type="text/javascript">
  2. jQuery(document).ready(function(){
  3. jQuery(".delSemester").click(function(){
  4. document.semesterId = jQuery(this).attr("semesterId");
  5. layer.msg('确定删除?', {
  6. time: 0,
  7. btn: ['确定', '取消'],
  8. yes: function(index){
  9. layer.close(index);
  10. jQuery.post(
  11. "<?php echo $this->createUrl("semester/delsemesteract");?>",
  12. {"semesterId": document.semesterId},
  13. function(data){
  14. data = eval("("+data+")");
  15. if(data.code == "0"){
  16. msg = data.msg;
  17. icon = 6;
  18. }
  19. else{
  20. msg = "因为以下原因操作失败:<br/>"+data.msg;
  21. icon = 5;
  22. }
  23. layer.alert(msg, {icon: icon}, function(){
  24. location.href = "<?php echo $this->createUrl("semester/index");?>";
  25. });
  26. }
  27. );
  28. }
  29. });
  30. });
  31. });
  32. </script>
  33. <div class="main-content-inner">
  34. <!--<div class="breadcrumbs" id="breadcrumbs">
  35. <ul class="breadcrumb">
  36. <li class="li_backgrond_color">
  37. <a href="<?php echo $this->createUrl("semester/index");?>">学期管理</a>
  38. </li>
  39. <li>
  40. <a href="<?php echo $this->createUrl("teacher/index");?>">教师管理</a>
  41. </li>
  42. <li>
  43. <a href="<?php echo $this->createUrl("classes/index");?>">班级管理</a>
  44. </li>
  45. <li>
  46. <a href="<?php echo $this->createUrl("studentinfo/index");?>">学生管理</a>
  47. </li>
  48. </ul>
  49. </div>-->
  50. <!-- 导航栏开始-->
  51. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  52. <!-- 导航栏结束-->
  53. <div class="page-content">
  54. <div class="row" style="margin:0px;">
  55. <div class="col-xs-12">
  56. <!-- PAGE CONTENT BEGINS -->
  57. <?php if($flag == 1):?>
  58. <div style="margin:200px 390px;color: red;">请联系助教组长设置使用学期!</div>
  59. <?php else:?>
  60. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  61. <div class="row">
  62. <div class="dataTables_length margin-zy">
  63. <div class="col-xs-9">
  64. <form action="">
  65. <input type="text" class="form-control input-sm" name="word" value="<?php echo $word;?>" placeholder="输入学期名称或学年搜索" />
  66. <!--<input type="submit" value="搜索" />-->
  67. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  68. </form>
  69. </div>
  70. <div class="col-xs-3">
  71. <?php if (Yii::app()->session['coachInfo']['leader'] == 1){?>
  72. <div id="dynamic-table_filter" class="dataTables_filter position_g">
  73. <a class="btn btn-success btn-sm" href="<?php echo $this->createUrl('semester/add');?>">
  74. <i class="fa fa-plus" style="font-style: normal;"></i> 添加学期
  75. </a>
  76. <a class="btn btn-success btn-sm" href="<?php echo $this->createUrl('semester/change');?>">
  77. <i class="fa" style="font-style: normal;"></i> 切换学期
  78. </a>
  79. </div>
  80. <?php }?>
  81. </div>
  82. </div>
  83. </div>
  84. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  85. <thead>
  86. <tr>
  87. <!-- <th>ID</th> -->
  88. <th>学期名称</th>
  89. <th>学年</th>
  90. <th>开始时间</th>
  91. <th>结束时间</th>
  92. <th>学期状态</th>
  93. <th>操作</th>
  94. </tr>
  95. </thead>
  96. <tbody>
  97. <?php if(!empty($list)):foreach($list as $cl):?>
  98. <tr>
  99. <!-- <td><?php echo $cl->semester_id;?></td> -->
  100. <td><?php echo $cl->semester_name;?></td>
  101. <td><?php echo $cl->school_year;?></td>
  102. <td><?php echo date('Y-m-d',$cl->start_time);?></td>
  103. <td><?php echo date('Y-m-d',$cl->end_time);?></td>
  104. <td class="hidden-480">
  105. <?php if($cl->status == 1){?>
  106. <span class="label label-sm label-primary">当前学期</span>
  107. <?php }else if($this->schoolManager->isFutureSemester($cl->semester_id)){?>
  108. <span class="label label-sm label-warning">未开始学期</span>
  109. <?php }else{?>
  110. <span class="label label-sm label-success">已完成学期</span>
  111. <?php }?>
  112. </td>
  113. <td>
  114. <div class="hidden-sm hidden-xs action-buttons">
  115. <?php if( (isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)) || $cl->status==1){?>
  116. <span class="iconfont addbx click-sc" title="编辑" onclick="javascript:location.href='<?php echo $this->createUrl('semester/edit',array('smtid'=>$cl->semester_id));?>'">&#xe77d;</span>
  117. <?php }?>
  118. <!--<a class="green delSemester" semesterId="<?php echo $cl->semester_id;?>" title="删除" href="javascript:;">删除</a>-->
  119. <span class="iconfont addbx click-delete delSemester" title="删除" semesterId="<?php echo $cl->semester_id;?>" >
  120. &#xe616;
  121. </span>
  122. </div>
  123. </td>
  124. </tr>
  125. <?php endforeach;else:?>
  126. <tr><td colspan="6">暂无数据!</td></tr>
  127. <?php endif;?>
  128. </tbody>
  129. </table>
  130. <?php if(!empty($page_total)):?>
  131. <div class="row">
  132. <div class="col-xs-7">
  133. <!-- <div class="dataTables_info" id="dynamic-table_info" role="status" aria-live="polite">Showing 1 to 10 of 23 entries</div> -->
  134. </div>
  135. <div class="col-xs-5">
  136. <div class="dataTables_paginate paging_simple_numbers">
  137. <?php
  138. $this->widget('CLinkPager', array(
  139. 'header' => '',
  140. //'selectedPageCssClass' => 'active2', //当前页的class
  141. //'hiddenPageCssClass' => 'disabled2', //禁用页的class
  142. 'firstPageLabel' => '首页',
  143. 'lastPageLabel' => '末页',
  144. 'prevPageLabel' => '上一页',
  145. 'nextPageLabel' => '下一页',
  146. 'pages' => $pages,
  147. 'maxButtonCount'=> 5,
  148. ));
  149. ?><?php echo '共:'.$page_total.'条';?>
  150. </div>
  151. </div>
  152. </div>
  153. <?php endif;?>
  154. </div>
  155. <?php endif;?>
  156. <!-- PAGE CONTENT ENDS -->
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <script type="text/javascript">
  162. function changeProvince(pid) {
  163. if (!pid) return;
  164. $.post("<?php echo $this->createUrl('school/area');?>",{pid:pid},function(data){
  165. var p = eval("("+data+")");
  166. if (p.flag) {
  167. var cityObj = $("#city");
  168. cityObj.show();
  169. cityObj.empty();
  170. var html;
  171. html = "<option value=''>请选择市</option>";
  172. $.each(p.getArray,function(i,n){
  173. html += "<option <?php if(!empty($cityId) && $cityId=="+n.region_id+"){echo 'selected';}?> value='"+n.region_id+"'>" + n.region_name + "</option>";
  174. });
  175. cityObj.append(html);
  176. } else {
  177. alert("获取数据失败!");
  178. }
  179. });
  180. }
  181. function changeCity(pid,flag) {
  182. if (!pid) return;
  183. $.post("<?php echo $this->createUrl('coach/area');?>",{pid:pid,flag:flag},function(data){
  184. var p = eval("("+data+")");
  185. if (p.flag) {
  186. var cityObj = $("#county");
  187. var schObj = $("#schoolId");
  188. //cityObj.show();
  189. // 市县select
  190. cityObj.empty();
  191. var html;
  192. html = "<option value=''>请选择区县</option>";
  193. $.each(p.getArray,function(i,n){
  194. html += "<option value='"+n.region_id+"'>" + n.region_name + "</option>";
  195. });
  196. cityObj.append(html);
  197. // 学校select
  198. var str;
  199. schObj.empty();
  200. $.each(p.schoolArr,function(i,n){
  201. str += "<option value='"+n.school_id+"'>" + n.school_name + "</option>";
  202. });
  203. schObj.append(str);
  204. } else {
  205. alert("获取数据失败!");
  206. }
  207. });
  208. }
  209. function changeCounty(aid,flag) {
  210. if (!aid) return;
  211. $.post("<?php echo $this->createUrl('coach/area');?>",{pid:aid,flag:flag},function(data){
  212. var p = eval("("+data+")");
  213. if (p.flag) {
  214. var schObj = $("#schoolId");
  215. // 学校select
  216. var str;
  217. schObj.empty();
  218. $.each(p.schoolArr,function(i,n){
  219. str += "<option value='"+n.school_id+"'>" + n.school_name + "</option>";
  220. });
  221. schObj.append(str);
  222. } else {
  223. alert("获取数据失败!");
  224. }
  225. });
  226. }
  227. </script>