123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- class ThirdAnswerSheet extends AssistModel
- {
- public function getDb($dsn,$user,$pwd){
- $my_connection = new CDbConnection($dsn,$user,$pwd);
- $my_connection->emulatePrepare = true;
- $my_connection->enableProfiling = true;
- $my_connection->enableParamLogging = true;
- $myDbDsn = null;
- return $my_connection;
- }
- public function tableName()
- {
- return '{{third_answer_sheet}}';
- }
- public function getDetail($dsn,$user,$pwd,$eid){
- $db=$this->getDb($dsn,$user,$pwd);
- $data=array(
- 'answer_card'=>0,
- 'paper'=>0,
- 'parse'=>0
- );
- $thirdPaper=$db->createCommand("select topic_upload,answer_upload,template_type from third_multi_template where exam_group_id='".$eid."'")->queryAll();
- if($thirdPaper){
- foreach ($thirdPaper as $item){
- if($item['template_type']==1 && $item['topic_upload']==1){
- $data['paper']=1;
- }
- if($item['template_type']==2 && $item['answer_upload']==1){
- $data['parse']=1;
- }
- }
- }
- //查询答题卡
- $thirdCard=$db->createCommand("select sheet_id from third_answer_sheet where exam_group_id='".$eid."'")->queryRow();
- if($thirdCard){
- $data['answer_card']=1;
- }
- return $data;
- }
- public function getTemplate($dsn,$user,$pwd,$eid){
- $db=$this->getDb($dsn,$user,$pwd);
- $data['paper_template']=0;
- $data['parse_template']=0;
- $thirdPaper=$db->createCommand("select template_id,template_type from third_multi_template where exam_group_id='".$eid."'")->queryAll();
- if($thirdPaper){
- foreach ($thirdPaper as $item){
- if($item['template_type']==1){
- $data['paper_template']=$item['template_id'];
- }
- if($item['template_type']==2){
- $data['parse_template']=$item['template_id'];
- }
- }
- }
- return $data;
- }
- //读取考试信息
- public function getExamTplData($dsn,$user,$pwd,$eid){
- $db=$this->getDb($dsn,$user,$pwd);
- $tpl_data=$db->createCommand("select tpl_data from exam where exam_group_id='".$eid."'")->queryRow();
- return $tpl_data['tpl_data'];
- }
- //读取答题卡
- public function getAnswerSheet($dsn,$user,$pwd,$eid){
- $db=$this->getDb($dsn,$user,$pwd);
- $thirdCard=$db->createCommand("select sheet_id from third_answer_sheet where exam_group_id='".$eid."'")->queryRow();
- if($thirdCard){
- return $thirdCard['sheet_id'];
- }
- return 0;
- }
- }
|