コード例 #1
0
 public function userscore()
 {
     $sqladd = SortStuScore('stu');
     $prirow = $this->isallow($this->eid, true);
     $query = "SELECT `stu`.`user_id`,`stu`.`nick`,`choosesum`,`judgesum`,`fillsum`,`programsum`,`score`\n\t\t\tFROM (SELECT `users`.`user_id`,`users`.`nick` FROM `ex_privilege`,`users` WHERE `ex_privilege`.`user_id`=`users`.`user_id` AND\n\t\t\t `ex_privilege`.`rightstr`=\"e{$this->eid}\" )stu left join `ex_student` on `stu`.`user_id`=`ex_student`.`user_id` AND \n\t\t\t`ex_student`.`exam_id`='{$this->eid}' {$sqladd}";
     $row = M()->query($query);
     $online = M('ex_stuanswer')->distinct('user_id')->field('user_id')->where('exam_id=%d', $this->eid)->select();
     $isonline = array();
     if ($online) {
         foreach ($online as $key => $value) {
             $isonline[$value['user_id']] = 1;
         }
         unset($online);
     }
     $xsid = I('get.xsid', '');
     $xsname = I('get.xsname', '');
     $sortanum = I('get.sortanum', 0, 'intval');
     $sortdnum = I('get.sortdnum', 0, 'intval');
     $this->zadd('row', $row);
     $this->zadd('xsid', $xsid);
     $this->zadd('xsname', $xsname);
     $this->zadd('isonline', $isonline);
     $this->zadd('asortnum', $sortanum);
     $this->zadd('dsortnum', $sortdnum);
     $this->zadd('end_timeC', strtotime($prirow['end_time']));
     $this->auto_display();
 }
コード例 #2
0
 public function userscore()
 {
     $sqladd = SortStuScore('stu');
     $prirow = $this->isCanWatchInfo($this->eid, true);
     $isExamEnd = time() > strtotime($prirow['end_time']) ? true : false;
     $query = "SELECT `stu`.`user_id`,`stu`.`nick`,`choosesum`,`judgesum`,`fillsum`,`programsum`,`score`,`extrainfo` " . "FROM (SELECT `users`.`user_id`,`users`.`nick`,`extrainfo` FROM `ex_privilege`,`users` WHERE `ex_privilege`.`user_id`=`users`.`user_id` AND " . "`ex_privilege`.`rightstr`=\"e{$this->eid}\" )stu left join `ex_student` on `stu`.`user_id`=`ex_student`.`user_id` AND " . "`ex_student`.`exam_id`='{$this->eid}' {$sqladd}";
     $row = M()->query($query);
     $hasSubmit = 0;
     $hasTakeIn = 0;
     foreach ($row as &$r) {
         $r['hasTakenIn'] = 0;
         $r['hasSubmit'] = 0;
         if (isset($r['score']) && $r['score'] >= 0) {
             $hasSubmit++;
             $r['hasSubmit'] = 1;
         }
         if ($r['extrainfo'] != 0 || isset($r['score']) && $r['choosesum'] + $r['judgesum'] + $r['fillsum'] + $r['programsum'] != -4) {
             $hasTakeIn++;
             $r['hasTakenIn'] = 1;
         }
     }
     unset($r);
     $isShowDel = false;
     if ($hasTakeIn <= $hasSubmit) {
         $isShowDel = true;
     }
     $xsid = I('get.xsid', '');
     $xsname = I('get.xsname', '');
     $sortanum = I('get.sortanum', 0, 'intval');
     $sortdnum = I('get.sortdnum', 0, 'intval');
     $this->zadd('row', $row);
     $this->zadd('xsid', $xsid);
     $this->zadd('xsname', $xsname);
     $this->zadd('asortnum', $sortanum);
     $this->zadd('dsortnum', $sortdnum);
     $this->zadd('isEnd', $isExamEnd);
     $this->zadd('isShowDel', $isShowDel);
     $this->auto_display();
 }