Beispiel #1
0
 public function action_source()
 {
     $user = $this->check_login();
     $sid = $this->request->param('id');
     $solution = Model_Solution::find_by_id($sid);
     $cinfo = Model_CInfo::for_solution($sid);
     $rinfo = Model_RInfo::for_solution($sid);
     if ($solution and $solution->allow_view_code($user)) {
         $this->template_data['title'] = __('solution.source.solution_detail');
         $this->template_data['solution'] = $solution;
         $this->template_data['cinfo'] = $cinfo;
         $this->template_data['rinfo'] = $rinfo;
     } else {
         throw new Exception_Page(__('common.solution_detail_not_found'));
     }
 }
Beispiel #2
0
 public function action_rejudge()
 {
     if ($this->request->is_post()) {
         $type = $this->get_post('type');
         $id = intval($this->get_post('typeid'));
         if ($type == 'PROBLEM') {
             $problem = Model_Problem::find_by_id($id);
             if ($problem) {
                 $problem->rejudge();
                 $this->flash_info(__('common.rejudge_:problem', array(':problem' => $problem->problem_id)));
             }
         } else {
             if ($type == 'SOLUTION') {
                 $solution = Model_Solution::find_by_id($id);
                 if ($solution) {
                     $solution->rejudge();
                     $this->flash_info(__('common.rejudge_:runid', array(':runid' => $solution->solution_id)));
                 }
             }
         }
     }
     $this->redirect('/admin/');
 }