Another Acknowledgements page update (fix for previous commit)
[openemr.git] / interface / patient_file / encounter / new_form.php
blob3c2cea2a06a382ff8586638c7ec3098dd0601d46
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 include_once("../../globals.php");
8 ?>
9 <html>
10 <head>
11 <?php html_header_show();?>
12 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css">
14 <script language="JavaScript">
16 function openNewForm(sel) {
17 top.restoreSession();
18 <?php if ($GLOBALS['concurrent_layout']) { ?>
19 FormNameValueArray = sel.split('formname=');
20 if(FormNameValueArray[1] == 'newpatient')
22 parent.location.href = sel
24 else
26 parent.Forms.location.href = sel;
28 <?php } else { ?>
29 top.frames['Main'].location.href = sel;
30 <?php } ?>
32 function toggleFrame1(fnum) {
33 top.frames['left_nav'].document.forms[0].cb_top.checked=false;
34 top.window.parent.left_nav.toggleFrame(fnum);
36 </script>
37 <style type="text/css">
38 #sddm
39 { margin: 0;
40 padding: 0;
41 z-index: 30;
44 </style>
45 <script type="text/javascript" language="javascript">
47 var timeout = 500;
48 var closetimer = 0;
49 var ddmenuitem = 0;
50 var oldddmenuitem = 0;
51 var flag = 0;
53 // open hidden layer
54 function mopen(id)
56 // cancel close timer
57 //mcancelclosetime();
59 flag=10;
61 // close old layer
62 //if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
63 //if(ddmenuitem) ddmenuitem.style.display = 'none';
65 // get new layer and show it
66 oldddmenuitem = ddmenuitem;
67 ddmenuitem = document.getElementById(id);
68 if((ddmenuitem.style.visibility == '')||(ddmenuitem.style.visibility == 'hidden')){
69 if(oldddmenuitem) oldddmenuitem.style.visibility = 'hidden';
70 if(oldddmenuitem) oldddmenuitem.style.display = 'none';
71 ddmenuitem.style.visibility = 'visible';
72 ddmenuitem.style.display = 'block';
73 }else{
74 ddmenuitem.style.visibility = 'hidden';
75 ddmenuitem.style.display = 'none';
78 // close showed layer
79 function mclose()
81 if(flag==10)
83 flag=11;
84 return;
86 if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
87 if(ddmenuitem) ddmenuitem.style.display = 'none';
90 // close layer when click-out
91 document.onclick = mclose;
92 //=================================================
93 function findPosX(id)
95 obj=document.getElementById(id);
96 var curleft = 0;
97 if(obj.offsetParent)
98 while(1)
100 curleft += obj.offsetLeft;
101 if(!obj.offsetParent)
102 break;
103 obj = obj.offsetParent;
105 else if(obj.x)
106 curleft += obj.x;
107 PropertyWidth=document.getElementById(id).offsetWidth;
108 if(PropertyWidth>curleft)
110 document.getElementById(id).style.left=0;
114 function findPosY(obj)
116 var curtop = 0;
117 if(obj.offsetParent)
118 while(1)
120 curtop += obj.offsetTop;
121 if(!obj.offsetParent)
122 break;
123 obj = obj.offsetParent;
125 else if(obj.y)
126 curtop += obj.y;
127 return curtop;
129 </script>
131 </head>
132 <body class="bgcolor2">
133 <dl>
134 <?php //DYNAMIC FORM RETREIVAL
135 include_once("$srcdir/registry.inc");
137 function myGetRegistered($state="1", $limit="unlimited", $offset="0") {
138 $sql = "SELECT category, nickname, name, state, directory, id, sql_run, " .
139 "unpackaged, date FROM registry WHERE " .
140 "state LIKE \"$state\" ORDER BY category, priority, name";
141 if ($limit != "unlimited") $sql .= " limit $limit, $offset";
142 $res = sqlStatement($sql);
143 if ($res) {
144 for($iter=0; $row=sqlFetchArray($res); $iter++) {
145 $all[$iter] = $row;
148 else {
149 return false;
151 return $all;
154 $reg = myGetRegistered();
155 $old_category = '';
157 $DivId=1;
159 if (!empty($reg)) {
160 $StringEcho= '<ul id="sddm">';
161 if(isset($hide)){
162 $StringEcho.= "<li><a id='enc2' >" . htmlspecialchars( xl('Encounter Summary'),ENT_NOQUOTES) . "</a></li>";
163 }else{
164 $StringEcho.= "<li><a href='JavaScript:void(0);' id='enc2' onclick=\" return top.window.parent.left_nav.loadFrame2('enc2','RBot','patient_file/encounter/encounter_top.php')\">" . htmlspecialchars( xl('Encounter Summary'),ENT_NOQUOTES) . "</a></li>";
166 foreach ($reg as $entry) {
167 $new_category = trim($entry['category']);
168 $new_nickname = trim($entry['nickname']);
169 if ($new_category == '') {$new_category = htmlspecialchars(xl('Miscellaneous'),ENT_QUOTES);}
170 if ($new_nickname != '') {$nickname = $new_nickname;}
171 else {$nickname = $entry['name'];}
172 if ($old_category != $new_category) {
173 $new_category_ = $new_category;
174 $new_category_ = str_replace(' ','_',$new_category_);
175 if ($old_category != '') {$StringEcho.= "</table></div></li>";}
176 $StringEcho.= "<li><a href='JavaScript:void(0);' onClick=\"mopen('$DivId');\" >$new_category</a><div id='$DivId' ><table border='0' cellspacing='0' cellpadding='0'>";
177 $old_category = $new_category;
178 $DivId++;
180 $StringEcho.= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a onclick=\"openNewForm('" . $rootdir .'/patient_file/encounter/load_form.php?formname=' .urlencode($entry['directory']) .
181 "')\" href='JavaScript:void(0);'>" . xl_form_title($nickname) . "</a></td></tr>";
183 $StringEcho.= '</table></div></li>';
185 if($StringEcho){
186 $StringEcho2= '<div style="clear:both"></div>';
187 }else{
188 $StringEcho2="";
191 <!--<table style="border:solid 1px black" cellspacing="0" cellpadding="0">
192 <tr>
193 <td valign="top"><?php //echo $StringEcho; ?></td>
194 </tr>
195 </table>-->
196 <?php
197 //$StringEcho='';
198 // This shows Layout Based Form names just like the above.
200 $lres = sqlStatement("SELECT * FROM list_options " .
201 "WHERE list_id = 'lbfnames' ORDER BY seq, title");
202 if (sqlNumRows($lres)) {
203 if(!$StringEcho){
204 $StringEcho= '<ul id="sddm">';
206 $StringEcho.= "<li><a href='JavaScript:void(0);' onClick=\"mopen('lbf');\" >".xl('Layout Based') ."</a><div id='lbf' ><table border='0' cellspacing='0' cellpadding='0'>";
207 while ($lrow = sqlFetchArray($lres)) {
208 $option_id = $lrow['option_id']; // should start with LBF
209 $title = $lrow['title'];
210 $StringEcho.= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a href='" . $rootdir .'/patient_file/encounter/load_form.php?formname='
211 .urlencode($option_id) ."' >" . xl_form_title($title) . "</a></td></tr>";
214 if($StringEcho){
215 $StringEcho.= "</table></div></li></ul>".$StringEcho2;
218 <table cellspacing="0" cellpadding="0" align="center">
219 <tr>
220 <td valign="top"><?php echo $StringEcho; ?></td>
221 </tr>
222 </table>
223 </dl>
225 </body>
226 </html>