edit.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <div class="main-content-inner">
  2. <div class="breadcrumbs" id="breadcrumbs">
  3. <ul class="breadcrumb">
  4. <li>
  5. <i class="ace-icon fa fa-home home-icon"></i>
  6. <a>首页</a>
  7. </li>
  8. <li>
  9. <a>教学管理</a>
  10. </li>
  11. <li class="active">修改教学进度</li>
  12. </ul>
  13. </div>
  14. <div class="page-content">
  15. <div class="row">
  16. <div class="col-xs-12">
  17. <!-- PAGE CONTENT BEGINS -->
  18. <form class="form-horizontal" action="<?php echo $this->createUrl('syllabus/edit',array('sid'=>$syllaInfo->syllabus_id));?>" method="post" id="userInfoSubmit">
  19. <div class="form-group">
  20. <label class="control-label col-xs-12 col-sm-3 no-padding-right">选择年级:</label>
  21. <div class="col-xs-12 col-sm-9">
  22. <div class="clearfix">
  23. <select class="input-medium" onchange="changeYears(this.value);" name="years_id" id="years_id">
  24. <option value="">请选择年级</option>
  25. <?php if(!empty($yearsInfo)):foreach($yearsInfo as $loop):?>
  26. <option <?php if($syllaInfo->years_id == $loop->years_id){echo 'selected';}?> value="<?php echo $loop->years_id;?>"><?php echo $loop->years_name;?></option>
  27. <?php endforeach;endif;?>
  28. </select>
  29. </div>
  30. </div>
  31. <div class="col-xs-12 col-sm-9" id="classDiv">
  32. <div class="clearfix">
  33. <select class="input-medium" id="class_id" name="class_id">
  34. <?php if(!empty($classInfo)):foreach($classInfo as $cf):?>
  35. <option <?php if($syllaInfo->class_id == $cf->class_id){echo 'selected';}?> value="<?php echo $cf->class_id;?>"><?php echo $cf->class_name;?></option>
  36. <?php endforeach;endif;?>
  37. </select>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="form-group">
  42. <label class="control-label col-xs-12 col-sm-3 no-padding-right">选择教材:</label>
  43. <div class="col-xs-12 col-sm-9">
  44. <div class="clearfix">
  45. <select class="input-medium" onchange="getMaterial(this.value);" name="tm_id" id="tm_id">
  46. <option value="">请选择教材</option>
  47. <?php if(!empty($material)):foreach($material as $mt):?>
  48. <option <?php if($syllaInfo->material_id == $mt->tm_id){echo 'selected';}?> value="<?php echo $mt->tm_id;?>"><?php echo $mt->teach_name;?></option>
  49. <?php endforeach;endif;?>
  50. </select>
  51. </div>
  52. </div>
  53. <div class="col-xs-12 col-sm-9" id="subjectDiv">
  54. <div class="clearfix">
  55. <select onchange="getUnit(this.value);" class="input-medium" id="subject_id" name="subject_id">
  56. <option value="">请选择科目</option>
  57. <?php if(!empty($subList)):foreach($subList as $sl):?>
  58. <option <?php if($syllaInfo->subject_id == $sl->tms_id){echo 'selected';}?> value="<?php echo $sl->tms_id;?>"><?php echo $sl->subject_name;?></option>
  59. <?php endforeach;endif;?>
  60. </select>
  61. </div>
  62. </div>
  63. <div class="col-xs-12 col-sm-9" id="unitDiv">
  64. <div class="clearfix">
  65. <select onchange="getSection(this.value);" class="input-medium" id="unit_id" name="unit_id">
  66. <option value="">请选择章</option>
  67. <?php if(!empty($unitArr)):foreach($unitArr as $ua):?>
  68. <option <?php if($syllaInfo->unit_id == $ua->unit_id){echo 'selected';}?> value="<?php echo $ua->unit_id;?>"><?php echo $ua->unit_name;?></option>
  69. <?php endforeach;endif;?>
  70. </select>
  71. </div>
  72. </div>
  73. <div class="col-xs-12 col-sm-9" id="secDiv">
  74. <div class="clearfix">
  75. <select class="input-medium" id="sec_id" name="sec_id">
  76. <option value="">请选择章</option>
  77. <?php if(!empty($allSec)):foreach($allSec as $as):?>
  78. <option <?php if($syllaInfo->section_id == $as->unit_id){echo 'selected';}?> value="<?php echo $as->unit_id;?>"><?php echo $as->unit_name;?></option>
  79. <?php endforeach;endif;?>
  80. </select>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="clearfix form-actions">
  85. <div class="col-md-offset-3 col-md-9">
  86. <button class="btn btn-info" type="submit" id="schoolSubmit">
  87. <i class="ace-icon fa fa-check bigger-110"></i>
  88. 提交
  89. </button>
  90. &nbsp; &nbsp; &nbsp;
  91. <button class="btn" type="reset">
  92. <i class="ace-icon fa fa-undo bigger-110"></i>
  93. 重填
  94. </button>
  95. </div>
  96. </div>
  97. </form>
  98. <!-- PAGE CONTENT ENDS -->
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <script src="/js/jquery.validate.min.js"></script>
  104. <script type="text/javascript">
  105. jQuery(function($) {
  106. $('#userInfoSubmit').validate({
  107. //debug:true,// 表单不会提交
  108. //errorElement: 'font', // 错误信息div
  109. errorClass: 'errorMessage', //错误样式
  110. ignore: "", //忽略提交字段
  111. rules: {
  112. years_id: {
  113. required: true,
  114. },
  115. class_id: {
  116. required: true,
  117. },
  118. tm_id: {
  119. required: true,
  120. },
  121. subject_id: {
  122. required: true,
  123. },
  124. unit_id: {
  125. required: true,
  126. },
  127. sec_id: {
  128. required: true,
  129. }
  130. },
  131. messages: {
  132. years_id: {
  133. required: "请选择年级!",
  134. },
  135. class_id: {
  136. required: "请选择班级!",
  137. },
  138. tm_id: {
  139. required: "请选择教材!",
  140. },
  141. subject_id: {
  142. required: "请选择科目!",
  143. },
  144. unit_id: {
  145. required: "请选择章!",
  146. },
  147. sec_id: {
  148. required: "请选择节!",
  149. }
  150. }
  151. })
  152. });
  153. // ajax获取班级
  154. function changeYears(num) {
  155. if (!num) return;
  156. $.post("<?php echo $this->createUrl('classes/ajaxclass');?>",{yid:num},function(data){
  157. var p = eval("("+data+")");
  158. if (p.flag) {
  159. $("#classDiv").show();
  160. var html;
  161. var cityObj = $("#class_id");
  162. cityObj.empty();
  163. if (p.classList.length > 0){
  164. html = "<option value=''>请选择班级</option>";
  165. $.each(p.classList,function(i,n){
  166. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  167. });
  168. } else {
  169. html = "<option value=''>暂无班级</option>";
  170. }
  171. cityObj.append(html);
  172. } else {
  173. alert("获取数据失败!");
  174. }
  175. });
  176. }
  177. // 获取教材信息
  178. function getMaterial(id) {
  179. if (!id){ alert('页面错误!');return;}
  180. $.post("<?php echo $this->createUrl('syllabus/material');?>",{tmid:id},function(data){
  181. var p = eval("("+data+")");
  182. if (p.flag) {
  183. $("#subjectDiv").show();
  184. var html;
  185. var subObj = $("#subject_id");
  186. subObj.empty();
  187. if (p.subList.length > 0){
  188. html = "<option value=''>请选择科目</option>";
  189. $.each(p.subList,function(i,n){
  190. html += "<option value='"+n.tms_id+"'>" + n.subject_name + "</option>";
  191. });
  192. } else {
  193. html = "<option value=''>暂无科目</option>";
  194. }
  195. subObj.append(html);
  196. } else {
  197. alert("获取数据失败!");
  198. }
  199. });
  200. }
  201. // 获取章
  202. function getUnit(num) {
  203. if (!num) return;
  204. $.post("<?php echo $this->createUrl('syllabus/unit');?>",{unid:num},function(data){
  205. var p = eval("("+data+")");
  206. if (p.flag) {
  207. $("#unitDiv").show();
  208. var hm;
  209. var unitObj = $("#unit_id");
  210. unitObj.empty();
  211. if (p.unitArr.length > 0){
  212. hm = "<option value=''>请选择章</option>";
  213. $.each(p.unitArr,function(i,n){
  214. hm += "<option value='"+n.unit_id+"'>" + n.unit_name + "</option>";
  215. });
  216. } else {
  217. hm = "<option value=''>暂无章可选</option>";
  218. }
  219. unitObj.append(hm);
  220. } else {
  221. alert("获取数据失败!");
  222. }
  223. });
  224. }
  225. // 获取节
  226. function getSection(num) {
  227. if (!num) return;
  228. $.post("<?php echo $this->createUrl('syllabus/section');?>",{seid:num},function(data){
  229. var p = eval("("+data+")");
  230. if (p.flag) {
  231. $("#secDiv").show();
  232. var hm;
  233. var secObj = $("#sec_id");
  234. secObj.empty();
  235. if (p.secList.length > 0){
  236. hm = "<option value=''>请选择节</option>";
  237. $.each(p.secList,function(i,n){
  238. hm += "<option value='"+n.unit_id+"'>" + n.unit_name + "</option>";
  239. });
  240. } else {
  241. hm = "<option value=''>暂无节可选</option>";
  242. }
  243. secObj.append(hm);
  244. } else {
  245. alert("获取数据失败!");
  246. }
  247. });
  248. }
  249. </script>