SuperviseController.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2018/12/12 0012
  6. * Time: 16:40
  7. */
  8. class SuperviseController extends Controller
  9. {
  10. //考试列表
  11. public function actionList(){
  12. //初始化
  13. $_exam_ids = array();
  14. $_exam_group_ids = array();
  15. $data = array();
  16. $condition = array();
  17. $class_ids = array();
  18. $class_grade_arr = array();
  19. $paper_arr = array();
  20. //筛选条件
  21. $exam_name = Req::get("name");
  22. $grade = Req::get("grade");
  23. // 年级条件
  24. $s_exam_ids = array();
  25. if($grade>0)
  26. {
  27. $class_data = $this->schoolManager->getSchoolByGrade($grade,$this->semesterId);
  28. if($class_data)
  29. {
  30. foreach($class_data as $v)
  31. {
  32. $class_ids[$v['class_id']] = $v['class_id'];
  33. }
  34. $exam_class_data = $this->schoolManager->getClassIdByExam($class_ids);
  35. if($exam_class_data)
  36. {
  37. foreach($exam_class_data as $v)
  38. {
  39. $s_exam_ids[$v['exam_id']] = $v['exam_id'];
  40. }
  41. }
  42. unset($exam_class_data);
  43. }
  44. unset($class_data);
  45. }
  46. if($s_exam_ids)
  47. {
  48. $condition[] = "e.exam_id in (".implode(',',$s_exam_ids).")";
  49. }
  50. $condition[] = "e.subject_id in (".implode(',',$this->mathSubjectId).")";
  51. // 考试名称条件
  52. if($exam_name)
  53. {
  54. $condition[] = "e.name like '%{$exam_name}%'";
  55. }
  56. $condition[] = "eg.create_type in (0,1,2,3,5,6) ";
  57. $condition[] = "eg.status = 2 ";
  58. //获取考试列表
  59. $exam_list = $this->schoolManager->getExamGroupList($condition,array('e.create_time desc'),10);
  60. //mark_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0:线下阅卷、1:按题阅卷、2:按人阅卷、3:班级混合阅卷、4:班级单独阅卷',
  61. //获取打印班级
  62. $exam_group_ids = array();
  63. $exam_ids = array();
  64. if($exam_list)
  65. {
  66. $StudentPaperRelation=new SStudentPaperRelation();
  67. $ExamModel=new Exam();
  68. foreach($exam_list['rs'] as $key=>$v)
  69. {
  70. $exam_group_ids[] = $v['exam_group_id'];
  71. $teacher_name = '';
  72. $exam_time = '';
  73. if(isset($v['tpl_data']) && $v['tpl_data']){
  74. $tpl_data = json_decode($v['tpl_data'],1);
  75. $exam_time = isset($tpl_data['examDate'])?$tpl_data['examDate']:'';
  76. $teacher_name = isset($tpl_data['author'])?$tpl_data['author']:'';
  77. }
  78. unset($v['tpl_data']);
  79. $v['teacher_name'] = $teacher_name;
  80. $v['exam_time'] = $exam_time;
  81. $examIds=$ExamModel->getExamIds($v['exam_group_id']);
  82. $v['stu_num']=0;
  83. $v['isp_loaded_num']=0;
  84. $v['class_count']=count($examIds);
  85. $v['upload_count']=0;
  86. if($examIds){
  87. $v['upload_count']=$this->schoolManager->getSuperviseStudentByExamId($examIds);
  88. $studentList=$StudentPaperRelation->getStudentExamInfo($examIds);
  89. foreach ($studentList as $value){
  90. if($value['is_three_isp_download'] == 1 || $value['is_two_isp_download'] == 1){
  91. $v['isp_loaded_num']++;
  92. }
  93. $v['stu_num']++;
  94. }
  95. }
  96. $exam_list['rs'][$key] = $v;
  97. }
  98. }
  99. // 获取多学科状态
  100. $data['pages'] = $exam_list['pager'];
  101. $data['page_total'] = $exam_list['pager']->rowsCount;
  102. $data['exam_group_list'] = $exam_list['rs'];
  103. $data['exam_class'] = $_exam_group_ids;
  104. $data["grade"] = $grade;
  105. $data["exam_name"] = $exam_name;
  106. $data["paper"] = $paper_arr;
  107. $data["class_grade"] = $class_grade_arr;
  108. $this->render('list',$data);
  109. }
  110. }