123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- <script type="text/javascript">
- function implode(glue, pieces) {
- // discuss at: http://phpjs.org/functions/implode/
- // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
- // improved by: Waldo Malqui Silva
- // improved by: Itsacon (http://www.itsacon.net/)
- // bugfixed by: Brett Zamir (http://brett-zamir.me)
- // example 1: implode(' ', ['Kevin', 'van', 'Zonneveld']);
- // returns 1: 'Kevin van Zonneveld'
- // example 2: implode(' ', {first:'Kevin', last: 'van Zonneveld'});
- // returns 2: 'Kevin van Zonneveld'
- var i = '',
- retVal = '',
- tGlue = '';
- if (arguments.length === 1) {
- pieces = glue;
- glue = '';
- }
- if (typeof pieces === 'object') {
- if (Object.prototype.toString.call(pieces) === '[object Array]') {
- return pieces.join(glue);
- }
- for (i in pieces) {
- retVal += tGlue + pieces[i];
- tGlue = glue;
- }
- return retVal;
- }
- return pieces;
- }
- html = ""+
- '<div style="padding:20px 30px">'+
- '<div style="margin:5px 0;">选择每个学生二维码数量</div>'+
- '<div><select id="amount" style="width:200px">'+
- '<option value="8">8</option>'+
- '<option value="16">16</option>'+
- '<option value="24">24</option>'+
- '<option value="32">32</option>'+
- '<option value="40">40</option>'+
- '<option value="48">48</option>'+
- '<option value="56">56</option>'+
- '<option value="64">64</option>'+
- '<option value="72">72</option>'+
- '<option value="80">80</option>'+
- '</select></div>'+
- '<div class="row" style="margin:15px auto;"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px">确定</button>'+
- '<button id="cancel" class="label-primary-s bth-s" style="border:gray;background:gray;padding:4px 12px;margin:5px 0 10px 25px">取消</button></div>'+
- '</div>'+
- '</div>'+
- "";
- html1 = ""+
- '<div style="padding:20px 30px">'+
- '<div style="margin:5px 0;">选择二维码份数</div>'+
- '<div><select id="amount" style="width:200px">'+
- '<option value="1">1</option>'+
- '<option value="2">2</option>'+
- '<option value="3">3</option>'+
- '<option value="4">4</option>'+
- '<option value="5">5</option>'+
- '<option value="6">6</option>'+
- '<option value="7">7</option>'+
- '<option value="8">8</option>'+
- '<option value="9">9</option>'+
- '<option value="10">10</option>'+
- '</select></div>'+
- '<div class="row" style="margin:15px auto;"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px">确定</button>'+
- '<button id="cancel" class="label-primary-s bth-s" style="border:gray;background:gray;padding:4px 12px;margin:5px 0 10px 25px">取消</button></div>'+
- '</div>'+
- '</div>'+
- "";
- isCurrentSemester = <?php echo $isCurrentSemester ? 1 : 0;?> ? true : false;
- jQuery(document).ready(function(){
- jQuery(".delStudent").click(function(){
- document.studentId = jQuery(this).attr("studentId");
-
- layer.msg('确定从本班中删除该学生?', {
- time: 0,
- btn: ['确定', '取消'],
- yes: function(index){
- layer.close(index);
-
- jQuery.post(
- "<?php echo $this->createUrl("studentinfo/delstudentact");?>",
- {"studentId": document.studentId, "classId": "<?php echo $cid;?>"},
- function(data){
- data = eval("("+data+")");
-
- if(data.code == "0"){
- msg = data.msg;
- icon = 6;
- }
- else{
- msg = "因为以下原因操作失败:<br/>"+data.msg;
- icon = 5;
- }
-
- layer.alert(msg, {icon: icon}, function(){
- location.href = "<?php echo $this->createUrl("classes/view", array("cid" => $cid));?>";
- });
- }
- );
- }
- });
- });
-
- // 全选\反选
- $(".selectAll").click(function(){
- if ($(this).prop("checked")) {
- $(".myselect").prop("checked",true);
- } else {
- $(".myselect").prop("checked",false);
- }
- });
- jQuery("#selectDelAll").click(function(){
- var studentsIds = "";
- /*if(!isCurrentSemester)
- {
- layer.msg("非当前学期无法下载二维码");
- return false;
- }*/
- // 判断是否有选中
- if (!$("input[class='ace myselect']").is(':checked'))
- {
- layer.msg('请至少选择一个学生!');return false;
- }
- layer.msg('确定删除选中的学生吗?', {
- time: 0,
- btn: ['确定', '取消'],
- yes: function(index){
- layer.close(index);
- jQuery("input[name='studentsIds[]']").each(function()
- {
- if(jQuery(this).is(":checked") && jQuery(this).val()!= "undefined")
- {
- studentsIds += ","+jQuery(this).val();
- }
- });
- if(studentsIds)
- {
- studentsIds = studentsIds.substr(1);
- }
- var params = "studentsIds="+studentsIds+"&classId=<?php echo $cid;?>";
- var data={
- "studentsIds":studentsIds,
- "classId":"<?php echo $cid;?>"
- };
- jQuery.post(
- "<?php echo $this->createUrl("classes/selectdel");?>",data,function(data){
- var m =JSON.parse(data);
- if(m.status==1)
- {
- var icon = 6;
- layer.alert("删除成功", {icon: icon}, function(){
- location.replace(location.href);
- });
- }else if(m.status==0){
- var icon = 5;
- layer.alert("删除失败", {icon: icon}, function(){
- location.replace(location.href);
- });
- }else if(m.status==-2){
- var icon = 5;
- layer.alert("所选学生存在订单数据,无法删除", {icon: icon}, function(){
- location.replace(location.href);
- });
- }else {
- var icon = 5;
- layer.alert("所选学生存在考试数据,无法删除", {icon: icon}, function(){
- location.replace(location.href);
- });
- }
- });
- }
- });
- });
- jQuery("#downloadSelected").click(function(){
- if(!isCurrentSemester){
- layer.msg("非当前学期无法下载二维码");
- return false;
- }
-
- // 判断是否有选中
- if (!$("input[class='ace myselect']").is(':checked')) {
- layer.msg('请至少选择一个学生!');return false;
- }
-
- layer.open({
- type: 1,
- area: ['350px', '220px'],
- title: "下载二维码",
- content: html,
- success: function(index, layerObj){
- jQuery("#cancel").on("click", function(){
- layer.closeAll();
- });
-
- jQuery("#confirm").on("click", function(){
- var studentsIds = "";
- jQuery("input[name='studentsIds[]']").each(function(){
- if(jQuery(this).is(":checked"))
- studentsIds += ","+jQuery(this).val();
- });
- if(studentsIds)
- studentsIds = studentsIds.substr(1);
-
- amount = jQuery("#amount").val();
-
- var params = "studentsIds="+studentsIds+"&amount="+amount+"&classId=<?php echo $cid;?>";
- location.href = "<?php echo $this->createUrl("downloadstudentsqrcodesact?");?>"+params;
-
- layer.closeAll();
- });
- },
- end: function(){
-
- }
- });
- });
-
- jQuery("#downloadAll").click(function(){
- if(!isCurrentSemester){
- layer.msg("非当前学期无法下载二维码");
- return false;
- }
-
- jQuery.get(
- "<?php echo $this->createUrl("classhasstudent?classId={$cid}");?>",
- function(data){
- if(data == 0){
- layer.msg("本班没有学生,无法下载二维码");
- return false;
- }
-
- layer.open({
- type: 1,
- area: ['350px', '220px'],
- title: "下载二维码",
- content: html1,
- success: function(index, layerObj){
- jQuery("#cancel").on("click", function(){
- layer.closeAll();
- });
-
- jQuery("#confirm").on("click", function(){
- amount = jQuery("#amount").val();
-
- var params = "amount="+amount+"&classId=<?php echo $cid;?>";
-
- location.href = "<?php echo $this->createUrl("downloadstudentsqrcodesact?");?>"+params;
-
- layer.closeAll();
- });
- },
- end: function(){
-
- }
- });
- }
- );
- });
- });
- </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;}
- </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"><button class="label-primary-s bth-s" id="downloadSelected" style="padding:4px 12px;margin:5px 0 10px 25px">下载选定学生的二维码</button>
- <button class="label-primary-s bth-s" id="downloadAll" style="padding:4px 12px;margin:5px 0 10px 25px">下载全班学生的二维码</button>
- <?php if($this->schoolManager->isCurrentSemester($semesterId) || $this->schoolManager->isFutureSemester($semesterId)){
- ?>
- <button class="label-primary-s click-delete" id="selectDelAll" style="padding:4px 12px;margin:5px 0 10px 25px">删除选择学生</button>
- <?php
- }
- ?>
- </div>
- <div class="row" style="margin:0px;">
- <div class="col-xs-12">
- <!-- PAGE CONTENT BEGINS -->
- <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
- <thead>
- <tr>
- <th class="center">
- <input type="checkbox" class="ace selectAll">
- </th>
- <th>姓名</th>
- <th>准考证</th>
- <th>学校准考证</th>
- <?php if($use_zhixue){
- ?>
- <th>智学网准考证</th>
- <?php }?>
- <th>身份证号</th>
- <th>学号</th>
- <th>序号</th>
- <th>性别</th>
- <th>是否为在籍生</th>
- <th>学习小组</th>
- <th>创建时间</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <?php if($students["rs"]):foreach($studentList as $cl):?>
- <tr>
- <td class="center">
- <input name="studentsIds[]" type="checkbox" class="ace myselect" value="<?php echo $cl->student_id;?>">
- </td>
- <td><?php echo $cl->realname;?></td>
- <td><?php if($b_student && isset($b_student[$cl->student_id]) && !empty($b_student[$cl->student_id])){ echo $b_student[$cl->student_id];}else{ echo '';};?></td>
- <td><?php if($school_card && isset($school_card[$cl->student_id]) && !empty($school_card[$cl->student_id])){ echo $school_card[$cl->student_id];}else{ echo '';};?></td>
- <?php if($use_zhixue){
- ?>
- <td><?php if($z_student && isset($z_student[$cl->student_id]) && !empty($z_student[$cl->student_id])){ echo $z_student[$cl->student_id];}else{ echo '';};?></td>
- <?php }?>
- <td><?php echo $cl->id_number;?></td>
- <td><?php echo $cl->userno;?></td>
- <td><?php echo $cl->serial_number;?></td>
- <td><?php if($cl->sex==1){echo '男';}else{echo '女';}?></td>
- <td><?php if($cl->is_outer==1){echo '否';}else{echo '是';}?></td>
- <td><?php if(isset($cl->team)) echo $cl->team?></td>
- <td><?php echo date('Y-m-d H:i:s',$cl->add_time);?></td>
- <td>
- <?php if($this->schoolManager->isCurrentSemester($semesterId)):?>
- <div class="hidden-sm hidden-xs btn-group">
- <!--<a class="green" title="编辑" href="<?php echo $this->createUrl('studentinfo/edit',array('stid'=>$cl->student_id));?>">编辑</a>-->
- <span class="iconfont addbx click-sc" title="编辑" onclick="javascript:location.href='<?php echo $this->createUrl('studentinfo/edit',array('stid'=>$cl->student_id));?>'"></span>
-
- <!--<a class="green delStudent" title="删除" studentId="<?php echo $cl->student_id;?>" href="javascript:;">删除</a>-->
- <span class="iconfont addbx click-delete delStudent" title="删除" studentId="<?php echo $cl->student_id;?>" >
- 
- </span>
- </div>
- <?php endif;?>
- </td>
- </tr>
- <?php endforeach;else:?>
- <?php if($use_zhixue){
- ?>
- <tr><td colspan="11">暂无数据!</td></tr>
- <?php }else{
- ?>
- <tr><td colspan="10">暂无数据!</td></tr>
- <?php }?>
- <?php endif;?>
- </tbody>
- </table>
-
- <?php if(!empty($page_total)):?>
- <div class="row">
- <div class="col-xs-8">
-
- </div>
- <div class="col-xs-4">
- <div class="dataTables_paginate paging_simple_numbers">
- <?php
- $this->widget('CLinkPager', array(
- 'header' => '',
- 'firstPageLabel'=> '首页',
- 'lastPageLabel' => '末页',
- 'prevPageLabel' => '上一页',
- 'nextPageLabel' => '下一页',
- 'pages' => $pages,
- 'maxButtonCount'=> 5,
- ));
- echo '共:'.$page_total.'条';
- ?>
- </div>
- </div>
- </div>
- <?php endif;?>
- </div>
- <!-- PAGE CONTENT ENDS -->
- </div>
- </div>
- </div>
- </div>
|