edit.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <style>
  2. .addborder {
  3. border: 1px solid #ccc
  4. }
  5. .addheight {
  6. height: 30px;
  7. border-radius: 2px;
  8. }
  9. .addheight:focus {
  10. border-color: #66afe9;
  11. box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
  12. outline: 0 none;
  13. }
  14. .ace {
  15. position: relative;
  16. top: 0px !important;
  17. left: 0px !important;
  18. }
  19. label {
  20. font-weight: 100 !important;
  21. }
  22. #phone_number-error, #teacher_name-error {
  23. margin-top: 4px;
  24. }
  25. </style>
  26. <div class="main-content-inner">
  27. <!-- 导航栏开始-->
  28. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  29. <!-- 导航栏结束-->
  30. <div class="page-content" style="margin-top:15px;">
  31. <div class="row" style="margin:0px">
  32. <div class="col-xs-12">
  33. <!-- PAGE CONTENT BEGINS -->
  34. <form class="form-horizontal"
  35. action="<?php echo $this->createUrl('teacher/edit', array('thid' => $teacherInfo->teacher_id)); ?>"
  36. method="post" id="teachSubmit">
  37. <div class="form-group">
  38. <label class="control-label col-xs-12 col-sm-3 no-padding-right">教师姓名<span class="errorMessage">*</span>:</label>
  39. <div class="col-sm-9">
  40. <input type="text" value="<?php echo $teacherInfo->teacher_name; ?>" name="teacher_name"
  41. class="col-xs-10 col-sm-3 addborder addheight marginLeftNo"/>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录手机号<span
  46. class="errorMessage">*</span>:</label>
  47. <div class="col-sm-9">
  48. <input type="text" value="<?php echo $getBtteacher->phone_number; ?>" name="phone_number"
  49. class="col-xs-10 col-sm-3 addborder addheight marginLeftNo phone_number"/>
  50. <label class="errorMessage forPhoneNumber"></label>
  51. </div>
  52. </div>
  53. <div class="form-group">
  54. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录密码<span class="errorMessage">*</span>:</label>
  55. <div class="col-sm-9">
  56. <input type="text" id="password" name="password"
  57. class="col-xs-10 col-sm-3 addborder addheight" value=""/>
  58. </div>
  59. </div>
  60. <div class="form-group">
  61. <label class="control-label col-xs-12 col-sm-3 no-padding-right">确认密码<span class="errorMessage">*</span>:</label>
  62. <div class="col-sm-9">
  63. <input type="text" id="password2" name="password2"
  64. class="col-xs-10 col-sm-3 addborder addheight" value=""/>
  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-sm-9">
  70. <input type="text" name="teacher_phone" class="col-xs-10 col-sm-3" />
  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-sm-9">
  76. <input type="text" name="teacher_email" value="<?php echo $teacherInfo->teacher_email; ?>"
  77. class="col-xs-10 col-sm-3 addborder addheight"/>
  78. </div>
  79. </div>
  80. <div class="form-group form-group-teacher">
  81. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学科组<span
  82. class="errorMessage">*</span>:</label>
  83. <div class="col-sm-9">
  84. <div class="col-xs-10 col-sm-3 addheight diy_select" style="padding:0;border:0;">
  85. <div style="border:1px solid #ccc;height:100%;" class="clearfix">
  86. <div class="diy_select_txt col-xs-10"
  87. style="padding:0;"><?php echo isset(Yii::app()->params['subjectId'][$teacherInfo->subjects]) ? Yii::app()->params['subjectId'][$teacherInfo->subjects] : '' ?></div>
  88. <div class="diy_select_btn col-sm-2"></div>
  89. </div>
  90. <ul class="diy_select_list">
  91. </ul>
  92. </div>
  93. <input type='hidden' value="<?php echo $teacherInfo->subjects ?>" class='diy_select_input'
  94. id="subjects" name="subjects"
  95. value="<?php echo isset($teacherInfo->subjects) ? $teacherInfo->subjects : 0 ?>"/>
  96. </div>
  97. </div>
  98. <div class="form-group">
  99. <label class="control-label col-xs-12 col-sm-3 no-padding-right">岗位<span
  100. class="errorMessage">*</span>:</label>
  101. <div class="col-sm-9">
  102. <div class="col-xs-10 col-sm-3 addheight diy_select" style="padding:0;border:0;">
  103. <div style="border:1px solid #ccc;height:100%;" class="clearfix">
  104. <div class="diy_select_txt col-xs-10" style="padding:0;"><?php
  105. if ($teacherInfo->posts == 1) {
  106. echo "班主任";
  107. }
  108. if ($teacherInfo->posts == 2) {
  109. echo "教研组长";
  110. }
  111. if ($teacherInfo->posts == 3) {
  112. echo "年级主任";
  113. }
  114. if ($teacherInfo->posts == 4) {
  115. echo "任课教师";
  116. }
  117. if ($teacherInfo->posts == 5) {
  118. echo "校长";
  119. }
  120. ?></div>
  121. <div class="diy_select_btn col-sm-2"></div>
  122. </div>
  123. <ul class="diy_select_list post">
  124. <li val="0" class="">请选择教师岗位</li>
  125. <!-- <li val="5" class="">校长</li>-->
  126. <li val="4" class="">任课教师</li>
  127. <li val="3" class="">年级主任</li>
  128. <li val="2" class="">教研组长</li>
  129. <li val="1" class="">班主任</li>
  130. </ul>
  131. </div>
  132. <input type='hidden' class='diy_select_input' id="posts" name="posts"
  133. value="<?php echo $teacherInfo->posts ?>"/>
  134. </div>
  135. </div>
  136. <div class="form-group" id="_grade">
  137. <label class="control-label col-xs-12 col-sm-3 no-padding-right">年级主任所在年级:</label>
  138. <div class="col-sm-9">
  139. <select name="grade" style="width: 100px;">
  140. <?php
  141. if(Yii::app()->params['grade_config']){
  142. foreach (Yii::app()->params['grade_config'] as $val){
  143. if($teacherInfo->grade==$val['id']){
  144. echo '<option value="'.$val['id'].'" selected >'.$val['grade_name'].'</option>';
  145. }else{
  146. echo '<option value="'.$val['id'].'" >'.$val['grade_name'].'</option>';
  147. }
  148. }
  149. }
  150. ?>
  151. </select>
  152. </div>
  153. </div>
  154. <div class="form-group">
  155. <label class="control-label col-xs-12 col-sm-3 no-padding-right">职称:</label>
  156. <div class="col-sm-9">
  157. <div class="col-xs-10 col-sm-3 addheight diy_select" style="padding:0;border:0;">
  158. <div style="border:1px solid #ccc;height:100%;" class="clearfix">
  159. <div class="diy_select_txt col-xs-10" style="padding:0;"><?php
  160. if ($teacherInfo->title == 4) {
  161. echo "高级教师";
  162. }
  163. if ($teacherInfo->title == 1) {
  164. echo "一级教师";
  165. }
  166. if ($teacherInfo->title == 2) {
  167. echo "二级教师";
  168. }
  169. if ($teacherInfo->title == 3) {
  170. echo "三级教师";
  171. }
  172. ?></div>
  173. <div class="diy_select_btn col-sm-2"></div>
  174. </div>
  175. <ul class="diy_select_list">
  176. <li val="" class="">请选择职称</li>
  177. <li val="3" class="">三级教师</li>
  178. <li val="2" class="">二级教师</li>
  179. <li val="1" class="">一级教师</li>
  180. <li val="4" class="">高级教师</li>
  181. </ul>
  182. </div>
  183. <input type='hidden' class='diy_select_input' id="title" name="title"
  184. value="<?php echo $teacherInfo->title ?>"/>
  185. </div>
  186. </div>
  187. <div class="form-group">
  188. <label class="control-label col-xs-12 col-sm-3 no-padding-right">教龄:</label>
  189. <div class="col-sm-9">
  190. <input type="text" name="teacher_age" class="col-xs-10 col-sm-3 addborder addheight"
  191. value="<?php echo $teacherInfo->teacher_age; ?>"/>
  192. </div>
  193. </div>
  194. <div class="form-group">
  195. <label class="control-label col-xs-12 col-sm-3 no-padding-right">性别:</label>
  196. <div class="col-sm-9 mt6">
  197. <span class="inline blue">
  198. <input type="radio" class="ace" name="teacher_sex"
  199. value="0" <?php if ($teacherInfo->teacher_sex == 0) {
  200. echo 'checked="checked"';
  201. } ?>>
  202. <span class="lbl middle"> 男</span>
  203. </span>
  204. &nbsp; &nbsp; &nbsp;
  205. <span class="inline blue">
  206. <input type="radio" class="ace" name="teacher_sex"
  207. value="1" <?php if ($teacherInfo->teacher_sex == 1) {
  208. echo 'checked="checked"';
  209. } ?>>
  210. <span class="lbl middle"> 女</span>
  211. </span>
  212. </div>
  213. </div>
  214. <div class="form-group">
  215. <label class="control-label col-xs-12 col-sm-3 no-padding-right">状态<span
  216. class="errorMessage">*</span>:</label>
  217. <div class="col-sm-9 mt6">
  218. <span class="inline blue">
  219. <input type="radio" class="ace" name="status"
  220. value="0" <?php if ($teacherInfo->status == 0) {
  221. echo 'checked="checked"';
  222. } ?>>
  223. <span class="lbl middle"> 有效</span>
  224. </span>
  225. &nbsp;
  226. <span class="inline blue">
  227. <input type="radio" class="ace" name="status"
  228. value="1" <?php if ($teacherInfo->status == 1) {
  229. echo 'checked="checked"';
  230. } ?>>
  231. <span class="lbl middle"> 无效</span>
  232. </span>
  233. </div>
  234. </div>
  235. <div class="clearfix form-actions">
  236. <div class="col-md-offset-3 col-md-9">
  237. <input type="hidden" name="changeSchool" value="0">
  238. <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
  239. <i class="ace-icon fa fa-check bigger-110"></i>
  240. 提交
  241. </button>
  242. &nbsp; &nbsp; &nbsp;
  243. <button class="btn btn-success btn-sm" type="reset">
  244. <i class="ace-icon fa fa-undo bigger-110"></i>
  245. 重填
  246. </button>
  247. </div>
  248. </div>
  249. </form>
  250. <!-- PAGE CONTENT ENDS -->
  251. </div>
  252. </div>
  253. </div>
  254. </div>
  255. <script src="/js/bootstrap.min.js"></script>
  256. <!-- page specific plugin scripts -->
  257. <!-- ace scripts -->
  258. <script src="/js/ace-elements.min.js"></script>
  259. <script src="/js/ace.min.js"></script>
  260. <!-- 学校管理 js -->
  261. <script src="/js/school.management.js"></script>
  262. <script src="/js/xsgl.js"></script>
  263. <script src="/js/jquery.validate.min.js"></script>
  264. <script type="text/javascript">
  265. jQuery(function ($) {
  266. //alert($("#class_id").val());
  267. var phoneNumberCheck=true;
  268. var isSuperMan=false;
  269. <?php
  270. if(isset(Yii::app()->session['testFlag']) && (Yii::app()->session['testFlag']==1)){
  271. //echo 'isSuperMan=true;';
  272. }
  273. ?>
  274. var schoolName='其它学校';
  275. //检测手机号
  276. $.validator.addMethod("isPhone", function(value, element) {
  277. var regMobile = /^1([356789]\d|4[57])\d{8}$/;
  278. return this.optional(element) || (regMobile.test( value ));
  279. }, "手机号格式有误!");
  280. <?php if ($teacherInfo->posts != 3) {
  281. echo '$("#_grade").hide();';
  282. }?>
  283. //检测邮箱
  284. $.validator.addMethod("isMail", function (value, element) {
  285. var regMail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
  286. return this.optional(element) || (regMail.test(value));
  287. }, "请填写正确的邮箱!");
  288. //检测是否选中班级
  289. /*$.validator.addMethod("isCheck", function(value, element) {
  290. $("#class_array").val(value);
  291. //alert(value);
  292. //return this.optional(element);
  293. return true;
  294. },'');*/
  295. $('#teachSubmit').validate({
  296. //debug:true,// 表单不会提交
  297. //errorElement: 'font', // 错误信息div
  298. errorClass: 'errorMessage', //错误样式
  299. ignore: "", //忽略提交字段
  300. rules: {
  301. class_id: {
  302. required: false,
  303. isCheck: true
  304. },
  305. teacher_name: {
  306. required: true,
  307. maxlength: 20
  308. },
  309. //account: {
  310. //required: true,
  311. //},
  312. password: {
  313. required: false,
  314. minlength: 6
  315. },
  316. password2: {
  317. required: false,
  318. minlength: 6,
  319. equalTo: "#password"
  320. },
  321. teacher_age: {
  322. digits: true
  323. },
  324. teacher_email: {
  325. //required: true,
  326. isMail: true
  327. },
  328. teacher_sex: {
  329. required: true,
  330. },
  331. status: {
  332. required: true,
  333. },
  334. subjects: {
  335. required: true,
  336. },
  337. posts: {
  338. required: true,
  339. range: [1, 5]
  340. }
  341. },
  342. messages: {
  343. class_id: {
  344. required: "请选择班级",
  345. //isCheck: "请选择班级!",
  346. },
  347. teacher_name: {
  348. required: "请填写教师姓名!",
  349. maxlength: "教师名称长度不能超过20个字符!"
  350. },
  351. //account: {
  352. // required: "请填写教师登录账号!",
  353. //},
  354. password: {
  355. required: "请填写登录密码!",
  356. minlength: "密码不能少于6位字符!"
  357. },
  358. password2: {
  359. required: "请填写确认密码!",
  360. minlength: "密码不能少于6位字符!",
  361. equalTo: "两次密码输入不一致!"
  362. },
  363. teacher_age: {
  364. digits: "教师年龄必须是合法整数!"
  365. },
  366. phone_number: {
  367. required: "请填写教师电话!",
  368. rangelength: "输入手机号不能大于或小于11位!",
  369. remote: "此手机号已存在"
  370. },
  371. teacher_email: {
  372. //required: "请填写教师邮箱!",
  373. isMail: "请填写正确的邮箱!"
  374. },
  375. teacher_sex: {
  376. required: "请选择性别!"
  377. },
  378. status: {
  379. required: "请选择状态!"
  380. },
  381. subjects: {
  382. required: "请选择学科!",
  383. },
  384. posts: {
  385. required: "请选择岗位!",
  386. range: '请选择岗位'
  387. }
  388. },
  389. errorPlacement: function (error, element) { // 指定错误信息显示位置
  390. if (element.is('input[type=radio]')) {
  391. var controls = element.closest('div[class*="col-"]');
  392. if (controls.find(':checkbox,:radio').length > 1) controls.append(error);
  393. else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
  394. } else {
  395. console.log(element);
  396. error.insertAfter(element.after());
  397. }
  398. },
  399. })
  400. $('.phone_number').change(function(){
  401. phoneNumberCheck=false;
  402. phoneNumber=$(this).val();
  403. $('input[name=changeSchool]').val(0);
  404. obj=$(this);
  405. var regMobile = /^1([356789]\d|4[57])\d{8}$/;
  406. if(!regMobile.test(phoneNumber)){
  407. $('.forPhoneNumber').html('手机号格式有误!');
  408. $(this).focus();
  409. return false;
  410. }
  411. layer.msg('正在检测手机号,请稍候。。。。。。',{time:0});
  412. $.ajax({
  413. url: "<?php echo $this->createUrl('teacher/verifyphone_number');?>",
  414. type:'POST',
  415. dataType:'json',
  416. data:{phone_number:phoneNumber,is_edit: 1, teacher_id: "<?php echo $_GET['thid']?>"},
  417. success:function(res){
  418. layer.closeAll();
  419. if(res.status==-1){
  420. obj.focus();
  421. $('.forPhoneNumber').html('本校内该手机号已存在!');
  422. }else if(res.status==0){
  423. obj.focus();
  424. var showMessage='';
  425. if(isSuperMan){
  426. showMessage="该手机号已存在,请仔细核查是否填写错误";
  427. if(res.data){
  428. schoolName=res.data;
  429. }
  430. layer.confirm('该手机号已在['+schoolName+']注册,编辑操作将使该号码从['+schoolName+']删除,请确认!', {
  431. btn: ['确定', '取消']
  432. }, function(index, layero){
  433. phoneNumberCheck=true;
  434. $('.forPhoneNumber').html('');
  435. $('input[name=changeSchool]').val(1);
  436. layer.closeAll();
  437. }, function(index){
  438. showMessage="该手机号已存在,点击查看详情";
  439. layer.closeAll();
  440. $('.forPhoneNumber').addClass('again').html(showMessage);
  441. });
  442. }else{
  443. showMessage="该手机号已存在,请仔细核查是否填写错误,若需修改可联系技术支持处理";
  444. $('.forPhoneNumber').html(showMessage);
  445. }
  446. }else if(res.status==1){
  447. phoneNumberCheck=true;
  448. $('.forPhoneNumber').html('');
  449. }
  450. }
  451. })
  452. });
  453. $('#schoolSubmit').click(function(){
  454. if(!phoneNumberCheck){
  455. return false;
  456. }
  457. });
  458. $('.form-horizontal').on('click','.again',function(){
  459. layer.confirm('该手机号已在['+schoolName+']注册,是否迁移到当前学校?', {
  460. btn: ['确定', '取消']
  461. }, function(index, layero){
  462. phoneNumberCheck=true;
  463. $('.forPhoneNumber').html('');
  464. $('input[name=changeSchool]').val(1);
  465. layer.closeAll();
  466. }, function(index){
  467. showMessage="该手机号已存在,点击查看详情";
  468. layer.closeAll();
  469. $('.forPhoneNumber').addClass('again').html(showMessage);
  470. });
  471. })
  472. });
  473. $(".diy_select_list.post li").click(function () {
  474. if($(this).attr('val') ==3){
  475. $("#_grade").show();
  476. } else {
  477. $("#_grade").hide();
  478. }
  479. });
  480. </script>