edit.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <style>
  2. .addborder{border:1px solid #ccc}
  3. .addheight{height:30px;border-radius:2px;}
  4. .addheight:focus{border-color: #66afe9;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);outline: 0 none;}
  5. .ace{position:relative;top:0px !important;left:0px !important;}
  6. label{font-weight:100 !important;}
  7. </style>
  8. <div class="main-content-inner">
  9. <!-- 导航栏开始-->
  10. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  11. <!-- 导航栏结束-->
  12. <div class="page-content" style="margin-top:15px;">
  13. <div class="row" style="margin:0px">
  14. <div class="col-xs-12">
  15. <!-- PAGE CONTENT BEGINS -->
  16. <form class="form-horizontal" action="<?php echo $this->createUrl('studentinfo/edit',array('stid'=>$userInfo->student_id));?>" method="post" id="userInfoSubmit">
  17. <div class="form-group">
  18. <label class="control-label col-xs-12 col-sm-3 no-padding-right">所属班级<span class="errorMessage">*</span>:</label>
  19. <div class="col-xs-12 col-sm-9">
  20. <input type="hidden" name="class_id" value="<?php echo $userInfo->class_id;?>" />
  21. <div class="clearfix" style="line-height:32px">
  22. <!--<select class="input-medium" id="class_id" name="class_id_1">
  23. <option value="">请选择</option>
  24. </select>-->
  25. <?php echo $userInfo->class_name;?>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="form-group">
  30. <label class="control-label col-xs-12 col-sm-3 no-padding-right">准考证:</label>
  31. <div class="col-sm-9" style="line-height:32px">
  32. <?php echo $studentInfo->student_card;?>
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录账号<span class="errorMessage">*</span>:</label>
  37. <div class="col-sm-9" style="line-height:32px">
  38. <input type="text" id="username" name="username" readonly class="col-xs-10 col-sm-3" value="<?php echo $studentInfo->username;?>" />
  39. <?php /*echo $studentInfo->username;*/?>
  40. </div>
  41. </div>
  42. <div class="form-group">
  43. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录密码:</label>
  44. <div class="col-sm-9">
  45. <input type="password" id="password" name="password" class="col-xs-10 col-sm-3 addborder addheight" placeholder="无需修改密码请留空!" />
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <label class="control-label col-xs-12 col-sm-3 no-padding-right">确认密码:</label>
  50. <div class="col-sm-9">
  51. <input type="password" id="password2" name="password2" class="col-xs-10 col-sm-3 addborder addheight" placeholder="无需修改密码请留空!" />
  52. </div>
  53. </div>
  54. <div class="hr hr-16 hr-dotted"></div>
  55. <div class="form-group">
  56. <label class="control-label col-xs-12 col-sm-3 no-padding-right">真实姓名<span class="errorMessage">*</span>:</label>
  57. <div class="col-xs-12 col-sm-9">
  58. <input value="<?php echo $userInfo->realname;?>" type="text" name="realname" class="col-xs-10 col-sm-3 addborder addheight" />
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学号:</label>
  63. <div class="col-xs-12 col-sm-9">
  64. <input type="text" name="userno" id="userno" class="col-xs-10 col-sm-3 addborder addheight" value="<?php echo $userInfo->userno;?>" />
  65. </div>
  66. </div>
  67. <div class="form-group">
  68. <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级序号<span class="errorMessage">*</span>:</label>
  69. <div class="col-xs-12 col-sm-9">
  70. <input type="text" name="serial_number" id="serial_number" class="col-xs-10 col-sm-3 addborder addheight" value="<?php echo $userInfo->serial_number;?>" />
  71. </div>
  72. </div>
  73. <div class="form-group">
  74. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学生手机号:</label>
  75. <div class="col-xs-12 col-sm-9">
  76. <input type="text" name="student_phone" class="col-xs-10 col-sm-3 addborder addheight" value="<?php if($userInfo->student_phone){echo $userInfo->student_phone;}?>" />
  77. <input type="hidden" name="student_id" value="<?php echo $studentId;?>" />
  78. </div>
  79. </div>
  80. <div class="form-group">
  81. <label class="control-label col-xs-12 col-sm-3 no-padding-right">性别:</label>
  82. <div class="col-sm-9 mt6">
  83. <span class="inline blue">
  84. <input type="radio" class="ace" name="sex" value="1" <?php if($userInfo->sex == 1){echo 'checked="checked"';}?>>
  85. <span class="lbl middle"> 男</span>
  86. </span>
  87. &nbsp; &nbsp; &nbsp;
  88. <span class="inline blue">
  89. <input type="radio" class="ace" name="sex" value="2" <?php if($userInfo->sex == 2){echo 'checked="checked"';}?>>
  90. <span class="lbl middle"> 女</span>
  91. </span>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <label class="control-label col-xs-12 col-sm-3 no-padding-right">是否为在籍生:</label>
  96. <div class="col-sm-9 mt6">
  97. <span class="inline blue">
  98. <input type="radio" class="ace" name="is_outer" value="0" <?php if($userInfo->is_outer == 0){echo 'checked="checked"';}?>>
  99. <span class="lbl middle"> 是</span>
  100. </span>
  101. &nbsp; &nbsp; &nbsp;
  102. <span class="inline blue">
  103. <input type="radio" class="ace" name="is_outer" value="1" <?php if($userInfo->is_outer == 1){echo 'checked="checked"';}?>>
  104. <span class="lbl middle"> 否</span>
  105. </span>
  106. </div>
  107. </div>
  108. <?php if($use_zhixue){
  109. ?>
  110. <div class="form-group">
  111. <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定智学网准考证号:</label>
  112. <div class="col-xs-12 col-sm-9">
  113. <input type="text" name="zhixue_student_card" class="col-xs-10 col-sm-3 addborder addheight" value="<?php if($studentInfo->zhixue_student_card){echo $studentInfo->zhixue_student_card;}?>" />
  114. </div>
  115. </div>
  116. <?php }?>
  117. <div class="form-group">
  118. <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定学校准考证号:</label>
  119. <div class="col-xs-12 col-sm-9">
  120. <input type="text" name="school_student_card" class="col-xs-10 col-sm-3 addborder addheight" value="<?php if($studentInfo->school_student_card){echo $studentInfo->school_student_card;}?>" />
  121. </div>
  122. </div>
  123. <div class="form-group">
  124. <label class="control-label col-xs-12 col-sm-3 no-padding-right">身份证号:</label>
  125. <div class="col-xs-12 col-sm-9">
  126. <input type="text" name="id_number" class="col-xs-10 col-sm-3 addborder addheight" value="<?php if($userInfo->id_number){echo $userInfo->id_number;}?>" />
  127. </div>
  128. </div>
  129. <div class="form-group">
  130. <label class="control-label col-xs-12 col-sm-3 no-padding-right">是否有效:</label>
  131. <div class="col-sm-9 mt6">
  132. <span class="inline blue">
  133. <input type="radio" class="ace" name="status" value="0" <?php if(!$studentInfo->status){echo 'checked="checked"';}?>>
  134. <span class="lbl middle"> 是</span>
  135. </span>
  136. &nbsp; &nbsp; &nbsp;
  137. <span class="inline blue">
  138. <input type="radio" class="ace" name="status" value="1" <?php if($studentInfo->status == 1){echo 'checked="checked"';}?>>
  139. <span class="lbl middle"> 否</span>
  140. </span>
  141. </div>
  142. </div>
  143. <div class="clearfix form-actions">
  144. <div class="col-md-offset-3 col-md-9">
  145. <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
  146. <i class="ace-icon fa fa-check bigger-110"></i>
  147. 提交
  148. </button>
  149. <!--&nbsp; &nbsp; &nbsp;
  150. <button class="btn" type="reset">
  151. <i class="ace-icon fa fa-undo bigger-110"></i>
  152. 重填
  153. </button>-->
  154. </div>
  155. </div>
  156. </form>
  157. <!-- PAGE CONTENT ENDS -->
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <script src="/js/jquery.validate.min.js"></script>
  163. <script type="text/javascript">
  164. //检测手机号
  165. $.validator.addMethod("isPhone", function(value, element) {
  166. var regMobile = /^1([356789]\d|4[57])\d{8}$/;
  167. return this.optional(element) || (regMobile.test( value ));
  168. }, "请正确填写手机号!");
  169. jQuery(function($) {
  170. $('#userInfoSubmit').validate({
  171. errorClass: 'errorMessage', //错误样式
  172. ignore: "", //忽略提交字段
  173. rules: {
  174. /*years_id: {
  175. required: true,
  176. },
  177. class_id: {
  178. required: true,
  179. },*/
  180. password: {
  181. //required: true,
  182. minlength: 6
  183. },
  184. password2: {
  185. //required: true,
  186. minlength: 6,
  187. equalTo: "#password"
  188. },
  189. sex: {
  190. required: true,
  191. },
  192. student_phone:{
  193. isPhone:true
  194. },
  195. realname: {
  196. required: true,
  197. maxlength: 20,
  198. remote:{ //自带远程验证存在的方法
  199. url:"<?php echo $this->createUrl('studentinfo/verifyrealname');?>",
  200. type:"post",
  201. dataType:"html",
  202. data:{
  203. realname:function(){return $("input[name=realname]").val();},
  204. student_id:function(){return $("input[name=student_id]").val();},
  205. cid:function(){return $("input[name=class_id]").val();},
  206. p_type:2
  207. },
  208. dataFilter: function(data) {
  209. var m = JSON.parse(data);
  210. if (m.status == 1){
  211. return true;
  212. }
  213. return false;
  214. }
  215. }
  216. },
  217. serial_number:{
  218. required: true,
  219. remote:{ //自带远程验证存在的方法
  220. url:"<?php echo $this->createUrl('studentinfo/verifynum');?>",
  221. type:"post",
  222. dataType:"html",
  223. data:{
  224. pnumber:function(){return $("input[name=serial_number]").val();},
  225. cid:function(){return $("input[name=class_id]").val();},
  226. sid:function(){return $("input[name=student_id]").val();},
  227. type:2
  228. },
  229. dataFilter: function(data) {
  230. var m = JSON.parse(data);
  231. if (m.status == 2){
  232. return true;
  233. }
  234. return false;
  235. }
  236. }
  237. }
  238. },
  239. messages: {
  240. years_id: {
  241. required: "请选择年级!",
  242. },
  243. class_id: {
  244. required: "请选择班级!",
  245. },
  246. password: {
  247. //required: "请填写登录密码!",
  248. minlength: "密码不能少于6位字符!"
  249. },
  250. password2: {
  251. //required: "请填写确认密码!",
  252. minlength: "密码不能少于6位字符!",
  253. equalTo: "两次密码输入不一致!"
  254. },
  255. realname: {
  256. required: "请填写真实姓名!",
  257. maxlength: "姓名不能大于20个字符!",
  258. remote: "此学生已存在!"
  259. },
  260. sex: {
  261. required: "请选择性别!",
  262. },
  263. serial_number:{
  264. required: "序号不能为空!",
  265. remote:"序号已经存在!"
  266. }
  267. },
  268. errorPlacement: function (error, element) { // 指定错误信息显示位置
  269. if(element.is('input[type=radio]')) {
  270. var controls = element.closest('div[class*="col-"]');
  271. if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
  272. else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
  273. }else{
  274. error.insertAfter(element.after());
  275. }
  276. },
  277. })
  278. });
  279. // ajax获取班级
  280. function changeYears(num) {
  281. if (!num) return;
  282. $.post("<?php echo $this->createUrl('classes/ajaxclass');?>",{yid:num},function(data){
  283. var p = eval("("+data+")");
  284. if (p.flag) {
  285. $("#classDiv").show();
  286. var html;
  287. var cityObj = $("#class_id");
  288. cityObj.empty();
  289. if (p.classList.length > 0){
  290. html = "<option value=''>请选择班级</option>";
  291. $.each(p.classList,function(i,n){
  292. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  293. });
  294. } else {
  295. html = "<option value=''>暂无班级</option>";
  296. }
  297. cityObj.append(html);
  298. } else {
  299. alert("获取数据失败!");
  300. }
  301. });
  302. }
  303. </script>