function GetPercentBar($first, $second) { if ($first <= 0) { $first = 1; $no = true; } if ($second <= 0) { $second = 1; } $percent = round($first * 100 / $second, 2); if ($percent <= 20) { $color = 'green'; } elseif ($percent <= 50) { $color = 'blue'; } elseif ($percent <= 90) { $color = 'orange'; } elseif ($percent <= 100) { $color = '#C00000'; } elseif ($percent > 100) { $color = '#C00000'; $percent = 100; } if ($no) { $color = 'green'; $percent = 0; } $Rand = mt_rand(100000, 99999999); $bar = "<center><div class='percentbar' id='percentbar" . $Rand . "'><div style='background-color:{$color};height:100%;width:" . (int) (1 + $percent) . "%;'> </div></div></center>"; AddTooltip('#percentbar' . $Rand, pretty_number($first) . "/" . pretty_number($second), "{$percent}%"); return $bar; }
public function GalaxyRowPlanetName($GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType, $HavePhalanx, $CurrentGalaxy, $CurrentSystem, $GalaxyRowWormHole) { global $user, $lang; if ($GalaxyRowPlanet['last_update'] > time() - 59 * 60 && $GalaxyRowUser['id'] != $user['id']) { $Inactivity = pretty_time_hour(time() - $GalaxyRowPlanet['last_update']); } if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0) { $Result = "<th style=\"white-space: nowrap;\" width=130>"; if ($HavePhalanx != 0) { if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) { $Range = $this->GetPhalanxRange($HavePhalanx); if ($CurrentGalaxy + $Range <= $CurrentSystem && $CurrentSystem >= $CurrentGalaxy - $Range) { $PhalanxTypeLink = "<a href=# onclick=fenster('game.php?page=phalanx&galaxy=" . $Galaxy . "&system=" . $System . "&planet=" . $Planet . "&planettype=" . $PlanetType . "') title=\"Phalanx\">" . $GalaxyRowPlanet['name'] . "</a><br />"; } else { $PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']); } } else { $PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']); } } else { $PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']); } $Result .= $TextColor . $PhalanxTypeLink . $EndColor; if ($GalaxyRowPlanet['last_update'] > time() - 59 * 60 && $GalaxyRowUser['id'] != $user['id']) { if ($GalaxyRowPlanet['last_update'] > time() - 10 * 60 && $GalaxyRowUser['id'] != $user['id']) { $Result .= "(*)"; } else { $Result .= " (" . $Inactivity . ")"; } } } elseif ($GalaxyRowWormHole) { $Result = "<th style=\"white-space: nowrap;\" width=130>"; if ($GalaxyRowWormHole['start_galaxy'] == $Galaxy and $GalaxyRowWormHole['start_system'] == $System and $GalaxyRowWormHole['start_planet'] == $Planet) { $Orientation = 'end'; } else { $Orientation = 'start'; } if ($GalaxyRowWormHole['state'] == 1) { $Result .= "<span style='color:yellow;'>Agujero de gusano [" . $GalaxyRowWormHole[$Orientation . '_galaxy'] . ":" . $GalaxyRowWormHole[$Orientation . '_system'] . ":" . $GalaxyRowWormHole[$Orientation . '_planet'] . "]</span>"; } elseif ($GalaxyRowWormHole['state'] == 2) { $Result .= "<span style='color:lime;'>Agujero de gusano [" . $GalaxyRowWormHole[$Orientation . '_galaxy'] . ":" . $GalaxyRowWormHole[$Orientation . '_system'] . ":" . $GalaxyRowWormHole[$Orientation . '_planet'] . "]</span>"; } elseif ($GalaxyRowWormHole['state'] == 0) { $Result .= "<span style='color:red;'>Agujero de gusano [" . $GalaxyRowWormHole[$Orientation . '_galaxy'] . ":" . $GalaxyRowWormHole[$Orientation . '_system'] . ":" . $GalaxyRowWormHole[$Orientation . '_planet'] . "]</span>"; } } elseif ($GalaxyRowPlanet["destruyed"] != 0) { $Result .= $lang['gl_planet_destroyed']; } else { $Result .= "<a id='colo" . $Planet . "' class='coloLink' href=\"game.php?page=fleet&galaxy=" . $Galaxy . "&system=" . $System . "&planet=" . $Planet . "&planettype=1&target_mission=7\">[Colonizar]</a>"; $Fields = PlanetSizeRandomiser($Planet, false, true); AddTooltip("#colo" . $Planet, 'Envia un Colonizador a esta posicion y crea una Colonia<br/><br/><b>Campos estimados</b><br/>De <span style=color:lime;>' . $Fields[0] . '</span> a <span style=color:lime; >' . $Fields[1] . '</span> campos', 'Colonizar'); } $Result .= "</th>"; return $Result; }