if (process_add_slot($_POST, $project, $venue)) {
                    $project = select_dbProjects($projectid);
                } else {
                    if (process_clear_project($_POST, $project, $venue)) {
                        $project = select_dbProjects($projectid);
                    } else {
                        if (process_ignore_slot($_POST, $project, $venue)) {
                            $project = select_dbProjects($projectid);
                        }
                    }
                }
            }
            $persons = $project->get_persons();
            echo "<br><br><table align=\"center\" border=\"1px\"><tr><td align=\"center\" colspan=\"2\"><b>" . get_project_name_from_id($projectid) . "</b></td></tr>";
            if ($_SESSION['access_level'] >= 2) {
                echo "<tr><td valign=\"top\"><br>&nbsp;" . do_slot_num($persons, $project > num_vacancies()) . "</td><td>";
                echo "<form method=\"POST\" style=\"margin-bottom:0;\">\r\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_add_slot\" value=\"1\"><br>\r\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Add Slot\" style=\"width: 150px\"\r\n\t\t\t\t\t\t\t\t\t\t\tname=\"submit\" >\r\n\t\t\t\t\t\t\t\t\t\t\t</form>";
                echo "<form method=\"POST\" style=\"margin-bottom:0;\">\r\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_clear_project\" value=\"1\">\r\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Clear Entire Project\" style=\"width: 150px\"\r\n\t\t\t\t\t\t\t\t\t\t\tname=\"submit\" >\r\n\t\t\t\t\t\t\t\t\t\t\t</form>";
                echo "<form method=\"POST\" style=\"margin-bottom:0;\">\r\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_move_project\" value=\"1\">\r\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Move Project\" style=\"width: 150px\"\r\n\t\t\t\t\t\t\t\t\t\t\tname=\"submit\" >\r\n\t\t\t\t\t\t\t\t\t\t\t</form>";
                echo "<br></td></tr>";
            }
            echo display_filled_slots($persons);
            echo display_vacant_slots($project->num_vacancies());
            echo "</td></tr></table>";
            echo "<p align=\"center\"><a href=\"calendar.php?id=" . substr($projectid, 0, 8) . "&edit=true&venue=house" . "\">\r\n\t\t\t\t\t\t\t\t\tBack to Calendar</a>";
        }
    }
}
?>

    </div>
            // try to remove a person
        } else {
            if (process_add_slot($_POST, $msentry, $venue)) {
                // try to add a new slot
            } else {
                if (process_ignore_slot($_POST, $msentry, $venue)) {
                    //try to remove a slot
                }
            }
        }
        // we've tried to clear the shift, add a slot, or remove a slot;
        // so now display the shift again.
        $msentry = retrieve_dbMasterSchedule($id);
        $persons = get_persons($msentry->get_id());
        // $groupdisplay = $venue . " Group ".$group;
        echo "<table align=\"center\" width=\"450\"><tr><td align=\"center\" colspan=\"2\"><b>" . $msentry->get_name() . "</b>\n\t\t\t\t\t\t\t\t<form method=\"POST\" style=\"margin-bottom:0;\">\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_remove_shift\" value=\"1\"><br>\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Remove Entire Shift\"\n\t\t\t\t\t\t\t\t\tname=\"submit\">\n\t\t\t\t\t\t\t\t\t</form><br>\n\t\t\t\t\t\t\t\t</td></tr>" . "<tr><td valign=\"top\"><br>&nbsp;" . do_slot_num($msentry) . "</td><td>\n\t\t\t\t\t\t\t\t\t<form method=\"POST\" style=\"margin-bottom:0;\">\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_add_slot\" value=\"1\"><br>\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Add Slot\"\n\t\t\t\t\t\t\t\t\tname=\"submit\" style=\"width: 250px\">\n\t\t\t\t\t\t\t\t\t</form><br></td></tr>";
        echo display_filled_slots($persons) . display_vacant_slots($msentry->get_slots() - count($persons)) . "</table>";
        $returnpoint = "viewSchedule.php?venue=" . $venue;
        echo "<table align=\"center\"><tr><td align=\"center\" width=\"442\">\n\t\t\t\t\t\t\t\t\t       <br><a href=\"" . $returnpoint . "\">\n\t\t\t\t\t\t\t\t\t\t   Back to Master Schedule</a></td></tr></table>";
    }
}
?>
                <br>
             </div>
          <?php 
include 'footer.inc';
?>
        </div>
    </body>
</html>
            } else {
                if (process_add_slot($_POST, $crew, $group)) {
                    $crew = select_dbCrews($crewid);
                } else {
                    if (process_clear_crew($_POST, $crew, $group)) {
                        $crew = select_dbCrews($crewid);
                    } else {
                        if (process_ignore_slot($_POST, $crew, $group)) {
                            $crew = select_dbCrews($crewid);
                        }
                    }
                }
            }
            $persons = $crew->get_persons();
            echo "<br><br><table align=\"center\" border=\"1px\"><tr><td align=\"center\" colspan=\"3\"><b>" . get_crew_name_from_id($crewid) . "</b></td><td></td></tr>";
            echo "<tr><td valign=\"top\"><br>&nbsp;" . do_slot_num($crew->get_slots()) . "</td><td>";
            if ($_SESSION['access_level'] == 2) {
                echo "<form method=\"POST\" style=\"margin-bottom:0;\">\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_add_slot\" value=\"1\"><br>\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Add Slot\"\n\t\t\t\t\t\t\t\t\t\t\tname=\"submit\" >\n\t\t\t\t\t\t\t\t\t\t\t</form></td><td><br>";
                echo "<form method=\"POST\" style=\"margin-bottom:0;\">\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_clear_crew\" value=\"1\">\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Clear Entire Crew\"\n\t\t\t\t\t\t\t\t\t\t\tname=\"submit\" >\n\t\t\t\t\t\t\t\t\t\t\t</form></td>";
            } else {
                echo "</td><td></td>";
            }
            echo "<td></td></tr>";
            echo display_filled_slots($persons);
            echo display_vacant_slots($crew->num_vacancies());
            echo "</td></tr></table>";
            echo "<p align=\"center\"><a href=\"calendar.php?month=" . substr($crewid, 0, 5) . "&group=" . $group . "&edit=true" . "\">\n\t\t\t\t\t\t\t\t\tBack to Calendar</a>";
        }
    }
}
?>
            // try to remove the crew
            if (process_unfill_crew($_POST, $group, $day, $week_no)) {
                // try to remove a person
            } else {
                if (process_add_slot($_POST, $group, $day, $week_no)) {
                    // try to add a new slot
                } else {
                    if (process_ignore_slot($_POST, $group, $day, $week_no)) {
                        //try to remove a slot
                    }
                }
            }
            // we've tried to clear the crew, add a slot, or remove a slot;
            // so now display the crew again.
            $persons = get_persons($group, $day, $week_no);
            echo "<br><table align=\"center\" width=\"450\" border=\"1px\"><tr><td align=\"center\" colspan=\"2\"><b>\n\t\t\t\t\t\t\t\tEditing master schedule crew for " . do_group_name($group) . "<br>" . do_week_name($week_no) . " " . do_day_name($day) . "\n\t\t\t\t\t\t\t\t</b>\n\t\t\t\t\t\t\t\t<form method=\"POST\" style=\"margin-bottom:0;\">\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_remove_crew\" value=\"1\"><br>\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Remove Entire Crew\"\n\t\t\t\t\t\t\t\t\tname=\"submit\">\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t</td></tr>" . "<tr><td valign=\"top\"><br>&nbsp;" . do_slot_num($group, $day, $week_no) . "</td><td>\n\t\t\t\t\t\t\t\t\t<form method=\"POST\" style=\"margin-bottom:0;\">\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_add_slot\" value=\"1\"><br>\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Add Slot\"\n\t\t\t\t\t\t\t\t\tname=\"submit\" style=\"width: 250px\">\n\t\t\t\t\t\t\t\t\t</form></td></tr>";
            echo display_filled_slots($persons) . display_vacant_slots(get_total_vacancies($group, $day, $week_no)) . "</table>";
            $returnpoint = "viewSchedule.php?group=" . $group;
            echo "<table align=\"center\"><tr><td align=\"center\" width=\"442\">\n\t\t\t\t\t\t\t\t\t       <br><a href=\"" . $returnpoint . "\">\n\t\t\t\t\t\t\t\t\t\t   Back to Master Schedule</a></td></tr></table>";
        }
    }
}
?>
                <br>
             </div>
          <?php 
include 'footer.inc';
?>
        </div>
    </body>
</html>