public function action_status() { // init $page = $this->get_query('page', 1); if ($page < 1) { $page = 1; } $pid = $this->get_query('pid', null); $uid = $this->get_query('uid', null); $cid = $this->get_query('cid', null); $language = $this->get_query('language', null); $result = $this->get_query('result', null); $per_page = OJ::per_page; $filter = array('problem_id' => $pid, 'user_id' => $uid, 'contest_id' => $cid, 'language' => $language, 'result' => $result); $filter = $this->clear_data($filter, array(-1, '', null)); $orderby = array(Model_Solution::$primary_key => Model_Base::ORDER_DESC); $status = Model_Solution::find($filter, $page, $per_page, $orderby); $total = Model_Solution::count($filter); // view $this->template_data['title'] = __('solution.status.status'); $this->template_data['list'] = $status; $this->template_data['total'] = ceil($total / $per_page); if ($cid) { $contest = Model_Contest::find_by_id($cid); if (!$contest) { $this->go_home(); } $this->template_data['cid'] = $cid; $this->template_data['contest'] = $contest; $this->template_data['title'] = "{$contest['title']} - Status"; } }
/** * get time of last user submission * * @return mixed */ public function get_last_submission() { $filter = array('user_id' => $this->user_id); $order_by = array('solution_id' => Model_Base::ORDER_DESC); $last = Model_Solution::find($filter, 1, 1, $order_by); if ($last and $last[0]) { return $last[0]->in_date; } else { return false; } }