function print_arrow($diff, $rev = 0) { $diff = round($diff, 2); if ($diff == 0) { return; } if ($diff > 0) { $type = 'more'; $diff = '+' . $diff; if (!$rev) { $col = 'red'; } else { $col = 'green'; } } else { if ($diff < 0) { $type = 'less'; if (!$rev) { $col = 'green'; } else { $col = 'red'; } } else { $type = 'same'; $col = 'black'; } } $arrow = get_arrow($type); echo <<<EOF \t<div class="arrow-wrapper {$col} left"> \t\t<div class="arrow">{$arrow}</div> \t\t<div class="diff">({$diff}%)</div> \t</div> EOF; }
function print_eu() { global $game_cfg; $xhprofModelObject = getXhProfModel(); $end_time = time(); $start_time = $end_time - 2 * 3600; $chart_result = $xhprofModelObject->generic_execute_get_query('bd_chart_range_per_dau', array('table' => $game_cfg["db_stats_table"], 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => "")); $last2 = array_splice($chart_result, -2, 2); list($new, $old) = get_column_vector($last2, "dau_all_count"); $pct = 100 * ($new - $old) / $old; $diff = abs($new - $old); if ($diff >= 0) { $kind = "good"; $type = "more"; } else { $kind = "bad"; $type = "less"; } $arrow = get_arrow($kind); $pct = round(abs($pct), 2); echo <<<EOF \tServing <span class="{$kind}">{$new}</span> users per server <span class="{$kind}"> {$diff} {$type} {$arrow} ({$pct}%)</span> EOF; }