本文整理汇总了PHP中get_rank函数的典型用法代码示例。如果您正苦于以下问题:PHP get_rank函数的具体用法?PHP get_rank怎么用?PHP get_rank使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_rank函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_ranklist
function get_ranklist($param)
{
global $redis;
$size = isset($param['size']) ? $param['size'] : RANKLIST_SIZE;
if (isset($param['user'])) {
//get user's rank
require_once 'get_rank.php';
$my_rank = get_rank($param) - 1;
//as in redis rank is start from 0
}
if (isset($my_rank)) {
$upper = floor($size * 0.5);
$from_rank = max($my_rank - $upper, 0);
} else {
//if $my_rank not exists, show fromrank to torank
$from_rank = isset($param['from']) && $param['from'] > 0 ? $param['from'] - 1 : RANKLIST_FROM;
}
$to_rank = $from_rank + $size - 1;
$ranking_data = $redis->zRevRange(REDIS_TABLE_RANKING, $from_rank, $to_rank, true);
//get user names and reconstuct return data
$return_data = array();
$count = 1;
foreach ($ranking_data as $key => $score) {
$username = $redis->hGet(REDIS_TABLE_USERS, $key);
$return_data[] = array('rank' => $from_rank + $count++, 'user' => $key, 'username' => $username, 'score' => $score);
}
return $return_data;
}
示例2: get_percentage
<li>
<ul class="score">
<li>Score: <?php
echo $score;
?>
out of <?php
echo $amount;
?>
</li>
<li class="center">Percentage: <?php
echo get_percentage($score, $amount);
?>
</li>
<li>Rank: #<?php
echo get_rank($username, $quizid);
?>
in <?php
echo $people;
?>
</li>
<div class="clear"></div>
</ul>
</li>
<?php
}
}
if ($status == 'grade') {
foreach ($main['query']->result() as $row) {
?>
<li>
示例3: get_rank
<table class="table orders_table">
<thead>
<tr>
<th>#</th>
<th></th>
<th>Catg</th>
<th>Tops</th>
<th>Flashs</th>
<th>Σ Flashs</th>
<th>Σ</th>
</tr>
</thead>
<tbody style="display: table-row-group;">
<?php
//echo $start;
$score_m = get_rank($cat, $start, $qty);
//vd($score_m);
//die;
$pos = $start;
foreach ($score_m as $key => $position) {
$pos++;
if ($pos % 2 == 0) {
///$color="#2F4F4F";
$color = "#333";
} else {
$color = "black";
}
$color_gender = "blue";
if ($position["gender"] == "female") {
$color_gender = "red";
}
示例4: redirect
}*/
$changed = PlayerDAO::saveDetails($char);
redirect('/stats.php?changed=' . (int) $changed . ($profile_changed ? '&profile_changed=1' : ''));
}
/*
if(false && DEBUG){
$description = 'This is a description here and all';
$goals = 'Kill ninja of the ramen clan';
$beliefs = 'I believe in a one true ninja god';
$instincts = 'When I hear whistling, I duck';
$traits = 'Hardy, nervous, meaty, silent';
}
*/
$player = self_info();
//$player['created_date']=$player['created_date']? date("c", strtotime($player['created_date'])) : null;
$class_theme = class_theme($char->class_identity());
$level_category = level_category($player['level']);
$status_list = get_status_list();
$gravatar_url = generate_gravatar_url($player['player_id']);
$gurl = $gravatar_url;
$rank_display = get_rank($char_id);
// rank display.
$profile_editable = $player['messages'];
$parts = get_certain_vars(get_defined_vars(), ['player', 'level_category', 'status_list', 'description', 'goals', 'beliefs', 'instincts', 'traits', 'dev', 'changed']);
// Set the parts array's player clan if any is found.
if ($parts['player_clan'] = get_clan_by_player_id($char_id)) {
// Set the char clan name and id for later usage.
$parts['clan_name'] = $parts['player_clan']->getName();
$parts['clan_id'] = $parts['player_clan']->getID();
}
display_page('stats.tpl', 'Ninja Stats', $parts, array('quickstat' => 'player'));
示例5: count
<?php //start if done empty not true
if($signoff_empty != true) { ?>
<table class="myTable" cellpadding="0" cellpadding="0" class="listing" width="100%">
<tr>
<th class="" width="5%">Priority</th>
<th class="" width="50%">Title</th>
<th class="" width="15%">Warrior</th>
<th class="" width="15%">Sweat Points</th>
<th class="" width="12%">Payout</th>
<th class="" width="1%"></th>
</tr>
<?php $c = count($work_list_signoff); for($i = 0; $i < $c; $i++): ?>
<tr class="story-title <?php if($i%2){ ?>odd-row<?php }else{?>even-row<?php } ?>">
<td><?php echo $work_list_signoff[$i]['priority'] ?></td>
<td><span class="type_<?php echo $work_list_signoff[$i]['type'] ?>"> <?php echo $work_list_signoff[$i]['title'] ?></a> </span></td>
<td><?php echo get_rank($work_list_signoff[$i]['work_horse']);?></td>
<td><div class="sweat-shirt-<?php echo points_size($work_list_signoff[$i]['points']) ?>">
<?php echo $work_list_signoff[$i]['points'] ?></td>
</div>
<td style="text-align: right"> RM <?php echo number_format($work_list_signoff[$i]['cost']) ?></td>
<td><div class="arrow"> </div></td>
</tr>
<tr>
<td colspan="6" class="details"><p> <?php echo $work_list_signoff[$i]['description'] ?> </p>
<br />
<a href="/story/<?php echo $work_list_signoff[$i]['work_id'] ?>">More details</a></td>
</tr>
<?php endfor; ?>
</table>
<?php }
//start else signoff empty not true
示例6: get_info
function get_info($gc)
{
// if($relocation_flg==1){
// $tesuryou[1] = 20000;
// $tesuryou[2] = 20000;
// $tesuryou[3] = 20000;
// $tesuryou[4] = 20000;
// }else{
//
// if($gc->menseki < 30){
// $tesuryou[1] = 20000;
// $tesuryou[2] = 13000;
// $tesuryou[3] = 10000;
// $tesuryou[4] = 5000;
// }elseif($gc->menseki < 50){
// $tesuryou[1] = 26000;
// $tesuryou[2] = 19000;
// $tesuryou[3] = 16000;
// $tesuryou[4] = 7000;
// }elseif($gc->menseki < 70){
// $tesuryou[1] = 35000;
// $tesuryou[2] = 25000;
// $tesuryou[3] = 20000;
// $tesuryou[4] = 8000;
// }else{
// $tesuryou[1] = 52000;
// $tesuryou[2] = 43000;
// $tesuryou[3] = 32000;
// $tesuryou[4] = 10000;
// }
//
// }
$relocation_flg = f_bool_edit_db($_POST["relocation_flg"], "0");
$rank = get_rank($gc);
if ($relocation_flg == 1) {
$tesuryou[1] = 15000;
$tesuryou[2] = 15000;
$tesuryou[3] = 15000;
$tesuryou[4] = 15000;
} else {
$tesuryou[1] = 15000;
$tesuryou[2] = 15000;
$tesuryou[3] = 8000;
$tesuryou[4] = 8000;
}
$info["rank"] = $rank;
//ライトプランのとき 金額だけ知りたいとき
if ($_POST["purpose_flg"] == 1) {
$info["tesuryou"] = 2500;
} else {
$info["tesuryou"] = $tesuryou[$rank];
}
return $info;
}
示例7: get_rank
$cmdr_rank_explore_icon .= '</a>';
$cmdr_rank_cqc = "";
$cmdr_rank_cqc_icon = "";
if ($settings["show_cqc_rank"] == "true") {
$cmdr_rank_cqc = $api["commander"]->{"rank"}->{"cqc"};
$cmdr_rank_cqc_icon = '<a href="#" title="CQC rank: ' . get_rank("cqc", $cmdr_rank_cqc, false) . '">';
$cmdr_rank_cqc_icon .= '<img src="' . get_rank("cqc", $cmdr_rank_cqc + 1) . '" class="status_img" alt="cqc" style="margin-right:6px" />';
$cmdr_rank_cqc_icon .= '</a>';
}
/**
* additional info
*/
$cmdr_rank_fed = $api["commander"]->{"rank"}->{"federation"};
$fed_rank = get_rank("federation", $cmdr_rank_fed, false);
$cmdr_rank_empire = $api["commander"]->{"rank"}->{"empire"};
$empire_rank = get_rank("empire", $cmdr_rank_empire, false);
$additional = '<div id="cmdr_status_mi" style="display:none">';
$additional .= '<strong>Federation rank:</strong> ' . $fed_rank . '<br />';
$additional .= '<strong>Empire rank:</strong> ' . $empire_rank;
$additional .= '</div>';
$data["cmdr_status"] = $cmdr_rank_combat_icon . $cmdr_rank_trade_icon . $cmdr_rank_explore_icon . $cmdr_rank_cqc_icon . $additional;
$data["cmdr_balance_status"] = '<img src="/style/img/rare.png" class="balance_pic" alt="Cr" />' . $cmdr_credits . ' CR';
}
}
/**
* show ship status
*/
$data["ship_status"] = "false";
if (isset($api["ship"]) && $settings["show_ship_status"] == "true") {
if ($api["ship"] == "no_data") {
$data["ship_status"] = '<a href="/Admin/API_login.php">No data, reconnect API</a>';
示例8: if
<?php if($show_bid == true) { ?>
<?php foreach($bid_data as $bid) { ?>
<tr>
<td><?php echo get_rank($bid['user_id']);?></td>
<td>RM <?php echo $bid['bid_cost']; ?></td>
<td><?php echo $bid['days']; ?></td>
<td><?php if($bid['bid_status'] == "Bid") { ?>
<?php if(strtolower($bid['work_status'])=='open' || strtolower($bid['work_status'])=='reject') {?><a href="/story/bid_accept/<?php echo $bid["bid_id"]; ?>">Accept</a><?php }else{?>No action <?php }?>
<?php } else { echo $bid['bid_status']; } ?>
</td>
</tr>
<?php } ?>
<?php }else{ ?>
<?php foreach($bid_data as $bid) if($bid['user_id'] == $userid){ ?>
<tr>
<td><?php echo get_rank($bid['user_id']);?></td>
<td>RM <?php echo $bid['bid_cost']; ?></td>
<td><?php echo $bid['days']; ?></td>
<td><?php if($bid['bid_status'] == "Bid") { ?>Bid
<?php } else { echo $bid['bid_status']; } ?>
</td>
</tr>
<?php } ?>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
<!--end of bid-admin tools-->
<?php }?>
示例9: number_format
*/
/** @require functions */
require_once $_SERVER["DOCUMENT_ROOT"] . "/source/functions.php";
/** @require configs */
require_once $_SERVER["DOCUMENT_ROOT"] . "/source/config.inc.php";
$info = "";
/**
* commander data
*/
if (isset($_GET["cmdr"])) {
$search = $_GET["cmdr"];
if (isset($api["commander"])) {
if ($search == "balance") {
$info = number_format($api["commander"]->{"credits"});
} elseif ($search == "rank" && isset($_GET["of"])) {
$info = get_rank($_GET["of"], $api["commander"]->{"rank"}->{$_GET["of"]}, false);
}
}
}
/**
* ship data
*/
if (isset($_GET["ship"])) {
$search = $_GET["ship"];
if (isset($api["ship"])) {
switch ($search) {
case "name":
$info = ship_name($api["ship"]->{"name"});
break;
case "health":
$info = number_format($api["ship"]->{"health"}->{"hull"} / 10000, 1);
示例10: in
$searched = in('searched', null, 'no filter');
// Don't filter the search setting.
$list_by_rank = $searched && substr_compare($searched, '#', 0, 1) === 0;
// Whether the search is by rank.
$hide_setting = !$searched && SESSION::is_set('hide_dead') ? SESSION::get('hide_dead') : 'dead';
// Defaults to hiding dead via session.
$hide = $searched ? 'none' : in('hide', $hide_setting);
// search override > get setting > session setting
$alive_only = $hide == 'dead';
$page = in('page', 1);
// Page will get changed down below.
$alive_count = 0;
$record_limit = 20;
// *** The number of players that gets shown per page.
$view_type = in('view_type');
$rank = get_rank($char_id);
$dead_count = query_item("SELECT count(player_id) FROM rankings WHERE alive = false");
$page = in('page');
if (!$searched && $hide_setting != $hide) {
SESSION::set('hide_dead', $hide);
}
// Save the toggled state for later.
// Display the clear search and create the where clause for searching.
// If a search was made, specify letter or word-based search.
// If unless showing dead, check that health is > 0, or alive = true from the ranking.
// Otherwise, no searching was done, so the score
$where_clauses = array();
// Array to add where clauses to.
// Select some players from the ranking.
$queryParams = array();
if ($searched) {
示例11: get_rank_info
function get_rank_info($ranks_id, $programs_id, $id)
{
global $rank;
get_rank($ranks_id);
echo $rank;
}
示例12: headers
$h = new headers();
$h->startheaders();
include "mysql.php";
global $c;
$is = mysql_query("SELECT u.*,us.*,h.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.userid={$userid}", $c) or die(mysql_error());
$ir = mysql_fetch_array($is);
check_level();
$fm = money_formatter($ir['money']);
$cm = money_formatter($ir['crystals'], '');
$lv = date('F j, Y, g:i a', $ir['laston']);
$h->userdata($ir, $lv, $fm, $cm);
$h->menuarea();
print "<h3>General Info:</h2>";
$exp = (int) ($ir['exp'] / $ir['exp_needed'] * 100);
print "<table><tr><td><b>Name:</b> {$ir['username']}</td><td><b>Crystals:</b> {$cm}</td></tr><tr>\n<td><b>Level:</b> {$ir['level']}</td>\n<td><b>Exp:</b> {$exp}%</td></tr><tr>\n<td><b>Money:</b> {$fm}</td>\n<td><b>HP:</b> {$ir['hp']}/{$ir['maxhp']}</td></tr>\n<tr><td><b>Property:</b> {$ir['hNAME']}</td></tr></table>";
print "<hr><h3>Stats Info:</h3>";
$ts = $ir['strength'] + $ir['agility'] + $ir['guard'] + $ir['labour'] + $ir['IQ'];
$ir['strank'] = get_rank($ir['strength'], 'strength');
$ir['agirank'] = get_rank($ir['agility'], 'agility');
$ir['guarank'] = get_rank($ir['guard'], 'guard');
$ir['labrank'] = get_rank($ir['labour'], 'labour');
$ir['IQrank'] = get_rank($ir['IQ'], 'IQ');
$tsrank = get_rank($ts, 'strength+agility+guard+labour+IQ');
$ir['strength'] = number_format($ir['strength']);
$ir['agility'] = number_format($ir['agility']);
$ir['guard'] = number_format($ir['guard']);
$ir['labour'] = number_format($ir['labour']);
$ir['IQ'] = number_format($ir['IQ']);
$ts = number_format($ts);
print "<table><tr><td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td><td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td></tr>\n<tr><td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td><td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr>\n<tr><td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td><td><b>Total stats:</b> {$ts} [Ranked: {$tsrank}]</td></tr></table>";
$h->endpage();
示例13: build_table
function build_table($course)
{
global $CFG;
// Pull an iterator for grades for that user
$iter = pull_grade_iterator($course->userid, $course->id);
// Start the table object
$table = new stdClass();
$table->head = array(get_string('itemname', 'grades'), get_string('category', 'grades'), get_string('overridden', 'grades'), get_string('excluded', 'grades'), get_string('range', 'grades'), get_string('rank', 'grades'), get_string('feedback', 'grades'), get_string('finalgrade', 'grades'));
$table->data = array();
$table->rowclass = array();
// Function to get ranks of students in a specific grade item
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$total_users = get_total_users($course->id);
foreach ($iter as $grade) {
$line = array();
$cat = $grade->sql_grade_item->get_parent_category();
$fullname = $cat->fullname;
$itemtype = $grade->sql_grade_item->itemtype;
$decimals = $grade->sql_grade_item->get_decimals();
$rowclass = '';
if ($itemtype == 'category') {
$rowclass = $itemtype;
$itemname = $fullname . ' Category Total';
} elseif ($itemtype == 'course') {
$itemname = 'Course Total';
} else {
$itemname = $grade->sql_grade_item->itemname;
}
// Output the necessary information
$line[] = $itemname;
$line[] = $fullname == '?' ? $course->fullname : $fullname;
$line[] = $grade->is_overridden() ? 'Y' : 'N';
$line[] = $grade->is_excluded() ? 'Y' : 'N';
$line[] = format_float($grade->sql_grade_item->grademin, $decimals) . '-' . format_float($grade->sql_grade_item->grademax, $decimals);
$line[] = get_rank($grade, $total_users, $context);
$line[] = format_text($grade->feedback, $grade->feedbackformat);
$line[] = '<span class="' . passing_grade($grade->sql_grade_item->gradepass, $grade->finalgrade) . '">' . simple_grade_format_gradevalue($grade->finalgrade, $grade->sql_grade_item, true) . '</span>';
$table->data[] = $line;
$table->rowclass[] = $rowclass;
}
print_table($table);
}
示例14: elseif
if ($ir['jail']) {
$gain /= 2;
}
$db->query("UPDATE `userstats` SET `{$stat}` = `{$stat}` + {$gain} WHERE `userid` = {$userid}");
$db->query("UPDATE `users` SET `will` = {$ir['will']}, energy = energy - {$_POST['amnt']} WHERE `userid` = {$userid}");
$inc = $ir[$stat] + $gain;
$inc2 = $ir['energy'] - $_POST['amnt'];
if ($stat == "strength") {
print "\n <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px;\n margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>\n \n \n You start to lift some weights, You go heavier and heavier until You are out of energy.<br />\n You have gained {$gain} strength by doing {$_POST['amnt']} sets of weights.<br />\n You now have {$inc} strength and {$inc2} energy left. \n \n </div></div> \n \n \n ";
} elseif ($stat == "agility") {
print "\n <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px;\n margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>\n You Begin to run on the treadmill, You keep tapping the faster button till you fly off the damn thing!.<br />\n You have gained {$gain} agility by doing {$_POST['amnt']} minutes of running.<br />\n You now have {$inc} agility and {$inc2} energy left.\n </div></div> ";
} elseif ($stat == "guard") {
print "\n <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px;\n margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>\n You jump into the pool and begin swimming, you keep flapping your arms in the water like Michael Felps, you get a cramp and almost drown.<br />\n You have gained {$gain} guard by doing {$_POST['amnt']} minutes of swimming.<br />\n You now have {$inc} guard and {$inc2} energy left.\n </div></div> ";
} elseif ($stat == "labour") {
print "\n <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px;\n margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>\n You walk over to the front desk, and ask the manager If you can volunteer to help the gym out, He says unload the boxes In the back, You unload boxes until the gym closes<br />\n You have gained {$gain} labour by unloading {$_POST['amnt']} boxes.<br />\n You now have {$inc} labour and {$inc2} energy left.\n </div></div> ";
}
$ir['energy'] -= $_POST['amnt'];
$ir[$stat] += $gain;
}
}
$ir['strank'] = get_rank($ir['strength'], 'strength');
$ir['agirank'] = get_rank($ir['agility'], 'agility');
$ir['guarank'] = get_rank($ir['guard'], 'guard');
$ir['labrank'] = get_rank($ir['labour'], 'labour');
if ($ir['energy'] == "0") {
print "\n\n<table width='90%'><tr><td><p>\nYou dont have any energy for taining <a href='crystaltemple.php?spend=refill'><font color='green'>[Refill Energy]</font></a></p></td></tr></table>\n<br /> \n";
} else {
print "\n\n<table width='90%'><tr><td><p>\nYou can train up to <prb> {$ir['energy']} </prb> times with your\ncurrent energy.</p></td></tr></table>\n<br />";
}
print " \n \n<table width='90%' class='table'>\n<tr>\n <form action='gym.php' method='post'>\n <input type='hidden' name='stat' value='Strength'></input>\n <th width='15%'><ph2>Strength:</ph2></th>\n <td width='15%'>{$ir['strength']}</td>\n <td width='10%'>Rank {$ir['strank']}</td>\n <td width='40%'>Times to train: <input name='amnt' type='text' style='color: black;background-color: white;' value='{$ir['energy']}' > </input> </td>\n <td width='20%'> <input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td>\n </form>\n</tr>\n<tr>\n <form action='gym.php' method='post'>\n <input type='hidden' name='stat' value='Agility'></input>\n <th width='15%'><ph2>Agility:</ph2></th>\n <td width='15%'>{$ir['agility']}</td>\n <td width='10%'>Rank {$ir['agirank']}</td>\n <td width='40%'>Times to train: <input type='text' style='color: black; background-color: white;' name='amnt' value='{$ir['energy']}'></input></td>\n <td width='20%'><input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td> \n </form>\n</tr>\n<tr>\n <form action='gym.php' method='post'>\n <input type='hidden' name='stat' value='Guard'></input>\n <th width='15%'><ph2>Guard:</ph2></th>\n <td width='15%'>{$ir['guard']}</td>\n <td width='10%'>Rank {$ir['guarank']}</td>\n <td width='40%'>Times to train: <input type='text' style='color: black; background-color: white;' name='amnt' value='{$ir['energy']}'></input></td>\n <td width='20%'><input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td> \n </form>\n</tr>\n<tr>\n <form action='gym.php' method='post'>\n <input type='hidden' name='stat' value='Labour'></input>\n <th width='15%'><ph2>Labour:</ph2></th>\n <td width='15%'>{$ir['labour']}</td>\n <td width='10%'>Rank {$ir['labrank']}</td>\n <td width='40%'>Times to train: <input type='text' style='color: black; background-color: white;' name='amnt' value='{$ir['energy']}'></input></td>\n <td width='20%'><input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td> \n </form>\n</tr>\n</table><br />";
$h->endpage();
示例15: date_create
<?php
include_once 'inc/functions.php';
include_once 'inc/session.php';
$title = 'My Profile - DSSD Student Portal';
$bday = date_create($user_check['birth_date']);
//$user_check from session.php
$start = date_create($user_check['start_date']);
$ranks_id = $user_check['ranks_id'];
$programs_id = $user_check['programs_id'];
$user_id = $user_check['id'];
//var_dump($user_check);
$rank_name = get_rank($ranks_id);
$next_rank_name = get_next_rank($ranks_id);
$program_name = get_program($programs_id);
$technique_list = get_techniques($ranks_id);
$working_technique_list = get_techniques($ranks_id + 1);
$class = get_class_times($ranks_id);
$start_time = new DateTime($class['start_time']);
$end_time = new DateTime($class['end_time']);
$start = $start_time->format('g:ia');
$end = $end_time->format('g:ia');
?>
<?php
include_once 'inc/head.html';
?>
<body>
<?php