function testdbMonthsModule() { //creates an empty dbMonths table //$this->assertTrue(create_dbMonths()); // create a month to add to the table $m1 = new Month("13-10-foodbank", "unpublished"); // test the insert function $this->assertTrue(insert_dbMonths($m1)); // test the retrieve function $this->assertEqual(retrieve_dbMonths($m1->get_id())->get_id(), "13-10-foodbank"); $this->assertEqual(retrieve_dbMonths($m1->get_id())->get_status(), "unpublished"); $this->assertEqual(retrieve_dbMonths($m1->get_id())->get_group(), "foodbank"); $this->assertEqual(retrieve_dbMonths($m1->get_id())->get_end_of_month_timestamp(), mktime(0, 0, 0, 10, 31, 2013)); // testing generation of a new calendar month from the master schedule $this->assertTrue(newMonth("13-10-foodbank")); // test the update function $m1->set_status("published"); $this->assertTrue(update_dbMonths($m1)); $this->assertEqual(retrieve_dbMonths($m1->get_id())->get_status(), "published"); // tests the delete function $this->assertTrue(delete_dbMonths($m1)); echo "\ntestdbMonths complete\n"; }
$month = retrieve_dbMonths($monthid); if ($month->get_status() == "unpublished") { $month->set_status("published"); } else { if ($month->get_status() == "published") { $month->set_status("unpublished"); } } update_monthstatus($month); add_log_entry('<a href=\\"personEdit.php?id=' . $_SESSION['_id'] . '\\">' . $_SESSION['f_name'] . ' ' . $_SESSION['l_name'] . '</a> ' . $month->get_status() . ' the month of <a href=\\"calendar.php?id=' . $month->get_id() . '&edit=true&group=' . $_SESSION['mygroup'] . '\\">' . $month->get_name() . '</a>.'); echo "<p>Month \"" . $month->get_name() . "\" " . $month->get_status() . ".<br>"; include 'addMonth.inc'; } else { if ($_GET['remove'] && $_SESSION['access_level'] >= 2) { $id = $_GET['monthid']; $month = retrieve_dbMonths($id); if ($month) { if ($month->get_status() == "unpublished" || $month->get_status() == "archived") { delete_dbMonths($month); add_log_entry('<a href=\\"personEdit.php?id=' . $_SESSION['_id'] . '\\">' . $_SESSION['f_name'] . ' ' . $_SESSION['l_name'] . '</a> removed the month of <a href=\\"calendar.php?id=' . $month->get_id() . '&edit=true&group=' . $_SESSION['mygroup'] . '\\">' . $month->get_name() . '</a>.'); echo "<p>Month \"" . $month->get_name() . "\" removed.<br>"; } else { echo "<p>Month \"" . $month->get_name() . "\" is published, so it cannot be removed.<br>"; } include 'addMonth.inc'; } } else { if (!array_key_exists('_submit_check_newmonth', $_POST)) { include 'addMonth.inc'; } else { $month_id = $_POST['_new_month_timestamp'];