1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- /**
- * @author: CeeFee
- * @description: 班级
- */
- class SStudentPaperRelation extends MyActiveRecord
- {
- public static function model($className = __CLASS__)
- {
- return parent::model($className);
- }
-
- public function tableName()
- {
- return 'student_paper_relation';
- }
-
- public function getRelationsByClassId_PaperId($classId, $paperId)
- {
- $result = array();
-
- if ($classId AND is_numeric($classId) AND $paperId AND is_numeric($paperId))
- {
- $criteria = new CDbCriteria();
- $criteria->addCondition("class_id = '". $classId ."' AND paper_id = '". $paperId ."'");
-
- $result = getAttributes($this->findAll($criteria));
- }
-
- return $result;
- }
-
- public function getStudentIdsByClassId_PaperId($classId, $paperId)
- {
- $relations = $this->getRelationsByClassId_PaperId($classId, $paperId);
- $result = array();
-
- if ($relations)
- {
- foreach ($relations AS $relation)
- {
- $result[] = $relation['student_id'];
- }
- }
-
- return $result ? array_unique($result) : $result;
- }
- /**
- * 获取试卷题信息
- * @param $examIds
- * @return array|CDbDataReader
- */
- public function getStudentExamInfo($examIds){
- $info = array();
- if($examIds){
- $sql = "select student_id,is_del,paper_id,exam_id,scoring,is_feedback,is_three_isp_download,is_two_isp_download from ".$this->tableName()." where exam_id in (".implode(',',$examIds).") ";
- $info = $this->getCommandBuilder()->createSqlCommand($sql)->queryAll();
- if($info){
- return $info;
- }
- }
- return $info;
- }
- /**
- * 获取试卷题信息
- * @param $examIds
- * @return array|CDbDataReader
- */
- public function getStudentFeedBack($examIds){
- if($examIds){
- $sql = "select is_feedback from ".$this->tableName()." where exam_id in (".implode(',',$examIds).") and is_feedback=1 limit 1";
- $info = $this->getCommandBuilder()->createSqlCommand($sql)->queryRow();
- if($info){
- return true;
- }
- }
- return false;
- }
- }
|