addSearchCondition('name', $name); !empty($status)&&$criteria->addInCondition('status', $status); $total = $this->count($criteria); $pager = new CPagination($total); $criteria->order = 'exam_id desc'; $pager->pageSize = 20; $pager->applyLimit($criteria); $data['result']=$this->findAll($criteria); $data['page']=$pager; $data['page_total']= $total; return $data; } //获取任务名称 public function getExamName($eid) { $info = $this->find('exam_id=:eid',array(':eid'=>$eid)); if (empty($info)) { return null; } else { return $info->name; } } /** * 获取考试教师讲案信息 * @param $examId * @return CDbDataReader|mixed */ public function getTeachingInfo($examId){ $sql = "select e.exam_group_id,e.class_id,e.subject_id,eg.is_third,e.name as exam_name,e.academicr_pdf_path,e.academicr_pdf_time,p.paper_id,e.is_academicr_pdf,c.class_name,e.tpl_index,e.tpl_data,e.is_fine_paper,academicr_common_practice,eg.qxk_paper_id from exam as e left join class as c on c.class_id=e.class_id left join exam_group as eg on e.exam_group_id=eg.exam_group_id left join paper as p on p.exam_id=e.exam_id where e.exam_id = {$examId}"; return $this->getCommandBuilder()->createSqlCommand($sql)->queryRow(); } /** * 获取考试教师讲案信息(新版物理) * @param $examId * @return CDbDataReader|mixed */ public function getTeachingInfoPhysics($examId){ $sql = "select e.exam_group_id,e.class_id,e.subject_id,e.tpl_data,e.name as exam_name,e.academicr_pdf_path,e.academicr_pdf_time,e.is_academicr_pdf from exam as e where e.exam_id = {$examId}"; return $this->getCommandBuilder()->createSqlCommand($sql)->queryRow(); } /** * 获取组id下的考试id * @param $examGroupId * @return array|CDbDataReader */ public function getExamIds($examGroupId){ $sql = "select exam_id from exam where exam_group_id = {$examGroupId}"; $info = $this->getCommandBuilder()->createSqlCommand($sql)->queryColumn(); if($info){ return $info; }else{ return array(); } } /** * 获取下载所需的groupId * @param $examGroupId * @return array|CDbDataReader */ public function getGroupInfo($examId){ if(empty($examId)) return array(); $sql = 'SELECT wb_group_id,isp_group_id,wbisp_group_id FROM exam WHERE exam_id='.$examId; $info = $this->getCommandBuilder()->createSqlCommand($sql)->queryRow(); if($info){ return $info; }else{ return array(); } } }