123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
- <link type="text/css" rel="stylesheet" href="/js/select/select2.min.css" />
- <script src="/js/xsgl.js"></script>
- <script src="/js/select/select2.min.js"></script>
- <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;}
- /* #coach_id-error{position: absolute;right:-80px;top:5px;}
- #level_name-error{position: absolute;right:-80px;top:5px;}
- #material_id-error{position: absolute;right:-110px;top:5px;}
- #class_name-error{margin: 6px 0px 0px 18px;font-size:13px;} */
- .clearfix:after {
- content: "";
- display: block;
- visibility: hidden;
- height: 0;
- clear: both;
- }
- .clearfix {
- zoom: 1;
- }
- .fl {
- float: left;
- }
- .fr {
- float: right;
- }
- em{
- color: #FF000C;
- margin-right: 4px;
- }
- .bm-name{
- width: 100px;
- text-align: right;
- // border: 1px solid #000;
- }
- .bm-inp-con{
- width: 170px;
- }
- .basic-message select{
- width: 160px;
- height: 26px;
- }
- .basic-message input{
- width: 156px;
- height: 22px;
- }
- .basic-message{
- padding: 10px 0;
- }
- .th-describe{
- margin-top: 10px;
- }
- .th-describe span{
- color: #FF000C;
- }
- table{
- width: 800px;
- border-color: #fff;
- text-align: center;
- font-size: 14px;
- margin-top: 10px;
- }
- thead{
- background: #F2F2F2;
- }
- .serial{
- width: 80px;
- }
- .operation{
- width: 100px;
- }
- .subject,.teacher,.remarks{
- width: 180px;
- }
- .teacher{
- }
- .remarks{
- }
- td{
- height: 40px;
- }
- table input,table select{
- width: 80%;
- height: 86%;
- text-indent: 10px;
- }
- .opration-con{
- font-size: 23px;
- font-weight: bold;
- }
- .opration-con > span{
- color: #2977ff;
- cursor: pointer;
- }
- .types-con{
- margin-top: 25px;
- }
- .getscore-type{
- margin-left: 60px;
- }
- .types-con input {
- margin-left: 10px;
- cursor: pointer;
- }
- .submit{
- width: 100px;
- height: 30px;
- background: #2977ff;
- color: #fff;
- border: none;
- margin-top: 50px;
- }
- .title_msg{
- padding-top:30px;
- padding-left:20px
- }
- </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 fontSize1">
- <!-- PAGE CONTENT BEGINS -->
- <section class="anc-top flex status_1" >
- <div class="flex-one flex">
- <p class="anc-title">教学班</p>
- <p class="title_msg">当前学年:<?php echo $thisSemester["school_year"];?>学年 当前学期:<?php echo $thisSemester["semester_name"];?></p>
- </div>
- </section>
- <form class="form-horizontal" action="<?php echo $this->createUrl('classes/editClassified',array('cid'=>$classInfo->class_id));?>" method="post" id="classAdd">
- <div class="col-xs-12 col-sm-12">
- <div class="form-group col-xs-12 col-sm-4">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级名称<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mtCentent">
- <input type="text" id="class_name" name="class_name" class="col-xs-10 col-sm-4 addborder addheight" value="<?php echo $classInfo->class_name;?>" />
- </div>
- </div>
- <div class="form-group col-xs-12 col-sm-4">
- <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="hidden" id="grade" value="<?php echo $classInfo->grade ? $classInfo->grade : 0;?>">
- <?php echo ($num = Char::numToZh($classInfo->grade)) ? "高{$num}" : "";?>
- </div>
- </div>
- <div class="form-group col-xs-12 col-sm-4">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">层级:</label>
- <div class="col-xs-12 col-sm-9">
- <div class="clearfix">
- <select class="input-medium" id="level_name" name="level_name">
- <option value="">请选择</option>
- <?php
- $levelArr=array(
- '1'=>'A',
- '2'=>'B',
- '3'=>'C'
- );
- if($classLevels){
- foreach ($classLevels as $classLevel){
- if(isset($levelArr[$classInfo->level]) && $levelArr[$classInfo->level]==$classLevel[0]){
- echo '<option selected value="'.$classLevel[0].'">'.$classLevel[0].'层</option>';
- }else{
- echo '<option value="'.$classLevel[0].'">'.$classLevel[0].'层</option>';
- }
- }
- }
- ?>
- </select>
- </div>
- </div>
- <input type="hidden" name="class_array" id="class_array">
- </div>
- </div>
- <p class="th-describe"><em>*</em>执教老师:(<span>点击"+"添加列,点击"-"删除列</span>)</p>
- <table class="" cellpadding="0" cellspacing="0" border="1">
- <thead>
- <td class="serial">序号</td>
- <td class="operation">操作</td>
- <td class="subject">学科组</td>
- <td class="teacher">老师(岗位)</td>
- </thead>
- <?php foreach($classTeachersIds as $ck=>$cv){
- ?>
- <tr class="subject_teacher">
- <td><?php echo $ck+1;?></td>
- <td class="opration-con"><span class="add">+</span> <span class="redus">-</span></td>
- <td>
- <select name="subject_ids[]" id="subject_ids" class="subject_ids">
- <?php foreach($subjects as $k=>$v){
- ?>
- <option value="<?php echo $k?>" <?php if(isset($subject_teacher[$cv]) && !empty($subject_teacher[$cv]) && $subject_teacher[$cv]==$k){echo 'selected';}?>><?php echo $v?></option>
- <?php
- }?>
- </select>
- </td>
- <td>
- <select name="teacher_ids[]" id="teacher_ids" class="teacher_ids projSelect">
- <?php if(isset($subject_teacher[$cv]) && !empty($subject_teacher[$cv]) && isset($subject_teacher_array[$subject_teacher[$cv]]) && !empty($subject_teacher_array[$subject_teacher[$cv]])){
- foreach($subject_teacher_array[$subject_teacher[$cv]] as $k=>$v){
- ?>
- <option value="<?php echo $v[$k]['teacher_id']?>"
- <?php if(isset($class_teacher[$cv]) && !empty($class_teacher[$cv]) && isset($v[$class_teacher[$cv]]['teacher_id'])){echo 'selected';}?>>
- <?php echo $v[$k]['teacher_name'].'('.$v[$k]['posts'].')'?>
- </option>
- <?php
- }}?>
- </select>
- </td>
- </tr>
- <?php
- }?>
- </table>
- <div class="clearfix form-actions mt15">.
- <input type='hidden' id="school_year" name="period" class='diy_select_input' value="<?php echo $classInfo->period?>"/>
- <div class="col-md-offset-3 col-md-9">
- <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" 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/jquery.validate.min.js"></script>
- <script src="/js/birthday.js" type="text/javascript" charset="utf-8"></script>
- <script>
- $(document).ready(function(){
- var subjectIds = <?php echo json_encode($subjects);?>;
- $('.projSelect').select2();
- var selectCount=0;
- $(document).on("click",".add",function () {
- var subjectSelectId=0;
- var index = $(this).parent().parent().index();
- var data = {'grade':$('#grade').val()};
- var obj = $(this);
- var str = '';
- str += '<tr><td>1</td>';
- str+='<td class="opration-con"><span class="add">+</span> <span class="redus">-</span></td>'
- str+='<td><select name="subject_ids[]" id="subject_ids" class="subject_ids">'
- $.each(subjectIds,function(index,val){
- if (index!=6 && index!=18 && index!=19){
- if(subjectSelectId==0){
- subjectSelectId=index;
- }
- str += '<option value="'+index+'">'+val+'</option>';
- }
- });
- str += '</select></td>';
- var data= {
- subject_id:subjectSelectId,
- grade: $('#grade').val()
- };
- $.post("<?php echo Yii::app()->createUrl('classes/get_subject_teachers')?>",data,function(flags){
- var m = JSON.parse(flags);
- if(m.status==0)
- {
- alert('没有教师');
- }else
- {
- selectCount++;
- var selectClass='projSelect'+selectCount;
- str += '<td><select name="teacher_ids[]" id="teacher_ids" class="teacher_ids '+selectClass+'">';
- $.each(m.result,function(index,val){
- str += '<option value="'+index+'">'+val+'</option>';
- });
- str += '<select></td></tr>';
- obj.parent().parent().after(str);
- for (var i=index+1;i<$('tbody tr').length;i++) {
- var tNum = parseInt($('tbody tr').eq(i-1).find('td').eq(0).text())+1;
- $('tbody tr').eq(i).find('td').eq(0).text(tNum);
- }
- $('.'+selectClass).select2();
- }
- });
- });
- $(document).on("click",".redus",function () {
- var index = $(this).parent().parent().index();
- for (var i=index+1;i<$('tbody tr').length;i++) {
- var tNum = parseInt($('tbody tr').eq(i).find('td').eq(0).text())-1;
- $('tbody tr').eq(i).find('td').eq(0).text(tNum);
- }
- if ($('tbody tr').length>1) {
- $(this).parent().parent().remove();
- } else{
- alert("最后一行不能删除了哦");
- }
- });
- $('body').on("change",".subject_ids",function(){
- /*$('#subject_ids').change(function(){*/
- var data= {
- subject_id:$(this).val(),
- grade: $('#grade').val()
- };
- var str ='';
- var _this = $(this);
- $.post("<?php echo Yii::app()->createUrl('classes/get_subject_teachers')?>",data,function(flags){
- var m = JSON.parse(flags);
- if(m.status==0)
- {
- alert('没有教师');
- }else
- {
- selectCount++;
- var selectClass='projSelect'+selectCount;
- str='<select name="teacher_ids[]" id="teacher_ids" class="teacher_ids '+selectClass+'">';
- $.each(m.result,function(index,val){
- str += '<option value="'+index+'">'+val+'</option>'
- });
- str+='</select>';
- }
- _this.parent().next().html(str);
- $('.'+selectClass).select2();
- //_this.parent().next().children('select').html(str);
- });
- });
- });
- </script>
- <script language="javascript">
- $(function(){
- //加载班主任教师
- $('#main-teacher').bind('input propertychange', function() {
- var obj_list=$(this).parent().find('.name-con');
- var keyword=$(this).val();
- if(keyword==''){
- return false;
- }
- $(this).attr('teacher_id','');
- $('#bzr_id').val(0);
- $.ajax({
- url:'<?php echo $this->createUrl('classes/loadTeacher')?>',
- type:'POST',
- dataType:'json',
- data:{'keyword':keyword},
- success:function(res){
- if(res.status==1){
- var html='';
- if(res.data.length>0){
- for(var i=0;i<res.data.length;i++){
- html+='<li class="name-list" id="'+res.data[i]['teacher_id']+'">'+res.data[i]['teacher_name']+'</li>';
- }
- obj_list.html(html);
- obj_list.show();
- }
- }
- }
- });
- });
- $('.mtCentent').on('click','.name-list',function(){
- $(this).closest('.mtCentent').find('#main-teacher').val($(this).html());
- $(this).closest('.mtCentent').find('#main-teacher').attr('teacher_id',$(this).attr('id'));
- $(this).closest('.mtCentent').find('#main-teacher').attr('title',$(this).html());
- $('#bzr_id').val($(this).attr('id'));
- $(this).closest('.mtCentent').find('.name-con').hide();
- })
- //提交保存
- $('#schoolSubmit').click(function(){
- var className=$('input[name=class_name]').val();
- if(className==''){
- layer.msg('请输入班级名称');
- return false;
- }
- if(className.length>10){
- layer.msg('班级名称不能超过10个字符');
- return false;
- }
- var teacher_ids=$('#teacher_ids');
- if(teacher_ids.length==0){
- layer.msg('请选择执教教师');
- return false;
- }
- if($('#coach_id').val()==''){
- layer.msg('请选择助教');
- return false;
- }
- if($('input[name=main-teacher]').val()==''){
- layer.msg('请选择班主任');
- return false;
- }
- });
- })
- </script>
|