@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function index(Request $request) |
| 21 | 21 | { |
| 22 | - $all_data = $request->all(); |
|
| 22 | + $all_data=$request->all(); |
|
| 23 | 23 | $problem=new ProblemModel(); |
| 24 | - $filter["oj"]=isset($all_data["oj"])?$all_data["oj"]:null; |
|
| 25 | - $filter["tag"]=isset($all_data["tag"])?$all_data["tag"]:null; |
|
| 24 | + $filter["oj"]=isset($all_data["oj"]) ? $all_data["oj"] : null; |
|
| 25 | + $filter["tag"]=isset($all_data["tag"]) ? $all_data["tag"] : null; |
|
| 26 | 26 | $prob=$problem->list($filter); |
| 27 | 27 | $tags=$problem->tags(); |
| 28 | 28 | $ojs=$problem->ojs(); |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $problem=new ProblemModel(); |
| 65 | 65 | $prob_detail=$problem->detail($pcode); |
| 66 | - return is_null($prob_detail) ? redirect("/problem") : |
|
| 67 | - view('problem.detail', [ |
|
| 66 | + return is_null($prob_detail) ? redirect("/problem") : view('problem.detail', [ |
|
| 68 | 67 | 'page_title'=>$prob_detail["title"], |
| 69 | 68 | 'site_title'=>"NOJ", |
| 70 | 69 | 'navigation' => "Problem", |
@@ -90,28 +89,28 @@ discard block |
||
| 90 | 89 | $pref=-1; |
| 91 | 90 | $submit_code=""; |
| 92 | 91 | |
| 93 | - if(!is_null($compiler_pref)){ |
|
| 92 | + if (!is_null($compiler_pref)) { |
|
| 94 | 93 | $submit_code=$compiler_pref["code"]; |
| 95 | 94 | // match precise compiler |
| 96 | - for($i=0;$i<count($compiler_list);$i++){ |
|
| 97 | - if($compiler_list[$i]["coid"]==$compiler_pref["coid"]){ |
|
| 95 | + for ($i=0; $i<count($compiler_list); $i++) { |
|
| 96 | + if ($compiler_list[$i]["coid"]==$compiler_pref["coid"]) { |
|
| 98 | 97 | $pref=$i; |
| 99 | 98 | break; |
| 100 | 99 | } |
| 101 | 100 | } |
| 102 | - if($pref==-1){ |
|
| 101 | + if ($pref==-1) { |
|
| 103 | 102 | // precise compiler is dead, use other compiler with same lang |
| 104 | - for($i=0;$i<count($compiler_list);$i++){ |
|
| 105 | - if($compiler_list[$i]["lang"]==$compiler_pref["detail"]["lang"]){ |
|
| 103 | + for ($i=0; $i<count($compiler_list); $i++) { |
|
| 104 | + if ($compiler_list[$i]["lang"]==$compiler_pref["detail"]["lang"]) { |
|
| 106 | 105 | $pref=$i; |
| 107 | 106 | break; |
| 108 | 107 | } |
| 109 | 108 | } |
| 110 | 109 | } |
| 111 | - if($pref==-1){ |
|
| 110 | + if ($pref==-1) { |
|
| 112 | 111 | // same lang compilers are all dead, use other compiler within the same group |
| 113 | - for($i=0;$i<count($compiler_list);$i++){ |
|
| 114 | - if($compiler_list[$i]["comp"]==$compiler_pref["detail"]["comp"]){ |
|
| 112 | + for ($i=0; $i<count($compiler_list); $i++) { |
|
| 113 | + if ($compiler_list[$i]["comp"]==$compiler_pref["detail"]["comp"]) { |
|
| 115 | 114 | $pref=$i; |
| 116 | 115 | break; |
| 117 | 116 | } |
@@ -120,15 +119,14 @@ discard block |
||
| 120 | 119 | // the entire comp group dead |
| 121 | 120 | } |
| 122 | 121 | |
| 123 | - if(empty($prob_status)){ |
|
| 122 | + if (empty($prob_status)) { |
|
| 124 | 123 | $prob_status=[ |
| 125 | 124 | "verdict"=>"NOT SUBMIT", |
| 126 | 125 | "color"=>"" |
| 127 | 126 | ]; |
| 128 | 127 | } |
| 129 | 128 | |
| 130 | - return is_null($prob_detail) ? redirect("/problem") : |
|
| 131 | - view('problem.editor', [ |
|
| 129 | + return is_null($prob_detail) ? redirect("/problem") : view('problem.editor', [ |
|
| 132 | 130 | 'page_title'=>$prob_detail["title"], |
| 133 | 131 | 'site_title'=>"NOJ", |
| 134 | 132 | 'navigation' => "Problem", |