OSDN Git Service

Merge remote-tracking branch 'score/master'
[hengband/web.git] / score / popularity_ranking.php
1 <?php
2 //ini_set('display_errors', 'On');
3
4 ini_set('log_errors', 'On');
5 ini_set('error_log', 'errors/'.pathinfo(__FILE__, PATHINFO_FILENAME).'.log');
6
7 ini_set('zlib.output_compression', 'On');
8
9 require_once "db_common.inc";
10
11 function print_popularity_table($stat, $id_name, $name)
12 {
13     echo <<<EOM
14 <table class="tablesorter statistics_table" id="${id_name}">
15 <thead>
16 <tr>
17 <th>$name</th>
18 EOM;
19     
20     foreach ([
21         '計', '男性', '女性', '勝利', '平均スコア', '最大スコア',
22     ] as $name) {
23         echo "<th>${name}</th>";
24     }
25     echo "</tr>\n";
26     echo "</thead>\n";
27
28     foreach ($stat as $k => $s) {
29         $name_link = "<a href='score_ranking.php?{$id_name}={$s['id']}'>{$s['name']}</a></td>";
30         $average_score = floor($s['average_score']);
31         echo <<<EOM
32 <tr>
33 <td>$name_link</td>
34 <td>{$s['total_count']}</td>
35 <td>{$s['male_count']}</td>
36 <td>{$s['female_count']}</td>
37 <td>{$s['winner_count']}</td>
38 <td>$average_score</td>
39 <td>{$s['max_score']}</td>
40 </tr>
41 EOM;
42     }
43
44     echo "</table>";
45 }
46
47
48 $db = new ScoreDB();
49
50 $time_start = microtime(true);
51
52 $statistics = $db->get_statistics_tables('total_count');
53
54 $query_time = microtime(true) - $time_start;
55 ?>
56
57 <!DOCTYPE html>
58
59 <html lang="jp">
60         <head>
61                 <meta charset="utf-8"/>
62                 <link rev=made href="mailto:hengband-dev@lists.sourceforge.jp">
63                 <link rel="stylesheet" type="text/css" href="/hengband.css">
64                 <link rel="stylesheet" type="text/css" href="tablesorter-theme/style.css">
65                 <link rel="alternate" title="変愚蛮怒 新着スコア" href="feed/newcome-atom.xml" type="application/atom+xml" />
66                 <script
67                 src="https://code.jquery.com/jquery-3.3.1.min.js"
68                 integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
69                 crossorigin="anonymous"></script>
70
71                 <script src="jquery.tablesorter.min.js" type="text/javascript"></script>
72                 <script src="popularity_ranking.js" type="text/javascript"></script>
73                 <title>変愚蛮怒 公式WEB スコアランキング 人気のある種族・職業・性格</title>
74         </head>
75
76         <body>
77
78                 <header>
79
80                         <section id="title">
81                                 <img class="tama1" src="/image/tama.gif" alt="tama">
82                                 <img class="tama2" src="/image/tama.gif" alt="tama">
83                                 <img class="tama3" src="/image/tama.gif" alt="tama">
84                                 <img class="tama4" src="/image/tama.gif" alt="tama">
85                                 <img id="hengTitle" src="/image/hengband_title.png" alt="変愚蛮怒 Hengband">
86                                 <img class="tama4" src="/image/tama.gif" alt="tama">
87                                 <img class="tama3" src="/image/tama.gif" alt="tama">
88                                 <img class="tama2" src="/image/tama.gif" alt="tama">
89                                 <img class="tama1" src="/image/tama.gif" alt="tama">
90                         </section>
91
92                         <section id="mainMenu">
93                                 <a href="/index.html">トップ</a>
94                                 <a href="/download.html">ダウンロード</a>
95                                 <a href="/score.html">スコア</a>
96                                 <a href="/lists.html">コミュニティ</a>
97                                 <a href="/history.html">バージョン履歴</a>
98                                 <a href="/link.html">関連リンク</a>
99                                 <a href="/jlicense.html">著作権表記</a>
100                                 <span>English (Coming Soon)</span>
101                         </section>
102
103                 </header>
104  
105                 <div id="main">
106 <!--main contents-->
107 <h2>人気のある種族・職業・性格</h2>
108 <!--
109 <small>
110 <?php
111 echo sprintf("(%.2f 秒)", $query_time);
112 ?>
113 </small>
114 -->
115 <nobr>[ <a href="javascript:void(0)" class="table_select" id="race_id">種族</a> | <a href="javascript:void(0)" class="table_select" id="class_id">職業</a> | <a href="javascript:void(0)" class="table_select" id="personality_id">性格</a> ]</nobr>
116
117 <?php
118 print_popularity_table($statistics['race'], 'race_id', "種族");
119 ?>
120 <?php
121 print_popularity_table($statistics['class'], 'class_id', "職業");
122 ?>
123 <?php
124 print_popularity_table($statistics['personality'], 'personality_id', "性格");
125 ?>
126
127                 </div>
128
129                 <footer>
130
131                         <section>
132                                 各ページへのリンクは御自由にどうぞ。/ Link Free.<br>
133                                 2018 Hengband Dev Team. <a href="mailto:hengband-dev@lists.sourceforge.jp">hengband-dev@lists.sourceforge.jp</a><br>
134                         </section>
135
136                         <section>
137                                 Powered by <a href="https://ja.osdn.net/" class="footer_banner">
138                                 <img src="https://ja.osdn.net/sflogo.php?group_id=541" border="0" alt="OSDN.jp">
139                                 </a>
140                         </section>
141
142                 </footer>
143
144         </body>
145
146 </html>