function testdbMasterScheduleModule()
 {
     //creates MasterScheduleEntries to insert to database
     $entry1 = new MasterScheduleEntry("house", "Wed", "odd", "1-5", 2, "", "I do not know what Lin means");
     $entry2 = new MasterScheduleEntry("house", "Tue", "even", "1-5", 3, "", "Yay kitchen shift!");
     $entry3 = new MasterScheduleEntry("house", "Wed", "even", "1-5", 2, "", "");
     $entry4 = new MasterScheduleEntry("house", "Fri", "odd", "1-5", 4, "", "Best job ever.");
     //tests the insert function
     $this->assertTrue(insert_dbMasterSchedule($entry1));
     $this->assertTrue(insert_dbMasterSchedule($entry2));
     $this->assertTrue(insert_dbMasterSchedule($entry3));
     $this->assertTrue(insert_dbMasterSchedule($entry4));
     //tests the retrieve function
     $this->assertEqual(retrieve_dbMasterSchedule($entry2->get_id())->get_day(), $entry2->get_day());
     $this->assertEqual(retrieve_dbMasterSchedule($entry2->get_id())->get_hours(), $entry2->get_hours());
     $this->assertEqual(retrieve_dbMasterSchedule($entry2->get_id())->get_venue(), $entry2->get_venue());
     $this->assertEqual(retrieve_dbMasterSchedule($entry2->get_id())->get_week_no(), $entry2->get_week_no());
     $this->assertEqual(retrieve_dbMasterSchedule($entry2->get_id())->get_slots(), $entry2->get_slots());
     $this->assertEqual(retrieve_dbMasterSchedule($entry2->get_id())->get_id(), $entry2->get_id());
     //tests the update function
     $entry3->set_notes("This is a new note");
     $this->assertTrue(update_dbMasterSchedule($entry3));
     $this->assertEqual(retrieve_dbMasterSchedule($entry3->get_id())->get_notes(), "This is a new note");
     //tests the delete function
     $this->assertTrue(delete_dbMasterSchedule($entry1->get_id()));
     $this->assertTrue(delete_dbMasterSchedule($entry2->get_id()));
     $this->assertTrue(delete_dbMasterSchedule($entry3->get_id()));
     $this->assertTrue(delete_dbMasterSchedule($entry4->get_id()));
     echo "testdbMasterSchedule complete";
 }
function test_retrieve_dbMasterSchedule()
{
    //  $m = new person("Gabrielle", "Booth", "female", "14 Way St", "Harpswell", "ME", "04079", "", 1112345678, 2071112345, "*****@*****.**", "email", "Mother", 2077758989, "manager", "", "", "active", "programmer", "Steve_2077291234", "yes", "", "", "Mon:morning,Tue:morning", "", "", "02-19-89", "03-14-08", "", "");
    $new_MasterScheduleEntry = new MasterScheduleEntry("weekly", "Mon", "odd", "14", "17", 2, "joe2071234567,sue2079876543", "I like pie.", "Night Shift");
    // not sure what the id looks like
    echo 'will test retrieve_dbMasterSchedule </br>';
    error_log('testing retrieve');
    $result = insert_dbMasterSchedule($new_MasterScheduleEntry);
    echo 'result is ' . $result;
    if ($result) {
        echo "insert_dbMasterSchedule succeeded </br>";
    } else {
        echo "insert_dbMasterSchedule failed</br>";
    }
    $mse = retrieve_dbMasterSchedule($new_MasterScheduleEntry->get_MS_ID());
    if ($mse == null) {
        echo 'Retrieve failed</br>';
    } else {
        checkEquals($mse->get_MS_ID(), "weeklyMon14-17");
        checkEquals($mse->get_start_time(), "14");
        checkEquals($mse->get_persons(), "joe2071234567,sue2079876543");
        checkEquals($mse->get_notes(), "I like pie.");
    }
    $res = delete_dbMasterSchedule($new_MasterScheduleEntry->get_MS_ID());
    if ($res == null) {
        echo 'delete failed</br>';
    }
}
function show_master_month($group)
{
    $group_names = array("foodbank" => "Food Bank", "foodpantry" => "Food Pantry", "soupkitchen" => "Soup Kitchen");
    $days = array("Sun" => "Sunday", "Mon" => "Monday", "Tue" => "Tuesday", "Wed" => "Wednesday", "Thu" => "Thursday", "Fri" => "Friday", "Sat" => "Saturday");
    $fpdays = array("Sun" => "Sunday", "Mon" => "Monday", "Tue" => "Tuesday", "Wed930" => "Wed 9:30", "Wed1100" => "Wed 11:45", "Thu" => "Thursday", "Fri" => "Friday", "Sat" => "Saturday");
    $weeks = array(1 => "1st", 2 => "2nd", 3 => "3rd", 4 => "4th", 5 => "5th");
    if ($group == "foodpantry") {
        $thisdays = $fpdays;
    } else {
        $thisdays = $days;
    }
    echo '<br><table id="calendar" align="center" >' . '<tr class="weekname"><td colspan="' . (sizeof($thisdays) + 2) . '" ' . 'bgcolor="#99B1D1" align="center" >' . $group_names[$group] . ' Master Schedule</td></tr>';
    echo '<tr><td bgcolor="#99B1D1"></td>';
    foreach ($thisdays as $day => $dayname) {
        echo '<td class="dow" align="center"> ' . $dayname . ' </td>';
    }
    echo '<td bgcolor="#99B1D1"></td></tr>';
    $shiftdefaultsizes = array("foodbank" => 8, "foodpantry" => 6, "soupkitchen" => 9);
    foreach ($weeks as $week_no => $week) {
        echo '<tr><td bgcolor="#99B1D1">' . $week . '</td>';
        foreach ($thisdays as $day => $dayname) {
            $master_shift = retrieve_dbMasterSchedule($group . $day . $week_no);
            /* retrieves a MasterScheduleEntry for this group, day, and week of the month */
            if ($master_shift) {
                echo do_shift($master_shift);
            } else {
                if ($group == "foodpantry" && ($day == "Sun" || $day == "Tue" || $day == "Thu")) {
                    $master_shift = new MasterScheduleEntry($group, $day, $week_no, 0, "", "");
                    insert_dbMasterSchedule($master_shift);
                    echo do_shift($master_shift);
                } else {
                    if ($group == "foodbank" && ($day == "Sat" || $day == "Sun") || $group == "soupkitchen" && $day == "Sat") {
                        $master_shift = new MasterScheduleEntry($group, $day, $week_no, 1, "", "");
                        insert_dbMasterSchedule($master_shift);
                        echo do_shift($master_shift);
                    } else {
                        if ($group == "soupkitchen" && $day == "Sun") {
                            $master_shift = new MasterScheduleEntry($group, $day, $week_no, 0, "", "");
                            insert_dbMasterSchedule($master_shift);
                            echo do_shift($master_shift);
                        } else {
                            $master_shift = new MasterScheduleEntry($group, $day, $week_no, $shiftdefaultsizes[$group], "", "");
                            insert_dbMasterSchedule($master_shift);
                            echo do_shift($master_shift);
                        }
                    }
                }
            }
        }
        echo '<td bgcolor="#99B1D1">' . $week . '</td></tr>';
    }
    echo '<tr class="weekname"><td colspan="' . (sizeof($thisdays) + 2) . '" ' . 'bgcolor="#99B1D1" align="center" >' . $group_names[$group] . ' Master Schedule</td></tr>';
    echo "</table>";
}
Exemplo n.º 4
0
function show_master_schedule($venue)
{
    $wkndgroups = array("1st", "2nd", "3rd", "4th", "5th");
    $groups = array("odd", "even");
    $shifts = array("9-12", "12-3", "3-6", "6-9", "night");
    $venues = array("portland" => "Portland House", "bangor" => "Bangor House");
    $days = array("Mon" => "Monday", "Tue" => "Tuesday", "Wed" => "Wednesday", "Thu" => "Thursday", "Fri" => "Friday");
    echo '<p><table id="calendar" align="center" ><tr class="weekname"><td colspan="' . (sizeof($days) + 2) . '" ' . 'bgcolor="ffdddd" align="center" >' . $venues[$venue] . " Master Schedule -- weekday shifts";
    echo '</td></tr><tr><td bgcolor="#ffdddd">  </td>';
    foreach ($days as $day => $dayname) {
        echo '<td class="dow" align="center"> ' . $dayname . ' </td>';
    }
    echo '<td bgcolor="#ffdddd"></td></tr>';
    $columns = sizeof($days);
    foreach ($groups as $group) {
        $showgroup = $group;
        foreach ($shifts as $hour) {
            echo "<tr><td class=\"masterhour\">   " . $showgroup . " " . $hour . "</td>";
            foreach ($days as $day => $dayname) {
                $master_shift = retrieve_dbMasterSchedule($group . ":" . $day . ":" . $hour . ":" . $venue);
                if ($master_shift) {
                    echo do_shift($master_shift, 1);
                } else {
                    $master_shift = new MasterScheduleEntry($venue, $day, $group, $hour, 0, "", "");
                    echo do_shift($master_shift, 0);
                }
            }
            echo "<td class=\"masterhour\">" . $showgroup . " " . $hour . "</td></tr>";
            $showgroup = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        }
    }
    echo "</table>";
    $satshiftsportland = array("10-1", "1-4", "night");
    $sunshiftsportland = array("9-12", "2-5", "5-9");
    $satshiftsbangor = array("9-5", "night");
    $sunshiftsbangor = array("9-5", "5-9");
    if ($_SESSION['venue'] == "portland") {
        $satshifts = $satshiftsportland;
        $sunshifts = $sunshiftsportland;
    } else {
        $satshifts = $satshiftsbangor;
        $sunshifts = $sunshiftsbangor;
    }
    echo "</p><p>&nbsp;<table align='center'><tr><td>";
    echo '<table id="calendar" align="left" ><tr class="weekname"><td colspan="2" ' . 'bgcolor="ffdddd" align="center" >weekend shifts';
    echo '</td></tr><tr><td bgcolor="#ffdddd">  </td>';
    echo '<td class="dow" align="center"> Saturday </td>';
    echo '<td bgcolor="#ffffff"></td></tr>';
    foreach ($wkndgroups as $group) {
        $showgroup = $group;
        foreach ($satshifts as $hour) {
            echo "<tr><td class=\"masterhour\">   " . $showgroup . " " . $hour . "</td>";
            $day = "Sat";
            $dayname = "Saturday";
            $master_shift = retrieve_dbMasterSchedule($group . ":" . $day . ":" . $hour . ":" . $venue);
            if ($master_shift) {
                echo do_shift($master_shift, 1);
            } else {
                $master_shift = new MasterScheduleEntry($venue, $day, $group, $hour, 0, "", "");
                echo do_shift($master_shift, 0);
            }
            echo "<td bgcolor='#ffffff'></td></tr>";
            $showgroup = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        }
    }
    echo "</table>";
    echo "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>";
    echo '<table id="calendar" align="center"><tr class="weekname"><td colspan="2" ' . 'bgcolor="ffdddd" align="center" >';
    echo '</td></tr><tr><td bgcolor="#ffdddd">  </td>';
    echo '<td class="dow" align="center"> Sunday </td>';
    echo '<td bgcolor="ffffff" ></td></tr>';
    foreach ($wkndgroups as $group) {
        $showgroup = $group;
        foreach ($sunshifts as $hour) {
            echo "<tr><td class=\"masterhour\">   " . $showgroup . " " . $hour . "</td>";
            $day = "Sun";
            $dayname = "Sunday";
            $master_shift = retrieve_dbMasterSchedule($group . ":" . $day . ":" . $hour . ":" . $venue);
            if ($master_shift) {
                echo do_shift($master_shift, 1);
            } else {
                $master_shift = new MasterScheduleEntry($venue, $day, $group, $hour, 0, "", "");
                echo do_shift($master_shift, 0);
            }
            echo "<td bgcolor='#ffffff'></td></tr>";
            $showgroup = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        }
    }
    echo "</table>";
    echo "</td></tr></table>";
}
Exemplo n.º 5
0
function delete_dbMasterSchedule($id)
{
    // first, unschedule people from the shift
    $msentry = retrieve_dbMasterSchedule($id);
    if ($msentry != null) {
        $ids = get_person_ids($msentry->get_venue(), $msentry->get_week_no(), $msentry->get_day(), $msentry->get_hours());
        foreach ($ids as $person_id) {
            if ($person_id) {
                unschedule_person($msentry, $person_id);
            }
        }
    }
    connect();
    $query = "DELETE FROM dbMasterSchedule WHERE id = '" . $id . "'";
    $result = mysql_query($query);
    if (!$result) {
        echo mysql_error() . " - Unable to delete from dbMasterSchedule: " . $id . "\n";
        return false;
    }
    mysql_close();
    return true;
}
if ($_SESSION['access_level'] < 2) {
    die("<p>Only managers can edit the master schedule.</p>");
}
// $frequency=$_GET['frequency'];
$venue = $_GET['venue'];
$day = $_GET['day'];
$shift = [$day, $_GET['shift']];
$shift = get_day_names($shift, $day);
include_once 'database/dbMasterSchedule.php';
include_once 'domain/MasterScheduleEntry.php';
include_once 'database/dbLog.php';
//if($group=="" || $day=="" || $shift=="") {
if ($day == "" || $shift == "") {
    echo "<p>Invalid schedule parameters.  Please click on the \"Master Schedule\" link above to edit a master schedule shift.</p>";
} else {
    $master_entry = retrieve_dbMasterSchedule($venue . $day . $shift[1]);
    if ($master_entry == false) {
        $result = process_set_times($_POST, $day);
        if ($result) {
            $returnpoint = "viewSchedule.php?frequency=" . $venue;
            echo "<table align=\"center\"><tr><td align=\"center\" width=\"442\">\r\n                                        <br><a href=\"" . $returnpoint . "\">\r\n                                        Back to Master Schedule</a></td></tr></table>";
        } else {
            //$groupdisplay = $venue . " Group ".$group;
            echo "<table align=\"center\" width=\"450\"><tr><td align=\"center\" colspan=\"2\"><b>\r\n\t\t                                Adding a new " . ucfirst($venue) . " shift for " . substr($shift[0], 3) . " " . $shift[2] . " which starts at " . explode(" to ", do_name($_GET['shift']))[0] . "</b></td></tr>" . "<tr><td>\r\n                                            <b>Shift Name:</b>\r\n                                            <form method=\"POST\" style=\"margin-bottom:0;\">\r\n                                            <input name=\"shift_name\" type=\"text\"><br>\r\n                                            \t\t<select hidden name=\"new_start\">\r\n                                                    <option value=\"0\">Please select a new starting time</option>" . get_all_times() . "\r\n                                                    </select>\r\n                                                    <select name=\"new_end\">\r\n                                                    <option value=\"0\">Default End</option>" . get_all_end_times(explode("-", $shift[1])[1]) . "\r\n                                                    </select>\r\n                                                    <input type=\"hidden\" name=\"_submit_change_times\" value=\"1\">\r\n\t\t                                    <input type=\"submit\" value=\"Add New Shift\" name=\"submit\">\r\n\t\t                                    </form><br></td></tr></table>";
        }
    } else {
        // if one is there, see what we can do to update it
        if (!process_remove_shift($_POST, $shift, $day, $shift[1], $venue)) {
            // try to remove the shift
            // we've tried to clear the shift, add a slot, or remove a slot;
            // so now display the shift again.
function newMonth($id)
{
    $days = array(1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat");
    $fpdays = array(1 => "Mon", 2 => "Wed930", 3 => "Wed1100", 4 => "Thu", 5 => "Fri", 6 => "Sat");
    if (substr($id, 6) == "foodpantry") {
        $thisdays = $fpdays;
    } else {
        $thisdays = $days;
    }
    // We switched new months to default to published, because otherwise they won't be available for viewing.
    // We're unsure if this was the right move to make.
    $new_month = new Month($id, "unpublished");
    $new_crews = $new_month->get_crews();
    $dom = 1;
    // day of the month, 1, 2, ..., 31
    $week_no = 1;
    // master schedule week number
    $firstdow = $dow = date("N", mktime(0, 0, 0, substr($id, 3, 2), "01", substr($id, 0, 2)));
    // day of week, 1 = Monday
    if (substr($id, 6) == "foodpantry" && $firstdow == 3) {
        $firstdow = $dow = 2;
    }
    $newbies = array();
    foreach ($new_crews as $new_crew) {
        if ($dom == sizeof($new_crews) && substr($id, 6) == "foodpantry" && $dow == 2) {
            break;
        }
        $id1 = substr($id, 6) . $thisdays[$dow] . $week_no;
        $schedule_entry = retrieve_dbMasterSchedule($id1);
        if ($schedule_entry && $schedule_entry->get_slots() > 0) {
            if ($dom < 10) {
                $dd = "-0" . $dom;
            } else {
                $dd = "-" . $dom;
            }
            $person_ids = $schedule_entry->get_persons();
            $crew_names = array();
            foreach ($person_ids as $person_id) {
                if ($person_id == "") {
                    continue;
                }
                $p = retrieve_person($person_id);
                if ($p) {
                    $crew_names[] = $person_id . "+" . $p->get_first_name() . "+" . $p->get_last_name() . "+(" . implode(' ', $p->get_role()) . ")";
                } else {
                    $crew_names[] = $person_id . "+++";
                }
            }
            $newbie = new Crew(substr($id, 0, 5) . $dd, substr($id, 6), $schedule_entry->get_slots(), $crew_names, "", "");
            $new_month->set_crew($dom, $newbie->get_id());
            $newbies[] = $newbie;
        }
        if ($dow == 7) {
            $dow = 1;
        } else {
            $dow++;
        }
        if ($dow == $firstdow) {
            $week_no++;
        }
        $dom++;
    }
    update_dbMonths($new_month);
    foreach ($newbies as $newbie) {
        update_dbCrews($newbie);
    }
    return $new_month;
}
function show_master_week($group, $days)
{
    echo '<br><table id="calendar" align="center" ><tr class="weekname"><td colspan="' . (sizeof($days) + 2) . '" ' . 'bgcolor="#99B1D1" align="center" >' . $group;
    if (sizeof($days) > 2) {
        echo ' weekday Master Schedule';
    } else {
        echo ' weekend Master Schedule';
    }
    echo '</td></tr><tr><td bgcolor="#99B1D1">  </td>';
    foreach ($days as $day => $dayname) {
        echo '<td class="dow" align="center"> ' . $dayname . ' </td>';
    }
    echo '<td bgcolor="#99B1D1"></td></tr>';
    $free_hour = [];
    $columns = sizeof($days);
    for ($i = 0; $i < 12 * $columns; $i++) {
        $free_hour[] = true;
    }
    for ($hour = 9; $hour < 21; $hour++) {
        echo "<tr><td class=\"masterhour\">" . show_hours($hour) . "</td>";
        $i = 0;
        foreach ($days as $day => $dayname) {
            $master_shift = retrieve_dbMasterSchedule("weekly" . $day . $group . "-" . $hour);
            /* retrieves a MasterScheduleEntry whose start time is $hour */
            if ($master_shift) {
                $shift_length = $master_shift->get_end_time() - $master_shift->get_start_time();
                echo do_shift($master_shift, $shift_length);
                for ($j = $hour; $j < $hour + $shift_length; $j++) {
                    $free_hour[$columns * ($j - 9) + $i] = false;
                }
            } else {
                if ($free_hour[$columns * ($hour - 9) + $i]) {
                    //	$t = $hour . "-" . ($hour+1);
                    $master_shift = new MasterScheduleEntry("weekly", $day, $group, $hour, $hour + 1, 1, "", "", "");
                    echo do_shift($master_shift, 0);
                }
            }
            $i++;
        }
        echo "<td class=\"masterhour\">" . show_hours($hour) . "</td></tr>";
    }
    echo "<tr><td class=\"masterhour\">" . "overnight" . "</td>";
    foreach ($days as $day => $dayname) {
        $master_shift = retrieve_dbMasterSchedule("weekly" . $day . $group . "-overnight");
        if ($master_shift) {
            echo do_shift($master_shift, 1);
        } else {
            $master_shift = new MasterScheduleEntry("weekly", $day, $group, "overnight", 0, 1, "", "", "");
            echo do_shift($master_shift, 0);
        }
    }
    echo "<td class=\"masterhour\">" . "overnight" . "</td></tr>";
    echo "</table>";
}
Exemplo n.º 9
0
    // if a shift is there, see what we can do to update it
    if (!process_fill_vacancy($_POST, $msentry) && !process_add_volunteer($_POST, $msentry) && !process_remove_shift($_POST, $msentry, $group, $day, $shiftname, $venue)) {
        if (process_unfill_shift($_POST, $msentry, $venue)) {
            // 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>
}
if (isset($_SESSION['mygroup'])) {
    $group = $_SESSION['mygroup'];
} else {
    $group = "foodbank";
}
$group = $_GET['group'];
$day = $_GET['day'];
$week_no = $_GET['week_no'];
include_once 'database/dbMasterSchedule.php';
include_once 'domain/MasterScheduleEntry.php';
include_once 'database/dbLog.php';
if ($group == "" || $day == "" || $week_no == "") {
    echo "<p>Invalid schedule parameters.  Please click on the \"Master Schedule\" link above to edit a master schedule crew.</p>";
} else {
    if (retrieve_dbMasterSchedule($group . $day . $week_no) == false) {
        $result = process_set_times($_POST, $group, $day, $week_no);
        if ($result) {
            $returnpoint = "viewSchedule.php?group=" . $group;
            echo "<table align=\"center\"><tr><td align=\"center\" width=\"442\">\n\t\t\t\t\t\t\t\t<br><a href=\"" . $returnpoint . "\">\n\t\t\t\t\t\t\t\tBack to Master Schedule</a></td></tr></table>";
        } else {
            echo "<table align=\"center\" width=\"450\"><tr><td align=\"center\" colspan=\"2\"><b>\n\t\t\t\t\t\t\t\tAdding a New Master Schedule crew for " . $do_group_name($group) . ", " . do_week_name($week_no) . " " . do_day_name($day) . " " . "</b></td></tr>" . "<tr><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<select name=\"new_slots\">\n\t\t\t\t\t\t\t\t\t<option value=\"0\">Please select the number of slots for this crew</option>" . slots_select() . "</select><br>\n\t\t\t\t\t\t\t\t\t<br><br>\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"_submit_change_times\" value=\"1\">\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"Add New Crew\" name=\"submit\">\n\t\t\t\t\t\t\t\t\t</form><br></td></tr></table>";
        }
    } else {
        // if one is there, see what we can do to update it
        if (!process_fill_vacancy($_POST, $group, $day, $week_no) && !process_add_volunteer($_POST, $group, $day, $week_no) && !process_remove_crew($_POST, $group, $day, $week_no)) {
            // 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)) {