本文整理汇总了PHP中game::ranks方法的典型用法代码示例。如果您正苦于以下问题:PHP game::ranks方法的具体用法?PHP game::ranks怎么用?PHP game::ranks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game
的用法示例。
在下文中一共展示了game::ranks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
// hent innstillinger
self::$settings = cache::fetch("settings");
if (!self::$settings) {
// hent ny data
require PATH_APP . "/scripts/update_db_settings.php";
}
// hent bydeler
self::$bydeler = cache::fetch("bydeler");
if (!self::$bydeler) {
// hent ny data
require PATH_APP . "/scripts/update_db_bydeler.php";
}
// hent ranker
self::$ranks = cache::fetch("ranks");
if (!self::$ranks) {
// hent ny data
require PATH_APP . "/scripts/update_db_ranks.php";
}
}
示例2: array
<?php
// denne filen henter informasjon om rankene og lagrer til cache
game::$ranks = array("items" => array(), "items_number" => array(), "pos" => array(), "pos_max" => 0);
// hent rankene
$result = \Kofradia\DB::get()->query("SELECT id, name, points, rank_max_health, rank_max_energy FROM ranks ORDER BY points");
// sett opp data
$i = 0;
$last_id = 0;
while ($row = $result->fetch()) {
// oppdater need_points til den forrige raden
if ($last_id) {
game::$ranks['items'][$last_id]['need_points'] = $row['points'] - game::$ranks['items'][$last_id]['points'];
game::$ranks['items_number'][$i]['need_points'] = $row['points'] - game::$ranks['items'][$last_id]['points'];
}
$row['number'] = ++$i;
game::$ranks['items'][$row['id']] = $row;
game::$ranks['items_number'][$i] = game::$ranks['items'][$row['id']];
$last_id = $row['id'];
}
// oppdater need_points til den siste raden
if ($last_id) {
game::$ranks['items'][$last_id]['need_points'] = 0;
game::$ranks['items_number'][$i]['need_points'] = 0;
}
// hent rankene for posisjonene
$result = \Kofradia\DB::get()->query("SELECT pos, name FROM ranks_pos ORDER BY pos");
$i = 0;
while ($row = $result->fetch()) {
$row['number'] = ++$i;
game::$ranks['pos'][$row['pos']] = $row;