2022-09-20 01:50:37 +00:00
< ? php
2022-10-08 06:10:14 +00:00
if ( ! Auth :: check () && UOJConfig :: $data [ 'switch' ][ 'force-login' ]) {
2022-10-06 12:28:43 +00:00
redirectToLogin ();
2022-09-20 01:50:37 +00:00
}
2022-10-07 09:29:26 +00:00
if ( ! isNormalUser ( $myUser ) && UOJConfig :: $data [ 'switch' ][ 'force-login' ]) {
2022-09-20 01:50:37 +00:00
become403Page ();
}
2022-10-22 13:12:13 +00:00
requireLib ( 'bootstrap5' );
requireLib ( 'mathjax' );
2022-09-20 01:50:37 +00:00
requirePHPLib ( 'form' );
2022-10-08 06:05:30 +00:00
$username = UOJContext :: userid ();
2022-09-20 01:53:19 +00:00
?>
2022-09-20 01:50:37 +00:00
< ? php echoUOJPageHeader ( UOJLocale :: get ( 'contests::contest self reviews' )) ?>
2022-10-08 06:05:30 +00:00
< h1 class = " h2 " >
2022-09-22 01:41:21 +00:00
< ? = $username ?> 的所有赛后总结
2022-10-08 06:05:30 +00:00
</ h1 >
2022-09-20 01:50:37 +00:00
< ? php
2022-10-08 06:05:30 +00:00
$col_names = array ( 'contest_id' );
2022-09-24 10:45:35 +00:00
$from = 'contests_registrants a left join contests b on a.contest_id = b.id' ;
2022-09-20 01:50:37 +00:00
$cond = " username = ' $username ' and has_participated = 1 " ;
2022-09-24 10:45:35 +00:00
$tail = 'order by start_time desc, id desc' ;
2022-09-20 01:50:37 +00:00
$config = array (
2022-09-24 10:45:35 +00:00
'pagination_table' => 'contests_registrants' ,
2022-09-20 01:50:37 +00:00
'page_len' => 10 ,
2022-10-08 06:05:30 +00:00
'div_classes' => [ 'card' , 'card-default' , 'table-responsive' ],
'table_classes' => [ 'table' , 'table-bordered' , 'text-center' , 'align-middle' , 'uoj-table' , 'mb-0' ],
2022-09-20 01:50:37 +00:00
);
$header_row = '' ;
$header_row .= '<tr>' ;
$header_row .= '<th style="width: 28em;">' . UOJLocale :: get ( 'contests::contest name' ) . '</th>' ;
$header_row .= '<th style="width: 14em;">' . UOJLocale :: get ( 'problems::problem' ) . '</th>' ;
$header_row .= '<th style="width: 35em;">' . UOJLocale :: get ( 'contests::problem self review' ) . '</th>' ;
$header_row .= '<th style="width: 35em;">' . UOJLocale :: get ( 'contests::contest self review' ) . '</th>' ;
$header_row .= '</tr>' ;
2022-10-12 11:19:54 +00:00
$parsedown = HTML :: parsedown ();
$purifier = HTML :: purifier_inline ();
$print_row = function ( $row ) use ( $parsedown , $purifier ) {
2022-09-20 01:50:37 +00:00
global $username ;
$contest_id = $row [ 'contest_id' ];
$contest = queryContest ( $contest_id );
$contest_problems = queryContestProblems ( $contest_id );
$n_contest_problems = count ( $contest_problems );
for ( $i = 0 ; $i < $n_contest_problems ; $i ++ ) {
$problem_id = $contest_problems [ $i ][ 'problem_id' ];
$problem = queryProblemBrief ( $problem_id );
$problem_self_review = DB :: selectFirst ( " select content from contests_reviews where contest_id = $contest_id and problem_id = $problem_id and poster = ' $username ' " );
$result .= '<tr>' ;
if ( $i == 0 ) {
$result .= '<td rowspan="' . $n_contest_problems . '"><a href="' . HTML :: url ( " /contest/ $contest_id " ) . '">' . $contest [ 'name' ] . '</a></td>' ;
}
$problem_review_id = " review- $contest_id - $i " ;
$result .= '<td>' . chr ( ord ( 'A' ) + $i ) . '. <a href="/problem/' . $problem_id . '">' . $problem [ 'title' ] . '</a></td>' ;
2022-10-12 11:19:54 +00:00
$result .= '<td>' . $purifier -> purify ( $problem_self_review != null ? $parsedown -> line ( $problem_self_review [ 'content' ]) : '' ) . '</td>' ;
2022-09-20 01:50:37 +00:00
if ( $i == 0 ) {
$contest_review_id = " review- $contest_id -overall " ;
$contest_self_review = DB :: selectFirst ( " select content from contests_reviews where contest_id = $contest_id and problem_id = -1 and poster = ' $username ' " );
2022-10-12 11:19:54 +00:00
$result .= '<td rowspan="' . $n_contest_problems . '">' . $purifier -> purify ( $contest_self_review != null ? $parsedown -> line ( $contest_self_review [ 'content' ]) : '' ) . '</td>' ;
2022-09-20 01:50:37 +00:00
}
$result .= '</tr>' ;
}
echo $result ;
};
echoLongTable ( $col_names , $from , $cond , $tail , $header_row , $print_row , $config );
2022-09-20 01:53:19 +00:00
?>
2022-10-08 06:05:30 +00:00
2022-09-20 01:50:37 +00:00
< ? php echoUOJPageFooter () ?>