示例#1
0
function show_crew_cumulatives()
{
    $crew = new crew();
    $crew->load($_SESSION['current_view']['crew']->get('id'));
    // Display Crew Cumulatives
    echo "<div style=\"text-align:center;\">\n";
    echo "<table style=\"margin:0 auto 0 auto;\">\n" . "<tr><td><img src=\"" . $crew->logo_filename . "\"></td>\n" . "<td><h1>" . $crew->name . "</h1>" . "<table style=\"margin:0 auto 0 auto;\">\n" . "<tr><td style=\"text-align:right\">Crew Size in " . $_SESSION['current_view']['year'] . ":</td><td style=\"text-align:right\">" . $crew->crewmember_count . "</td></tr>\n" . "<tr><td style=\"text-align:right\">Total Rappels in " . $_SESSION['current_view']['year'] . ":</td><td style=\"text-align:right\">" . $crew->raps_this_year_total . "</td></tr>\n" . "<tr><td style=\"text-align:right\">Operationals in " . $_SESSION['current_view']['year'] . ":</td><td style=\"text-align:right\">" . $crew->raps_this_year_operational . "</td></tr>\n" . "<tr><td style=\"text-align:right\">Operationals-per-Person in " . $_SESSION['current_view']['year'] . ":</td><td style=\"text-align:right; padding-left:10px;\">" . $crew->raps_this_year_per_person_operational . "</td></tr>\n" . "<tr><th colspan=\"2\" style=\"padding-top:10px;border-bottom:1px solid #555555;\">Demographics</th></tr>\n" . "<tr><td style=\"text-align:right\">Average Age:</td><td style=\"text-align:right\">" . $crew->avg_age . "</td></tr>\n" . "<tr><td style=\"text-align:right\">Crewmembers Who Are Male:</td><td style=\"text-align:right\">" . $crew->gender_ratio . "%</td></tr>\n" . "<tr><td style=\"text-align:right\">Rappels by Men / Women in " . $_SESSION['current_view']['year'] . ":</td><td style=\"text-align:right\">" . $crew->male_rappels . " / " . $crew->female_rappels . "</td></tr>\n" . "</table>\n" . "</td></tr>\n\n" . "</table></div>\n\n";
    echo "<hr style=\"width:75%; height:3px; \">\n\n";
    echo "This crew has roster information for the following years:<br>\n";
    $year_str = "";
    if ($year_array = $crew->get_roster_years()) {
        foreach ($year_array as $year) {
            $year_str .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?region=" . $_SESSION['current_view']['region'] . "&crew=" . $_SESSION['current_view']['crew']->get('id') . "&year=" . $year . "\">" . $year . "</a> | ";
        }
        $year_str = substr($year_str, 0, strlen($year_str) - 3);
        // Strip the last pipe divider off the string
    }
    echo $year_str . "\n<br><br>\n";
    // Display crew roster - if user is logged in, each crewmember image will be a link to their rappel history. If NOT logged in, images are not links.
    try {
        if ($crew->get_crewmembers($_SESSION['current_view']['year'])) {
            $col_count = 1;
            echo "<table style=\"margin:0 auto 0 auto;\">\n";
            foreach ($crew->crewmembers as $hrap) {
                if (($col_count - 1) % 5 == 0) {
                    echo "<tr>\n";
                }
                echo "<td class=\"roster_thumbnail\">";
                if (isset($_SESSION['logged_in']) && $_SESSION['logged_in']) {
                    echo "<a href=\"view_rappels.php?hrap=" . $hrap->get('id') . "\">";
                }
                echo "<img src=\"" . $hrap->headshot_filename . "\">";
                if (isset($_SESSION['logged_in']) && $_SESSION['logged_in']) {
                    echo "</a>";
                }
                /*				echo "<br>\n"
                					."<table><tr><td colspan=\"2\" style=\"text-align:center;font-weight:bold;\">".$hrap->name."</td></tr>\n"
                					."<tr><td style=\"text-align:right;\">Operationals:</td><td style=\"text-align:left;\">".$hrap->raps_all_time_operational."</td></tr></table>\n</td>";
                */
                echo "<br>\n" . "<span style=\"font-weight:bold;\">" . $hrap->name . "</span><br>\n" . $hrap->raps_all_time_operational . " Ops / " . $hrap->raps_all_time_live . " Total</td>\n";
                if ($col_count % 5 == 0) {
                    echo "\n</tr>\n";
                }
                $col_count++;
            }
            // End: foreach
            echo "</table></div><br>\n";
        }
    } catch (Exception $e) {
        echo $e->getMessage() . "<br>\n";
        //Display message if there is no data for the selected year
    }
}