edit.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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('userinfo/edit',array('uuid'=>$userInfo->uuid));?>" 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($userInfo->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($userInfo->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-sm-9">
  44. <input type="text" id="school" name="username" class="col-xs-10 col-sm-3" value="<?php echo $studentInfo->username;?>" readonly="readonly" />
  45. </div>
  46. </div>
  47. <div class="form-group">
  48. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录密码:</label>
  49. <div class="col-sm-9">
  50. <input type="password" id="password" name="password" class="col-xs-10 col-sm-3" placeholder="无需修改密码请留空!" />
  51. </div>
  52. </div>
  53. <div class="form-group">
  54. <label class="control-label col-xs-12 col-sm-3 no-padding-right">确认密码:</label>
  55. <div class="col-sm-9">
  56. <input type="password" id="password2" name="password2" class="col-xs-10 col-sm-3" placeholder="无需修改密码请留空!" />
  57. </div>
  58. </div>
  59. <div class="hr hr-16 hr-dotted"></div>
  60. <div class="form-group">
  61. <label class="control-label col-xs-12 col-sm-3 no-padding-right">真实姓名:</label>
  62. <div class="col-xs-12 col-sm-9">
  63. <input value="<?php echo $userInfo->realname;?>" type="text" name="realname" class="col-xs-10 col-sm-3" />
  64. </div>
  65. </div>
  66. <div class="form-group">
  67. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学号:</label>
  68. <div class="col-xs-12 col-sm-9">
  69. <input type="text" name="userno" class="col-xs-10 col-sm-3" value="<?php echo $userInfo->userno;?>" />
  70. </div>
  71. </div>
  72. <div class="form-group">
  73. <label class="control-label col-xs-12 col-sm-3 no-padding-right">性别:</label>
  74. <div class="col-xs-12 col-sm-9">
  75. <div>
  76. <label class="line-height-1 blue">
  77. <input name="sex" value="1" type="radio" class="ace sex" <?php if($userInfo->sex == 1){echo 'checked="checked"';}?> />
  78. <span class="lbl"> 男</span>
  79. </label>
  80. </div>
  81. <div>
  82. <label class="line-height-1 blue">
  83. <input name="sex" <?php if($userInfo->sex == 2){echo 'checked="checked"';}?> value="2" type="radio" class="ace sex" />
  84. <span class="lbl"> 女</span>
  85. </label>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="clearfix form-actions">
  90. <div class="col-md-offset-3 col-md-9">
  91. <button class="btn btn-info" type="submit" id="schoolSubmit">
  92. <i class="ace-icon fa fa-check bigger-110"></i>
  93. 提交
  94. </button>
  95. &nbsp; &nbsp; &nbsp;
  96. <button class="btn" type="reset">
  97. <i class="ace-icon fa fa-undo bigger-110"></i>
  98. 重填
  99. </button>
  100. </div>
  101. </div>
  102. </form>
  103. <!-- PAGE CONTENT ENDS -->
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <script src="/js/jquery.validate.min.js"></script>
  109. <script type="text/javascript">
  110. jQuery(function($) {
  111. $('#userInfoSubmit').validate({
  112. //debug:true,// 表单不会提交
  113. //errorElement: 'font', // 错误信息div
  114. errorClass: 'errorMessage', //错误样式
  115. ignore: "", //忽略提交字段
  116. rules: {
  117. years_id: {
  118. required: true,
  119. },
  120. class_id: {
  121. required: true,
  122. },
  123. username: {
  124. required: true,
  125. },
  126. password: {
  127. //required: true,
  128. minlength: 6
  129. },
  130. password2: {
  131. //required: true,
  132. minlength: 6,
  133. equalTo: "#password"
  134. },
  135. sex: {
  136. required: true,
  137. },
  138. realname: {
  139. required: true,
  140. },
  141. userno: {
  142. required: true,
  143. }
  144. },
  145. messages: {
  146. years_id: {
  147. required: "请选择年级!",
  148. },
  149. class_id: {
  150. required: "请选择班级!",
  151. },
  152. username: {
  153. required: "请填写登录账号!",
  154. },
  155. password: {
  156. //required: "请填写登录密码!",
  157. minlength: "密码不能少于6位字符!"
  158. },
  159. password2: {
  160. //required: "请填写确认密码!",
  161. minlength: "密码不能少于6位字符!",
  162. equalTo: "两次密码输入不一致!"
  163. },
  164. realname: {
  165. required: "请填写真实姓名!",
  166. },
  167. sex: {
  168. required: "请选择性别!",
  169. },
  170. userno: {
  171. required: "请填写学号!",
  172. }
  173. },
  174. errorPlacement: function (error, element) { // 指定错误信息显示位置
  175. if(element.is('input[type=radio]')) {
  176. var controls = element.closest('div[class*="col-"]');
  177. if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
  178. else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
  179. }else{
  180. error.insertAfter(element.after());
  181. }
  182. },
  183. })
  184. });
  185. // ajax获取班级
  186. function changeYears(num) {
  187. if (!num) return;
  188. $.post("<?php echo $this->createUrl('classes/ajaxclass');?>",{yid:num},function(data){
  189. var p = eval("("+data+")");
  190. if (p.flag) {
  191. $("#classDiv").show();
  192. var html;
  193. var cityObj = $("#class_id");
  194. cityObj.empty();
  195. if (p.classList.length > 0){
  196. html = "<option value=''>请选择班级</option>";
  197. $.each(p.classList,function(i,n){
  198. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  199. });
  200. } else {
  201. html = "<option value=''>暂无班级</option>";
  202. }
  203. cityObj.append(html);
  204. } else {
  205. alert("获取数据失败!");
  206. }
  207. });
  208. }
  209. </script>