function indexAction() { /* build query */ $db = contestDB::get_zend_db(); $this->view->title = "Problems"; $curuser = Zend_Auth::getInstance()->getIdentity(); if (empty($curuser)) { $this->view->problems = ProblemTable::get_problem_list(webconfig::getContestId(), 0, 100); return; } /* case 2: build a complex query */ $query = "select distinct p.rowid as rowid,p.id as id,p.nickname as nickname,s.state as state from problemdata as p left join (select * from submissionqueue where uid = ? and state='Accepted') as s on p.id = s.problemid where p.owner=? group by p.rowid,p.id,p.nickname,s.state order by rowid;"; $this->view->problems = $db->fetchAll($query, array($curuser, webconfig::getContestId())); }
public function indexAction() { $this->view->title = "Submit a solution"; $this->view->problems = ProblemTable::get_problem_list(webconfig::getContestId(), 0, 100); $this->view->problem_code = $this->_request->get("probid"); }