Exemple #1
0
<?php

require "base.php";
if (isset($_GET['data_file'])) {
    OFC::embed("stats", $_GET['data_file'], "100%", 400);
}
echo '
<h1>Stats</h1>
<form action="" method="get">
	<p>
		<select name="data_file" onchange="this.form.submit()">
			<option>Velg..</option>
			<option value="graphs/users">Antall nye og døde brukere siste periode</option>
			<option value="graphs/record_online">Rekord for antall pålogget</option>
			<option value="graphs/hits">Sidevisninger siste periode</option>
			<option value="graphs/rank">Rankaktivitet siste periode</option>
			<option value="graphs/rank_avg">Gjennomsnittlig rankaktivitet per bruker siste periode</option>
		</select>
	</p>
</form>
<p><span id="stats"></span></p>';
$_base->page->load();
Exemple #2
0
    /**
     * Diverse
     */
    protected static function page_diverse()
    {
        // hent totalt resultat i poker for siste 30 dager
        $date = ess::$b->date->get();
        $date->modify("-30 days");
        $date->setTime(0, 0, 0);
        $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT SUM(CONVERT(poker_prize - poker_cash, SIGNED) * IF((poker_winner = 1 AND poker_starter_up_id = up_id) OR (poker_winner = 2 AND poker_challenger_up_id = up_id), 1, -1)) sum_result\n\t\t\tFROM poker, users_players\n\t\t\tWHERE poker_time_start >= " . $date->format("U") . " AND up_u_id = " . page_min_side::$active_user->id . " AND (up_id = poker_starter_up_id OR up_id = poker_challenger_up_id) AND poker_state = 4");
        $poker_result = $result->fetchColumn(0);
        OFC::embed("stats_poker", "graphs/poker?up_id=" . page_min_side::$active_player->id, "100%", 250);
        OFC::embed("stats_poker_num", "graphs/pokernum?up_id=" . page_min_side::$active_player->id, "100%", 250);
        echo '
	<div class="bg1_c">
		<h1 class="bg1">Pokerbevegelse siste 30 dager<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<p class="c">Totalt resultat siste 30 dager: ' . game::format_cash($poker_result) . '</p>
			<p><span id="stats_poker"></span></p>
			<p><span id="stats_poker_num"></span></p>
		</div>
	</div>';
    }
Exemple #3
0
    $stats_new[$day] = 0;
    $stats_die[$day] = 0;
    $time->modify("+1 day");
    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));
Exemple #4
0
$x = array();
for ($i = 1; $i <= 12; $i++) {
    $stats1[$i] = 0;
    $stats2[$i] = 0;
    $x[] = $_lang['months'][$i];
}
// hent statistikk
$result = \Kofradia\DB::get()->query("SELECT MONTH(FROM_UNIXTIME(ft_time)) AS month, COUNT(ft_id) num FROM forum_topics JOIN users_players ON ft_up_id = up_id WHERE up_u_id = {$u_id} AND ft_time >= {$time_from} AND ft_time <= {$time_to} GROUP BY MONTH(FROM_UNIXTIME(ft_time))");
while ($row = $result->fetch()) {
    $stats1[$row['month']] = (int) $row['num'];
}
$result = \Kofradia\DB::get()->query("SELECT MONTH(FROM_UNIXTIME(fr_time)) AS month, COUNT(fr_id) num FROM forum_replies JOIN users_players ON fr_up_id = up_id WHERE up_u_id = {$u_id} AND fr_time >= {$time_from} AND fr_time <= {$time_to} GROUP BY MONTH(FROM_UNIXTIME(fr_time))");
while ($row = $result->fetch()) {
    $stats2[$row['month']] = (int) $row['num'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Aktivitet i forumet for {$up_name} - " . $date->format("Y")));
$bar = new OFC_Charts_Area();
$bar->text("Antall forumsvar");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# svar");
$bar->values(array_values($stats2));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Area();
$bar->text("Antall forumtråder");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# tråder");
$bar->values(array_values($stats1));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(1)->rotate(330)->labels($x);
$ofc->axis_y()->set_numbers(0, max(max($stats1), max($stats2)));
Exemple #5
0
$month = $date->format(date::FORMAT_MONTH);
$stats = array();
$stats_redir = array();
$x = array();
for ($i = 1; $i <= $days; $i++) {
    $stats[$i] = 0;
    $stats_redir[$i] = 0;
    $x[] = "{$i}. " . $month;
}
// hent dagstatistikk
$result = \Kofradia\DB::get()->query("SELECT DAY(FROM_UNIXTIME(uhi_secs_hour)) AS day, SUM(uhi_hits) sum_hits, SUM(uhi_hits_redirect) sum_hits_redirect FROM users_hits, users_players WHERE up_u_id = {$u_id} AND up_id = uhi_up_id AND uhi_secs_hour >= {$time_from} AND uhi_secs_hour <= {$time_to} GROUP BY DAY(FROM_UNIXTIME(uhi_secs_hour))");
while ($row = $result->fetch()) {
    $stats[$row['day']] = (int) $row['sum_hits'];
    $stats_redir[$row['day']] = (int) $row['sum_hits_redirect'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Sidevisninger for {$up_name} - " . $date->format(date::FORMAT_MONTH) . " " . $date->format("Y")));
$bar = new OFC_Charts_Area();
$bar->text("Antall visninger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# visninger");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Area();
$bar->text("Antall videresendinger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# videresendinger");
$bar->values(array_values($stats_redir));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(2)->rotate(330)->labels($x);
$ofc->axis_y()->set_numbers(0, max(max($stats), max($stats_redir)));
Exemple #6
0
    /**
     * Standard side - viser status for spilleren
     */
    protected static function page_default()
    {
        // kan ikke se?
        if (!page_min_side::$pstats) {
            echo '
	<p class="c">Du har ikke tilgang til å se denne siden.</p>';
            return;
        }
        global $_game;
        // rank
        $rank_need = 0;
        if (page_min_side::$active_player->rank['need_points'] == 0) {
            $rank_prosent = 100;
        } else {
            $rank_prosent = (page_min_side::$active_player->data['up_points'] - page_min_side::$active_player->rank['points']) / page_min_side::$active_player->rank['need_points'] * 100;
            $rank_need = page_min_side::$active_player->rank['need_points'] - page_min_side::$active_player->data['up_points'] + page_min_side::$active_player->rank['points'];
        }
        $rank_prosent_top = page_min_side::$active_player->data['up_points'] / game::$ranks['items_number'][count(game::$ranks['items_number'])]['points'] * 100;
        // hvor mange rankprosent må vi til for å ta igjen neste person?
        $result = \Kofradia\DB::get()->query("SELECT up_points FROM users_players WHERE up_access_level != 0 AND up_access_level < {$_game['access_noplay']} AND up_points > " . page_min_side::$active_player->data['up_points'] . " ORDER BY up_points LIMIT 1");
        $rank_user_next = false;
        $rank_user_prevnext = false;
        if ($next = $result->fetch()) {
            $points = $next['up_points'];
            $to = game::rank_info($points);
            if ($to['need_points'] == 0) {
                // totalt for spillet
                $percent = game::format_rank($points, "all");
                $rank_user_next = '<p>Du må oppnå ' . game::format_num($points) . ' poeng (' . $percent . ' rank for spillet totalt) for å ta igjen neste rangert spiller.</p>';
                // antall prosent vi trenger
                $rank_user_next .= '<p>Du trenger ' . game::format_num($points - page_min_side::$active_player->data['up_points']) . ' poeng (' . game::format_rank($points - page_min_side::$active_player->data['up_points'], $to) . ' rank).</p>';
            } else {
                $percent = game::format_number(($points - $to['points']) / $to['need_points'] * 100, 3);
                // samme rank?
                $same = page_min_side::$active_player->rank['id'] == $to['id'];
                $rank_user_next = '<p>Du må oppnå ' . game::format_num($points) . ' poeng (' . $percent . ' % ' . ($same ? 'på nåværende rank' : 'på ranken ' . $to['name']) . ') for å nå neste rangert spiller.</p>';
                if ($same) {
                    $rank_user_next .= '<p>Du trenger ' . game::format_num($points - page_min_side::$active_player->data['up_points']) . ' poeng (' . game::format_rank($points - page_min_side::$active_player->data['up_points'], $to) . ' rank).</p>';
                }
            }
            // finn ut hvor langt det er til forrige rankerte spiller
            $result = \Kofradia\DB::get()->query("SELECT up_points FROM users_players WHERE up_access_level != 0 AND up_access_level < {$_game['access_noplay']} AND up_id != " . page_min_side::$active_player->id . " AND up_points <= " . page_min_side::$active_player->data['up_points'] . " ORDER BY up_points DESC LIMIT 1");
            if ($row = $result->fetch()) {
                $rank_user_prevnext = round((page_min_side::$active_player->data['up_points'] - $row['up_points']) / ($next['up_points'] - $row['up_points']) * 100, 4);
            }
        }
        // finn ut tidspunkt for de forskjellige funksonene
        $status = array("krim" => page_min_side::$active_player->status_kriminalitet(), "utpressing" => page_min_side::$active_player->status_utpressing(), "gta" => page_min_side::$active_player->status_gta(), "lotto" => page_min_side::$active_player->status_lotto());
        // finn ut når vi kan gjøre forskjellige ting
        $wait = array("kriminalitet" => $status['krim']['wait_time'], "utpressing" => $status['utpressing']['wait_time'], "biltyveri" => $status['gta']['wait_time'], "lotto" => $status['lotto']['wait_time'], "forum_topic" => 0, "forum_reply" => 0, "fengsel" => 0);
        // forumene
        $wait['forum_reply'] = max(0, page_min_side::$active_user->data['u_forum_reply_time'] + game::$settings['delay_forum_reply']['value'] - time());
        $wait['forum_topic'] = max(0, page_min_side::$active_user->data['u_forum_topic_time'] + game::$settings['delay_forum_new']['value'] - time());
        if (page_min_side::$active_player->data['up_weapon_id']) {
            $wait['training'] = max(0, page_min_side::$active_player->data['up_weapon_training_next'] - time());
        }
        // for lav rank til å opprette forumtråder?
        if (page_min_side::$active_player->rank['number'] < 4) {
            $wait['forum_topic'] = -1;
        }
        // fengsel og bomberom
        $wait['fengsel'] = max(0, page_min_side::$active_player->data['up_fengsel_time'] - time());
        $wait['bomberom'] = max(0, page_min_side::$active_player->data['up_brom_expire'] - time());
        $wait['lock'] = max($wait['fengsel'], $wait['bomberom']);
        // sammendrag
        $status = array(array("Kriminalitet", max($wait['kriminalitet'], $wait['lock']), "kriminalitet"), array("Utpressing", max($wait['utpressing'], $wait['lock']), "utpressing"), array("Biltyveri", max($wait['biltyveri'], $wait['lock']), "gta/biltyveri"), array("Lotto", max($wait['lotto'], $wait['lock']), "lotto"), array("Forumemne", $wait['forum_topic'], "forum/"), array("Forumsvar", $wait['forum_reply'], "forum/"), array("Fengsel", $wait['lock'], "fengsel"));
        if (page_min_side::$active_player->data['up_weapon_id']) {
            $status[] = array("Våpentrening", max($wait['training'], $wait['lock']), "angrip");
        }
        // javascript funksjoner for status
        ess::$b->page->add_js_domready('
	var min_side_data = ' . js_encode($status) . ';
	var elm, c;
	for (var i = 0; i < min_side_data.length; i++)
	{
		elm = $("min_side_"+i);
		if (!elm) continue;
		
		c = new Countdown($("min_side_"+i));
		c.timesize = "partial",
		c.complete = function()
		{
			this.element.set("text", "Klar!");
			this.element.removeClass("status_venter").addClass("status_ny");
		};
	}');
        // css
        ess::$b->page->add_css('
.ms_space { margin-top: 2px }
.ms_space_bt { margin-bottom: 1em }
.status dd { text-align: right }
.status dd a { text-decoration: none; color: #CCFF00 }
a.status_ny { font-weight: bold }
a.status_klar:hover, a.status_ny:hover { color: #AAFF00; text-decoration: underline }
.status_venter { color: #888888 !important }
a.status_venter:hover { }
.split { height: 1px; background-color: #222222; overflow: hidden }');
        $health = page_min_side::$active_player->data['up_health'] / page_min_side::$active_player->data['up_health_max'] * 100;
        $energy = page_min_side::$active_player->data['up_energy'] / page_min_side::$active_player->data['up_energy_max'] * 100;
        $health = page_min_side::$active_player->get_health_percent();
        $energy = page_min_side::$active_player->get_energy_percent();
        $protection = page_min_side::$active_player->get_protection_percent();
        $training = page_min_side::$active_player->weapon ? page_min_side::$active_player->data['up_weapon_training'] * 100 : false;
        echo '
	<div class="col2_w">
		<div class="col_w left">
			<div class="col">' . (page_min_side::$active_player->active ? '
				<div class="bg1_c">
					<h1 class="bg1">Status<span class="left2"></span><span class="right2"></span></h1>
					<div class="ms_space ms_up_st progressbar' . ($health < 20 ? ' levelcrit' : ($health < 50 ? ' levelwarn' : '')) . '">
						<div class="progress" style="width: ' . round(min(100, $health)) . '%">
							<p>Helse: ' . ($health == 100 ? '100' : game::format_num($health, 2)) . ' %</p>
						</div>
					</div>
					<div class="ms_space ms_up_st progressbar' . ($energy < 20 ? ' levelcrit' : ($energy < 50 ? ' levelwarn' : '')) . '">
						<div class="progress" style="width: ' . round(min(100, $energy)) . '%">
							<p>Energi: ' . ($energy == 100 ? '100' : game::format_num($energy, 2)) . ' %</p>
						</div>
					</div>
					<div class="ms_space ms_up_st progressbar' . ($protection !== false ? $protection < 20 ? ' levelcrit' : ($protection < 50 ? ' levelwarn' : '') : '') . '">
						<div class="progress" style="width: ' . round(min(100, $protection)) . '%">
							<p>Beskyttelse: ' . ($protection === false ? 'Ingen' : ($protection == 100 ? '100' : game::format_num($protection, 2)) . ' %') . '</p>
						</div>
					</div>
					<div class="ms_space ms_up_st progressbar' . ($training !== false ? $training < 28 ? ' levelcrit' : ($training < 35 ? ' levelwarn' : '') : '') . '">
						<div class="progress" style="width: ' . round(min(100, $training)) . '%">
							<p><a href="' . ess::$s['relative_path'] . '/angrip">Våpentrening</a>: ' . ($training === false ? 'Ingen våpen' : ($training == 100 ? '100' : game::format_num($training, 2)) . ' %') . '</p>
						</div>
					</div>
					<div class="progressbar ms_space">
						<div class="progress" style="width: ' . round(min(100, page_min_side::$active_player->data['up_wanted_level'] / 10)) . '%">
							<p>Wanted nivå: ' . game::format_number(page_min_side::$active_player->data['up_wanted_level'] / 10, 1) . ' %</p>
						</div>
					</div>
				</div>' : '') . ($rank_prosent < 100 ? '
				<div class="bg1_c">
					<h1 class="bg1">Prosent til neste rank<span class="left2"></span><span class="right2"></span></h1>
					<div class="progressbar">
						<div class="progress" style="width: ' . round($rank_prosent) . '%">
							<p>' . game::format_number($rank_prosent, 3) . ' %' . ($rank_need > 0 ? ' (trenger ' . game::format_num($rank_need) . ' poeng)' : '') . '</p>
						</div>
					</div>
				</div>' : '') . '
				<div class="bg1_c">
					<h1 class="bg1">Prosent til høyeste rank<span class="left2"></span><span class="right2"></span></h1>
					<div class="progressbar">' . (page_min_side::$active_player->rank['number'] < 5 && !access::has("mod") ? '
						<p>Krever ranken <b>' . game::$ranks['items_number'][5]['name'] . '</b> eller høyere!</p>' : '
						<div class="progress" style="width: ' . min(round($rank_prosent_top), 100) . '%">
							<p>' . game::format_number($rank_prosent_top, 4) . ' % (' . game::format_num(page_min_side::$active_player->data['up_points']) . ' poeng)</p>
						</div>') . '
					</div>
				</div>
				<div class="bg1_c">
					<h1 class="bg1">Rangstige<span class="left2"></span><span class="right2"></span></h1>';
        $ranks = array_reverse(game::$ranks['items_number']);
        $active = page_min_side::$active_player->rank['number'];
        $split = false;
        foreach ($ranks as $rank) {
            if ($split) {
                echo '
						<div class="split"></div>';
            }
            if ($rank['number'] <= $active) {
                echo '
						<div class="progressbar_v"' . ($rank['number'] == $active ? ' style="font-weight: bold"' : '') . '>
							<p>' . $rank['number'] . ' - ' . $rank['name'] . '</p>
						</div>';
            } elseif ($rank['number'] == $active + 1) {
                echo '
						<div class="progressbar_v">
							<div class="progress" style="height: ' . round(100 - $rank_prosent) . '%">
								<p>' . $rank['number'] . ' - ' . $rank['name'] . '</p>
							</div>
						</div>';
            } else {
                echo '
						<div class="progressbar_v">
							<div class="progress">
								<p>' . $rank['number'] . ' - ' . $rank['name'] . '</p>
							</div>
						</div>';
            }
            $split = true;
        }
        echo '
				</div>
			</div>
		</div>
		<div class="col_w right">
			<div class="col">';
        if (page_min_side::$active_player->active) {
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Status<span class="left2"></span><span class="right2"></span></h1>
					<div class="bg1">
						<dl class="dl_40 status">';
            foreach ($status as $key => $row) {
                echo '
							<dt>' . htmlspecialchars($row[0]) . '</dt>
							<dd>' . ($row[1] == -1 ? '<span class="status_venter">For lav rank</span>' : ($row[1] == 0 ? '<a href="' . htmlspecialchars($row[2]) . '" class="status_klar">Klar!</a>' : '<a href="' . htmlspecialchars($row[2]) . '" rel="' . $row[1] . '" id="min_side_' . $key . '" class="status_venter">' . game::timespan($row[1], 0, 5) . '</a>')) . '
							</dd>';
            }
            echo '
					</div>
				</div>';
        } elseif (page_min_side::$active_player->data['up_deactivated_dead'] != 0) {
            $instant = page_min_side::$active_player->data['up_deactivated_dead'] == 1;
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Drept<span class="left2"></span><span class="right2"></span></h1>' . (access::has("mod") ? '
					<p class="h_right"><a href="' . htmlspecialchars(page_min_side::addr("activate")) . '">aktiver</a></p>' : '') . '
					<div class="bg1">
						<p>Denne spilleren ' . ($instant ? 'ble drept' : 'døde av skader') . (access::has("mod") ? $instant ? ' av <user id="' . page_min_side::$active_player->data['up_deactivated_up_id'] . '" />' : ' påført av <user id="' . page_min_side::$active_player->data['up_deactivated_up_id'] . '" />' : '') . ' ' . ess::$b->date->get(page_min_side::$active_player->data['up_deactivated_time'])->format(date::FORMAT_SEC) . '.</p>
					</div>
				</div>';
        } else {
            // deaktivert av seg selv?
            $deact_self = false;
            if (!empty(page_min_side::$active_player->data['up_deactivated_up_id'])) {
                $deact_self = page_min_side::$active_player->data['up_deactivated_up_id'] == page_min_side::$active_player->id;
                if (!$deact_self) {
                    $result = \Kofradia\DB::get()->query("SELECT u_id FROM users JOIN users_players ON u_id = up_u_id WHERE up_id = " . page_min_side::$active_player->data['up_deactivated_up_id']);
                    $row = $result->fetch();
                    unset($result);
                    if ($row && $row['u_id'] == page_min_side::$active_user->id) {
                        $deact_self = true;
                    }
                }
            }
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Deaktivert<span class="left2"></span><span class="right2"></span></h1>' . (access::has("mod") ? '
					<p class="h_right"><a href="' . htmlspecialchars(page_min_side::addr("cdeact")) . '">rediger</a> <a href="' . htmlspecialchars(page_min_side::addr("activate")) . '">aktiver</a></p>' : '') . '
					<div class="bg1">' . ($deact_self ? '
						<p>Denne spilleren deaktiverte seg selv ' . ess::$b->date->get(page_min_side::$active_player->data['up_deactivated_time'])->format(date::FORMAT_SEC) . '.</p>' : '
						<p>Denne spilleren ble deaktivert ' . ess::$b->date->get(page_min_side::$active_player->data['up_deactivated_time'])->format(date::FORMAT_SEC) . (!page_min_side::$active_own ? ' av ' . (empty(page_min_side::$active_player->data['up_deactivated_up_id']) ? 'en ukjent bruker' : '<user id="' . page_min_side::$active_player->data['up_deactivated_up_id'] . '" />') : '') . '.</p>') . '
						<div class="p"><b>Begrunnelse:</b> ' . (empty(page_min_side::$active_player->data['up_deactivated_reason']) ? 'Ingen begrunnelse oppgitt.' : game::bb_to_html(page_min_side::$active_player->data['up_deactivated_reason'])) . '</div>' . (!page_min_side::$active_own && !$deact_self ? '
						<div class="p"><b>Intern informasjon:</b> ' . (access::has("mod") ? empty(page_min_side::$active_player->data['up_deactivated_note']) ? 'Ingen intern informasjon oppgitt.' : game::bb_to_html(page_min_side::$active_player->data['up_deactivated_note']) : 'Du har ikke tilgang til å se intern informasjon.') . '</div>' : '') . '
					</div>
				</div>';
        }
        echo '
				<div class="bg1_c">
					<h1 class="bg1">Avstand til neste rangert spiller<span class="left2"></span><span class="right2"></span></h1>
					<div class="bg1">
						' . ($rank_user_next ? $rank_user_next : '<p>Du er høyest rangert!</p>') . ($rank_user_prevnext ? '
						<div class="progressbar ms_space_bt">
							<div class="progress" style="width: ' . round($rank_user_prevnext) . '%">
								<p>Avstand forrige/neste spiller: ' . game::format_number($rank_user_prevnext, 4) . ' %</p>
							</div>
						</div>' : '') . '
					</div>
				</div>';
        if (page_min_side::$active_player->active) {
            OFC::embed("ranklevel_last_days", "graphs/ranklevel_last_days?up_id=" . page_min_side::$active_player->id, "100%", 150);
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Ditt ranknivå siste dagene<span class="left2"></span><span class="right2"></span></h1>
					<div class="bg1" style="padding: 0 0 5px; background-color: #1A1A1A">
						<p style="font-size: 10px; margin: 5px">Denne grafen sammenlikner deg med de 10 beste rankerne de siste dagene.</p>
						<span id="ranklevel_last_days"></span>
					</div>
				</div>';
        }
        echo '
			</div>
		</div>
	</div>';
    }
Exemple #7
0
$time = $_base->date->get();
$time->modify("-50 days");
$time->setTime(0, 0, 0);
$expire = $time->format("U");
$stats = array();
$today = $_base->date->get()->format("Y-m-d");
while (true) {
    $day = $time->format("Y-m-d");
    $stats[$day] = 0;
    $time->modify("+1 day");
    if ($day == $today) {
        break;
    }
}
$result = \Kofradia\DB::get()->query("SELECT DATE(FROM_UNIXTIME(uhi_secs_hour)) day, SUM(uhi_points)/COUNT(DISTINCT uhi_up_id) avg_points FROM users_hits WHERE uhi_secs_hour >= {$expire} GROUP BY DATE(FROM_UNIXTIME(uhi_secs_hour))");
while ($row = $result->fetch()) {
    $stats[$row['day']] = (int) $row['avg_points'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Gjennomsnittlig rankaktivitet per bruker"));
$ofc->tooltip()->title("font-size: 13px;font-weight:bold");
$bar = new OFC_Charts_Area();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# rankpoeng");
$bar->text("Gjennomsnittlig antall rankpoeng per bruker");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->rotate(330)->labels(array_keys($stats))->steps(3);
$ofc->axis_y()->set_numbers(min(0, min($stats)), max($stats));
$ofc->dark_colors();
$ofc->dump();
}
// hent dagstatistikk
$result = \Kofradia\DB::get()->query("SELECT WEEKDAY(FROM_UNIXTIME(uhi_secs_hour)) AS date, SUM(uhi_hits) sum_hits, SUM(uhi_hits_redirect) sum_hits_redirect FROM users_hits, users_players WHERE up_u_id = {$u_id} AND up_id = uhi_up_id GROUP BY WEEKDAY(FROM_UNIXTIME(uhi_secs_hour)) ORDER BY date");
while ($row = $result->fetch()) {
    $stats[$row['date'] + 1] = (int) $row['sum_hits'];
    $stats_redir[$row['date'] + 1] = (int) $row['sum_hits_redirect'];
}
$x = array();
global $_lang;
foreach ($stats as $date => $dummy) {
    if ($date == 7) {
        $date = 0;
    }
    $x[] = $_lang['weekdays'][$date];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Sidevisninger for {$up_name}"));
$bar = new OFC_Charts_Bar();
$bar->text("Antall visninger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# visninger");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Bar();
$bar->text("Antall videresendinger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# videresendinger");
$bar->values(array_values($stats_redir));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(ceil(count($x) / 20))->rotate(330)->labels($x);
$ofc->axis_y()->set_numbers(0, max(max($stats), max($stats_redir)));
    $stats[$day] = 0;
    $stats_redir[$day] = 0;
    $time->modify("+1 day");
    if ($day == $today) {
        break;
    }
}
$time->modify("-1 sec");
$time_to = $time->format("U");
// hent dagstatistikk
$result = \Kofradia\DB::get()->query("SELECT DATE(FROM_UNIXTIME(uhi_secs_hour)) AS date, SUM(uhi_hits) sum_hits, SUM(uhi_hits_redirect) sum_hits_redirect FROM users_hits, users_players WHERE up_u_id = {$u_id} AND up_id = uhi_up_id AND uhi_secs_hour >= {$time_from} AND uhi_secs_hour <= {$time_to} GROUP BY DATE(FROM_UNIXTIME(uhi_secs_hour))");
while ($row = $result->fetch()) {
    $stats[$row['date']] = (int) $row['sum_hits'];
    $stats_redir[$row['date']] = (int) $row['sum_hits_redirect'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Sidevisninger for {$up_name} siste periode"));
$bar = new OFC_Charts_Area();
$bar->text("Antall visninger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# visninger");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Area();
$bar->text("Antall videresendinger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# videresendinger");
$bar->values(array_values($stats_redir));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->steps(2)->label()->steps(4)->rotate(330)->labels(array_keys($stats));
$ofc->axis_y()->set_numbers(0, max(max($stats), max($stats_redir)));
    while ($row = $result->fetch()) {
        $stats_avg[$row['day']] = (int) $row['avg_points'];
    }
} else {
    $today = ess::$b->date->get()->format("Y-m-d");
    $stats[$today] = 0;
    $stats_avg[$today] = 0;
}
// regn om til prosent
foreach ($stats as $day => &$value) {
    if ($stats_avg[$day] > 0) {
        $value = round($value / $stats_avg[$day] * 100, 1);
    } else {
        $value = (int) $value;
    }
}
$stats = array_reverse($stats);
$ofc = new OFC();
$ofc->title(new OFC_Title("Rankaktivitet"));
$ofc->tooltip()->title("font-size: 13px;font-weight:bold");
$bar = new OFC_Charts_Area();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# %");
#$bar->text("Ranking ift. 5 beste rankere");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->labels(array_keys($stats))->steps(0);
$ofc->axis_y()->set_numbers(min(floor(min($stats)), 0), max(100, ceil(max($stats))));
$ofc->dark_colors();
$ofc->bg_colour("#282828");
$ofc->dump();
Exemple #11
0
<?php

require "graphs_base.php";
ajax::require_user();
global $_base;
// hent stats
$result = \Kofradia\DB::get()->query("SELECT name, extra, value, time FROM sitestats");
$sitestats = array();
$max = 0;
while ($row = $result->fetch()) {
    $sitestats[$row['name']][$row['extra']] = (int) $row['value'];
    $max = max($max, $row['value']);
}
$ofc = new OFC();
$c = new OFC_Colours();
$ofc->title(new OFC_Title("Rekord for antall pålogget"));
$ofc->tooltip()->title("font-size: 13px;font-weight:bold");
$info = array("max_online_900" => "15 minutter", "max_online_300" => "5 minutter", "max_online_60" => "1 minutt", "max_online_30" => "30 sekunder");
foreach ($info as $key => $title) {
    $bar = new OFC_Charts_Area();
    $bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("Rekord for #x_label#:<br>#val# i løpet av {$title}");
    $bar->text($title);
    $bar->values(array_values($sitestats[$key]));
    $bar->colour($c->pick());
    $ofc->add_element($bar);
}
$x_label = array();
foreach (array_keys($sitestats['max_online_60']) as $val) {
    $x_label[] = "{$val}:00 - " . ($val + 1) . ":00";
}
$ofc->axis_x()->label()->rotate(340)->labels($x_label)->steps(2);
Exemple #12
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();
Exemple #13
0
    /** Vis oversikt over statistikk */
    protected static function show_stats()
    {
        // hent litt statistikk
        $result = \Kofradia\DB::get()->query("SELECT COUNT(su_id) FROM support");
        $totalt = $result->fetchColumn(0);
        // hent spillere med status..
        $result = \Kofradia\DB::get()->query("SELECT up_id, up_name, up_access_level, up_last_online FROM users_players WHERE up_access_level > 1 ORDER BY up_name");
        $players = array();
        $last_online = array();
        while ($row = $result->fetch()) {
            if ($row['up_access_level'] == 4) {
                $level = 3;
            } elseif ($row['up_access_level'] == 6) {
                $level = 3;
            } elseif ($row['up_access_level'] == 8) {
                $level = 7;
            } else {
                $level = $row['up_access_level'];
            }
            $players[$level][] = $row;
            $last_online[$row['up_id']] = $row['up_last_online'];
        }
        // hent antall besvarelser per bruker
        $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT sum_up_id, COUNT(sum_id) num_sum, MAX(sum_time) max_sum_time, m.up_last_online, m.up_access_level\n\t\t\tFROM support\n\t\t\t\tJOIN support_messages ON sum_su_id = su_id\n\t\t\t\tJOIN users_players s ON s.up_id = su_up_id\n\t\t\t\tJOIN users_players m ON m.up_id = sum_up_id AND m.up_u_id != s.up_u_id\n\t\t\tGROUP BY sum_up_id");
        $reply_users = array();
        while ($row = $result->fetch()) {
            if ($row['max_sum_time'] < time() - 2592000 && ($row['up_access_level'] == 0 || $row['up_access_level'] == 1)) {
                continue;
            }
            $reply_users[$row['sum_up_id']] = $row['num_sum'];
            $last_online[$row['sum_up_id']] = $row['up_last_online'];
        }
        // vis oversikt
        echo '
<table class="table center" style="width: 400px">
	<thead>
		<tr>
			<th colspan="3">Besvarte henvendelser</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td colspan="2">Antall henvendelser totalt</td>
			<td>' . game::format_number($totalt) . ' stk</td>
		</tr>
		<tr>
			<th colspan="3">Administratorer</th>
		</tr>' . self::show_stats_users($players, 7, $reply_users, $last_online) . '
		<tr>
			<th colspan="3">Seniormoderatorer</th>
		</tr>' . self::show_stats_users($players, 11, $reply_users, $last_online) . '
		<tr>
			<th colspan="3">Moderatorer</th>
		</tr>' . self::show_stats_users($players, 5, $reply_users, $last_online) . '
		<tr>
			<th colspan="3">Forummoderatorer</th>
		</tr>' . self::show_stats_users($players, 3, $reply_users, $last_online);
        // noen andre folk?
        if (count($reply_users) > 0) {
            echo '
		<tr>
			<th colspan="3">Andre brukere</th>
		</tr>';
            $i = 0;
            foreach ($reply_users as $player => $ant) {
                echo '
		<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
			<td><user id="' . $player . '" /></td>
			<td class="r">' . game::format_number($ant) . '</td>
			<td class="r">' . game::timespan($last_online[$player], game::TIME_ABS) . '</td>
		</tr>';
            }
        }
        echo '
	</tbody>
</table>';
        // statistikk for de siste 30 ukene
        $uker = 30;
        $limit = 7 * $uker;
        $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT num_su, num_sum, date_sum\n\t\t\tFROM\n\t\t\t\t(SELECT COUNT(sum_id) num_sum, DATE(FROM_UNIXTIME(sum_time)) date_sum\n\t\t\t\t\tFROM support_messages\n\t\t\t\t\tGROUP BY DATE(FROM_UNIXTIME(sum_time))\n\t\t\t\t\tORDER BY date_sum DESC\n\t\t\t\t\tLIMIT {$limit}) ref_sum\n\t\t\t\tLEFT JOIN\n\t\t\t\t(SELECT COUNT(su_id) num_su, DATE(FROM_UNIXTIME(su_time)) date_su\n\t\t\t\t\tFROM support\n\t\t\t\t\tGROUP BY DATE(FROM_UNIXTIME(su_time))\n\t\t\t\t\tORDER BY date_su DESC\n\t\t\t\t\tLIMIT {$limit}) ref_su ON date_sum = date_su\n\t\t\tORDER BY date_sum DESC\n\t\t\tLIMIT {$limit}");
        $data = array();
        $d = ess::$b->date->get();
        for ($i = 0; $i < $uker; $i++) {
            $w = $d->format("o-W");
            $data['labels'][$w] = $w;
            $data['sum'][$w] = 0;
            $data['su'][$w] = 0;
            $d->modify("-1 week");
        }
        while ($row = $result->fetch()) {
            $w = ess::$b->date->parse($row['date_sum'])->format("o-W");
            if (!isset($data['labels'][$w])) {
                continue;
            }
            $data['sum'][$w] += (int) $row['num_sum'];
            $data['su'][$w] += (int) $row['num_su'];
        }
        // reverser så nyeste kommer sist
        $data['labels'] = array_reverse($data['labels']);
        $data['sum'] = array_reverse($data['sum']);
        $data['su'] = array_reverse($data['su']);
        $ofc = new OFC();
        $bar = new OFC_Charts_Area();
        $bar->text("Antall meldinger");
        $bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# meldinger");
        $bar->values(array_values($data['sum']));
        $bar->colour(OFC_Colours::$colours[1]);
        $ofc->add_element($bar);
        $bar = new OFC_Charts_Area();
        $bar->text("Antall henvendelser");
        $bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# henvendelser");
        $bar->values(array_values($data['su']));
        $bar->colour(OFC_Colours::$colours[0]);
        $ofc->add_element($bar);
        $ofc->axis_x()->label()->steps(2)->rotate(330)->labels(array_values($data['labels']));
        $ofc->axis_y()->set_numbers(0, max(max($data['sum']), max($data['su'])));
        $ofc->dark_colors();
        ess::$b->page->add_js('
function open_flash_chart_data()
{
	return ' . js_encode((string) $ofc) . ';
}');
        ess::$b->page->add_js_file(LIB_HTTP . '/swfobject/swfobject.js');
        ess::$b->page->add_js_domready('swfobject.embedSWF("' . LIB_HTTP . '/ofc/open-flash-chart.swf", "stats_support", "100%", 250, "9.0.0");');
        echo '
<div class="bg1_c small">
	<h2 class="bg1">Statistikk over henvendelser til support<span class="left2"></span><span class="right2"></span></h2>
	<div class="bg1" style="padding: 10px">
		<div id="stats_support"></div>
	</div>
</div>';
    }
Exemple #14
0
$today = $_base->date->get()->format("Y-m-d");
while (true) {
    $day = $time->format("Y-m-d");
    $stats_normal[$day] = 0;
    $stats_redirect[$day] = 0;
    $time->modify("+1 day");
    if ($day == $today) {
        break;
    }
}
$result = \Kofradia\DB::get()->query("SELECT DATE(FROM_UNIXTIME(uhi_secs_hour)) day, SUM(uhi_hits) sum_hits, SUM(uhi_hits_redirect) sum_hits_redirect FROM users_hits WHERE uhi_secs_hour >= {$expire} GROUP BY DATE(FROM_UNIXTIME(uhi_secs_hour))");
while ($row = $result->fetch()) {
    $stats_normal[$row['day']] = (int) $row['sum_hits'];
    $stats_redirect[$row['day']] = (int) $row['sum_hits_redirect'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Antall sidevisninger"));
$ofc->tooltip()->title("font-size: 13px;font-weight:bold");
$bar = new OFC_Charts_Area();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# visninger");
$bar->text("Antall visninger");
$bar->values(array_values($stats_normal));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Area();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# videresendinger");
$bar->text("Antall videresendinger");
$bar->values(array_values($stats_redirect));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->rotate(330)->labels(array_keys($stats_normal))->steps(3);
Exemple #15
0
$date->setTime(0, 0, 0);
$time_from = $date->format("U");
$date->modify("+1 month -1 sec");
$time_to = $date->format("U");
// sett opp timestatistikk
$days = $date->format("t");
$month = $date->format(date::FORMAT_MONTH);
$stats = array();
$stats_redir = array();
$x = array();
for ($i = 1; $i <= $days; $i++) {
    $stats[$i] = 0;
    $x[] = "{$i}. " . $month;
}
// hent dagstatistikk
$result = \Kofradia\DB::get()->query("SELECT DAY(FROM_UNIXTIME(uhi_secs_hour)) AS day, SUM(uhi_points) sum_points FROM users_hits, users_players WHERE up_u_id = {$u_id} AND up_id = uhi_up_id AND uhi_secs_hour >= {$time_from} AND uhi_secs_hour <= {$time_to} GROUP BY DAY(FROM_UNIXTIME(uhi_secs_hour))");
while ($row = $result->fetch()) {
    $stats[$row['day']] = (int) $row['sum_points'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Rankpoeng for {$up_name} - " . $date->format(date::FORMAT_MONTH) . " " . $date->format("Y")));
$bar = new OFC_Charts_Area();
$bar->text("Antall rankpoeng");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# poeng");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(2)->rotate(330)->labels($x);
$ofc->axis_y()->set_numbers(min($stats), max($stats));
$ofc->dark_colors();
echo $ofc;
Exemple #16
0
}
$stats = array();
$stats_redir = array();
$x_label = array();
for ($i = 0; $i <= 23; $i++) {
    $stats[$i] = 0;
    $stats_redir[$i] = 0;
    $x_label[] = "{$i}:00 - " . ($i + 1) . ":00";
}
// hent timestatistikk
$result = \Kofradia\DB::get()->query("SELECT HOUR(FROM_UNIXTIME(uhi_secs_hour)) AS hour, SUM(uhi_hits) AS sum_hits, SUM(uhi_hits_redirect) AS sum_hits_redirect FROM users_hits, users_players WHERE up_u_id = {$u_id} AND uhi_up_id = up_id GROUP BY HOUR(FROM_UNIXTIME(uhi_secs_hour))");
while ($row = $result->fetch()) {
    $stats[$row['hour']] = (int) $row['sum_hits'];
    $stats_redir[$row['hour']] = (int) $row['sum_hits_redirect'];
}
$ofc = new OFC();
$c = new OFC_Colours();
$ofc->title(new OFC_Title("Gjennomsnittlig antall visninger for {$up_name}"));
$ofc->tooltip()->title("font-size: 13px;font-weight:bold");
$bar = new OFC_Charts_Area();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# visninger");
$bar->text("Antall visninger");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Area();
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# videresendinger");
$bar->text("Antall videresendinger");
$bar->values(array_values($stats_redir));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
Exemple #17
0
$time_end = $date->format("U");
$day_end = $date->format("Y-m-d");
$date->modify("-30 days");
$date->setTime(0, 0, 0);
$time_start = $date->format("U");
$stats = array();
while (true) {
    $day = $date->format("Y-m-d");
    $stats[$day] = 0;
    $date->modify("+1 day");
    if ($day == $day_end) {
        break;
    }
}
// hent statistikk
$result = \Kofradia\DB::get()->query("\n\tSELECT DATE(FROM_UNIXTIME(poker_time_start)) AS day, SUM(CONVERT(poker_prize - poker_cash, SIGNED) * IF((poker_winner = 1 AND poker_starter_up_id = up_id) OR (poker_winner = 2 AND poker_challenger_up_id = up_id), 1, -1)) sum_result\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))");
while ($row = $result->fetch()) {
    $stats[$row['day']] = (double) $row['sum_result'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Pokerstatistikk for {$up_name} siste 30 dager"));
$bar = new OFC_Charts_Area();
$bar->text("Resultat av poker");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# kr");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(2)->rotate(330)->labels(array_keys($stats));
$ofc->axis_y()->set_numbers(min(0, min($stats)), max($stats));
$ofc->dark_colors();
echo $ofc;
Exemple #18
0
$x = array();
for ($i = $time_from; $i < $time_to; $i += 3600) {
    $time = $_base->date->get($i);
    $stats[$time->format("dH")] = 0;
    $stats_redir[$time->format("dH")] = 0;
    $h = $time->format("H");
    $x[] = $h . ":00 - " . ($h + 1) . ":00";
}
// hent timestatistikk
$result = \Kofradia\DB::get()->query("SELECT uhi_secs_hour, uhi_hits, uhi_hits_redirect FROM users_hits, users_players WHERE up_u_id = {$u_id} AND up_id = uhi_up_id AND uhi_secs_hour >= {$time_from} AND uhi_secs_hour < {$time_to}");
while ($row = $result->fetch()) {
    $time = $_base->date->get($row['uhi_secs_hour']);
    $stats[$time->format("dH")] = (int) $row['uhi_hits'];
    $stats_redir[$time->format("dH")] = (int) $row['uhi_hits_redirect'];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Sidevisninger for {$up_name} siste 24 timer"));
$bar = new OFC_Charts_Area();
$bar->text("Antall visninger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# visninger");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Area();
$bar->text("Antall videresendinger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# videresendinger");
$bar->values(array_values($stats_redir));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(2)->rotate(330)->labels($x);
$ofc->axis_y()->set_numbers(0, max(max($stats), max($x)));