} else { $PROCESSED["event_status"] = $_POST["event_status"]; } } if (!$ERROR) { $PROCESSED["modified_last"] = time(); $PROCESSED["modified_by"] = $ENTRADA_USER->getID(); if (!$db->AutoExecute("`" . CLERKSHIP_DATABASE . "`.`events`", $PROCESSED, "UPDATE", "`event_id` = " . $db->qstr($EVENT_ID))) { $ERROR++; $ERRORSTR[] = "Failed to update this event in the database. Please contact a system administrator if this problem persists."; application_log("error", "Error while editing clerkship event into database. Database server said: " . $db->ErrorMsg()); $STEP = 1; } //Delete apartment schedule info for this student if the location has changed. if ($PROCESSED["region_id"] != $event_info["region_id"] || $event_info["event_start"] != $PROCESSED["event_start"] || $event_info["event_finish"] != $PROCESSED["event_finish"]) { if (!notify_regional_education("change-critical", $EVENT_ID)) { system_log_data("error", "Unable to notify the regional education office that event_id [" . $EVENT_ID . "] endured a critical change."); } if (!$db->Execute("DELETE FROM `" . CLERKSHIP_DATABASE . "`.`apartment_schedule` WHERE `event_id` = " . $db->qstr($EVENT_ID))) { application_log("error", "There was an issue while trying to remove the apartment schedule information for event [" . $EVENT_ID . "]. Database said: " . $db->ErrorMsg()); } } } else { $STEP = 1; } } break; default: // No error checking for step 1. break; }
<td colspan="2"> </td> </tr> </tbody> </table> <?php break; } } else { $query = "\tSELECT * FROM `" . CLERKSHIP_DATABASE . "`.`events`, `" . CLERKSHIP_DATABASE . "`.`event_contacts`\n\t\t\t\t\t\tWHERE `" . CLERKSHIP_DATABASE . "`.`events`.`event_id` = " . $db->qstr($EVENT_ID) . "\n\t\t\t\t\t\tAND `" . CLERKSHIP_DATABASE . "`.`events`.`event_id` = `" . CLERKSHIP_DATABASE . "`.`event_contacts`.`event_id`"; if ($event_info = $db->GetRow($query)) { $PROCESSED = $event_info; $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/clerkship/electives?" . replace_query(array("section" => "edit")), "title" => "Deleting Elective"); $header_output = "<h1>Removing Core Rotation</h1>\n"; switch ($STEP) { case 2: if (!notify_regional_education("deleted", $EVENT_ID)) { system_log_data("error", "Unable to notify the regional education office that event_id [" . $EVENT_ID . "] was deleted."); } $query = "DELETE FROM `" . CLERKSHIP_DATABASE . "`.`events` WHERE `event_id`=" . $db->qstr($EVENT_ID); if ($db->Execute($query)) { $query = "DELETE FROM `" . CLERKSHIP_DATABASE . "`.`electives` WHERE `event_id`=" . $db->qstr($EVENT_ID); if ($db->Execute($query)) { $query = "DELETE FROM `" . CLERKSHIP_DATABASE . "`.`event_contacts` WHERE `event_id`=" . $db->qstr($EVENT_ID); if ($db->Execute($query)) { if (!$db->Execute("DELETE FROM `" . CLERKSHIP_DATABASE . "`.`apartment_schedule` WHERE `event_id` = " . $db->qstr($EVENT_ID))) { application_log("error", "There was an issue while trying to remove the apartment schedule information for event [" . $EVENT_ID . "]. Database said: " . $db->ErrorMsg()); } $url = ENTRADA_URL . "/admin/clerkship/"; $msg = " You will now be redirected to the clerkship index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; $SUCCESS++; $SUCCESSSTR[] = "You have successfully removed <strong>" . html_encode($PROCESSED["geo_location"]) . "</strong> core rotation from the system.<br /><br />" . $msg;