新增到第一页和到最后一页

This commit is contained in:
2024-10-11 14:45:34 +08:00
parent 74cd879ce2
commit 3f95886aa5

View File

@@ -8,9 +8,9 @@
<form action="" method="get"> <form action="" method="get">
<div class="ui search" style="width: 280px; height: 28px; margin-top: -5.3px;float:left "> <div class="ui search" style="width: 280px; height: 28px; margin-top: -5.3px;float:left ">
<div class="ui left icon input" style="width: 100%; "> <div class="ui left icon input" style="width: 100%; ">
<input class="prompt" style="width: 100%; " type="text" placeholder=" <?php echo $MSG_TITLE;?> …" name="search" <input class="prompt" style="width: 100%; " type="text" placeholder=" <?php echo $MSG_TITLE; ?> …"
value="<?php if(isset($_GET['search']))echo htmlentities($_GET['search'],ENT_QUOTES,'UTF-8') ?>" name="search" value="<?php if (isset($_GET['search']))
> echo htmlentities($_GET['search'], ENT_QUOTES, 'UTF-8') ?>">
<i class="search icon"></i> <i class="search icon"></i>
</div> </div>
@@ -28,18 +28,19 @@
</div> </div>
</form> </form>
<!-- 管理员用来显示指定用户的对错情况 --> <!-- 管理员用来显示指定用户的对错情况 -->
<?php if (isset($_SESSION[$OJ_NAME . '_' . 'administrator'])): ?>
<form action="" method="get"> <form action="" method="get">
<div class="ui search" style="width: 280px; height: 28px; margin-top: -5.3px;float:left "> <div class="ui search" style="width: 280px; height: 28px; margin-top: -5.3px;">
<div class="ui left icon input" style="width: 100%; "> <div class="ui left icon input" style="width: 100%; ">
<input class="prompt" style="width: 100%; " type="text" placeholder="用户ID" name="query_user_id" <input class="prompt" style="width: 100%; " type="text" placeholder="用户ID" name="query_user_id" value="<?php if (isset($_GET['query_user_id']))
value="<?php if(isset($_GET['query_user_id']))echo htmlentities($_GET['query_user_id'],ENT_QUOTES,'UTF-8') ?>" echo htmlentities($_GET['query_user_id'], ENT_QUOTES, 'UTF-8') ?>">
>
<i class="search icon"></i> <i class="search icon"></i>
</div> </div>
<div class="results" style="width: 100%; "></div> <div class="results" style="width: 100%; "></div>
</div> </div>
</form> </form>
<?php endif; ?>
</div> </div>
@@ -75,7 +76,8 @@
</div> </div>
<div style="margin-left: 10px; display: inline-block; "> <div style="margin-left: 10px; display: inline-block; ">
<a style="margin-left: 10px; " href="category.php" class="ui labeled icon mini green button"><i class="plus icon"></i> <?php echo $MSG_SHOW_ALL_TAGS;?></a> <a style="margin-left: 10px; " href="category.php" class="ui labeled icon mini green button"><i
class="plus icon"></i> <?php echo $MSG_SHOW_ALL_TAGS; ?></a>
</div> </div>
@@ -88,25 +90,46 @@
<div style="margin-bottom: 30px; "> <div style="margin-bottom: 30px; ">
<?php <?php
if(!isset($page)) $page=1; if (!isset($page))
$page = 1;
$page = intval($page); $page = intval($page);
$section = 8; $section = 8;
$start = $page > $section ? $page - $section : 1; $start = $page > $section ? $page - $section : 1;
$end = $page + $section > $view_total_page ? $view_total_page : $page + $section; $end = $page + $section > $view_total_page ? $view_total_page : $page + $section;
function get_href($page, $postfix, $query_user_id)
{
return "problemset.php?page=" . $page .
htmlentities($postfix, ENT_QUOTES, 'UTF-8') .
"&query_user_id=" . $query_user_id;
}
?> ?>
<div style="text-align: center; "> <div style="text-align: center; ">
<div class="ui pagination menu" style="box-shadow: none; "> <div class="ui pagination menu" style="box-shadow: none; ">
<a class="<?php if($page==1) echo "disabled "; ?>icon item" href="<?php if($page<>1) echo "problemset.php?page=".($page-1).htmlentities($postfix,ENT_QUOTES,'UTF-8'); ?>" id="page_prev"> <a class="<?php if ($page == 1)
echo "disabled "; ?>icon item" href="<?php if ($page <> 1)
echo get_href(1, $postfix, $query_user_id); ?>" id="page_first">
<i class="angle double left icon"></i>
</a>
<a class="<?php if ($page == 1)
echo "disabled "; ?>icon item" href="<?php if ($page <> 1)
echo get_href($page - 1, $postfix, $query_user_id); ?>" id="page_prev">
<i class="left chevron icon"></i> <i class="left chevron icon"></i>
</a> </a>
<?php <?php
for ($i = $start; $i <= $end; $i++) { for ($i = $start; $i <= $end; $i++) {
echo "<a class=\"".($page==$i?"active ":"")."item\" href=\"problemset.php?page=".$i.htmlentities($postfix,ENT_QUOTES,'UTF-8')."\">".$i."</a>"; echo "<a class=\"" . ($page == $i ? "active " : "") . "item\" href=\"" . get_href($i, $postfix, $query_user_id) . "\">" . $i . "</a>";
} }
?> ?>
<a class="<?php if($page==$view_total_page) echo "disabled "; ?> icon item" href="<?php if($page<>$view_total_page) echo "problemset.php?page=".($page+1).htmlentities($postfix,ENT_QUOTES,'UTF-8'); ?>" id="page_next"> <a class="<?php if ($page == $view_total_page)
echo "disabled "; ?> icon item" href="<?php if ($page <> $view_total_page)
echo get_href($page + 1, $postfix, $query_user_id); ?>" id="page_next">
<i class="right chevron icon"></i> <i class="right chevron icon"></i>
</a> </a>
<a class="<?php if ($page == $view_total_page)
echo "disabled "; ?> icon item" href="<?php if ($page <> $view_total_page)
echo get_href($view_total_page, $postfix, $query_user_id); ?>" id="page_last">
<i class="angle double right icon"></i>
</a>
</div> </div>
</div> </div>
</div> </div>
@@ -151,8 +174,9 @@
echo "<a style=\"vertical-align: middle; \" href=\"problem.php?id=" . $row['problem_id'] . "\">"; echo "<a style=\"vertical-align: middle; \" href=\"problem.php?id=" . $row['problem_id'] . "\">";
echo $row['title']; echo $row['title'];
echo "</a>"; echo "</a>";
if($row['defunct']=='Y') if ($row['defunct'] == 'Y') {
{echo "<a href=admin/problem_df_change.php?id=".$row['problem_id']."&getkey=".$_SESSION[$OJ_NAME.'_'.'getkey'].">".("<span class=\"ui tiny red label\">未公开</span>")."</a>";} echo "<a href=admin/problem_df_change.php?id=" . $row['problem_id'] . "&getkey=" . $_SESSION[$OJ_NAME . '_' . 'getkey'] . ">" . ("<span class=\"ui tiny red label\">未公开</span>") . "</a>";
}
echo "<div class=\"show_tag_controled\" style=\"float: right; \">"; echo "<div class=\"show_tag_controled\" style=\"float: right; \">";
//echo "<span class=\"ui header\">"; //echo "<span class=\"ui header\">";
@@ -181,7 +205,8 @@
<div style="margin-bottom: 30px; "> <div style="margin-bottom: 30px; ">
<?php <?php
if(!isset($page)) $page=1; if (!isset($page))
$page = 1;
$page = intval($page); $page = intval($page);
$section = 8; $section = 8;
$start = $page > $section ? $page - $section : 1; $start = $page > $section ? $page - $section : 1;
@@ -189,7 +214,10 @@
?> ?>
<div style="text-align: center; "> <div style="text-align: center; ">
<div class="ui pagination menu" style="box-shadow: none; "> <div class="ui pagination menu" style="box-shadow: none; ">
<a class="<?php if($page==1) echo "disabled "; ?>icon item" href="<?php if($page<>1) echo "problemset.php?page=".($page-1).htmlentities($postfix,ENT_QUOTES,'UTF-8'); ?>" id="page_prev"> <a class="<?php if ($page == 1)
echo "disabled "; ?>icon item" href="<?php if ($page <> 1)
echo "problemset.php?page=" . ($page - 1) . htmlentities($postfix, ENT_QUOTES, 'UTF-8'); ?>"
id="page_prev">
<i class="left chevron icon"></i> <i class="left chevron icon"></i>
</a> </a>
<?php <?php
@@ -197,7 +225,10 @@
echo "<a class=\"" . ($page == $i ? "active " : "") . "item\" href=\"problemset.php?page=" . $i . htmlentities($postfix, ENT_QUOTES, 'UTF-8') . "\">" . $i . "</a>"; echo "<a class=\"" . ($page == $i ? "active " : "") . "item\" href=\"problemset.php?page=" . $i . htmlentities($postfix, ENT_QUOTES, 'UTF-8') . "\">" . $i . "</a>";
} }
?> ?>
<a class="<?php if($page==$view_total_page) echo "disabled "; ?> icon item" href="<?php if($page<>$view_total_page) echo "problemset.php?page=".($page+1).htmlentities($postfix,ENT_QUOTES,'UTF-8'); ?>" id="page_next"> <a class="<?php if ($page == $view_total_page)
echo "disabled "; ?> icon item" href="<?php if ($page <> $view_total_page)
echo "problemset.php?page=" . ($page + 1) . htmlentities($postfix, ENT_QUOTES, 'UTF-8'); ?>"
id="page_next">
<i class="right chevron icon"></i> <i class="right chevron icon"></i>
</a> </a>
</div> </div>
@@ -207,4 +238,3 @@
</div> </div>
<?php include("template/$OJ_TEMPLATE/footer.php"); ?> <?php include("template/$OJ_TEMPLATE/footer.php"); ?>