Last active
April 11, 2021 04:42
-
-
Save pjaudiomv/fe18f15d3c4351e371060c92a5e64543 to your computer and use it in GitHub Desktop.
BMLT Get Meetings By Venue Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$root_server = "https://my.root-server.org/main_server"; | |
$meetings = json_decode(file_get_contents("$root_server/client_interface/json/?switcher=GetSearchResults"), true); | |
$console_color = true; | |
$tempvirtual = 0; | |
$virtual = 0; | |
$inperson = 0; | |
$hybrid = 0; | |
$total_meetings = 0; | |
foreach ($meetings as $meeting) { | |
$formats = explode(",", $meeting['formats']); | |
if ( !in_array("VM", $formats) && !in_array("TC", $formats) && !in_array("HY", $formats) ) { | |
$inperson++; | |
} else if ( in_array("VM", $formats) && !in_array("TC", $formats) && !in_array("HY", $formats) ) { | |
$virtual++; | |
} else if ( in_array("VM", $formats) && in_array("TC", $formats) && !in_array("HY", $formats) ) { | |
$tempvirtual++; | |
} else if ( !in_array("VM", $formats) && !in_array("TC", $formats) && in_array("HY", $formats) ) { | |
$hybrid++; | |
} | |
$total_meetings++; | |
} | |
echo colors("Total Meetings By Venue Type", "31"); | |
echo colors(pretty(), "34") . "\n"; | |
echo colors("In-person: ", "36") . colors($inperson, "32") . "\n"; | |
echo colors("Hybrid: ", "36") . colors($hybrid, "32") . "\n"; | |
echo colors("Virtual: ", "36") . colors($virtual, "32") . "\n"; | |
echo colors("Virtual (temporarily replacing an in-person): ", "36"). colors($tempvirtual, "32") . "\n\n"; | |
echo colors("Total Meetings: ", "37") . colors($total_meetings, "32") . "\n"; | |
echo colors(pretty(), "34"); | |
echo "\n"; | |
function pretty() | |
{ | |
return "\n" . str_repeat("-=", 20) . "\n"; | |
} | |
function colors($string, $color) | |
{ | |
if ($GLOBALS['console_color']) { | |
return "\e[1;" . $color . "m" . $string . "\e[0m"; | |
} else { | |
return $string; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment