function new_hours(&$state) { $logdate = clone $state->from_date; if ($state->columns < 0 && $state->row == 0) { //add a rec in list style if (!audit_date($state, $logdate)) { return; } } $status = array(); if (!audit_hours($state, $logdate, $status)) { return; } //adding a row but didn't select existing activity: if ($state->row == 0 && $state->activity_id == 0) { add_activity($state); } for ($ndx = 0; $ndx < abs($state->columns); $ndx++, $logdate->add(new DateInterval('P1D'))) { switch ($status[$ndx]) { case 'a': //add add_log($state, $logdate, $ndx); break; case 'u': //update update_log($state, $logdate, $ndx); break; case 'd': //delete delete_log($state, $logdate, $ndx); break; } } }
function new_info(&$state) { $state->recID = 0; if ($state->row > 0) { //0 is add row log_list($state); foreach ($state->records as $recID => $record) { $state->recID = $recID; if ($record["row"] == $state->row) { break; } } if ($state->recID == 0) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid POST", true); } } if (!audit_counts($state)) { return false; } if (substr($_POST["comments"], 0, 1) == "\n") { $_POST["comments"] = "---"; } $logdate = clone $state->from_date; if ($state->recID == 0) { //adding if (!audit_date($state, $logdate)) { return false; } add_log($state); return; } if ($state->records[$state->recID]["event_id"] != $_POST["event"] || $state->records[$state->recID]["account_id"] != $_POST["account"]) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid record " . $recID, true); } if ($_POST["sessions"] == 0) { delete_log($state); } else { update_log($state); } }