public function getAllPercent() { header('Content-type:text/json'); $score = !empty($_POST['score']) ? trim(strip_tags($_POST['score'])) : 0; if ($score == 0) { echo 0; exit; } $json = getPercent($score); echo $json; }
function color($current, $max) { $percent = getPercent($current, $max); $green = round($percent * 255 / 100); $red = 255 - $green; if ($percent > 0 && $current <= $max) { //$rgb = "rgb(255, 0, 00)"; return "rgb(" . $red . ", " . $green . ", 00)"; } else { if ($percent > 0 && $current > $max) { return "rgb(105, 73, 166)"; } } }
function player_bodyparts_s($playerid, $dbID = false) { $Output = ""; $link = baselink(); global $coddb; global $separatorline; global $t; // table names from config global $b; // bodypart names from config global $game; global $groupbits; global $text; //<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"outertable\"><tr><td align=\"center\">Hitzones</td></tr><tr><td> $Output = " <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"outertable\"><tr valign=\"top\"><td> \n <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"outertable\"><tr><td>\n <table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" class=\"innertable\">\n <tr class=\"outertable\">\n <td width=\"250\" align=\"left\">" . $text["bodyparts"] . "</td>\n <td width=\"140\"colspan=\"2\" align=\"center\">" . $text["yourkill"] . "</td>\n <td width=\"140\"colspan=\"2\" align=\"center\">" . $text["yourdeath"] . "</td>\n "; if ($dbID == false) { $query = "SELECT id, kills, deaths, suicides, teamkills, teamdeaths\n FROM {$t['players']}\n WHERE id = {$playerid} AND hide = 0\n LIMIT 1"; } else { $query = "SELECT id, kills, deaths, suicides, teamkills, teamdeaths\n FROM {$t['players']}\n WHERE client_id = {$playerid} AND hide = 0\n LIMIT 1"; } $result = $coddb->sql_query($query); $row = $coddb->sql_fetchrow($result); $playerid = $row['id']; $kills = $row['kills']; $deaths = $row['deaths']; $suicides = $row['suicides']; $teamkills = $row['teamkills']; $teamdeaths = $row['teamdeaths']; $query = "SELECT {$t['bodyparts']}.name, {$t['bodyparts']}.id, {$t['playerbody']}.kills, \n {$t['playerbody']}.deaths, {$t['playerbody']}.suicides, \n {$t['playerbody']}.teamkills, {$t['playerbody']}.teamdeaths\n FROM {$t['bodyparts']}, {$t['playerbody']}\n WHERE {$t['playerbody']}.player_id = {$playerid}\n AND {$t['bodyparts']}.id = {$t['playerbody']}.bodypart_id\n ORDER BY {$t['playerbody']}.kills DESC"; $result = $coddb->sql_query($query); $mybodypats = array(); while ($row = $coddb->sql_fetchrow($result)) { if ($separatorline == 1) { $Output .= "<tr><td colspan=\"11\" class=\"outertable\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\"></td></tr>\n "; // This draws a one pixel line between rows } $Output .= "<tr>"; $bset = false; if (isset($b[$row['name']])) { $Output .= " <td align=\"left\">" . $b[$row['name']] . "</td>\n "; $bset = true; } else { $Output .= " <td>{$row['name']}</td>"; } $Output .= " <td align=\"center\">"; if ($row['kills'] == "") { $Output .= "</td>\n "; } else { $Output .= $row['kills'] . "</td>\n "; } if ($kills > 0 && $row['kills'] > 0) { $temp = sprintf("%.2f", 100 * $row['kills'] / $kills); $Output .= " <td align=\"center\" class=\"tiny\">({$temp}%)</td>\n "; $mybodypats[$row['name']] = sprintf("%.0f", intval(round($row['kills'] / $kills, 1) * 10) * 10); } else { $Output .= " <td></td>"; } $Output .= " <td align=\"center\">"; if ($row['deaths'] == "") { $Output .= "</td>\n "; } else { $Output .= $row['deaths'] . "</td>\n "; } if ($deaths > 0 && $row['deaths'] > 0) { $temp = sprintf("%.2f", 100 * $row['deaths'] / $deaths); $Output .= " <td align=\"center\" class=\"tiny\">({$temp}%)</td>\n "; } else { $Output .= " <td></td>\n "; } $Output .= "</tr>"; } $Output .= "</table>\n "; $Output .= "</td>\n </tr>\n <tr> \n <td class=\"tiny\" align =\"right\">" . $text["watchcover"] . "\n "; $Output .= " </td>\n </tr>\n </table> \n "; //<td align=\"center\" width=\"1\" width=\"10\"> </td> if ($game == "urt") { if (isset($mybodypats['0'])) { $hz_head = $mybodypats['0'] + $mybodypats['1']; } else { $hz_head = 0; } if (isset($mybodypats['neck'])) { $hz_neck = 0; } else { $hz_neck = 0; } if (isset($mybodypats['2'])) { $hz_torso_upper = $mybodypats['2'] + $mybodypats['3']; } else { $hz_torso_upper = 0; } if (isset($mybodypats['2'])) { $hz_torso_lower = $mybodypats['2'] + $mybodypats['3']; } else { $hz_torso_lower = 0; } if (isset($mybodypats['4'])) { $hz_left_arm_upper = $mybodypats['4']; } else { $hz_left_arm_upper = 0; } if (isset($mybodypats['4'])) { $hz_left_arm_lower = $mybodypats['4']; } else { $hz_left_arm_lower = 0; } if (isset($mybodypats['4'])) { $hz_left_hand = $mybodypats['4']; } else { $hz_left_hand = 0; } if (isset($mybodypats['4'])) { $hz_right_arm_upper = $mybodypats['4']; } else { $hz_right_arm_upper = 0; } if (isset($mybodypats['4'])) { $hz_right_arm_lower = $mybodypats['4']; } else { $hz_right_arm_lower = 0; } if (isset($mybodypats['4'])) { $hz_right_hand = $mybodypats['4']; } else { $hz_right_hand = 0; } if (isset($mybodypats['5'])) { $hz_left_leg_upper = $mybodypats['5']; } else { $hz_left_leg_upper = 0; } if (isset($mybodypats['5'])) { $hz_left_leg_lower = $mybodypats['5']; } else { $hz_left_leg_lower = 0; } if (isset($mybodypats['5'])) { $hz_left_foot = $mybodypats['5']; } else { $hz_left_foot = 0; } if (isset($mybodypats['5'])) { $hz_right_leg_upper = $mybodypats['5']; } else { $hz_right_leg_upper = 0; } if (isset($mybodypats['5'])) { $hz_right_leg_lower = $mybodypats['5']; } else { $hz_right_leg_lower = 0; } if (isset($mybodypats['5'])) { $hz_right_foot = $mybodypats['5']; } else { $hz_right_foot = 0; } if (isset($mybodypats['none'])) { $hz_none = 0; } else { $hz_none = 0; } } else { if (isset($mybodypats['head'])) { $hz_head = $mybodypats['head']; } else { $hz_head = 0; } if (isset($mybodypats['neck'])) { $hz_neck = $mybodypats['neck']; } else { $hz_neck = 0; } if (isset($mybodypats['torso_upper'])) { $hz_torso_upper = $mybodypats['torso_upper']; } else { $hz_torso_upper = 0; } if (isset($mybodypats['torso_lower'])) { $hz_torso_lower = $mybodypats['torso_lower']; } else { $hz_torso_lower = 0; } if (isset($mybodypats['left_arm_upper'])) { $hz_left_arm_upper = $mybodypats['left_arm_upper']; } else { $hz_left_arm_upper = 0; } if (isset($mybodypats['left_arm_lower'])) { $hz_left_arm_lower = $mybodypats['left_arm_lower']; } else { $hz_left_arm_lower = 0; } if (isset($mybodypats['left_hand'])) { $hz_left_hand = $mybodypats['left_hand']; } else { $hz_left_hand = 0; } if (isset($mybodypats['right_arm_upper'])) { $hz_right_arm_upper = $mybodypats['right_arm_upper']; } else { $hz_right_arm_upper = 0; } if (isset($mybodypats['right_arm_lower'])) { $hz_right_arm_lower = $mybodypats['right_arm_lower']; } else { $hz_right_arm_lower = 0; } if (isset($mybodypats['right_hand'])) { $hz_right_hand = $mybodypats['right_hand']; } else { $hz_right_hand = 0; } if (isset($mybodypats['left_leg_upper'])) { $hz_left_leg_upper = $mybodypats['left_leg_upper']; } else { $hz_left_leg_upper = 0; } if (isset($mybodypats['left_leg_lower'])) { $hz_left_leg_lower = $mybodypats['left_leg_lower']; } else { $hz_left_leg_lower = 0; } if (isset($mybodypats['left_foot'])) { $hz_left_foot = $mybodypats['left_foot']; } else { $hz_left_foot = 0; } if (isset($mybodypats['right_leg_upper'])) { $hz_right_leg_upper = $mybodypats['right_leg_upper']; } else { $hz_right_leg_upper = 0; } if (isset($mybodypats['right_leg_lower'])) { $hz_right_leg_lower = $mybodypats['right_leg_lower']; } else { $hz_right_leg_lower = 0; } if (isset($mybodypats['right_foot'])) { $hz_right_foot = $mybodypats['right_foot']; } else { $hz_right_foot = 0; } if (isset($mybodypats['none'])) { $hz_none = $mybodypats['none']; } else { $hz_none = 0; } } $zero = "0"; $Output .= "</td>\n <td> </td> \n <td> \n <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"outertable\"><tr><td>\n <table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" class=\"innertable\">\n <tr class=\"outertable\">\n <td width=\"250\"><center>" . $text["accuracy"] . "</center></td> \n <tr>\n <td> \n <table id=\"Table_01\" width=\"370\" height=\"584\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n <tr>\n <td colspan=\"14\">\n <img src=\"images/model/common/0_01.png\" width=\"370\" height=\"31\" alt=\"\"></td>\n <td height=\"31\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"6\">\n <img src=\"images/model/common/0_02.png\" width=\"140\" height=\"94\" alt=\"\"></td>\n <td colspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_head, $kills) . "/head.png\" width=\"90\" height=\"94\" alt=\"\"></td>\n <td colspan=\"6\">\n <img src=\"images/model/common/0_04.png\" width=\"140\" height=\"94\" alt=\"\"></td>\n <td height=\"94\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"4\">\n <img src=\"images/model/common/0_05.png\" width=\"102\" height=\"28\" alt=\"\"></td>\n <td colspan=\"6\">\n <img src=\"images/model/" . getPercent($hz_neck, $kills) . "/neck.png\" width=\"166\" height=\"28\" alt=\"\"></td>\n <td colspan=\"4\">\n <img src=\"images/model/common/0_07.png\" width=\"102\" height=\"28\" alt=\"\"></td>\n <td height=\"28\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"2\">\n <img src=\"images/model/common/0_08.png\" width=\"57\" height=\"62\" alt=\"\"></td>\n <td colspan=\"3\">\n <img src=\"images/model/" . getPercent($hz_right_arm_upper, $kills) . "/left_arm_upper.png\" width=\"68\" height=\"62\" alt=\"\"></td>\n <td colspan=\"4\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_torso_upper, $kills) . "/chest.png\" width=\"120\" height=\"97\" alt=\"\"></td>\n <td colspan=\"3\">\n <img src=\"images/model/" . getPercent($hz_left_arm_upper, $kills) . "/right_arm_upper.png\" width=\"61\" height=\"62\" alt=\"\"></td>\n <td colspan=\"2\">\n <img src=\"images/model/common/0_12.png\" width=\"64\" height=\"62\" alt=\"\"></td>\n <td height=\"62\" nowrap></td>\n </tr>\n <tr>\n <td rowspan=\"2\">\n <img src=\"images/model/common/0_13.png\" width=\"27\" height=\"47\" alt=\"\"></td>\n <td colspan=\"3\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_right_arm_lower, $kills) . "/left_arm_lower.png\" width=\"75\" height=\"47\" alt=\"\"></td>\n <td>\n <img src=\"images/model/common/0_15.png\" width=\"23\" height=\"35\" alt=\"\"></td>\n <td>\n <img src=\"images/model/common/0_16.png\" width=\"23\" height=\"35\" alt=\"\"></td>\n <td colspan=\"3\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_left_arm_lower, $kills) . "/right_arm_lower.png\" width=\"71\" height=\"47\" alt=\"\"></td>\n <td rowspan=\"2\">\n <img src=\"images/model/common/0_18.png\" width=\"31\" height=\"47\" alt=\"\"></td>\n <td height=\"35\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"6\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_torso_lower, $kills) . "/torso_lower.png\" width=\"166\" height=\"60\" alt=\"\"></td>\n <td height=\"12\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"3\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_right_hand, $kills) . "/left_hand.png\" width=\"69\" height=\"59\" alt=\"\"></td>\n <td rowspan=\"6\">\n <img src=\"images/model/common/0_21.png\" width=\"33\" height=\"322\" alt=\"\"></td>\n <td rowspan=\"6\">\n <img src=\"images/model/common/0_22.png\" width=\"27\" height=\"322\" alt=\"\"></td>\n <td colspan=\"3\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_left_hand, $kills) . "/right_hand.png\" width=\"75\" height=\"59\" alt=\"\"></td>\n <td height=\"48\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"3\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_right_leg_upper, $kills) . "/left_leg_upper.png\" width=\"83\" height=\"84\" alt=\"\"></td>\n <td colspan=\"3\" rowspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_left_leg_upper, $kills) . "/right_leg_upper.png\" width=\"83\" height=\"84\" alt=\"\"></td>\n <td height=\"11\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"3\" rowspan=\"4\">\n <img src=\"images/model/common/0_26.png\" width=\"69\" height=\"263\" alt=\"\"></td>\n <td colspan=\"3\" rowspan=\"4\">\n <img src=\"images/model/common/0_27.png\" width=\"75\" height=\"263\" alt=\"\"></td>\n <td height=\"73\" nowrap></td>\n </tr>\n <tr>\n <td rowspan=\"3\">\n <img src=\"images/model/common/0_28.png\" width=\"23\" height=\"190\" alt=\"\"></td>\n <td colspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_right_leg_lower, $kills) . "/left_leg_lower.png\" width=\"60\" height=\"98\" alt=\"\"></td>\n <td colspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_left_leg_lower, $kills) . "/right_leg_lower.png\" width=\"60\" height=\"98\" alt=\"\"></td>\n <td rowspan=\"3\">\n <img src=\"images/model/common/0_31.png\" width=\"23\" height=\"190\" alt=\"\"></td>\n <td height=\"98\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_right_foot, $kills) . "/left_foot.png\" width=\"60\" height=\"63\" alt=\"\"></td>\n <td colspan=\"2\">\n <img src=\"images/model/" . getPercent($hz_left_foot, $kills) . "/right_foot.png\" width=\"60\" height=\"63\" alt=\"\"></td>\n <td height=\"63\" nowrap></td>\n </tr>\n <tr>\n <td colspan=\"4\">\n <img src=\"images/model/common/0_34.png\" width=\"120\" height=\"29\" alt=\"\"></td>\n <td height=\"29\" nowrap></td>\n </tr>\n <tr>\n <td width=\"27\" nowrap></td>\n <td width=\"30\" nowrap></td>\n <td width=\"12\" nowrap></td>\n <td width=\"33\" nowrap></td>\n <td width=\"23\" nowrap></td>\n <td width=\"15\" nowrap></td>\n <td width=\"45\" nowrap></td>\n <td width=\"45\" nowrap></td>\n <td width=\"15\" nowrap></td>\n <td width=\"23\" nowrap></td>\n <td width=\"27\" nowrap></td>\n <td width=\"11\" nowrap></td>\n <td width=\"33\" nowrap></td>\n <td width=\"31\" nowrap></td>\n <td></td>\n </tr>\n </table>\n </td> \n </tr>\n </td>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table> \n "; return $Output; // Closing extra border-table }
/** * @param integer $min * @param integer $max * @param integer $value * @param string|null $text * @return string */ function getProgressBar($min, $max, $value, $text = null) { $percent = getPercent($max, $value); $color = getPercentColor($percent); $bar = '<div class="progress" style="text-indent:0; height: 20px; margin-bottom: 0;">'; $bar .= "<div class='progress-bar {$color}' role='progressbar' aria-valuenow='{$value}' aria-valuemin='{$min}' aria-valuemax='{$max}' style='width: {$percent}%;'>"; $bar .= is_null($text) ? $value : $text; $bar .= '</div>'; $bar .= '</div>'; return $bar; }
function getNextRankInfo($PID) { // Get player data $player = getPlayerDataFromPID($PID); // Read the lines from the ranks list,a dn assign a key to each rank $lines = file(getcwd() . "/queries/ranks.list"); foreach ($lines as $key => $value) { $rank[$key] = $value; } unset($lines); // Read the lines from the ranks points list to assign needed points for each rank $lines = file(getcwd() . "/queries/rank_points.list"); foreach ($lines as $key => $value) { $points[$key] = $value; } unset($lines); // Lets get our SPM, very important $SPM = round($player['score'] / intToMins($player['time']), 1); // Init a return array $return = array(); // Initiate next 3 ranks before checking 1SG, SGM checks $NEXT_RANK = array(); $NEXT_RANK[0] = $player['rank'] + 1; $NEXT_RANK[1] = $player['rank'] + 2; $NEXT_RANK[2] = $player['rank'] + 3; // Include the requirements for special ranks, and get the next 3 include getcwd() . "/queries/nextRankReqs.php"; $RANK = getNext3($PID, $NEXT_RANK[0], $NEXT_RANK[1], $NEXT_RANK[2]); // Next rank $return[0] = array('rank' => $RANK[0], 'title' => $rank[$RANK[0]], 'rank_points' => $points[$RANK[0]], 'points_needed' => $points[$RANK[0]] - $player['score'], 'percent' => getPercent($player['score'], $points[$RANK[0]]), 'days' => getNextRankDayCount($player['joined'], $player['lastonline'], $player['score'], $points[$RANK[0]]), 'time_straight' => getNextRankTime($player['score'], $points[$RANK[0]], $SPM)); // 2 ranks away $return[1] = array('rank' => $RANK[1], 'title' => $rank[$RANK[1]], 'rank_points' => $points[$RANK[1]], 'points_needed' => $points[$RANK[1]] - $player['score'], 'percent' => getPercent($player['score'], $points[$RANK[1]]), 'days' => getNextRankDayCount($player['joined'], $player['lastonline'], $player['score'], $points[$RANK[1]]), 'time_straight' => getNextRankTime($player['score'], $points[$RANK[1]], $SPM)); // 3 ranks away $return[2] = array('rank' => $RANK[2], 'title' => $rank[$RANK[2]], 'rank_points' => $points[$RANK[2]], 'points_needed' => $points[$RANK[2]] - $player['score'], 'percent' => getPercent($player['score'], $points[$RANK[2]]), 'days' => getNextRankDayCount($player['joined'], $player['lastonline'], $player['score'], $points[$RANK[2]]), 'time_straight' => getNextRankTime($player['score'], $points[$RANK[2]], $SPM)); return $return; }
<form id="showTasks" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> <input type="hidden" name="u" id="u"> </form> <table class="hoursBarsChart hours" id="barChart1" style="display:none;"> <?php if (mysqli_num_rows($result5) > 0) { for ($i = 0; $i < count($user_name_temp); $i++) { $percent = getPercent($sum_tangible_hours[$i], $user_week_hrs_temp[$i]); $color = getColor($sum_tangible_hours[$i], $user_week_hrs_temp[$i]); $user_id_encode = $user_id_temp[$i]; if ($sum_tangible_hours[$i] > $user_week_hrs_temp[$i]) { $percent = getPercent($user_week_hrs_temp[$i] + 0.01, $user_week_hrs_temp[$i]); echo "<tr onclick='showTasksID({$user_id_encode})' style='cursor: hand;'><td>" . $user_name_temp[$i] . "</td>"; echo "<td style='text-align: right;'>" . $sum_tangible_hours[$i] . " tan" . "</td>"; echo "<td style='width: 40%;'>" . "<div style='border-radius: 10px; border: 1px solid; background: #FFF; height: 8px;'><div style='width: " . $percent . "%; background-color: " . $color . "; border-radius: 10px; height: 8px;'></div></div>" . "</td>"; echo "<td>" . $time_task[$i] . " tot" . "</td></tr>"; } else { echo "<tr onclick='showTasksID({$user_id_encode})' style='cursor: hand;'><td>" . $user_name_temp[$i] . "</td>"; echo "<td style='text-align: right;'>" . $sum_tangible_hours[$i] . " tan" . "</td>"; echo "<td style='width: 40%;'>" . "<div style='border-radius: 10px; border: 1px solid; background: #FFF; height: 8px;'><div style='width: " . $percent . "%; background-color: " . $color . "; border-radius: 10px; height: 8px;'></div></div>" . "</td>"; echo "<td>" . $time_task[$i] . " tot" . "</td></tr>"; } } } ?> </table>
?> "> <input type="hidden" name="time_now" value="<?php echo $time_now; ?> "> <input type="hidden" name="time_revote" value="<?php echo $time_revote; ?> "> </form> <?php } else { ?> <div class="radial-progress" data-progress="<?php echo getPercent('vote_mg'); ?> "> <div class="circle"> <div class="mask full"> <div class="fill"></div> </div> <div class="mask half"> <div class="fill"></div> <div class="fill fix"></div> </div> <div class="shadow"></div> </div> <div class="inset"> <div class="percentage" id="revote_mg"></div> </div>
function progressBar($maxVal = 100, $val = 0, $percent = null, $minVal = 0, $color = "red", $params = array()) { $str = ""; $tagParam = $this->classitize($params, "progress"); $str .= $this->sTag('div', $tagParam); // $params = $this->classitize($params,"progress-bar progress-bar-".$color); $params['class'] = "progress-bar progress-bar-" . $color; $params['role'] = "progressbar"; $params['aria-valuenow'] = $val; $params['aria-valuemin'] = $percent; $params['aria-valuemax'] = $maxVal; $per = getPercent($val, $maxVal); if (!is_null($percent)) { $per = $percent; } $params['style'] = "width:" . $per; $str .= $this->sTag('div', $params); $str .= $this->tag('span', $per, array('class' => 'sr-only')); $str .= $this->eTag('div'); $str .= $this->eTag('div'); if ($this->returnitize($params)) { return $str; } else { $this->code .= $str; } }
function fetchCache() { global $memcache_server; global $memcache_port; global $memcache_expiration; global $platforms; $cache = new Cache($memcache_server, $memcache_port, $memcache_expiration); $root = array(); foreach ($platforms as $platformName => $components) { $root[$platformName] = array(); $cachePlatform = $cache->get($platformName); /* overview data */ $currentPlatformRT = 0; $currentDatabaseRT = 0; $currentDatabaseRTL = 0; $maxPlatformRT = 0; $maxDatabaseRT = 0; $maxDatabaseRTL = 0; $minPlatformRT = 0; $minDatabaseRT = 0; $minDatabaseRTL = 0; foreach ($cachePlatform as $componentName => $componentValue) { switch ($componentName) { case 'responsetime': case "tr1usuario1": case "tr1usuario2": case "tr1usuario3": case "tr1usuario4": case "tr1usuario5": case "tr1usuario6": case "tr1usuario7": case "tr1usuario8": case "tr1usuario9": case "tr1usuario10": $currentPlatformRT = $componentValue['live']; $maxPlatformRT = $componentValue['hi']; $minPlatformRT = $componentValue['lo']; case 'db_responsetime': $currentDatabaseRT = $componentValue['live']; $maxDatabaseRT = $componentValue['hi']; $minDatabaseRT = $componentValue['lo']; case 'dbl_responsetime': $currentDatabaseRTL = $componentValue['live']; $maxDatabaseRTL = $componentValue['hi']; $minDatabaseRTL = $componentValue['lo']; case 'connections': $live = $componentValue['live']; $max = $componentName == 'connections' ? getMax($platformName) : $componentValue['hi']; $min = $componentName == 'connections' ? 0 : $componentValue['lo']; //$live = ($live >0)?$live:0; $fillPercent = getPercent($live, $max, $min); $root[$platformName][$componentName] = array(); $root[$platformName][$componentName]['chart'] = array($fillPercent, 100 - $fillPercent); $root[$platformName][$componentName]['value'] = $live; break; case 'condition': case 'appresponse1': case 'appresponse2': case 'appresponse3': case 'appresponse4': case 'appresponse5': case 'appresponse6': case 'appresponse7': case 'appresponse8': case 'appresponse9': case 'appresponse10': case 'appresponse11': case 'appresponse12': case 'appresponse13': case 'appresponse14': case 'appresponse15': case 'db_condition': $root[$platformName][$componentName] = $componentValue; break; /*10 usuarios Inicia tr*/ /*10 usuarios Inicia tr*/ case "app1usuario1": case "app1usuario2": case "app1usuario3": case "app1usuario4": case "app1usuario5": case "app1usuario6": case "app1usuario7": case "app1usuario8": case "app1usuario9": case "app1usuario10": case "app2usuario1": case "app2usuario2": case "app2usuario3": case "app2usuario4": case "app2usuario5": case "app2usuario6": case "app2usuario7": case "app2usuario8": case "app2usuario9": case "app2usuario10": case "app3usuario1": case "app3usuario2": case "app3usuario3": case "app3usuario4": case "app3usuario5": case "app3usuario6": case "app3usuario7": case "app3usuario8": case "app3usuario9": case "app3usuario10": case "app4usuario1": case "app4usuario2": case "app4usuario3": case "app4usuario4": case "app4usuario5": case "app4usuario6": case "app4usuario7": case "app4usuario8": case "app4usuario9": case "app4usuario10": case "app5usuario1": case "app5usuario2": case "app5usuario3": case "app5usuario4": case "app5usuario5": case "app5usuario6": case "app5usuario7": case "app5usuario8": case "app5usuario9": case "app5usuario10": case "app6usuario1": case "app6usuario2": case "app6usuario3": case "app6usuario4": case "app6usuario5": case "app6usuario6": case "app6usuario7": case "app6usuario8": case "app6usuario9": case "app6usuario10": case "app7usuario1": case "app7usuario2": case "app7usuario3": case "app7usuario4": case "app7usuario5": case "app7usuario6": case "app7usuario7": case "app7usuario8": case "app7usuario9": case "app7usuario10": case "app8usuario1": case "app8usuario2": case "app8usuario3": case "app8usuario4": case "app8usuario5": case "app8usuario6": case "app8usuario7": case "app8usuario8": case "app8usuario9": case "app8usuario10": $root[$platformName][$componentName] = $componentValue; break; /*10 usuarios finaliza*/ /*10 usuarios Inicia capa de datos*/ /*10 usuarios finaliza*/ /*10 usuarios Inicia capa de datos*/ case "bd1usuario1": case "bd1usuario2": case "bd1usuario3": case "bd1usuario4": case "bd1usuario5": case "bd1usuario6": case "bd1usuario7": case "bd1usuario8": case "bd1usuario9": case "bd1usuario10": $root[$platformName][$componentName] = $componentValue; break; /*10 usuarios Finaliza capa de datos*/ /*10 usuarios Finaliza capa de datos*/ default: # code... break; } /* compile overview data */ $sumLive = 0; $sumMax = 0; $sumMin = 0; if ($currentPlatformRT > 0) { $sumLive += $currentPlatformRT; $sumMax += $maxPlatformRT; $sumMin += $minPlatformRT; } if ($currentDatabaseRT > 0) { $sumLive += $currentDatabaseRT; $sumMax += $maxDatabaseRT; $sumMin += $minDatabaseRT; } if ($currentDatabaseRTL > 0) { $sumLive += $currentDatabaseRTL; $sumMax += $maxDatabaseRTL; $sumMin += $minDatabaseRTL; } $fillPercent = getPercent($sumLive, $sumMax, $sumMin); $root[$platformName]['overview']['chart'] = array($fillPercent, 100 - $fillPercent); $root[$platformName]['overview']['value'] = $sumLive; } } return json_encode($root); }