123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?php
- class JuniorController extends Controller
- {
- //产品班级页
- public function actionProduct()
- {
- $grade = Req::get("grade");
- $classId = Req::get("classId");
- $name = Req::get("name");
- $type = Req::get("type");
- if(!$type) self::responseMsg(0, '参数错误');
- $condition = array();
- if($name) $condition[] = "e.name like '%{$name}%'";
- if($grade) $condition[] = "c.grade = '{$grade}'";
- if($classId) $condition[] = "e.class_id = '{$classId}'";
- $condition[] = "eg.create_type in (0,1,2,3,5,6) and is_labelled=1 and cep.type={$type}";
- if (empty($grade)) {
- $grade = 'ALL';
- }
- $examProduct = new SExamProductStatus();
- $resultList = $examProduct->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();
- }
- }
|