Refactor previous name into dedicated service (#7571)
[openemr.git] / interface / patient_file / encounter / encounter_top.php
blob51e79d2ff8f59a2b173c528a30f4ed574277a599
1 <?php
3 /**
4 * This contains the tab set for encounter forms.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2017 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once(dirname(__FILE__) . '/../../globals.php');
16 require_once("$srcdir/pid.inc.php");
17 require_once("$srcdir/encounter.inc.php");
18 require_once("$srcdir/forms.inc.php");
20 use OpenEMR\Tabs\TabsWrapper;
21 use OpenEMR\Core\Header;
23 if (isset($_GET["set_encounter"])) {
24 // The billing page might also be setting a new pid.
25 if (isset($_GET["set_pid"])) {
26 $set_pid = $_GET["set_pid"];
27 } elseif (isset($_GET["pid"])) {
28 $set_pid = $_GET["pid"];
29 } else {
30 $set_pid = false;
33 if ($set_pid && $set_pid != $_SESSION["pid"]) {
34 setpid($set_pid);
37 setencounter($_GET["set_encounter"]);
40 $tabset = new TabsWrapper('enctabs');
41 $tabset->declareInitialTab(
42 xl('Summary'),
43 "<iframe class='w-100' style='height:94.5vh;border: 0;' src='forms.php'>" . xlt('Problem loading.') . "</iframe>"
45 // We might have been invoked to load a particular encounter form.
46 // In that case it will be the second tab, and removable.
47 if (!empty($_GET['formname'])) {
48 $url = $rootdir . "/patient_file/encounter/load_form.php?formname=" . attr_url($_GET['formname']);
49 $tabset->declareInitialTab(
50 $_GET['formdesc'],
51 "<iframe name='enctabs-2' class='w-100' style='height:94.5vh;border: 0;' src='$url'>" . xlt('Problem loading.') . "</iframe>",
52 true
56 // This is for making the page title which will be picked up as the tab label.
57 $dateres = getEncounterDateByEncounter($encounter);
58 $encounter_date = date("Y-m-d", strtotime($dateres["date"]));
60 <!DOCTYPE html>
61 <html>
62 <head>
63 <title><?php echo text(oeFormatShortDate($encounter_date)) . ' ' . xlt('Encounter'); ?></title>
64 <?php Header::setupHeader(); ?>
65 <?php echo $tabset->genCss(); ?>
66 <?php echo $tabset->genJavaScript(); ?>
67 <script>
69 $(function () {
70 // Initialize support for the tab set.
71 twSetup('enctabs');
72 });
74 // This is called to refresh encounter display data after something has changed it.
75 // Currently only the encounter summary tab will be refreshed.
76 function refreshVisitDisplay() {
77 for (var i = 0; i < window.frames.length; ++i) {
78 if (window.frames[i].refreshVisitDisplay) {
79 window.frames[i].refreshVisitDisplay();
84 // Called from the individual iframes when their forms want to close.
85 // The iframe window name is passed and identifies which tab it is.
86 // The "refresh" argument indicates if encounter data may have changed.
87 function closeTab(winname, refresh) {
88 twCloseTab('enctabs', winname);
89 if (refresh) {
90 refreshVisitDisplay();
94 </script>
95 </head>
96 <body class='m-0'>
97 <?php echo $tabset->genHtml(); ?>
98 </body>
99 </html>