Skip to content

Commit

Permalink
fix numbering for judge interface
Browse files Browse the repository at this point in the history
  • Loading branch information
bobby285271 committed Nov 30, 2021
1 parent 7f527a7 commit e54e37c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
7 changes: 6 additions & 1 deletion modules/admin/views/contest/oi_rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
<?php foreach ($problems as $key => $p) : ?>
<td>
<b>
<?= Html::a(chr(65 + $key), ['/contest/problem', 'id' => $model->id, 'pid' => $key], ['class' => 'text-dark']) ?>
<?php
$cur_id = (sizeof($problems) > 26)
? (str_pad($key + 1, 2, '0', STR_PAD_LEFT))
: chr(65 + $key);
?>
<?= Html::a($cur_id, ['/contest/problem', 'id' => $model->id, 'pid' => $key], ['class' => 'text-dark']) ?>
</b>
</td>
<?php endforeach; ?>
Expand Down
9 changes: 8 additions & 1 deletion modules/admin/views/contest/print.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@
<br>
<div style="page-break-after: always"></div>
<?php foreach ($problems as $key => $problem) : ?>
<h3 class="limit"><?= Html::encode(chr(65 + $problem['num']) . '. ' . $problem['title']) ?></h3>

<?php
$cur_id = (sizeof($problems) > 26)
? (str_pad($key + 1, 2, '0', STR_PAD_LEFT))
: chr(65 + $key);
?>

<h3 class="limit"><?= Html::encode($cur_id . '. ' . $problem['title']) ?></h3>
<p class="limit">
<?= Yii::t('app', '{t, plural, =1{# second} other{# seconds}}', ['t' => intval($problem['time_limit'])]); ?>, <?= $problem['memory_limit'] ?> MB
</p>
Expand Down
10 changes: 8 additions & 2 deletions modules/admin/views/contest/rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@
<?php foreach ($problems as $key => $p) : ?>
<td style="width:3.5rem">
<b>
<?= Html::a(chr(65 + $key), ['/contest/problem', 'id' => $model->id, 'pid' => $key], ['class' => 'text-dark']) ?>
<?php
$cur_id = (sizeof($problems) > 26)
? (str_pad($key + 1, 2, '0', STR_PAD_LEFT))
: chr(65 + $key);
?>

<?= Html::a($cur_id, ['/contest/problem', 'id' => $model->id, 'pid' => $key], ['class' => 'text-dark']) ?>
</b>
</td>
<?php endforeach; ?>
Expand Down Expand Up @@ -86,7 +92,7 @@
}
$time = '';
}

echo "<td class=\"{$css_class}\"><b>{$num}{$time}</b></td>";
}
?>
Expand Down
16 changes: 13 additions & 3 deletions modules/admin/views/contest/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
$this->title = $model->title;
$this->params['model'] = $model;
$problems = $model->problems;
$problems_size = sizeof($problems);

$nav = [];
$nav[''] = 'All';

foreach ($problems as $key => $p) {
$nav[$p['problem_id']] = chr(65 + $key) . '-' . $p['title'];
$nav[$p['problem_id']] = ($problems_size > 26)
? ('P' . str_pad($key + 1, 2, '0', STR_PAD_LEFT))
: chr(65 + $key);

$nav[$p['problem_id']] .= '. ' . $p['title'];
}
?>
<div class="container">
Expand Down Expand Up @@ -88,16 +94,20 @@
],
[
'label' => Yii::t('app', 'Problem'),
'value' => function ($model, $key, $index, $column) {
'value' => function ($model, $key, $index, $column) use ($problems_size) {
$res = $model->getProblemInContest();
if (!isset($model->problem)) {
return null;
}
if (!isset($res->num)) {
return $model->problem->title;
} else {
$cur_id = ($problems_size > 26)
? ('P' . str_pad($res->num + 1, 2, '0', STR_PAD_LEFT))
: chr(65 + $res->num);
}
return Html::a(
chr(65 + $res->num) . ' - ' . $model->problem->title,
$cur_id . ' - ' . $model->problem->title,
['/contest/problem', 'id' => $res->contest_id, 'pid' => $res->num],
['class' => 'text-dark']
);
Expand Down
17 changes: 12 additions & 5 deletions modules/admin/views/contest/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,22 @@
<tbody>
<?php foreach ($problems as $key => $p) : ?>
<tr>
<td><?= Html::a(chr(65 + $key), ['/admin/problem/view', 'id' => $p['problem_id']]) ?></td>

<?php
$cur_id = (sizeof($problems) > 26)
? (str_pad($key + 1, 2, '0', STR_PAD_LEFT))
: chr(65 + $key);
?>

<td><?= Html::a($cur_id, ['/admin/problem/view', 'id' => $p['problem_id']]) ?></td>
<td><?= Html::a($p['problem_id'], ['/admin/problem/view', 'id' => $p['problem_id']]) ?></td>
<td><?= Html::a(Html::encode($p['title']), ['/admin/problem/view', 'id' => $p['problem_id']]) ?></td>
<td>
<!-- <?php Modal::begin([
'title' => Yii::t('app', 'Modify') . ' ' . chr(65 + $key) . ' 题题目编号',
'size' => Modal::SIZE_LARGE,
'toggleButton' => ['tag' => 'a', 'label' => '<i class="fas fa-sm fa-pen"></i>', 'class' => 'text-dark'],
]); ?>
'title' => Yii::t('app', 'Modify') . ' ' . chr(65 + $key) . ' 题题目编号',
'size' => Modal::SIZE_LARGE,
'toggleButton' => ['tag' => 'a', 'label' => '<i class="fas fa-sm fa-pen"></i>', 'class' => 'text-dark'],
]); ?>

<?= Html::beginForm(['contest/updateproblem', 'id' => $model->id]) ?>

Expand Down

0 comments on commit e54e37c

Please sign in to comment.