1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- /**
- * @author: CeeFee
- * @description: 考试
- */
- class SThirdMultiTemplate extends MyActiveRecord
- {
- public static function model($className = __CLASS__)
- {
- return parent::model($className);
- }
-
- public function tableName()
- {
- return 'third_multi_template';
- }
- public function getByCondition(){}
- /*根据考试id,判断上传状态*/
- public function getStatusByExamGroupId($ExamGroupId){
- $result = array();
- $criteria = new CDbCriteria();
- $criteria->addCondition('exam_group_id=:exam_group_id');
- $criteria->params[':exam_group_id']=$ExamGroupId;
- $data = getAttributes($this->findAll($criteria));
- if($data){
- foreach ($data as $val){
- $result[$val['template_type']]=$val;
- }
- }
- return $result;
- }
- /**
- * 获取多个答案和题上传完成的组id
- * @param $examGroupIds
- * @return array
- */
- public function getMulUploadGroupId($examGroupIds){
- $group_ids = array();
- if($examGroupIds){
- $sql = "SELECT exam_group_id,topic_upload,answer_upload,template_type FROM third_multi_template where exam_group_id in (".implode(',',$examGroupIds).") ";
- $upload_info = $this->queryAll($sql);
- $rs = array();
- if($upload_info){
- foreach($upload_info as $v){
- if(!isset($rs[$v['exam_group_id']])){
- $rs[$v['exam_group_id']] = 0;
- }
- if($v['template_type'] == 1){
- if($v['topic_upload'] == 1){
- $rs[$v['exam_group_id']]++;
- }
- }elseif($v['template_type'] == 2){
- if($v['answer_upload'] == 1){
- $rs[$v['exam_group_id']]++;
- }
- }
- }
- unset($upload_info);
- }
- if($rs){
- foreach($rs as $gId => $v){
- if($v == 2){
- $group_ids[] = $gId;
- }
- }
- }
- }
- return $group_ids;
- }
- }
|