copy.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <link rel="stylesheet" href="/css/bootstrap-duallistbox.min.css" />
  2. <style>
  3. .addborder{border:1px solid #ccc}
  4. .addheight{height:30px;border-radius:2px;}
  5. .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;}
  6. .ace{position:relative;top:0px !important;left:0px !important;}
  7. label{font-weight:100 !important;}
  8. .moveall {
  9. background-color:#619aff;
  10. border: none;
  11. }
  12. .removeall{
  13. background-color:#ed1b24;border: none;
  14. }
  15. option{
  16. margin: 5px 0;
  17. padding-left: 10px;
  18. border-bottom: 1px solid #e4e4e4;
  19. }
  20. </style>
  21. <div class="main-content-inner">
  22. <!-- 导航栏开始-->
  23. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  24. <!-- 导航栏结束-->
  25. <div class="page-content" style="margin-top:15px;">
  26. <div class="row" style="margin:0px;">
  27. <div class="col-xs-12">
  28. <!-- PAGE CONTENT BEGINS -->
  29. <form class="form-horizontal" action="<?php echo $this->createUrl('classes/copy',array('cid'=>$classId));?>" method="post" id="copyStudent">
  30. <div class="form-group">
  31. <label class="control-label col-xs-12 col-sm-2 no-padding-right">来自学期<span class="errorMessage">*</span>:</label>
  32. <div class="col-xs-12 col-sm-9">
  33. <div class='diy_select1' style="width: 240px; border: 1px solid #ccc">
  34. <input type='hidden' id="semester_id" name="semester_id" class='diy_select_input1' value="<?php echo $currSemester['semester_id']?>" />
  35. <div class='diy_select_txt1' style=" width: 207px;"><?php echo $currSemester['semester_name']?>(当前学期)</div>
  36. <div class='diy_select_btn1'></div>
  37. <ul class='diy_select_list1'>
  38. <li val="<?php echo $currSemester['semester_id']?>"><?php echo $currSemester['semester_name']?>(当前学期)</li>
  39. <?php if(!empty($semesters)){?><li val="<?php echo $semesters->semester_id?>"><?php echo $semesters->semester_name ?>(上学期)</li><?php }?>
  40. </ul>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="control-label col-xs-12 col-sm-2 no-padding-right">来自班级<span class="errorMessage">*</span>:</label>
  46. <div class="col-xs-12 col-sm-9">
  47. <!--<select id="class_id" name="class_id" onchange="chageClass(this.value)">
  48. <option value="">请选择</option>
  49. <?php if(!empty($all_class)):foreach($all_class as $ac):?>
  50. <option value="<?php echo $ac->class_id;?>"><?php echo $ac->class_name;?></option>
  51. <?php endforeach;endif;?>
  52. </select>-->
  53. <div class='diy_select' style="width: 131px">
  54. <input type='hidden' id="class_id" name="class_id" class='diy_select_input' />
  55. <div class='diy_select_txt'>请选择班级</div>
  56. <div class='diy_select_btn'></div>
  57. <ul class='diy_select_list'>
  58. <?php if(!empty($all_class)):foreach($all_class as $ac):?>
  59. <li copyClass="cc" val="<?php echo $ac->class_id;?>"><?php echo $ac->class_name;?></li>
  60. <?php endforeach;endif;?>
  61. </ul>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="form-group">
  66. <label class="col-sm-2 control-label no-padding-top" for="duallist"></label>
  67. <div class="col-sm-8">
  68. <select multiple="multiple" size="15" name="class_array[]" id="duallist">
  69. </select>
  70. <div class="hr hr-16 hr-dotted"></div>
  71. </div>
  72. </div>
  73. <div class="clearfix form-actions">
  74. <div class="col-md-offset-3 col-md-9">
  75. <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
  76. <i class="ace-icon fa fa-check bigger-110"></i>
  77. 提交
  78. </button>
  79. &nbsp; &nbsp; &nbsp;
  80. <button class="btn btn-success btn-sm" type="reset" onclick="javascript:history.go(-1)">
  81. <i class="ace-icon fa fa-undo bigger-110"></i>
  82. 返回
  83. </button>
  84. </div>
  85. </div>
  86. </form>
  87. <!-- PAGE CONTENT ENDS -->
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <style type="text/css">
  93. .info-container{display:none;}
  94. </style>
  95. <script src="/js/jquery.validate.min.js"></script>
  96. <script src="/js/jquery.bootstrap-duallistbox.min.js"></script>
  97. <script src="/js/xsgl.js"></script>
  98. <script type="text/javascript">
  99. jQuery(function($) {
  100. demo1 = $('select[name="class_array[]"]').bootstrapDualListbox({
  101. nonSelectedListLabel: '&nbsp;',
  102. selectedListLabel: "转到班级:<?php echo $className;?>",
  103. infoTextEmpty:'',
  104. filterPlaceHolder:'',
  105. infoText:''
  106. //preserveSelectionOnMove: 'moved',
  107. //moveOnSelect: false,
  108. });
  109. $("#copyStudent").submit(function() {
  110. var res = $('[name="class_array[]"]').val();
  111. if ($.trim(res)=='' || $.trim(res)== null) {
  112. layer.msg('请选择要复制的学生');
  113. return false;
  114. } //else {
  115. //alert(res);return;
  116. //}
  117. jQuery("#schoolSubmit").attr("disabled", true);
  118. });
  119. $("#copyStudent").submit(function() {
  120. var res = $('[name="class_array[]"]').val();
  121. if ($.trim(res)=='' || $.trim(res)== null) {
  122. layer.msg('请选择要复制的学生');
  123. return false;
  124. } //else {
  125. //alert(res);return;
  126. //}
  127. jQuery("#schoolSubmit").attr("disabled", true);
  128. });
  129. $(".diy_select_list1").click(function(){
  130. var semester_id = $("#semester_id").val();
  131. var html = '<li val="0">请选择班级</li>';
  132. var data={
  133. semester_id:semester_id,
  134. class_id:"<?php echo $classId?>"
  135. };
  136. $('.diy_select_txt').html('请选择班级');
  137. $("select").find("option").remove();
  138. $.post("<?php echo Yii::app()->createUrl('classes/ajax_semester_class')?>",data,function(flags){
  139. var m = JSON.parse(flags);
  140. if(m.status>0)
  141. {
  142. $.each(m.data,function(index,val){
  143. html+='<li copyClass="cc" val="'+val.class_id+'">'+val.class_name+'</li>'
  144. });
  145. $('.diy_select_list').html(html);
  146. }else
  147. {
  148. $('.diy_select_list').html(html);
  149. }
  150. });
  151. });
  152. });
  153. // 获取当前班级学生
  154. function chageClass(num) {
  155. if (!num) return false;
  156. var selectVal = [];
  157. var html;
  158. var cityObj = $("#duallist");
  159. var count=$("#duallist option").length;
  160. for(var i=0;i<count;i++){
  161. if($("#duallist").get(0).options[i].selected==true){
  162. value=$("#duallist").get(0).options[i].value;
  163. text=$("#duallist").get(0).options[i].text;
  164. selectVal.push(value);
  165. html += "<option value='"+value+"' selected>" + text+ "</option>";
  166. }
  167. }
  168. $.post("<?php echo $this->createUrl('studentinfo/getstudent');?>",{cid:num},function(data){
  169. var p = eval("("+data+")");
  170. var cityObj = $("#duallist");
  171. cityObj.empty();
  172. if (p.flag) {
  173. if (p.resArray.length > 0){
  174. $.each(p.resArray,function(i,n){
  175. if($.inArray(n.student_id,selectVal)==-1){
  176. html += "<option value='"+n.student_id+"'>" + n.realname + " ( 准考证号:"+ n.student_card + " )</option>";
  177. }
  178. });
  179. }
  180. cityObj.html(html);
  181. demo1.bootstrapDualListbox('refresh',true);
  182. } else {
  183. demo1.bootstrapDualListbox('refresh',true);
  184. }
  185. });
  186. }
  187. </script>