/** * mixed Test(int $idProblem = 0, int $idTest = 0) * * Constructor * * @param int $idProblem (optional) medical problem identificator * @param int $idTest (optional) medical test identificator * @return mixed void if not argument, null if not exists problem, object otherwise * @access public */ public function Test($idProblem = 0, $idTest = 0) { $this->_trans = array_flip(get_html_translation_table(HTML_SPECIALCHARS)); if ($idProblem && $idTest) { $_testQ = new Query_Test(); if (!$_testQ->select($idProblem, $idTest)) { return null; } foreach (get_object_vars($_testQ->fetch()) as $key => $value) { $this->{$key} = $value; } $_testQ->freeResult(); $_testQ->close(); } }
$title = _("View Medical Tests"); $titlePage = $patient->getName() . ' [' . $problem->getWordingPreview() . '] (' . $title . ')'; require_once "../layout/header.php"; /** * Breadcrumb */ $links = array(_("Medical Records") => "../medical/index.php", $patient->getName() => "../medical/patient_view.php", _("Medical Problems Report") => "../medical/problem_list.php", $problem->getWordingPreview() => "../medical/problem_view.php", $title => ""); echo HTML::breadcrumb($links, "icon icon_patient"); unset($links); echo $patient->getHeader(); echo $problem->getHeader(); if ($_SESSION['auth']['is_administrative']) { echo HTML::para(HTML::link(_("Add New Medical Test"), '../medical/test_new_form.php', array('id_problem' => $idProblem, 'id_patient' => $idPatient))); echo HTML::rule(); } $testQ = new Query_Test(); if (!$testQ->select($idProblem)) { $testQ->close(); echo Msg::info(_("No medical tests defined for this medical problem.")); include_once "../layout/footer.php"; exit; } echo HTML::section(2, _("Medical Tests List:")); $thead = array(_("Function") => array('colspan' => $_SESSION['auth']['is_administrative'] ? 3 : 1), _("Document Type"), _("Path Filename")); $tbody = array(); while ($test = $testQ->fetch()) { $temp = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); $temp = substr($temp, 0, strrpos($temp, "/")) . "/tests/" . String::translateBrowser($test->getPathFilename(false)); $row = HTML::link(HTML::image('../img/action_view.png', _("view")), $temp, null, array('class' => 'popup')); $row .= OPEN_SEPARATOR; if ($_SESSION['auth']['is_administrative']) {
*/ $test = new Test(); $test->setIdTest($_POST["id_test"]); require_once "../medical/test_validate_post.php"; /** * Destroy form values and errors */ Form::unsetSession(); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Update medical test */ $testQ = new Query_Test(); $testQ->update($test); FlashMsg::add(sprintf(_("Medical test, %s, has been updated."), $test->getPathFilename(false))); $testQ->close(); unset($testQ); /** * Record log process */ $recordQ = new Query_Page_Record(); $recordQ->log("Query_Test", "UPDATE", array($test->getIdTest())); $recordQ->close(); unset($recordQ); unset($test); /** * Reset abort setting */
require_once "../model/Query/Page/Record.php"; /** * Retrieving post vars */ $idProblem = intval($_POST["id_problem"]); $idTest = intval($_POST["id_test"]); $idPatient = intval($_POST["id_patient"]); $file = Check::safeText($_POST["path_filename"]); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Delete medical test */ $testQ = new Query_Test(); /** * Record log process (before deleting process) */ $recordQ = new Query_Page_Record(); $recordQ->log("Query_Test", "DELETE", array($idTest)); $recordQ->close(); unset($recordQ); $testQ->delete($idTest); $testQ->close(); unset($testQ); //@unlink($file); // do not remove the file because LORTAD /** * Reset abort setting */ ignore_user_abort($oldAbort);
* Validate data */ $test = new Test(); require_once "../medical/test_validate_post.php"; /** * Destroy form values and errors */ Form::unsetSession(); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Insert new medical test */ $testQ = new Query_Test(); $testQ->insert($test); $idTest = $testQ->getLastId(); FlashMsg::add(sprintf(_("Medical test, %s, has been added."), $test->getPathFilename(false))); $testQ->close(); unset($testQ); unset($test); /** * Record log process */ $recordQ = new Query_Page_Record(); $recordQ->log("Query_Test", "INSERT", array($idTest)); $recordQ->close(); unset($recordQ); /** * Reset abort setting