public function index() { if (!$this->isSuperAdmin()) { if ($this->isCreator()) { $userId = $this->userInfo['user_id']; $_where = array('isprivate' => 0, 'creator' => array('eq', $userId), '_logic' => 'or'); $where = array('visible' => 'Y', '_complex' => $_where, '_logic' => 'and'); } else { $where = array('user_id' => $this->userInfo['user_id']); $fields = array('rightstr'); $privileges = M('ex_privilege')->field($fields)->where($where)->select(); $examIds = array(0); foreach ($privileges as $privilege) { $rightstr = $privilege['rightstr']; $examIds[] = intval(substr($rightstr, 1)); } $where = array('visible' => 'Y', 'exam_id' => array('in', $examIds)); } } else { $where = array('visible' => 'Y'); } $mypage = splitpage('exam', $where); $where['order'] = array('end_time desc'); $where['limit'] = $mypage['sqladd']; $field = array('exam_id', 'title', 'start_time', 'end_time'); $row = ExamBaseModel::instance()->queryData($where, $field); $this->zadd('row', $row); $this->zadd('mypage', $mypage); $this->auto_display(); }
public function index() { $table = 'exam'; $where['visible'] = 'Y'; $mypage = splitpage($table, $where); $row = M($table)->field('exam_id,title,start_time,end_time')->where($where)->order('exam_id desc')->limit($mypage['sqladd'])->select(); $this->zadd('row', $row); $this->zadd('mypage', $mypage); $this->auto_display(); }
public function fill() { $sch = getproblemsearch('fill_id', FillBaseModel::FILL_PROBLEM_TYPE); $key = set_get_key(); $isadmin = $this->isSuperAdmin(); $mypage = splitpage('ex_fill', $sch['sql']); $numoffill = 1 + ($mypage['page'] - 1) * $mypage['eachpage']; $row = M('ex_fill')->field('fill_id,question,creator,easycount,kind')->where($sch['sql'])->order('fill_id asc')->limit($mypage['sqladd'])->select(); $widgets = array('row' => $row, 'mykey' => $key, 'mypage' => $mypage, 'isadmin' => $isadmin, 'numoffill' => $numoffill); $questionIds = array(); foreach ($row as $r) { $questionIds[] = $r['fill_id']; } $this->getQuestionChapterAndPoint($questionIds, FillBaseModel::FILL_PROBLEM_TYPE); $this->ZaddWidgets($widgets); $this->auto_display(); }
public function fill() { $sch = getproblemsearch(); $key = set_get_key(); $isadmin = checkAdmin(1); $mypage = splitpage('ex_fill', $sch['sql']); $numoffill = 1 + ($mypage['page'] - 1) * $mypage['eachpage']; $row = m('ex_fill')->field('fill_id,question,creator,point,easycount,kind')->where($sch['sql'])->order('fill_id asc')->limit($mypage['sqladd'])->select(); $this->assign('row', $row); $this->assign('mypage', $mypage); $this->assign('numoffill', $numoffill); $this->assign('isadmin', $isadmin); $this->assign('mykey', $key); $this->assign('search', $sch['search']); $this->assign('problem', $sch['problem']); $this->auto_display(); }
private function addfill() { $sch = getproblemsearch(); $isadmin = checkAdmin(1); $mypage = splitpage('ex_fill', $sch['sql']); $numoffill = 1 + ($mypage['page'] - 1) * $mypage['eachpage']; $row = M('ex_fill')->field('fill_id,question,creator,point,easycount,kind')->where($sch['sql'])->order('fill_id asc')->limit($mypage['sqladd'])->select(); $haveadded = array(); if ($row) { foreach ($row as $value) { $haveadded[$value['fill_id']] = $this->checkadded($this->eid, 3, $value['fill_id']); } } $this->zadd('added', $haveadded); $this->zadd('mypage', $mypage); $this->zadd('numoffill', $numoffill); $this->zadd('isadmin', $isadmin); $this->zadd('row', $row); $this->zadd('search', $sch['search']); $this->zadd('problem', $sch['problem']); $this->auto_display('fill'); }
private function addFillProblem() { $sch = getproblemsearch('fill_id', FillBaseModel::FILL_PROBLEM_TYPE); $isadmin = $this->isSuperAdmin(); $mypage = splitpage('ex_fill', $sch['sql']); $numoffill = 1 + ($mypage['page'] - 1) * $mypage['eachpage']; $row = M('ex_fill')->field('fill_id,question,creator,easycount,kind')->where($sch['sql'])->order('fill_id asc')->limit($mypage['sqladd'])->select(); $questionAddedIds = QuestionBaseModel::instance()->getQuestionIds4ExamByType($this->eid, FillBaseModel::FILL_PROBLEM_TYPE); $haveadded = array(); foreach ($questionAddedIds as $qid) { $haveadded[$qid['question_id']] = 1; } $widgets = array('row' => $row, 'added' => $haveadded, 'mypage' => $mypage, 'isadmin' => $isadmin, 'numoffill' => $numoffill); $questionIds = array(); foreach ($row as $r) { $questionIds[] = $r['fill_id']; } $this->getQuestionChapterAndPoint($questionIds, FillBaseModel::FILL_PROBLEM_TYPE); $this->ZaddWidgets($widgets); $this->auto_display('fill'); }