2022-09-18 11:34:17 +00:00
< ? php
2022-10-07 09:29:26 +00:00
if ( ! Auth :: check () && UOJConfig :: $data [ 'switch' ][ 'force-login' ]) {
2022-10-06 12:28:43 +00:00
redirectToLogin ();
2022-09-18 11:34:17 +00:00
}
2022-10-07 09:29:26 +00:00
if ( ! isNormalUser ( $myUser ) && UOJConfig :: $data [ 'switch' ][ 'force-login' ]) {
become403Page ();
}
2022-09-18 11:34:17 +00:00
requirePHPLib ( 'form' );
requirePHPLib ( 'judger' );
requirePHPLib ( 'data' );
$list_id = $_GET [ 'id' ];
if ( ! validateUInt ( $list_id ) || ! ( $list = queryProblemList ( $list_id ))) {
become404Page ();
}
2022-09-25 23:58:58 +00:00
if ( ! isset ( $_COOKIE [ 'bootstrap4' ])) {
$REQUIRE_LIB [ 'bootstrap5' ] = '' ;
}
2022-09-18 11:34:17 +00:00
function echoProblem ( $problem ) {
2022-09-25 23:58:58 +00:00
global $myUser , $removeProblemForms , $REQUIRE_LIB ;
2022-09-18 11:34:17 +00:00
if ( isProblemVisibleToUser ( $problem , $myUser )) {
echo '<tr class="text-center">' ;
if ( $problem [ 'submission_id' ]) {
2022-09-29 01:20:08 +00:00
echo '<td class="table-success">' ;
2022-09-18 11:34:17 +00:00
} else {
echo '<td>' ;
}
echo '#' , $problem [ 'id' ], '</td>' ;
2022-09-25 23:58:58 +00:00
if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) {
echo '<td class="text-start">' ;
} else {
echo '<td class="text-left">' ;
}
2022-09-18 11:34:17 +00:00
if ( $problem [ 'is_hidden' ]) {
echo ' <span class="text-danger">[隐藏]</span> ' ;
}
if ( $problem [ 'uploader' ] == $myUser [ 'username' ]) {
echo ' <span class="text-info">[我的题目]</span> ' ;
}
2022-09-25 23:58:58 +00:00
echo '<a ' ;
if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) {
echo ' class="text-decoration-none" ' ;
}
echo ' href="/problem/' , $problem [ 'id' ], '">' , $problem [ 'title' ], '</a>' ;
2022-09-18 11:34:17 +00:00
if ( isset ( $_COOKIE [ 'show_tags_mode' ])) {
2022-09-20 10:39:01 +00:00
echo ' <span class="text-info" style="font-size: 10px">' . $problem [ " uploader " ] . '</span> ' ;
2022-09-18 11:34:17 +00:00
foreach ( queryProblemTags ( $problem [ 'id' ]) as $tag ) {
2022-09-25 23:58:58 +00:00
if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) {
echo '<a class="uoj-problem-tag my-1">' ;
echo '<span class="badge bg-secondary">' ;
} else {
echo '<a class="uoj-problem-tag">' ;
echo '<span class="badge badge-pill badge-secondary">' ;
}
echo HTML :: escape ( $tag ), '</span>' ;
echo '</a> ' ;
2022-09-18 11:34:17 +00:00
}
}
echo '</td>' ;
if ( isset ( $_COOKIE [ 'show_submit_mode' ])) {
$perc = $problem [ 'submit_num' ] > 0 ? round ( 100 * $problem [ 'ac_num' ] / $problem [ 'submit_num' ]) : 0 ;
echo <<< EOD
< td >< a href = " /submissions?problem_id= { $problem [ 'id' ] } &min_score=100&max_score=100 " >& times ;{ $problem [ 'ac_num' ]} </ a ></ td >
< td >< a href = " /submissions?problem_id= { $problem [ 'id' ] } " >& times ;{ $problem [ 'submit_num' ]} </ a ></ td >
< td >
< div class = " progress bot-buffer-no " >
< div class = " progress-bar progress-bar-success " role = " progressbar " aria - valuenow = " $perc " aria - valuemin = " 0 " aria - valuemax = " 100 " style = " width: $perc %; min-width: 20px; " > { $perc } %</ div >
</ div >
</ td >
EOD ;
}
2022-09-29 02:10:24 +00:00
if ( isset ( $_COOKIE [ 'show_difficulty' ])) {
$extra_config = getProblemExtraConfig ( $problem );
if ( $extra_config [ 'difficulty' ] == 0 ) {
echo " <td></td> " ;
} else {
echo " <td> { $extra_config [ 'difficulty' ] } </td> " ;
}
}
2022-10-03 12:47:32 +00:00
echo '<td class="text-left">' , getClickZanBlock ( 'P' , $problem [ 'id' ], $problem [ 'zan' ], null , false ), '</td>' ;
2022-09-18 11:34:17 +00:00
echo '</tr>' ;
}
}
$header = '<tr>' ;
$header .= '<th class="text-center" style="width:5em;">ID</th>' ;
$header .= '<th>' . UOJLocale :: get ( 'problems::problem' ) . '</th>' ;
if ( isset ( $_COOKIE [ 'show_submit_mode' ])) {
2022-09-25 23:58:58 +00:00
$header .= '<th class="text-center" style="width:' . ( isset ( $REQUIRE_LIB [ 'bootstrap5' ]) ? '4' : '5' ) . 'em;">' . UOJLocale :: get ( 'problems::ac' ) . '</th>' ;
$header .= '<th class="text-center" style="width:' . ( isset ( $REQUIRE_LIB [ 'bootstrap5' ]) ? '4' : '5' ) . 'em;">' . UOJLocale :: get ( 'problems::submit' ) . '</th>' ;
$header .= '<th class="text-center" style="width:' . ( isset ( $REQUIRE_LIB [ 'bootstrap5' ]) ? '125' : '150' ) . 'px;">' . UOJLocale :: get ( 'problems::ac ratio' ) . '</th>' ;
2022-09-18 11:34:17 +00:00
}
2022-09-29 02:10:24 +00:00
if ( isset ( $_COOKIE [ 'show_difficulty' ])) {
$header .= '<th class="text-center" style="width:3em;">' . UOJLocale :: get ( 'problems::difficulty' ) . '</th>' ;
}
2022-10-03 12:47:32 +00:00
$header .= '<th class="text-center" style="width:100px;">' . UOJLocale :: get ( 'appraisal' ) . '</th>' ;
2022-09-18 11:34:17 +00:00
$header .= '</tr>' ;
$pag_config = array ( 'page_len' => 40 );
2022-09-29 02:10:24 +00:00
$pag_config [ 'col_names' ] = array ( 'best_ac_submissions.submission_id as submission_id' , 'problems.id as id' , 'problems.is_hidden as is_hidden' , 'problems.title as title' , 'problems.submit_num as submit_num' , 'problems.ac_num as ac_num' , 'problems.zan as zan' , 'problems.extra_config as extra_config' , 'problems.uploader as uploader' , 'problems.extra_config as extra_config' );
2022-09-18 11:34:17 +00:00
$pag_config [ 'table_name' ] = " problems left join best_ac_submissions on best_ac_submissions.submitter = ' { $myUser [ 'username' ] } ' and problems.id = best_ac_submissions.problem_id inner join lists_problems lp on lp.list_id = { $list_id } and lp.problem_id = problems.id " ;
$pag_config [ 'cond' ] = '1' ;
$pag_config [ 'tail' ] = " order by id asc " ;
$pag = new Paginator ( $pag_config );
2022-09-25 23:58:58 +00:00
$div_classes = isset ( $REQUIRE_LIB [ 'bootstrap5' ])
? array ( 'card' , 'my-3' , 'overflow-auto' )
: array ( 'table-responsive' );
$table_classes = isset ( $REQUIRE_LIB [ 'bootstrap5' ])
? array ( 'table' , 'uoj-table' , 'mb-0' )
: array ( 'table' , 'table-bordered' , 'table-hover' , 'table-striped' );
2022-09-18 11:34:17 +00:00
?>
< ? php echoUOJPageHeader ( UOJLocale :: get ( 'problems lists' )); ?>
2022-09-25 23:58:58 +00:00
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< div class = " row " >
2022-09-26 23:57:01 +00:00
< div class = " col-lg-9 " >
2022-09-25 23:58:58 +00:00
< div class = " d-flex justify-content-between " >
< ? php endif ?>
2022-09-25 23:39:01 +00:00
< h1 class = " h2 " >
2022-09-26 01:30:34 +00:00
< ? php if ( $list [ 'is_hidden' ]) : ?>
< span class = " fs-5 text-danger " > [ 隐藏 ] </ span >
< ? php endif ?>
2022-09-25 23:39:01 +00:00
< ? = $list [ 'title' ] ?>
2022-09-25 23:58:58 +00:00
< span class = " fs-5 " > ( ID : #<?= $list['id'] ?>)</span>
2022-09-25 23:39:01 +00:00
</ h1 >
< ? php if ( isSuperUser ( $myUser )) : ?>
2022-09-25 23:58:58 +00:00
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< div class = " text-end " >
< a class = " btn btn-primary " href = " /problem_list/<?= $list['id'] ?>/manage " role = " button " >
< ? = UOJLocale :: get ( 'problems::manage' ) ?>
</ a >
</ div >
< ? php else : ?>
2022-09-25 23:39:01 +00:00
< ul class = " nav nav-tabs " role = " tablist " >
2022-09-25 23:58:58 +00:00
< li class = " nav-item " >
< a class = " nav-link " href = " /problem_list/<?= $list['id'] ?>/manage " role = " tab " >
< ? = UOJLocale :: get ( 'problems::manage' ) ?>
</ a >
</ li >
2022-09-25 23:39:01 +00:00
</ ul >
< ? php endif ?>
2022-09-25 23:58:58 +00:00
< ? php endif ?>
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
</ div >
< ? php endif ?>
2022-09-25 23:39:01 +00:00
2022-09-18 11:34:17 +00:00
< div class = " row " >
2022-09-29 02:10:24 +00:00
< div class = " col-sm-4
2022-09-25 23:58:58 +00:00
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
2022-09-29 02:10:24 +00:00
col - 12
< ? php endif ?>
" ></div>
< div class = "
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
text - end p - 2 col - 12 col - sm - 8
2022-09-25 23:58:58 +00:00
< ? php else : ?>
2022-09-29 02:10:24 +00:00
text - right checkbox order - sm - 5 col - sm - 4
2022-09-25 23:58:58 +00:00
< ? php endif ?>
" >
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< div class = " form-check d-inline-block me-2 " >
< ? php else : ?>
< label class = " checkbox-inline " for = " input-show_tags_mode " >
< ? php endif ?>
< input type = " checkbox " id = " input-show_tags_mode "
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
class = " form-check-input "
< ? php endif ?>
< ? = isset ( $_COOKIE [ 'show_tags_mode' ]) ? 'checked="checked" ' : '' ?>
/>
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< label class = " form-check-label " for = " input-show_tags_mode " >
< ? php endif ?>
< ? = UOJLocale :: get ( 'problems::show tags' ) ?>
</ label >
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
</ div >
< ? php endif ?>
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< div class = " form-check d-inline-block " >
< ? php else : ?>
< label class = " checkbox-inline " for = " input-show_submit_mode " >
< ? php endif ?>
< input type = " checkbox " id = " input-show_submit_mode "
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
class = " form-check-input "
< ? php endif ?>
< ? = isset ( $_COOKIE [ 'show_submit_mode' ]) ? 'checked="checked" ' : '' ?>
/>
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< label class = " form-check-label " for = " input-show_submit_mode " >
< ? php endif ?>
< ? = UOJLocale :: get ( 'problems::show statistics' ) ?>
</ label >
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
</ div >
< ? php endif ?>
2022-09-29 02:10:24 +00:00
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< div class = " form-check d-inline-block " >
< ? php else : ?>
< label class = " checkbox-inline " for = " input-show_difficulty " >
< ? php endif ?>
< input type = " checkbox " id = " input-show_difficulty "
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
class = " form-check-input "
< ? php endif ?>
< ? = isset ( $_COOKIE [ 'show_difficulty' ]) ? 'checked="checked" ' : '' ?> />
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< label class = " form-check-label " for = " input-show_difficulty " >
< ? php endif ?>
< ? = UOJLocale :: get ( 'problems::show difficulty' ) ?>
</ label >
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
</ div >
< ? php endif ?>
2022-09-18 11:34:17 +00:00
</ div >
2022-09-29 02:10:24 +00:00
< ? php if ( ! isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
2022-09-25 23:58:58 +00:00
< div class = " col-sm-4 order-sm-3 " >
2022-09-29 02:10:24 +00:00
< ? = $pag -> pagination (); ?>
2022-09-18 11:34:17 +00:00
</ div >
2022-09-29 02:10:24 +00:00
< ? php endif ?>
</ div >
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< div class = " text-center " >
< ? = $pag -> pagination (); ?>
2022-09-18 11:34:17 +00:00
</ div >
2022-09-29 02:10:24 +00:00
< ? php endif ?>
2022-09-25 23:58:58 +00:00
< ? php if ( ! isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
2022-09-18 11:34:17 +00:00
< div class = " top-buffer-sm " ></ div >
2022-09-25 23:58:58 +00:00
< ? php endif ?>
2022-09-18 11:34:17 +00:00
< script type = " text/javascript " >
$ ( '#input-show_tags_mode' ) . click ( function () {
if ( this . checked ) {
$ . cookie ( 'show_tags_mode' , '' , { path : '/' });
} else {
$ . removeCookie ( 'show_tags_mode' , { path : '/' });
}
location . reload ();
});
$ ( '#input-show_submit_mode' ) . click ( function () {
if ( this . checked ) {
$ . cookie ( 'show_submit_mode' , '' , { path : '/' });
} else {
$ . removeCookie ( 'show_submit_mode' , { path : '/' });
}
location . reload ();
});
$ ( '#input-show_difficulty' ) . click ( function () {
if ( this . checked ) {
$ . cookie ( 'show_difficulty' , '' , { path : '/' });
} else {
$ . removeCookie ( 'show_difficulty' , { path : '/' });
}
location . reload ();
});
</ script >
2022-09-25 23:39:01 +00:00
< div class = " <?= join( $div_classes , ' ') ?> " >
< table class = " <?= join( $table_classes , ' ') ?> " >
< thead >
< ? = $header ?>
</ thead >
< tbody >
2022-09-18 11:34:17 +00:00
< ? php
foreach ( $pag -> get () as $idx => $row ) {
echoProblem ( $row );
echo " \n " ;
}
?>
2022-09-25 23:39:01 +00:00
< ? php if ( $pag -> isEmpty ()) : ?>
< tr >
< td class = " text-center " colspan = " 233 " >
< ? = UOJLocale :: get ( 'none' ) ?>
</ td >
</ tr >
< ? php endif ?>
2022-09-25 23:58:58 +00:00
2022-09-25 23:39:01 +00:00
</ tbody >
</ table >
</ div >
< ? = $pag -> pagination (); ?>
2022-09-26 03:28:53 +00:00
2022-09-25 23:58:58 +00:00
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
</ div >
2022-09-26 23:57:01 +00:00
< aside class = " col mt-3 mt-lg-0 " >
2022-09-25 23:39:01 +00:00
2022-09-25 23:58:58 +00:00
< ? php uojIncludeView ( 'sidebar' , array ()); ?>
</ aside >
</ div >
< ? php endif ?>
2022-09-26 03:28:53 +00:00
2022-09-18 11:34:17 +00:00
< ? php echoUOJPageFooter () ?>