12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * @author: CeeFee
- * @description: 考试
- */
- class ZlExam extends Model
- {
- function __construct(){
- parent::__construct();
- }
- public function getList($grade,$class,$semester_id,$page,$pagelimit,$is_display=0){
- $result=array();
- $where =" zl_is_display = ".$is_display." ";
- if($class){
- $where.=" And zl_class_id='{$class}' ";
- }
- if($grade){
- $where.=" And zl_grade={$grade} ";
- }
- if($semester_id){
- $where.=" And zl_semester_id={$semester_id} ";
- }
- $Sql="select count(0) as count from zl_exam_group eg join `zl_exam` e on eg.zl_exam_group_id=e.zl_exam_group_id ";
- $dataCount=$this->sConn->createCommand($Sql." where ".$where)->queryRow();
- $result['totalCount']=$dataCount['count'];
- $result['pageTotal']=ceil($dataCount['count']/$pagelimit);
- $offset=($page-1)*$pagelimit;
- $Sql="select zl_exam_group_id,zl_grade,zl_exam_name,zl_exam_date,e.zl_tpl_data from zl_exam_group eg join `zl_exam` e on eg.zl_exam_group_id=e.zl_exam_group_id ";
- $data=$this->sConn->createCommand($Sql." where ".$where." order by zl_create_time desc limit {$offset},{$pagelimit} ")->queryAll();
- $result['data']=$data;
- return $result;
- }
- public function getExamByExamGroupId($examGroupId){
- if(!$examGroupId) return false;
- $sql="select * from zl_exam where zl_exam_group_id='".$examGroupId."'";
- return $this->sConn->createCommand($sql)->queryAll();
- }
- public function getExamByExamId($examId){
- if(!$examId) return false;
- $sql="select * from zl_exam where zl_exam_id='".$examId."'";
- return $this->sConn->createCommand($sql)->queryRow();
- }
- }
|