12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- /**
- * @author: CeeFee
- * @description: 考试
- */
- class SExamGroup extends MyActiveRecord
- {
- public static function model($className = __CLASS__)
- {
- return parent::model($className);
- }
-
- public function tableName()
- {
- return 'exam_group';
- }
-
- public function getDetailByGroupId($groupId)
- {
- $result = array();
-
- if ($groupId AND is_numeric($groupId))
- {
- $criteria = new CDbCriteria();
- $criteria->addCondition("group_id = '". $groupId ."'");
-
- $result = getAttribute($this->find($criteria));
- }
-
- return $result;
- }
- /**
- * 获取考试组是否是第三方的试卷
- * @param $examGroupId
- * @param $examId
- * @return bool|int
- */
- public function getExamIsTird($examGroupId,$examId){
- if(!$examGroupId){
- if($examId){
- $_sql = "SELECT exam_group_id FROM exam where exam_id = ".$examId;
- $exam_info = $this->getCommandBuilder()->createSqlCommand($_sql)->queryRow();
- if(isset($exam_info['exam_group_id']) && $exam_info['exam_group_id']){
- $examGroupId = $exam_info['exam_group_id'];
- }
- }
- }
- $sql="SELECT `is_third` FROM `exam_group` WHERE exam_group_id = {$examGroupId}" ;
- $res = $this->getCommandBuilder()->createSqlCommand($sql)->queryRow();
- if($res && isset($res['is_third'])){
- return $res['is_third']?1:0;
- }else{
- return false;
- }
- }
- }
|