예제 #1
0
파일: users.php 프로젝트: Kuzat/kofradia
    if ($day == $today) {
        break;
    }
}
$result = \Kofradia\DB::get()->query("SELECT DATE(FROM_UNIXTIME(up_created_time)) day, COUNT(up_id) count FROM users_players WHERE up_created_time >= {$expire} GROUP BY DATE(FROM_UNIXTIME(up_created_time))");
while ($row = $result->fetch()) {
    $stats_new[$row['day']] = (int) $row['count'];
}
$result = \Kofradia\DB::get()->query("SELECT DATE(FROM_UNIXTIME(up_deactivated_time)) day, COUNT(up_id) count FROM users_players WHERE up_deactivated_time >= {$expire} GROUP BY DATE(FROM_UNIXTIME(up_deactivated_time))");
while ($row = $result->fetch()) {
    $stats_die[$row['day']] = (int) $row['count'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Antall spillere"));
$ofc->tooltip()->title("font-size: 13px;font-weight:bold");
$bar = new OFC_Charts_Line();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# nye brukere");
$bar->text("Antall nye spillere");
$bar->values(array_values($stats_new));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Line();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# døde brukere");
$bar->text("Antall døde spillere");
$bar->values(array_values($stats_die));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(2)->rotate(330)->labels(array_keys($stats_new));
$ofc->axis_y()->set_numbers(0, max(max($stats_new), max($stats_die)));
$ofc->dark_colors();
$ofc->dump();
예제 #2
0
파일: pokernum.php 프로젝트: Kuzat/kofradia
$result = \Kofradia\DB::get()->query("\n\tSELECT DATE(FROM_UNIXTIME(poker_time_start)) AS day, COUNT(IF(poker_winner = 0, 1, NULL)) num_uavgjort,\n\t\tCOUNT(IF((poker_winner = 1 AND poker_starter_up_id = up_id) OR (poker_winner = 2 AND poker_challenger_up_id = up_id), 1, NULL)) num_wins,\n\t\tCOUNT(IF((poker_winner = 1 AND poker_starter_up_id = up_id) OR (poker_winner = 2 AND poker_challenger_up_id = up_id), NULL, 1)) num_loss\n\tFROM poker, users_players\n\tWHERE poker_time_start >= {$time_start} AND poker_time_start <= {$time_end} AND up_u_id = {$u_id} AND (up_id = poker_starter_up_id OR up_id = poker_challenger_up_id) AND poker_state = 4\n\tGROUP BY DATE(FROM_UNIXTIME(poker_time_start))");
$max = 0;
while ($row = $result->fetch()) {
    $stats_wins[$row['day']] = (int) $row['num_wins'];
    $stats_loss[$row['day']] = (int) $row['num_loss'];
    $stats_u[$row['day']] = (int) $row['num_uavgjort'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Pokerstatistikk for {$up_name} siste 30 dager"));
$bar = new OFC_Charts_Line();
$bar->text("Antall vunnet");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>Vunnet #val# runder");
$bar->values(array_values($stats_wins));
$bar->colour(OFC_Colours::$colours[2]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Line();
$bar->text("Antall tapt");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>Tapt #val# runder");
$bar->values(array_values($stats_loss));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Line();
$bar->text("Antall uavgjort");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# runder uavgjort");
$bar->values(array_values($stats_u));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(2)->rotate(330)->labels(array_keys($stats_wins));
$ofc->axis_y()->set_numbers(0, max(max($stats_wins), max($stats_loss), max($stats_u)));
$ofc->dark_colors();
echo $ofc;
예제 #3
0
$days = array();
$days_max = 0;
$users = array();
while ($row = $result->fetch()) {
    $users[$row['up_name']][$row['day']] = (int) $row['num_actions'];
    $days[$row['day']] = (isset($days[$row['day']]) ? (int) $days[$row['day']] : 0) + (int) $row['num_actions'];
    $days_max = max($days_max, $row['num_actions']);
}
// sorter statistikk
$stats = array();
foreach ($days as $day => $total) {
    foreach ($users as $user => $user_days) {
        $stats[$user][$day] = isset($user_days[$day]) ? $user_days[$day] : 0;
    }
}
$ofc = new OFC();
$c = new OFC_Colours();
$ofc->title(new OFC_Title("Aktivitet i crewloggen"));
$ofc->tooltip()->title("font-size: 13px;font-weight:bold");
foreach ($stats as $user => $days) {
    $bar = new OFC_Charts_Line();
    $bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("Antall registreringer #x_label# for {$user}: #val#");
    $bar->text($user);
    $bar->values(array_values($days));
    $bar->colour($c->pick());
    $ofc->add_element($bar);
}
$ofc->axis_x()->label()->rotate(340)->labels(array_keys($days))->steps(5);
$ofc->axis_y()->set_numbers(0, min(20, $days_max));
$ofc->dark_colors();
$ofc->dump();
예제 #4
0
파일: panel.php 프로젝트: Kuzat/kofradia
 /**
  * Opprett OFC-linje
  */
 protected function stats_ofc_line($ofc, $text, $tip, $values, $color)
 {
     $bar = new OFC_Charts_Line();
     $bar->text($text);
     $bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip($tip);
     $bar->values($values);
     $bar->colour($color);
     $ofc->add_element($bar);
 }