123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- <style>
- .addborder {
- border: 1px solid #ccc
- }
- .addheight {
- height: 30px;
- border-radius: 2px;
- }
- .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;
- }
- .ace {
- position: relative;
- top: 0px !important;
- left: 0px !important;
- }
- label {
- font-weight: 100 !important;
- }
- #phone_number-error, #teacher_name-error {
- margin-top: 4px;
- }
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="page-content" style="margin-top:15px;">
- <div class="row" style="margin:0px">
- <div class="col-xs-12">
- <!-- PAGE CONTENT BEGINS -->
- <form class="form-horizontal"
- action="<?php echo $this->createUrl('teacher/edit', array('thid' => $teacherInfo->teacher_id)); ?>"
- method="post" id="teachSubmit">
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">教师姓名<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <input type="text" value="<?php echo $teacherInfo->teacher_name; ?>" name="teacher_name"
- class="col-xs-10 col-sm-3 addborder addheight marginLeftNo"/>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录手机号<span
- class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <input type="text" value="<?php echo $getBtteacher->phone_number; ?>" name="phone_number"
- class="col-xs-10 col-sm-3 addborder addheight marginLeftNo phone_number"/>
- <label class="errorMessage forPhoneNumber"></label>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录密码<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <input type="text" id="password" name="password"
- class="col-xs-10 col-sm-3 addborder addheight" value=""/>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">确认密码<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <input type="text" id="password2" name="password2"
- class="col-xs-10 col-sm-3 addborder addheight" value=""/>
- </div>
- </div>
- <!-- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">电话<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <input type="text" name="teacher_phone" class="col-xs-10 col-sm-3" />
- </div>
- </div> -->
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">邮箱:</label>
- <div class="col-sm-9">
- <input type="text" name="teacher_email" value="<?php echo $teacherInfo->teacher_email; ?>"
- class="col-xs-10 col-sm-3 addborder addheight"/>
- </div>
- </div>
- <div class="form-group form-group-teacher">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">学科组<span
- class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <div class="col-xs-10 col-sm-3 addheight diy_select" style="padding:0;border:0;">
- <div style="border:1px solid #ccc;height:100%;" class="clearfix">
- <div class="diy_select_txt col-xs-10"
- style="padding:0;"><?php echo isset(Yii::app()->params['subjectId'][$teacherInfo->subjects]) ? Yii::app()->params['subjectId'][$teacherInfo->subjects] : '' ?></div>
- <div class="diy_select_btn col-sm-2"></div>
- </div>
- <ul class="diy_select_list">
- </ul>
- </div>
- <input type='hidden' value="<?php echo $teacherInfo->subjects ?>" class='diy_select_input'
- id="subjects" name="subjects"
- value="<?php echo isset($teacherInfo->subjects) ? $teacherInfo->subjects : 0 ?>"/>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">岗位<span
- class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <div class="col-xs-10 col-sm-3 addheight diy_select" style="padding:0;border:0;">
- <div style="border:1px solid #ccc;height:100%;" class="clearfix">
- <div class="diy_select_txt col-xs-10" style="padding:0;"><?php
- if ($teacherInfo->posts == 1) {
- echo "班主任";
- }
- if ($teacherInfo->posts == 2) {
- echo "教研组长";
- }
- if ($teacherInfo->posts == 3) {
- echo "年级主任";
- }
- if ($teacherInfo->posts == 4) {
- echo "任课教师";
- }
- if ($teacherInfo->posts == 5) {
- echo "校长";
- }
- ?></div>
- <div class="diy_select_btn col-sm-2"></div>
- </div>
- <ul class="diy_select_list post">
- <li val="0" class="">请选择教师岗位</li>
- <!-- <li val="5" class="">校长</li>-->
- <li val="4" class="">任课教师</li>
- <li val="3" class="">年级主任</li>
- <li val="2" class="">教研组长</li>
- <li val="1" class="">班主任</li>
- </ul>
- </div>
- <input type='hidden' class='diy_select_input' id="posts" name="posts"
- value="<?php echo $teacherInfo->posts ?>"/>
- </div>
- </div>
- <div class="form-group" id="_grade">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">年级主任所在年级:</label>
- <div class="col-sm-9">
- <select name="grade" style="width: 100px;">
- <?php
- if(Yii::app()->params['grade_config']){
- foreach (Yii::app()->params['grade_config'] as $val){
- if($teacherInfo->grade==$val['id']){
- echo '<option value="'.$val['id'].'" selected >'.$val['grade_name'].'</option>';
- }else{
- echo '<option value="'.$val['id'].'" >'.$val['grade_name'].'</option>';
- }
- }
- }
- ?>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">职称:</label>
- <div class="col-sm-9">
- <div class="col-xs-10 col-sm-3 addheight diy_select" style="padding:0;border:0;">
- <div style="border:1px solid #ccc;height:100%;" class="clearfix">
- <div class="diy_select_txt col-xs-10" style="padding:0;"><?php
- if ($teacherInfo->title == 4) {
- echo "高级教师";
- }
- if ($teacherInfo->title == 1) {
- echo "一级教师";
- }
- if ($teacherInfo->title == 2) {
- echo "二级教师";
- }
- if ($teacherInfo->title == 3) {
- echo "三级教师";
- }
- ?></div>
- <div class="diy_select_btn col-sm-2"></div>
- </div>
- <ul class="diy_select_list">
- <li val="" class="">请选择职称</li>
- <li val="3" class="">三级教师</li>
- <li val="2" class="">二级教师</li>
- <li val="1" class="">一级教师</li>
- <li val="4" class="">高级教师</li>
- </ul>
- </div>
- <input type='hidden' class='diy_select_input' id="title" name="title"
- value="<?php echo $teacherInfo->title ?>"/>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">教龄:</label>
- <div class="col-sm-9">
- <input type="text" name="teacher_age" class="col-xs-10 col-sm-3 addborder addheight"
- value="<?php echo $teacherInfo->teacher_age; ?>"/>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">性别:</label>
- <div class="col-sm-9 mt6">
- <span class="inline blue">
- <input type="radio" class="ace" name="teacher_sex"
- value="0" <?php if ($teacherInfo->teacher_sex == 0) {
- echo 'checked="checked"';
- } ?>>
- <span class="lbl middle"> 男</span>
- </span>
-
- <span class="inline blue">
- <input type="radio" class="ace" name="teacher_sex"
- value="1" <?php if ($teacherInfo->teacher_sex == 1) {
- echo 'checked="checked"';
- } ?>>
- <span class="lbl middle"> 女</span>
- </span>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">状态<span
- class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mt6">
- <span class="inline blue">
- <input type="radio" class="ace" name="status"
- value="0" <?php if ($teacherInfo->status == 0) {
- echo 'checked="checked"';
- } ?>>
- <span class="lbl middle"> 有效</span>
- </span>
-
- <span class="inline blue">
- <input type="radio" class="ace" name="status"
- value="1" <?php if ($teacherInfo->status == 1) {
- echo 'checked="checked"';
- } ?>>
- <span class="lbl middle"> 无效</span>
- </span>
- </div>
- </div>
- <div class="clearfix form-actions">
- <div class="col-md-offset-3 col-md-9">
- <input type="hidden" name="changeSchool" value="0">
- <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
- <i class="ace-icon fa fa-check bigger-110"></i>
- 提交
- </button>
-
- <button class="btn btn-success btn-sm" type="reset">
- <i class="ace-icon fa fa-undo bigger-110"></i>
- 重填
- </button>
- </div>
- </div>
- </form>
- <!-- PAGE CONTENT ENDS -->
- </div>
- </div>
- </div>
- </div>
- <script src="/js/bootstrap.min.js"></script>
- <!-- page specific plugin scripts -->
- <!-- ace scripts -->
- <script src="/js/ace-elements.min.js"></script>
- <script src="/js/ace.min.js"></script>
- <!-- 学校管理 js -->
- <script src="/js/school.management.js"></script>
- <script src="/js/xsgl.js"></script>
- <script src="/js/jquery.validate.min.js"></script>
- <script type="text/javascript">
- jQuery(function ($) {
- //alert($("#class_id").val());
- var phoneNumberCheck=true;
- var isSuperMan=false;
- <?php
- if(isset(Yii::app()->session['testFlag']) && (Yii::app()->session['testFlag']==1)){
- //echo 'isSuperMan=true;';
- }
- ?>
- var schoolName='其它学校';
- //检测手机号
- $.validator.addMethod("isPhone", function(value, element) {
- var regMobile = /^1([356789]\d|4[57])\d{8}$/;
- return this.optional(element) || (regMobile.test( value ));
- }, "手机号格式有误!");
- <?php if ($teacherInfo->posts != 3) {
- echo '$("#_grade").hide();';
- }?>
- //检测邮箱
- $.validator.addMethod("isMail", function (value, element) {
- var regMail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
- return this.optional(element) || (regMail.test(value));
- }, "请填写正确的邮箱!");
- //检测是否选中班级
- /*$.validator.addMethod("isCheck", function(value, element) {
- $("#class_array").val(value);
- //alert(value);
- //return this.optional(element);
- return true;
- },'');*/
- $('#teachSubmit').validate({
- //debug:true,// 表单不会提交
- //errorElement: 'font', // 错误信息div
- errorClass: 'errorMessage', //错误样式
- ignore: "", //忽略提交字段
- rules: {
- class_id: {
- required: false,
- isCheck: true
- },
- teacher_name: {
- required: true,
- maxlength: 20
- },
- //account: {
- //required: true,
- //},
- password: {
- required: false,
- minlength: 6
- },
- password2: {
- required: false,
- minlength: 6,
- equalTo: "#password"
- },
- teacher_age: {
- digits: true
- },
- teacher_email: {
- //required: true,
- isMail: true
- },
- teacher_sex: {
- required: true,
- },
- status: {
- required: true,
- },
- subjects: {
- required: true,
- },
- posts: {
- required: true,
- range: [1, 5]
- }
- },
- messages: {
- class_id: {
- required: "请选择班级",
- //isCheck: "请选择班级!",
- },
- teacher_name: {
- required: "请填写教师姓名!",
- maxlength: "教师名称长度不能超过20个字符!"
- },
- //account: {
- // required: "请填写教师登录账号!",
- //},
- password: {
- required: "请填写登录密码!",
- minlength: "密码不能少于6位字符!"
- },
- password2: {
- required: "请填写确认密码!",
- minlength: "密码不能少于6位字符!",
- equalTo: "两次密码输入不一致!"
- },
- teacher_age: {
- digits: "教师年龄必须是合法整数!"
- },
- phone_number: {
- required: "请填写教师电话!",
- rangelength: "输入手机号不能大于或小于11位!",
- remote: "此手机号已存在"
- },
- teacher_email: {
- //required: "请填写教师邮箱!",
- isMail: "请填写正确的邮箱!"
- },
- teacher_sex: {
- required: "请选择性别!"
- },
- status: {
- required: "请选择状态!"
- },
- subjects: {
- required: "请选择学科!",
- },
- posts: {
- required: "请选择岗位!",
- range: '请选择岗位'
- }
- },
- errorPlacement: function (error, element) { // 指定错误信息显示位置
- if (element.is('input[type=radio]')) {
- var controls = element.closest('div[class*="col-"]');
- if (controls.find(':checkbox,:radio').length > 1) controls.append(error);
- else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
- } else {
- console.log(element);
- error.insertAfter(element.after());
- }
- },
- })
- $('.phone_number').change(function(){
- phoneNumberCheck=false;
- phoneNumber=$(this).val();
- $('input[name=changeSchool]').val(0);
- obj=$(this);
- var regMobile = /^1([356789]\d|4[57])\d{8}$/;
- if(!regMobile.test(phoneNumber)){
- $('.forPhoneNumber').html('手机号格式有误!');
- $(this).focus();
- return false;
- }
- layer.msg('正在检测手机号,请稍候。。。。。。',{time:0});
- $.ajax({
- url: "<?php echo $this->createUrl('teacher/verifyphone_number');?>",
- type:'POST',
- dataType:'json',
- data:{phone_number:phoneNumber,is_edit: 1, teacher_id: "<?php echo $_GET['thid']?>"},
- success:function(res){
- layer.closeAll();
- if(res.status==-1){
- obj.focus();
- $('.forPhoneNumber').html('本校内该手机号已存在!');
- }else if(res.status==0){
- obj.focus();
- var showMessage='';
- if(isSuperMan){
- showMessage="该手机号已存在,请仔细核查是否填写错误";
- if(res.data){
- schoolName=res.data;
- }
- layer.confirm('该手机号已在['+schoolName+']注册,编辑操作将使该号码从['+schoolName+']删除,请确认!', {
- btn: ['确定', '取消']
- }, function(index, layero){
- phoneNumberCheck=true;
- $('.forPhoneNumber').html('');
- $('input[name=changeSchool]').val(1);
- layer.closeAll();
- }, function(index){
- showMessage="该手机号已存在,点击查看详情";
- layer.closeAll();
- $('.forPhoneNumber').addClass('again').html(showMessage);
- });
- }else{
- showMessage="该手机号已存在,请仔细核查是否填写错误,若需修改可联系技术支持处理";
- $('.forPhoneNumber').html(showMessage);
- }
- }else if(res.status==1){
- phoneNumberCheck=true;
- $('.forPhoneNumber').html('');
- }
- }
- })
- });
- $('#schoolSubmit').click(function(){
- if(!phoneNumberCheck){
- return false;
- }
- });
- $('.form-horizontal').on('click','.again',function(){
- layer.confirm('该手机号已在['+schoolName+']注册,是否迁移到当前学校?', {
- btn: ['确定', '取消']
- }, function(index, layero){
- phoneNumberCheck=true;
- $('.forPhoneNumber').html('');
- $('input[name=changeSchool]').val(1);
- layer.closeAll();
- }, function(index){
- showMessage="该手机号已存在,点击查看详情";
- layer.closeAll();
- $('.forPhoneNumber').addClass('again').html(showMessage);
- });
- })
- });
- $(".diy_select_list.post li").click(function () {
- if($(this).attr('val') ==3){
- $("#_grade").show();
- } else {
- $("#_grade").hide();
- }
- });
- </script>
|