Example #1
0
function standingsCheck($interactionName, $type)
{
    global $db;
    $interactionName = trim($interactionName);
    $standingsArray = ["Legion of xXDEATHXx" => "-10", "Shadow of xXDEATHXx" => "-5", "SHOVEL.OF.DEATH" => "-5", "Pandemic Legion" => "-10", "Northern Coalition." => "-5", "Black Legion" => "-5", "Mordus Angels" => "-10", "Goonswarm Federation" => "10", "RAZOR Alliance" => "5", "SpaceMonkey's Alliance" => "5", "Tactical Narcotics Team" => "5", "The Bastion" => "5", "Fidelas Constans" => "5", "Executive Outcomes" => "5", "A Band Apart." => "5", "The Terrifying League Of Dog Fort" => "10", "Get Off My Lawn" => "10", "Garys Most Noble Army of Third Place Mediocrity" => "5", "Ashkrall" => "10", "Mapache Doom" => "10", "Matt18001" => "10"];
    // Checking to see if the character name is in our standings
    if (isset($standingsArray[$interactionName])) {
        $value = $standingsArray[$interactionName];
    } else {
        // Creating the Pheal object for the Owner lookup
        $phealLookup = new Pheal(1, 1, 'eve');
        // Lookup OwnerID page
        $ownerInfo = $phealLookup->OwnerID(array('names' => $interactionName));
        // Geting the typeId and the object class
        $interactionClass = $ownerInfo->owners[0]->ownerGroupID;
        $interactionID = $ownerInfo->owners[0]->ownerID;
        //Guide to Interaction Classes:
        // 1 - character, 2 - corporation, 19 - faction, 32 - alliance
        if ($interactionClass != '32' and $interactionClass != '19' and $interactionID != '0') {
            if ($interactionClass == '1') {
                $lookupResponse = $phealLookup->CharacterAffiliation(array('ids' => $interactionID));
                $corporationID = $lookupResponse->characters[0]->corporationID;
            } else {
                $corporationID = $interactionID;
            }
            // Now we are on a corporation, so we're looking up their corporation ID
            $phealLookupCorp = new Pheal(1, 1, 'corp');
            $corporationInfo = $phealLookupCorp->CorporationSheet(array('corporationID' => $corporationID));
            $corporationName = $corporationInfo->corporationName;
            $allianceName = $corporationInfo->allianceName;
        } else {
            $value = 0;
        }
        // Checking to see if either the corporation or alliance name is in our standings
        if (isset($corporationName) and isset($standingsArray[$corporationName])) {
            $value = $standingsArray[$corporationName];
        } elseif (isset($allianceName) and isset($standingsArray[$allianceName])) {
            $value = $standingsArray[$allianceName];
        } else {
            $value = 0;
        }
    }
    switch ($value) {
        case "10":
            $color = 'primary';
            $secondary = 'white-space: normal';
            break;
        case "5":
            $color = 'info';
            $secondary = 'white-space: normal';
            break;
        case "-5":
            $color = 'warning';
            $secondary = 'white-space: normal';
            break;
        case "-10":
            $color = 'danger';
            $secondary = 'white-space: normal';
            break;
        default:
            $color = 'default';
            $secondary = 'background-color: transparent; background-image: none; color: #f5f5f5';
            break;
    }
    if ($type == 'button') {
        $return = 'btn-' . $color . '" style="' . $secondary;
    } else {
        $return = '<span class="label label-' . $color . '">';
    }
    return $return;
}