getProductList($condition,array('e.create_time desc'), $type); $printList = array(); $desc = $type == 1 ? '错题本': '个性化学习宝'; if($resultList["rs"]){ foreach ($resultList['rs'] as $k=>$v) { $printList[$k] = $v; $printList[$k]['print_name'] = $v["exam_name"]. $desc; $printList[$k]['is_cloud_print'] = Yii::app()->cache->getValue(sprintf("cloud_print_task:%s:%s:%s:%s", $this->schoolId,$v['class_id'],$v['exam_id'],$type)) ? 1 : 0; } } $grade_class_array = array(); if($grade) { $grade_class_data = $this->sConn->createCommand("select class_id,class_name from class where grade='{$grade}' and semester_id='{$this->semesterId}'")->queryAll(); if ($grade_class_data) { foreach ($grade_class_data as $v) { $grade_class_array[$v['class_id']] = $v; } } } $data = array(); $data['printList'] = $printList; $data['pages'] = $resultList['pager']; $data['page_total'] = $resultList['pager']->rowsCount; $data["printName"] = $name; $data["classes"] = $grade_class_array; $data["classId"] = $classId; $data["grade"] = $grade; $data['subjectId']=$this->subjectId; $data['type'] = $type; $data['desc'] = $desc; unset($resultList); $this->render('product',$data); } //产品学生页面 public function actionProduct_stu(){ $data = array(); $sname = (string)Req::get("sname"); //学生名字 $type = (int)Req::get("type"); //产品类型 $examId = (string)Req::get("eid"); $classId = (string)Req::get("cid"); if(!$examId || !$classId || !$type){ Yii::app()->jump->error('参数错误!'); } //获取班级名称以及考试名称 $sql = "select e.name,c.class_name,c.grade,e.class_id,p.add_time,e.semester_id from exam e join class_exam_printer p on p.exam_id=e.exam_id join class c on e.class_id = c.class_id where e.class_id = '{$classId}' and e.exam_id = '{$examId}'"; $names = $this->sConn->createCommand($sql)->queryRow(); if(!$names){ $names = array(); $names['name'] = ''; $names['class_name'] = ''; $names['grade'] = 0; }else{ $data['name'] = isset($names['name']) && isset($names['class_name'])?$names['class_name'].$names['name']:''; } $sql = "select student_id,is_create_pdf from exam_product_status where product_type ='{$type}' and exam_id = '{$examId}'"; $relateStudent = $this->sConn->createCommand($sql)->queryAll(); $studentIds = array(); $stuIsPdf = array(); if($relateStudent){ foreach ($relateStudent as $studentInfo) { $stuIsPdf[(string)$studentInfo['student_id']] = $studentInfo['is_create_pdf']; } } $allStudent = SStudentClassRelation::model()->getStudentInfoByClassId($classId, $sname); $i = 1; foreach ($allStudent as $v) { $studentIds[] = (string)$v['student_id']; $data['list'][$i]['stu_id'] = (string)$v['student_id']; $data['list'][$i]['stu_name'] = $v['realname']; $data['list'][$i]['name'] = $names['class_name'] . $names['name']; $data['list'][$i]['is_pdf'] = isset($stuIsPdf[(string)$v['student_id']]) ? $stuIsPdf[(string)$v['student_id']] : 0; $i++; } $Sem=new SSemester(); $code= $Sem->conn->createQuery() ->from('semester') ->where("semester_id = '".$names['semester_id']."'") ->limit(1) ->query() ->read(); $intarr=array( "schoolId"=>$this->schoolId, "clazzId"=>$names['class_id'], "semester"=>$code['refer_code'], "grade"=>$names['grade'], "students"=>$studentIds, "examTime"=>$names['add_time'], "classify"=>$type, "subject"=>$this->subjectId ); $basic = imsBasicAuth($this->schoolId.'_'.Yii::app()->session['coachInfo']['coach_name'],Yii::app()->params["zsy_api_key"]); $rs = json_decode(Curl::http_post_Basic_json(Yii::app()->params["get_limit_url"], json_encode($intarr),$basic)); //TODO 订单 // if(!$rs){ // Yii::app()->jump->error("接口错误"); // } // if($rs->errCode!="00"){ // Yii::app()->jump->error($rs->errMsg); // } if(!empty($rs->data)){ $data['limitstu']=$rs->data; } $data['examId'] = $examId; $data['classId'] = $classId; $data['sname'] = $sname; $data['type'] = $type; $data['desc'] = $type == 1 ? '错题本': '个性化学习宝'; $this->render('product_stu',$data); } //FIXME 教师讲案 public function actionTeach(){ $this->layout = false; set_time_limit (300); ini_set('memory_limit', '300M'); $examId = (string)Req::get("examId"); $isWb = Req::get("isWb"); require_once('TeachingJunior.php'); $teachingPhysicsObj = new TeachingJunior($this); $result = $teachingPhysicsObj->getTeachingPdf($this->schoolId, $examId, 1, 1, $isWb); $result['pdf_path'] = ''; echo json_encode($result); exit(); } }