本文整理汇总了PHP中aasort函数的典型用法代码示例。如果您正苦于以下问题:PHP aasort函数的具体用法?PHP aasort怎么用?PHP aasort使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了aasort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_users_reputation_topic
public function get_users_reputation_topic($uids, $users_reputation, $limit = 10)
{
if ($users_reputation_topics = $this->model('reputation')->get_reputation_topic($uids)) {
foreach ($users_reputation_topics as $key => $val) {
if ($val['reputation'] < 1 or $val['agree_count'] < 1) {
continue;
}
$reputation_topics[$val['uid']][] = $val;
}
}
if ($reputation_topics) {
foreach ($reputation_topics as $uid => $reputation_topic) {
$reputation_topic = array_slice(aasort($reputation_topic, 'reputation', 'DESC'), 0, $limit);
foreach ($reputation_topic as $key => $val) {
$topic_ids[$val['topic_id']] = $val['topic_id'];
}
foreach ($reputation_topic as $key => $val) {
$reputation_topic[$key]['topic_title'] = $topics[$val['topic_id']]['topic_title'];
$reputation_topic[$key]['url_token'] = $topics[$val['topic_id']]['url_token'];
}
$reputation_topics[$uid] = $reputation_topic;
}
$topics = $this->model('topic')->get_topics_by_ids($topic_ids);
foreach ($reputation_topics as $uid => $reputation_topic) {
foreach ($reputation_topic as $key => $val) {
$reputation_topics[$uid][$key]['topic_title'] = $topics[$val['topic_id']]['topic_title'];
$reputation_topics[$uid][$key]['url_token'] = $topics[$val['topic_id']]['url_token'];
}
}
}
return $reputation_topics;
}
示例2: char_skill
function char_skill(&$sqlr, &$sqlc)
{
global $lang_global, $lang_char, $output, $realm_id, $realm_db, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $skill_datasite;
wowhead_tt();
require_once 'core/char/char_security.php';
$order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : 1;
$dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 1;
if (preg_match('/^[01]{1}$/', $dir)) {
} else {
$dir = 1;
}
$order_dir = $dir ? 'ASC' : 'DESC';
$dir = $dir ? 0 : 1;
$result = $sqlc->query('SELECT account, name, race, class, level, gender FROM characters WHERE guid = ' . $id . ' LIMIT 1');
if ($sqlc->num_rows($result)) {
$char = $sqlc->fetch_assoc($result);
// we get user permissions first
$owner_acc_id = $sqlc->result($result, 0, 'account');
$result = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
$owner_name = $sqlr->result($result, 0, 'username');
$owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
if (empty($owner_gmlvl)) {
$owner_gmlvl = 0;
}
if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
$result = $sqlc->query('SELECT name, race, class, level, gender FROM characters WHERE guid = ' . $id . '');
$char = $sqlc->fetch_assoc($result);
$output .= '
<center>
<div id="tab_content">
<h1>' . $lang_char['skills'] . '</h1>
<br />';
require_once 'core/char/char_header.php';
$output .= '
<br /><br />
<table class="lined" style="width: 550px;">
<tr>
<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['skills'] . '</th>
</tr>
<tr>
' . ($user_lvl ? '<th><a href="char_skill.php?id=' . $id . '&realm=' . $realmid . '&order_by=0&dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_id'] . '</a></th>' : '') . '
<th align="right"><a href="char_skill.php?id=' . $id . '&realm=' . $realmid . '&order_by=1&dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_name'] . '</a></th>
<th><a href="char_skill.php?id=' . $id . '&realm=' . $realmid . '&order_by=2&dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_value'] . '</a></th>
</tr>';
$skill_array = array();
$class_array = array();
$prof_1_array = array();
$prof_2_array = array();
$weapon_array = array();
$armor_array = array();
$language_array = array();
$skill_rank_array = array(75 => $lang_char['apprentice'], 150 => $lang_char['journeyman'], 225 => $lang_char['expert'], 300 => $lang_char['artisan'], 375 => $lang_char['master'], 450 => $lang_char['inherent'], 385 => $lang_char['wise']);
$result = $sqlc->query('SELECT skill, value, max FROM character_skills WHERE guid = ' . $id . '');
$sqlm = new SQL();
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
while ($char_skill = $sqlc->fetch_assoc($result)) {
$temp = $char_skill['value'];
$skill = $char_skill['skill'];
$max = $char_skill['max'];
if (skill_get_type($skill, $sqlm) == 6) {
array_push($weapon_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 7) {
array_push($class_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 8) {
array_push($armor_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 9) {
array_push($prof_2_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 10) {
array_push($language_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 11) {
array_push($prof_1_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} else {
array_push($skill_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
}
}
unset($char_skill);
aasort($skill_array, $order_by, $dir);
aasort($class_array, $order_by, $dir);
aasort($prof_1_array, $order_by, $dir);
aasort($prof_2_array, $order_by, $dir);
aasort($weapon_array, $order_by, $dir);
aasort($armor_array, $order_by, $dir);
aasort($language_array, $order_by, $dir);
foreach ($skill_array as $data) {
$output .= '
<tr>
' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
<td align="right">' . $data[1] . '</td>
<td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
<span>' . $data[2] . '/' . $data[3] . '</span>
</td>
</tr>';
}
if (count($class_array)) {
$output .= '
<tr>
<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['classskills'] . '</th>
</tr>';
}
foreach ($class_array as $data) {
//.........这里部分代码省略.........
示例3: char_skill
function char_skill(&$sqlr, &$sqlc)
{
global $lang_global, $lang_char, $output, $realm_id, $realm_db, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $skill_datasite;
// this page uses wowhead tooltops
wowhead_tt();
//==========================$_GET and SECURE=================================
// id and multi realm security to prevent sql injection
require_once './include/char/include/char_multi_realm_security.php';
$order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : 1;
$dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 1;
if (preg_match('/^[01]{1}$/', $dir)) {
} else {
$dir = 1;
}
$order_dir = $dir ? 'ASC' : 'DESC';
$dir = $dir ? 0 : 1;
//==========================$_GET and SECURE end=============================
// getting character data from database
$result = $sqlc->query('
SELECT account, name, race, class, gender, level
FROM characters
WHERE guid = ' . $id . '
LIMIT 1');
// no point going further if character does not exist
if ($sqlc->num_rows($result)) {
$char = $sqlc->fetch_assoc($result);
// we get user permissions first
$owner_acc_id = $sqlc->result($result, 0, 'account');
$result = $sqlr->query('
SELECT gmlevel, username
FROM account
WHERE id = ' . $char['account'] . '');
$owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
$owner_name = $sqlr->result($result, 0, 'username');
// check user permission
if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
// character sub header
$output .= '
<center>
<div id="tab_content">
<h1>' . $lang_char['skills'] . '</h1>
<br />';
// character menu tab
require_once './include/char/include/char_header.php';
// character info
require_once './include/char/include/char_info.php';
//---------------Page Specific Data Starts Here--------------------------
$output .= '
<div id="tab_content2">
<table class="lined" style="width: 700px;">
<tr>
<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['skills'] . '</th>
</tr>
<tr>
' . ($user_lvl ? '<th><a href="char_skill.php?id=' . $id . '&realm=' . $realmid . '&order_by=0&dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_id'] . '</a></th>' : '') . '
<th align="right"><a href="char_skill.php?id=' . $id . '&realm=' . $realmid . '&order_by=1&dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_name'] . '</a></th>
<th><a href="char_skill.php?id=' . $id . '&realm=' . $realmid . '&order_by=2&dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_value'] . '</a></th>
</tr>';
$skill_array = array();
$class_array = array();
$prof_1_array = array();
$prof_2_array = array();
$weapon_array = array();
$armor_array = array();
$language_array = array();
$skill_rank_array = array(1 => $lang_char['none'], 350 => $lang_char['none'], 75 => $lang_char['apprentice'], 150 => $lang_char['journeyman'], 225 => $lang_char['expert'], 300 => $lang_char['artisan'], 375 => $lang_char['master'], 450 => $lang_char['grand_master'], 525 => $lang_char['illustrious']);
$result = $sqlc->query('
SELECT skill, value, max
FROM character_skills
WHERE guid = ' . $id . '');
$sqlm = new SQL();
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
while ($char_skill = $sqlc->fetch_assoc($result)) {
$temp = $char_skill['value'];
$skill = $char_skill['skill'];
$max = $char_skill['max'];
if (skill_get_type($skill, $sqlm) == 6) {
array_push($weapon_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 7) {
array_push($class_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 8) {
array_push($armor_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 9) {
array_push($prof_2_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 10) {
array_push($language_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} elseif (skill_get_type($skill, $sqlm) == 11) {
array_push($prof_1_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
} else {
array_push($skill_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
}
}
unset($char_skill);
aasort($skill_array, $order_by, $dir);
aasort($class_array, $order_by, $dir);
aasort($prof_1_array, $order_by, $dir);
aasort($prof_2_array, $order_by, $dir);
aasort($weapon_array, $order_by, $dir);
aasort($armor_array, $order_by, $dir);
aasort($language_array, $order_by, $dir);
//.........这里部分代码省略.........
示例4: search_articles
public function search_articles($q, $topic_ids = null, $page = 1, $limit = 20, $is_recommend = false)
{
if ($topic_ids) {
$topic_ids = explode(',', $topic_ids);
array_walk_recursive($topic_ids, 'intval_string');
$where[] = '`id` IN (SELECT `item_id` FROM ' . $this->get_table('topic_relation') . ' WHERE topic_id IN(' . implode(',', $topic_ids) . ') AND `type` = "article")';
}
if ($is_recommend) {
$where[] = '(`is_recommend` = "1" OR `chapter_id` IS NOT NULL)';
}
if ($where) {
$where = implode(' AND ', $where);
}
$search_hash = $this->get_search_hash('article', 'title', $q, $where);
if (!($result = $this->fetch_cache($search_hash))) {
if ($result = $this->query_all($this->bulid_query('article', 'title', $q, $where), $this->max_results)) {
$result = aasort($result, 'score', 'DESC');
} else {
return false;
}
$this->save_cache($search_hash, $result);
}
if (!$page) {
$slice_offset = 0;
} else {
$slice_offset = ($page - 1) * $limit;
}
return array_slice($result, $slice_offset, $limit);
}
示例5: trendField
/**
* Compute trends in the values of a field.
*
* @param object $req Request data
* @param object $query ES query
* @param object $return Partial response
* @return object Response to request
*/
protected function trendField($req, $query, $return, $result)
{
$field = self::canonicalFieldName($req->analyze_field);
// Scale samples. If analyze_limit is more than 50% of the
// results, then change size to 50% of the results to avoid
// overlap
$analyze_limit = $this->config['analyze_limit'];
$query->size = $analyze_limit;
if ($return->hits < $analyze_limit * 2) {
$query->size = $return->hits / 2;
}
$result = $this->esQuery($query);
$analyze = self::collectFieldValues($result->hits->hits, $field);
unset($result);
$analyze = array_count_values($analyze);
$query->sort->{'@timestamp'}->order = 'asc';
$result = $this->esQuery($query);
$return->analysis->count = count($result->hits->hits);
$analyze2 = self::collectFieldValues($result->hits->hits, $field);
unset($result);
$analyze2 = array_count_values($analyze2);
$final = array();
foreach ($analyze as $key => $value) {
$first = isset($analyze2[$key]) ? $analyze2[$key] : 0;
$final[$key] = array();
$final[$key]['count'] = $value;
$final[$key]['start'] = $first;
$final[$key]['trend'] = round(($value / $query->size - $first / $query->size) * 100, 2);
$final[$key]['abs'] = abs($final[$key]['trend']);
}
aasort($final, "abs");
$final = array_slice($final, 0, $this->config['analyze_show'], true);
$return->analysis->results = $final;
return $return;
}
示例6: event_sorting_by_date
function event_sorting_by_date()
{
query_posts(array('post_type' => 'events', 'post_status' => 'publish'));
$dates_array = array();
if (have_posts()) {
while (have_posts()) {
the_post();
$data = array('post_id' => get_the_ID(), 'start_date' => get_field('start_date'), 'end_date' => get_field('end_date'));
array_push($dates_array, $data);
}
wp_reset_query();
aasort($dates_array, 'start_date');
return $dates_array;
}
return 0;
}
示例7: round
echo round($project['over_budget']);
?>
%</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div class="span6">
<?php
aasort($projects, 'hours_over_budget');
$projects = array_reverse($projects, true);
?>
<h2>Grootste verlies</h2>
<div class="panel">
<table class="table table-striped table-bordered table-condense">
<thead>
<tr>
<th><?php
_e('Project', 'orbis');
?>
</th>
<th><?php
_e('Aantal uren over budget', 'orbis');
示例8: get_exercise_dataFN
function get_exercise_dataFN($id_course_instance, $id_student = "")
{
$dh = $GLOBALS['dh'];
$out_fields_ar = array('ID_NODO', 'ID_ISTANZA_CORSO', 'DATA_VISITA', 'PUNTEGGIO', 'COMMENTO', 'CORREZIONE_RISPOSTA_LIBERA');
$dataHa = $dh->find_ex_history_list($out_fields_ar, $this->id_user, $id_course_instance);
if (AMA_DataHandler::isError($dataHa) || empty($dataHa)) {
$this->user_ex_historyAr = '';
} else {
aasort($dataHa, array("-1"));
$this->user_ex_historyAr = $dataHa;
}
}
示例9: calculate_by_uid
//.........这里部分代码省略.........
$s_agree_value = 0;
// 赞同威望系数
$s_against_value = 0;
// 反对威望系数
// 是否最佳回复
if ($questions_info[$answers_val['question_id']]['best_answer'] == $answers_val['answer_id']) {
$s_best_answer = 1;
} else {
$s_best_answer = 0;
}
// 赞同的用户
if ($vote_agree_users[$answers_val['answer_id']]) {
foreach ($vote_agree_users[$answers_val['answer_id']] as $key => $val) {
// 排除发起者
if ($questions_info[$answers_val['question_id']]['published_uid'] != $val['answer_uid']) {
$s_agree_value = $s_agree_value + $val['reputation_factor'];
if ($questions_info[$answers_val['question_id']]['published_uid'] == $val['vote_uid'] and !$s_publisher_agree) {
$s_publisher_agree = 1;
}
}
}
}
// 反对的用户
if ($vote_against_users[$answers_val['answer_id']]) {
foreach ($vote_against_users[$answers_val['answer_id']] as $key => $val) {
// 排除发起者
if ($questions_info[$answers_val['question_id']]['published_uid'] != $val['answer_uid']) {
$s_against_value = $s_against_value + $val['reputation_factor'];
if ($questions_info[$answers_val['question_id']]['published_uid'] == $val['vote_uid'] and !$s_publisher_against) {
$s_publisher_against = 1;
}
}
}
}
if ($s_publisher_agree) {
$s_agree_value = $s_agree_value - 1;
}
if ($s_publisher_against) {
$s_against_value = $s_against_value - 1;
}
$best_answer_reput = get_setting('best_answer_reput');
// 最佳回复威望系数
$publisher_reputation_factor = get_setting('publisher_reputation_factor');
// 发起者赞同/反对威望系数
$reputation_log_factor = get_setting('reputation_log_factor');
//(用户组威望系数 x 赞同数量 - 用户组威望系数 x 反对数量)+ 发起者赞同反对系数 + 最佳答案系数
$answer_reputation = $s_agree_value - $s_against_value + $s_publisher_agree * $publisher_reputation_factor - $s_publisher_against * $publisher_reputation_factor + $s_best_answer * $best_answer_reput;
if ($answer_reputation < 0) {
$answer_reputation = 0 - $answer_reputation - 0.5;
if ($reputation_log_factor > 1) {
$answer_reputation = 0 - log($answer_reputation, $reputation_log_factor);
}
} else {
if ($answer_reputation > 0) {
$answer_reputation = $answer_reputation + 0.5;
if ($reputation_log_factor > 1) {
$answer_reputation = log($answer_reputation, $reputation_log_factor);
}
}
}
// 计算在话题中的威望
if ($answer_reputation) {
if ($question_topics[$answers_val['question_id']]) {
foreach ($question_topics[$answers_val['question_id']] as $key => $topic_info) {
$user_topics[$topic_info['topic_id']] = array('topic_id' => $topic_info['topic_id'], 'count' => intval($user_topics[$topic_info['topic_id']]['count']) + 1, 'agree_count' => intval($user_topics[$topic_info['topic_id']]['agree_count']) + $answers_val['agree_count'], 'thanks_count' => intval($user_topics[$topic_info['topic_id']]['thanks_count']) + $answers_val['thanks_count'], 'reputation' => $user_topics[$topic_info['topic_id']]['reputation'] + $answer_reputation);
}
}
}
if ($questions_info[$answers_val['question_id']]['category_id']) {
$user_reputation_category[$questions_info[$answers_val['question_id']]['category_id']]['reputation'] += $answer_reputation;
$user_reputation_category[$questions_info[$answers_val['question_id']]['category_id']]['agree_count'] += $answers_val['agree_count'];
$user_reputation_category[$questions_info[$answers_val['question_id']]['category_id']]['questions'][$answers_val['question_id']] = $answers_val['question_id'];
}
$user_reputation = $user_reputation + $answer_reputation;
}
}
if (is_array($user_topics)) {
if ($user_topics = aasort($user_topics, 'count', 'DESC')) {
$user_topics = array_slice($user_topics, 0, 20);
}
foreach ($user_topics as $t_key => $t_val) {
if ($reputation_topic_id = $this->fetch_one('reputation_topic', 'auto_id', 'uid = ' . $uid . ' AND topic_id = ' . $t_val['topic_id'])) {
$this->update('reputation_topic', array('uid' => $uid, 'topic_id' => $t_val['topic_id'], 'topic_count' => $t_val['count'], 'update_time' => time(), 'agree_count' => $t_val['agree_count'], 'thanks_count' => $t_val['thanks_count'], 'reputation' => round($t_val['reputation'])), 'auto_id = ' . $reputation_topic_id);
} else {
$this->insert('reputation_topic', array('uid' => $uid, 'topic_id' => $t_val['topic_id'], 'topic_count' => $t_val['count'], 'update_time' => time(), 'agree_count' => $t_val['agree_count'], 'thanks_count' => $t_val['thanks_count'], 'reputation' => round($t_val['reputation'])));
}
}
}
if (is_array($user_reputation_category)) {
foreach ($user_reputation_category as $t_key => $t_val) {
if ($user_reputation_category_id = $this->fetch_one('reputation_category', 'auto_id', 'uid = ' . intval($uid) . ' AND category_id = ' . $t_key)) {
$this->update('reputation_category', array('uid' => intval($uid), 'category_id' => $t_key, 'update_time' => time(), 'reputation' => round($t_val['reputation']), 'agree_count' => $t_val['agree_count'], 'question_count' => count($t_val['questions'])), 'auto_id = ' . $user_reputation_category_id);
} else {
$this->insert('reputation_category', array('uid' => intval($uid), 'category_id' => $t_key, 'update_time' => time(), 'reputation' => round($t_val['reputation']), 'agree_count' => $t_val['agree_count'], 'question_count' => count($t_val['questions'])));
}
}
}
$this->model('account')->update_users_fields(array('reputation' => round($user_reputation), 'reputation_update_time' => time()), $uid);
$this->model('account')->update_user_reputation_group($uid);
}
示例10: formatOffset
"> [<?php
echo $abbr;
?>
<?php
echo formatOffset($offset);
?>
] <?php
echo $tz;
?>
</option>-->
<?php
}
?>
<?php
aasort($tzArray, "offset");
foreach ($tzArray as $tz) {
if ($tz["tz"] == $TimeZone) {
$sel = 'selected="selected" style="background-color: yellow;"';
} else {
$sel = "";
}
?>
<option <?php
echo $sel;
?>
value="<?php
echo $tz["tz"];
?>
"> (<?php
echo formatOffset($tz["offset"]);
示例11: Dashboard
//.........这里部分代码省略.........
$y = $cnt + 1;
$weekAvgOffPeak[$tk] = array($tk, $x, $y);
}
if ($row['value'] > $nacD) {
$row['value'] = $nominal;
}
if ($row['t'] == 'P') {
$sum = $weekQoEPeak[$tk][1];
$cnt = $weekQoEPeak[$tk][2];
$x = $sum + $row['value'];
$y = $cnt + 1;
$weekQoEPeak[$tk] = array($tk, $x, $y);
}
if ($row['t'] == 'O') {
$sum = $weekQoEOffPeak[$tk][1];
$cnt = $weekQoEOffPeak[$tk][2];
$x = $sum + $row['value'];
$y = $cnt + 1;
$weekQoEOffPeak[$tk] = array($tk, $x, $y);
}
}
}
}
}
}
unset($dataPeak);
unset($dataOffPeak);
unset($dataQoEPeak);
unset($dataQoEOffPeak);
unset($dataNominal);
unset($dataWarning);
unset($dataCritical);
if (isset($weekQoEPeak)) {
aasort($weekQoEPeak, 0);
aasort($weekQoEOffPeak, 0);
aasort($weekAvgPeak, 0);
aasort($weekAvgOffPeak, 0);
$sumQoEPeak = 0;
$cntQoEPeak = 0;
$sumQoEOffPeak = 0;
$cntQoEOffPeak = 0;
foreach (array_reverse($weekQoEPeak) as $tvalue) {
$key = $tvalue[0];
$sumQoEPeak += $weekQoEPeak[$key][1];
$cntQoEPeak += $weekQoEPeak[$key][2];
$sumQoEOffPeak += $weekQoEOffPeak[$key][1];
$cntQoEOffPeak += $weekQoEOffPeak[$key][2];
if ($weekQoEPeak[$key][2] > 0) {
$dataQoEPeak[$key] = array('x' => $key, 'y' => round($weekQoEPeak[$key][1] / $weekQoEPeak[$key][2] / $div, 2), 'cnt' => $weekQoEPeak[$key][2]);
}
// ColorBar($x,$nominal,$warning,$critical,$value,$div)
if ($weekQoEOffPeak[$key][2] > 0) {
$dataQoEOffPeak[$key] = array('x' => $key, 'y' => round($weekQoEOffPeak[$key][1] / $weekQoEOffPeak[$key][2] / $div, 2), 'cnt' => $weekQoEOffPeak[$key][2]);
}
if ($weekAvgPeak[$key][2] > 0) {
$dataAvgPeak[$key] = array('x' => $key, 'y' => round($weekAvgPeak[$key][1] / $weekAvgPeak[$key][2] / $div, 2), 'cnt' => $weekAvgPeak[$key][2]);
}
if ($weekAvgOffPeak[$key][2] > 0) {
$dataAvgOffPeak[$key] = array('x' => $key, 'y' => round($weekAvgOffPeak[$key][1] / $weekAvgOffPeak[$key][2] / $div, 2), 'cnt' => $weekAvgOffPeak[$key][2]);
}
}
//echo $items['descriptionLong'] . " " . $plans['plan'] . " " . $host['host'] ;
//var_dump($dataQoEPeak);
//echo "<br>";
if (!isset($dataAvgOffPeak)) {
$dataAvgOffPeak = null;
示例12: char_quest
function char_quest(&$sqlr, &$sqlc)
{
global $output, $lang_global, $lang_char, $realm_id, $world_db, $characters_db, $action_permission, $user_lvl, $user_name, $quest_datasite, $itemperpage;
wowhead_tt();
require_once 'core/char/char_security.php';
//==========================$_GET and SECURE=================================
$start = isset($_GET['start']) ? $sqlc->quote_smart($_GET['start']) : 0;
if (is_numeric($start)) {
} else {
$start = 0;
}
$order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : 1;
if (is_numeric($order_by)) {
} else {
$order_by = 1;
}
$dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 0;
if (preg_match('/^[01]{1}$/', $dir)) {
} else {
$dir = 0;
}
$order_dir = $dir ? 'ASC' : 'DESC';
$dir = $dir ? 0 : 1;
//==========================$_GET and SECURE end=============================
$result = $sqlc->query('SELECT account, name, race, class, level, gender
FROM characters WHERE guid = ' . $id . ' LIMIT 1');
if ($sqlc->num_rows($result)) {
$char = $sqlc->fetch_assoc($result);
$owner_acc_id = $sqlc->result($result, 0, 'account');
$result = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
$owner_name = $sqlr->result($result, 0, 'username');
$owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
if (empty($owner_gmlvl)) {
$owner_gmlvl = 0;
}
if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
$output .= '
<center>
<div id="tab_content">
<h1>' . $lang_char['quests'] . '</h1>
<br />';
require_once 'core/char/char_header.php';
$output .= '
<br /><br />
<table class="lined" style="width: 550px;">
<tr>
<th width="10%"><a href="char_quest.php?id=' . $id . '&realm=' . $realmid . '&start=' . $start . '&order_by=0&dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_id'] . '</a></th>
<th width="7%"><a href="char_quest.php?id=' . $id . '&realm=' . $realmid . '&start=' . $start . '&order_by=1&dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_level'] . '</a></th>
<th width="78%"><a href="char_quest.php?id=' . $id . '&realm=' . $realmid . '&start=' . $start . '&order_by=2&dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_title'] . '</a></th>
<th width="5%"><img src="img/aff_qst.png" width="14" height="14" border="0" alt="" /></th>
</tr>';
$result = $sqlc->query('SELECT quest, status FROM character_queststatus WHERE guid = ' . $id . ' AND ( status = 3 OR status = 1 ) ORDER BY status DESC');
$quests_1 = array();
$quests_3 = array();
if ($sqlc->num_rows($result)) {
while ($quest = $sqlc->fetch_assoc($result)) {
$deplang = get_lang_id();
$query1 = $sqlc->query('SELECT Level, IFNULL(' . ($deplang != 0 ? '`title_loc' . $deplang . '`' : 'NULL') . ', title) as Title FROM `' . $world_db[$realmid]['name'] . '`.`quest_template` LEFT JOIN `' . $world_db[$realmid]['name'] . '`.`locales_quest` ON `quest_template`.`id` = `locales_quest`.`entry` WHERE `quest_template`.`id` = \'' . $quest['quest'] . '\'');
$quest_info = $sqlc->fetch_assoc($query1);
if (1 == $quest['status']) {
array_push($quests_1, array($quest['quest'], $quest_info['QuestLevel'], $quest_info['Title'], $quest['rewarded']));
} else {
array_push($quests_3, array($quest['quest'], $quest_info['QuestLevel'], $quest_info['Title']));
}
}
unset($quest);
unset($quest_info);
aasort($quests_1, $order_by, $dir);
$orderby = $order_by;
if (2 < $orderby) {
$orderby = 1;
}
aasort($quests_3, $orderby, $dir);
$all_record = count($quests_1);
foreach ($quests_3 as $data) {
$output .= '
<tr>
<td>' . $data[0] . '</td>
<td>(' . $data[1] . ')</td>
<td align="left"><a href="' . $quest_datasite . $data[0] . '" target="_blank">' . htmlentities($data[2]) . '</a></td>
<td><img src="img/aff_qst.png" width="14" height="14" alt="" /></td>
</tr>';
}
unset($quest_3);
if (count($quests_1)) {
$output .= '
</table>
<table class="hidden" style="width: 550px;">
<tr align="right">
<td>';
$output .= generate_pagination('char_quest.php?id=' . $id . '&realm=' . $realmid . '&start=' . $start . '&order_by=' . $order_by . '&dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
$output .= '
</td>
</tr>
</table>
<table class="lined" style="width: 550px;">
<tr>
<th width="10%"><a href="char_quest.php?id=' . $id . '&realm=' . $realmid . '&start=' . $start . '&order_by=0&dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_id'] . '</a></th>
<th width="7%"><a href="char_quest.php?id=' . $id . '&realm=' . $realmid . '&start=' . $start . '&order_by=1&dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_level'] . '</a></th>
<th width="68%"><a href="char_quest.php?id=' . $id . '&realm=' . $realmid . '&start=' . $start . '&order_by=2&dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_title'] . '</a></th>
//.........这里部分代码省略.........
示例13: aasort
}
function aasort(&$array, $key)
{
$sorter = array();
$ret = array();
reset($array);
foreach ($array as $ii => $va) {
$sorter[$ii] = $va[$key];
}
asort($sorter);
foreach ($sorter as $ii => $va) {
$ret[$ii] = $array[$ii];
}
$array = $ret;
}
aasort($slbusesmetros, "departure");
?>
<table id="SLRealtime" data-refresh-every-n-seconds=30>
<tr>
<th style="width:3%"></th>
<th style="width:75px;text-align:center"><img src="http://images2.wikia.nocookie.net/__cb20100824161519/logopedia/images/c/ca/SL_logo.svg" height="30px" /></th>
<th style="padding-left:20"><?php
echo $slstation[0]->get('Name') . ' om ' . $distance . ' min';
?>
</th>
<th style="width:12%;text-align:center">min.</th>
</tr>
<?php
foreach ($slbusesmetros as $dps) {
//if ($dps['transport'] == 'METRO'){
// $distance = 0;
示例14: result_sheet_ajax_rs
function result_sheet_ajax_rs()
{
$class_name_id = $_GET['class_name_id'];
$class_id = $_GET['class_id'];
$section_id = $_GET['section_id'];
$exam_id = $_GET['exam_id'];
$school_id = $_SESSION['school_id'];
#$data['studentInfo'] = $this->Admin_model->result_sheet_ajax($_SESSION['school_id'],$class_name_id);
$data['studentInfo'] = $this->Admin_model->result_sheet_ajax_rs($_SESSION['school_id'], $class_name_id, $section_id);
$data['studentInfo'] = aasort($data['studentInfo'], 'roll_no');
$list = $this->load->view('admin/result/ajax-student-result', $data, true);
$result = 'success';
$return = array('result' => $result, 'list' => $list);
print json_encode($return);
exit;
}
示例15: array
}
}
if (!empty($request_params["max_price"])) {
if ($csv_item_array[ITEM_PRICE] > $request_params["max_price"]) {
continue;
}
}
$result_array[] = array($csv_item_array[ITEM_ID], $csv_item_array[ITEM_TITLE], $csv_item_array[ITEM_DESCRIPTION], $csv_item_array[ITEM_PRICE]);
}
// SORT
switch ($request_params["sort"]) {
case "price":
aasort($result_array, ITEM_PRICE);
break;
case "id":
aasort($result_array, ITEM_ID);
break;
default:
break;
}
// PAGE && LIMIT
$offset = ($request_params["page"] - 1) * $request_params["limit"];
if ($offset < 0) {
$offset = 0;
}
$length = $request_params["limit"] - $offset;
if ($length < $request_params["limit"]) {
$length = $request_params["limit"];
}
$result_array = array_slice($result_array, $offset, $length);
// OUTPUT