コード例 #1
0
 public function showpaper()
 {
     if (isset($_GET['eid']) && isset($_GET['users'])) {
         $eid = intval(trim($_GET['eid']));
         $users = trim($_GET['users']);
         $rightstr = "e{$eid}";
         $row = M('exam')->field('title')->where('exam_id=%d', $eid)->find();
         $this->isallow($eid);
         $num = M('ex_privilege')->where("user_id='%s' and rightstr='%s'", $users, $rightstr)->count();
         if (!$num) {
             $this->error("The student have no privilege to take part in it");
         }
         $allscore = AdminexamModel::instance()->getallscore($eid);
         $choosearr = AdminexamModel::instance()->getuserans($eid, $users, 1);
         $judgearr = AdminexamModel::instance()->getuserans($eid, $users, 2);
         $fillarr = AdminexamModel::instance()->getuserans($eid, $users, 3);
         $chooseans = AdminproblemModel::instance()->getproblemans($eid, 1);
         $judgeans = AdminproblemModel::instance()->getproblemans($eid, 2);
         $fillans = AdminproblemModel::instance()->getproblemans($eid, 3);
         $fillans2 = array();
         if ($fillans) {
             foreach ($fillans as $key => $value) {
                 $fillans2[$value['fill_id']] = AdminproblemModel::instance()->getproblemans($value['fill_id'], 4);
             }
         }
         $this->zadd('title', $row['title']);
         $this->zadd('allscore', $allscore);
         $this->zadd('choosearr', $choosearr);
         $this->zadd('judgearr', $judgearr);
         $this->zadd('fillarr', $fillarr);
         $this->zadd('chooseans', $chooseans);
         $this->zadd('judgeans', $judgeans);
         $this->zadd('fillans', $fillans);
         $this->zadd('fillans2', $fillans2);
         $this->auto_display('paper');
     } else {
         $this->error('Wrong Path');
     }
 }
コード例 #2
0
 public function index()
 {
     if (!$this->isowner($this->eid)) {
         $this->error('You have no privilege of this exam~');
     }
     $allscore = AdminexamModel::instance()->getallscore($this->eid);
     $chooseans = AdminproblemModel::instance()->getproblemans($this->eid, 1);
     $judgeans = AdminproblemModel::instance()->getproblemans($this->eid, 2);
     $fillans = AdminproblemModel::instance()->getproblemans($this->eid, 3);
     $programans = AdminproblemModel::instance()->getproblemans($this->eid, 5);
     $fillans2 = array();
     if ($fillans) {
         foreach ($fillans as $key => $value) {
             $fillans2[$value['fill_id']] = AdminproblemModel::instance()->getproblemans($value['fill_id'], 4);
         }
     }
     $numofchoose = count($chooseans);
     $numofjudge = count($judgeans);
     $numoffill = 0;
     $numofprgans = 0;
     $numofprgfill = 0;
     $numofprogram = count($programans);
     $this->zadd('allscore', $allscore);
     $this->zadd('chooseans', $chooseans);
     $this->zadd('judgeans', $judgeans);
     $this->zadd('fillans', $fillans);
     $this->zadd('fillans2', $fillans2);
     $this->zadd('programans', $programans);
     $this->zadd('choosenum', $numofchoose);
     $this->zadd('judgenum', $numofjudge);
     $this->zadd('fillnum', $numoffill);
     $this->zadd('prgansnum', $numofprgans);
     $this->zadd('prgfillnum', $numofprgfill);
     $this->zadd('programnum', $numofprogram);
     $this->auto_display();
 }
コード例 #3
0
 public function addprogram()
 {
     if (IS_POST && I('post.eid')) {
         if (!check_post_key()) {
             $this->error('发生错误!');
         } else {
             if (!checkAdmin(2)) {
                 $this->error('You have no privilege of this exam');
             } else {
                 $eid = I('post.eid', 0, 'intval');
                 $flag = AdminproblemModel::instance()->addprogram($eid);
                 if ($flag === true) {
                     $this->success('程序题添加成功', U('Teacher/Problem/addprogram', array('eid' => $eid, 'type' => 4)), 2);
                 } else {
                     $this->error('Invaild Path');
                 }
             }
         }
     } else {
         $ansrow = M('exp_question')->field('question_id')->where('exam_id=%d and type=4', $this->eid)->order('question_id')->select();
         $answernumC = M('exp_question')->where('exam_id=%d and type=4', $this->eid)->count();
         $key = set_post_key();
         $this->zadd('mykey', $key);
         $this->zadd('answernumC', $answernumC);
         $this->zadd('ansrow', $ansrow);
         $this->auto_display('program');
     }
 }