require_once "../model/Query/DelProblem.php"; // referencial integrity require_once "../model/Query/Page/Record.php"; /** * Retrieving post vars */ $idPatient = intval($_POST["id_patient"]); $patName = Check::safeText($_POST["name"]); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Delete relatives */ $relQ = new Query_Relative(); $numRows = $relQ->select($idPatient); $rel = array(); for ($i = 0; $i < $numRows; $i++) { $rel[] = $relQ->fetch(); } $relQ->freeResult(); while ($aux = array_shift($rel)) { $relQ->delete($idPatient, $aux[1]); } $relQ->close(); unset($relQ); unset($rel); /** * Delete patient */
require_once "../lib/Form.php"; Form::compareToken('../medical/patient_new_form.php'); require_once "../model/Query/Relative.php"; require_once "../model/Query/Page/Record.php"; /** * Retrieving post var */ $idPatient = intval($_POST["id_patient"]); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Insert new relatives patient */ $relQ = new Query_Relative(); $relQ->captureError(true); $recordQ = new Query_Page_Record(); $n = count($_POST["check"]); for ($i = 0; $i < $n; $i++) { if ($idPatient == $_POST["check"][$i]) { continue; // a patient can't be relative of himself } $relQ->insert($idPatient, $_POST["check"][$i]); if ($relQ->isError()) { if ($relQ->getDbErrno() == 1062) { $relQ->clearErrors(); } else { $relQ->close(); Error::query($relQ);
require_once "../model/Query/Page/Record.php"; require_once "../lib/Check.php"; /** * Retrieving post vars */ $idPatient = intval($_POST["id_patient"]); $idRelative = intval($_POST["id_relative"]); $relName = Check::safeText($_POST["name"]); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Delete relative */ $relQ = new Query_Relative(); /** * Record log process (before deleting process) */ $recordQ = new Query_Page_Record(); $recordQ->log("Query_Relative", "DELETE", array($idPatient, $idRelative)); $recordQ->close(); unset($recordQ); $relQ->delete($idPatient, $idRelative); $relQ->close(); unset($relQ); /** * Reset abort setting */ ignore_user_abort($oldAbort); /**
require_once "../model/Patient.php"; require_once "../lib/Form.php"; /** * Retrieving vars (PGS) */ $idPatient = Check::postGetSessionInt('id_patient'); $patient = new Patient($idPatient); if ($patient->getName() == '') { FlashMsg::add(_("That patient does not exist."), OPEN_MSG_ERROR); header("Location: ../medical/patient_search_form.php"); exit; } /** * Search database for relatives */ $relQ = new Query_Relative(); $relArray = array(); if ($relQ->select($idPatient)) { while ($rel = $relQ->fetch()) { $relArray[] = $rel[1]; } $relQ->freeResult(); } $relQ->close(); unset($relQ); /** * Show page */ $title = _("View Relatives"); $titlePage = $patient->getName() . ' (' . $title . ')'; require_once "../layout/header.php";