OSDN Git Service

[modify]スコアページのテーブルCSS共通化
authorHabu <habu@users.sourceforge.jp>
Thu, 29 Mar 2018 11:35:32 +0000 (20:35 +0900)
committerHabu <habu@users.sourceforge.jp>
Thu, 29 Mar 2018 12:08:34 +0000 (21:08 +0900)
score/css/.htaccess [new file with mode: 0644]
score/css/score-table.css [new file with mode: 0644]
score/popularity_ranking.php
score/score_ranking.php
score/tablesorter-theme/style.css

diff --git a/score/css/.htaccess b/score/css/.htaccess
new file mode 100644 (file)
index 0000000..f4f0328
--- /dev/null
@@ -0,0 +1,5 @@
+deny from all
+
+<Files ~ "(\.css)$">
+allow from all
+</Files>
diff --git a/score/css/score-table.css b/score/css/score-table.css
new file mode 100644 (file)
index 0000000..85a9a92
--- /dev/null
@@ -0,0 +1,46 @@
+table.score
+{
+    width: 100%;
+}
+
+table.score thead tr th,
+table.score tfoot tr th
+{
+         background-color: #302010;
+         border: 1px solid #d27d00;
+         padding: 4px;
+}
+
+table.score tbody td
+{
+         color: black;
+         padding: 4px;
+         background-color: #e9967a;
+         vertical-align: top;
+}
+
+table.score tbody tr:nth-child(odd) td
+{
+         background-color: #f9b69a;
+}
+
+table.score tbody td.number
+{
+         text-align: right;
+}
+
+table.score tbody td a:link
+{
+    color: black;
+}
+table.score tbody td a:visited {
+    color: gray;
+}
+table.score tbody td a:hover {
+    color: red;
+}
+
+table.statistics_table
+{
+    display: none;
+}
index a3451cd..ce2f043 100644 (file)
@@ -13,7 +13,7 @@ function print_popularity_table($fp, $stat, $id_name, $name)
 {
     fwrite($fp, <<<EOM
 <div id="{$id_name}">
-<table class="tablesorter statistics_table">
+<table class="tablesorter score statistics_table">
 <thead>
 <tr>
 <th>$name</th>
@@ -35,12 +35,12 @@ EOM
         fwrite($fp, <<<EOM
 <tr>
 <td>$name_link</td>
-<td>{$s['total_count']}</td>
-<td>{$s['male_count']}</td>
-<td>{$s['female_count']}</td>
-<td>{$s['winner_count']}</td>
-<td>$average_score</td>
-<td>{$s['max_score']}</td>
+<td class="number">{$s['total_count']}</td>
+<td class="number">{$s['male_count']}</td>
+<td class="number">{$s['female_count']}</td>
+<td class="number">{$s['winner_count']}</td>
+<td class="number">$average_score</td>
+<td class="number">{$s['max_score']}</td>
 </tr>
 
 EOM
@@ -70,7 +70,7 @@ function print_realm_popularity_table($fp, $stat, $id_name)
         $class_name = $class_realm_stat[0]['class_name'];
 
         fwrite($fp, <<<EOM
-<table class="tablesorter statistics_table" id="${id_name}">
+<table class="tablesorter score statistics_table" id="${id_name}">
 <thead>
 <tr>
 <th>{$class_name}</th>
@@ -91,12 +91,12 @@ EOM
             fwrite($fp, <<<EOM
 <tr>
 <td>$name_link</td>
-<td>{$realm['total_count']}</td>
-<td>{$realm['male_count']}</td>
-<td>{$realm['female_count']}</td>
-<td>{$realm['winner_count']}</td>
-<td>$average_score</td>
-<td>{$realm['max_score']}</td>
+<td class="number">{$realm['total_count']}</td>
+<td class="number">{$realm['male_count']}</td>
+<td class="number">{$realm['female_count']}</td>
+<td class="number">{$realm['winner_count']}</td>
+<td class="number">$average_score</td>
+<td class="number">{$realm['max_score']}</td>
 </tr>
 
 EOM
@@ -118,6 +118,7 @@ $query_time = microtime(true) - $time_start;
 
 $wt = new WebTemplate();
 
+$wt->add_head_contents('<link rel="stylesheet" type="text/css" href="css/score-table.css">');
 $wt->add_head_contents('<link rel="stylesheet" type="text/css" href="tablesorter-theme/style.css">');
 $wt->add_head_contents(
     <<<EOM
index 3b2f7b1..f69f994 100644 (file)
@@ -93,7 +93,8 @@ function print_navi_page_table($fp, $pageinfo)
 function print_score_table($fp, $scores, $rank_start)
 {
     fwrite($fp, <<<EOM
-<table align='center' border=1>
+<table class="score">
+<thead>
 <tr>
 <th>順位</th>
 <th>スコア</th>
@@ -104,10 +105,12 @@ function print_score_table($fp, $scores, $rank_start)
 <th>性別</th>
 <th>死因</th>
 </tr>
+</thead>
 
 EOM
     );
 
+    fwrite($fp, "<tbody>\n");
     foreach($scores as $idx => $score) {
         $rank = $rank_start + $idx + 1;
         $date = substr($score['date'], 0, 10); // 日時から日付部分を取り出す
@@ -124,7 +127,7 @@ EOM
         fwrite($fp, <<<EOM
 <tr>
 <td>$rank</td>
-<td align="right">{$score['score']}</td>
+<td class="number">{$score['score']}</td>
 <td><nobr>$date</nobr></td>
 <td>$name</td>
 <td>{$score['race_name']}</td>
@@ -141,6 +144,7 @@ EOM
         fwrite($fp, "<br>({$depth}{$score['version']})</td>\n".
                "</tr>\n");
     }
+    fwrite($fp, "</tbody>\n");
     fwrite($fp, "</table>\n");
 }
 
@@ -154,6 +158,7 @@ $pageinfo = calc_page_info($search_result['total_data_count'], $start_num, 50);
 
 $wt = new WebTemplate();
 $wt->set_title("変愚蛮怒 スコアランキング");
+$wt->add_head_contents('<link rel="stylesheet" type="text/css" href="css/score-table.css">');
 $fp = $wt->main_contents_fp();
 fprintf($fp, "<h2>変愚蛮怒 歴代スコア (%s)</h2>\n", $db->get_sort_mode_name());
 fprintf($fp, <<<EOM
index e45ea50..5059b2f 100644 (file)
@@ -1,45 +1,10 @@
 /* tables */
-table.tablesorter {
-       font-family:arial;
-       /*background-color: #CDCDCD;*/
-       margin:10px 0pt 15px;
-       /*font-size: 8pt;*/
-       width: 100%;
-       text-align: left;
-}
-table.tablesorter thead tr th, table.tablesorter tfoot tr th {
-       /*background-color: #e6EEEE;*/
-       background-color: #302010;
-       /*border: 1px solid #FFF;*/
-       border: 1px solid #d27d00;
-       /*font-size: 8pt;*/
-       padding: 4px;
-}
 table.tablesorter thead tr .header {
        background-image: url(bg.gif);
        background-repeat: no-repeat;
        background-position: center right;
        cursor: pointer;
 }
-table.tablesorter tbody td {
-       color: #3D3D3D;
-       padding: 4px;
-       background-color: #e9967a;
-       vertical-align: top;
-}
-table.tablesorter tbody td:nth-child(n+2) {
-         text-align: right;
-}
-table.tablesorter tbody td a:link,
-table.tablesorter tbody td a:visited {
-    color: black;
-}
-table.tablesorter tbody td a:hover {
-    color: red;
-}
-table.tablesorter tbody tr:nth-child(odd) td {
-       background-color: #f9b69a;
-}
 table.tablesorter thead tr .headerSortUp {
        background-image: url(asc.gif);
 }
@@ -49,7 +14,3 @@ table.tablesorter thead tr .headerSortDown {
 table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
        border: 3px ridge #d27d00;
 }
-
-table.statistics_table {
-    display: none;
-}