function displayData($data) { $htm = ''; $totals = array(); foreach ($data as $name => $stats) { $htm .= '<table id="tb_' . $name . '" class="stats">' . "\n"; $htm .= '<tr><th class="machine" colspan="2">' . $name . "</th></tr>\n"; if (!empty($stats)) { $summary = (array) $stats['summary']; foreach ($summary as $key => $val) { if (!empty($val) && !ignoreField($key)) { $htm .= '<tr><td class="key">' . translateField($key) . '</td>' . '<td class="val">' . translateValue($key, $val, $summary) . "</td></tr>\n"; } } if (isset($summary['KHS'])) { @($totals[$summary['ALGO']] += floatval($summary['KHS'])); } foreach ($stats['threads'] as $g => $gpu) { $card = isset($gpu['CARD']) ? $gpu['CARD'] : ''; $htm .= '<tr><th class="gpu" colspan="2">' . $g . " {$card}</th></tr>\n"; foreach ($gpu as $key => $val) { if (!empty($val) && !ignoreField($key)) { $htm .= '<tr><td class="key">' . translateField($key) . '</td>' . '<td class="val">' . translateValue($key, $val) . "</td></tr>\n"; } } } } $htm .= "</table>\n"; } // totals if (!empty($totals)) { $htm .= '<div class="totals"><h2>Total Hash rate</h2>' . "\n"; foreach ($totals as $algo => $hashrate) { $htm .= '<li><span class="algo">' . $algo . ":</span>{$hashrate} kH/s</li>\n"; } $htm .= '</div>'; } return $htm; }
$i = 1 * $page; if (!$result) { echo $mysqli->error; } $lastVal = 0; while (($arr = $result->fetch_array()) != null) { echo "<tr>"; echo "<th>#" . $i++ . "</th>"; $playerName = getPlayerName($mysqli, $mysql_table_prefix, $arr['player_id']); echo "<td><img src='" . $avatar_service_uri . $playerName . "/16' " . "class='img-circle avatar-list-icon'> <a href='" . LINKBASE . "players/" . $arr['player_id'] . "' title='" . $playerName . "'s Stats'> " . $playerName . "</a></td>"; echo "<td>" . translateValue($stat, $arr['value']); if ($stat !== 'playtime' && $lastVal !== 0) { echo " <i><small>(" . (intval(translateValue($stat, $arr['value'])) - $lastVal) . ")</small></i>"; } echo "</td>"; $lastVal = translateValue($stat, $arr['value']); } ?> </tbody> </table> </div> <?php if ($key % 2 === 1) { ?> </div> <?php } ?> <?php }
</tr> </thead> <tbody> <?php $page = 1; $result = getTopPlayers($mysqli, $mysql_table_prefix, $player_top_calc_stat, $page, $player_on_top); $i = 1 * $page; if (!$result) { echo $mysqli->error; } while (($arr = $result->fetch_array()) != null) { echo "<tr>"; echo "<th>#" . $i++ . "</th>"; $playerName = getPlayerName($mysqli, $mysql_table_prefix, $arr['player_id']); echo "<td><img src='" . $avatar_service_uri . $playerName . "/16' " . "class='img-circle avatar-list-icon'> <a href='" . LINKBASE . "players/" . $arr['player_id'] . "' title='" . $playerName . "'s Stats'> " . $playerName . "</a></td>"; echo "<td>" . translateValue($player_top_calc_stat, $arr['value']) . "</td>"; } ?> </tbody> </table> </div> </div> </div> </div> <!-- /Main Content --> <!-- Sidebar --> <div class="col-md-3 col-md-offset-1"> <!-- Server status --> <?php