if (!defined("PARENT_INCLUDED") || !defined("IN_ENCOUNTER_TRACKING")) { exit; } elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) { header("Location: " . ENTRADA_URL); exit; } elseif (!$ENTRADA_ACL->amIAllowed('encounter_tracking', 'read')) { $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)"; $ERROR++; $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance."; echo display_error(); application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]"); } else { if (defined("IN_ENCOUNTER_TRACKING") && IN_ENCOUNTER_TRACKING && (defined("EDIT_ENTRY") && EDIT_ENTRY || defined("ADD_ENTRY") && ADD_ENTRY)) { $logbook = new Models_Logbook(); if (isset($entry_id)) { $entry = Models_Logbook_Entry::fetchRow($entry_id); } else { $entry = new Models_Logbook_Entry(); } switch ($STEP) { case 2: if (isset($entry_id)) { $PROCESSED["lentry_id"] = $entry_id; } $encounter_date = validate_calendar("", "encounter", true); if (isset($encounter_date) && (int) $encounter_date) { $PROCESSED["encounter_date"] = (int) $encounter_date; } else { add_error("The <strong>Encounter Date</strong> field is required."); } /**
header("Location: " . ENTRADA_URL); exit; } elseif (!$ENTRADA_ACL->amIAllowed('encounter_tracking', 'delete', false)) { $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)"; $ERROR++; $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance."; echo display_error(); application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]"); } else { $BREADCRUMB[] = array("url" => ENTRADA_URL . "/logbook?section=delete", "title" => "Delete Logbook Entry"); echo "<h1>Delete Logbook Entry</h1>"; if (isset($_POST["delete"])) { foreach ($_POST["delete"] as $entry_id) { if ($tmp_input = clean_input($entry_id, "numeric")) { $PROCESSED["delete"][] = $tmp_input; $entries[] = Models_Logbook_Entry::fetchRow($tmp_input); } } } switch ($STEP) { case 2: foreach ($entries as $entry) { $entry_data = $entry->toArray(); $entry_data["entry_active"] = 0; if ($entry->fromArray($entry_data)->update()) { add_statistic("encounter_tracking", "delete", "lentry_id", $entry->getID(), $ENTRADA_USER->getID()); if (!$ERROR) { add_success("Successfully deleted a <strong>Logbook Entry</strong>. You will now be redirected to the logbook index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/logbook\"><strong>click here</strong></a> to continue."); } } else { add_error("Failed to delete a <strong>Logbook Entry</strong>, an Administrator has been informed, please try again later. You will now be redirected to the logbook index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/logbook\"><strong>click here</strong></a> to continue.");