2022-09-20 01:50:37 +00:00
< ? php
if ( ! Auth :: check ()) {
become403Page ( UOJLocale :: get ( 'need login' ));
}
if ( ! isNormalUser ( $myUser )) {
become403Page ();
}
requirePHPLib ( 'form' );
2022-09-22 01:41:21 +00:00
$username = UOJContext :: user ()[ 'username' ];
2022-09-20 01:50:37 +00:00
2022-09-22 02:38:06 +00:00
$REQUIRE_LIB [ 'mathjax' ] = '' ;
2022-09-20 01:53:19 +00:00
?>
2022-09-20 01:50:37 +00:00
< ? php echoUOJPageHeader ( UOJLocale :: get ( 'contests::contest self reviews' )) ?>
< h2 style = " margin-top: 24px " >
2022-09-22 01:41:21 +00:00
< ? = $username ?> 的所有赛后总结
2022-09-20 01:50:37 +00:00
</ h2 >
< ? php
2022-09-20 01:53:19 +00:00
$col_names = array ( 'contest_id' );
2022-09-20 01:50:37 +00:00
$from = 'contests_registrants' ;
$cond = " username = ' $username ' and has_participated = 1 " ;
$tail = '' ;
$config = array (
'page_len' => 10 ,
'table_classes' => array ( 'table' , 'table-bordered' , 'table-text-center' , 'table-vertical-middle' ),
);
$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>' ;
$print_row = function ( $row ) {
global $username ;
$contest_id = $row [ 'contest_id' ];
$contest = queryContest ( $contest_id );
$contest_problems = queryContestProblems ( $contest_id );
$n_contest_problems = count ( $contest_problems );
$result = '' ;
$dom_sanitize_config = DOM_SANITIZE_CONFIG ;
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>' ;
$result .= '<td><div id="' . $problem_review_id . '"></div></td>' ;
$esc_problem_self_review = rawurlencode ( $problem_self_review != null ? $problem_self_review [ 'content' ] : '' );
$result .= '<script type="text/javascript">'
2022-09-22 02:38:06 +00:00
. " (function() { $ ('# $problem_review_id ').html(DOMPurify.sanitize(decodeURIComponent( \" { $esc_problem_self_review } \" ), $dom_sanitize_config )); })(); "
2022-09-20 01:50:37 +00:00
. '</script>' ;
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 ' " );
$esc_contest_self_review = rawurlencode ( $contest_self_review != null ? $contest_self_review [ 'content' ] : '' );
$result .= '<td rowspan="' . $n_contest_problems . '"><div id="' . $contest_review_id . '"></div></td>' ;
$result .= '<script type="text/javascript">'
2022-09-22 02:38:06 +00:00
. " (function() { $ ('# $contest_review_id ').html(DOMPurify.sanitize(decodeURIComponent( \" { $esc_contest_self_review } \" ), $dom_sanitize_config )); })(); "
2022-09-20 01:50:37 +00:00
. '</script>' ;
}
$result .= '</tr>' ;
}
echo $result ;
};
echoLongTable ( $col_names , $from , $cond , $tail , $header_row , $print_row , $config );
2022-09-20 01:53:19 +00:00
?>
2022-09-22 02:38:06 +00:00
< script > if ( window . MathJax ) MathJax . typeset (); </ script >
2022-09-20 01:50:37 +00:00
< ? php echoUOJPageFooter () ?>