internationalize LBF form title
[openemr.git] / interface / patient_file / encounter / new_form.php
blob4891cf61b7f073d02e21dca433a127cb4ade998b
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 parent.location.href = sel.options[sel.selectedIndex].value;
20 <?php } else { ?>
21 top.frames['Main'].location.href = sel.options[sel.selectedIndex].value;
22 <?php } ?>
25 </script>
27 </head>
28 <body class="body_top">
29 <dl>
30 <?php //DYNAMIC FORM RETREIVAL
31 include_once("$srcdir/registry.inc");
33 function myGetRegistered($state="1", $limit="unlimited", $offset="0") {
34 $sql = "SELECT category, nickname, name, state, directory, id, sql_run, " .
35 "unpackaged, date FROM registry WHERE " .
36 "state LIKE \"$state\" ORDER BY category, priority, name";
37 if ($limit != "unlimited") $sql .= " limit $limit, $offset";
38 $res = sqlStatement($sql);
39 if ($res) {
40 for($iter=0; $row=sqlFetchArray($res); $iter++) {
41 $all[$iter] = $row;
44 else {
45 return false;
47 return $all;
50 $reg = myGetRegistered();
51 $old_category = '';
52 echo "<FORM METHOD=POST NAME='choose'>\n";
53 if (!empty($reg)) {
54 foreach ($reg as $entry) {
55 $new_category = trim($entry['category']);
56 $new_nickname = trim($entry['nickname']);
57 if ($new_category == '') {$new_category = 'miscellaneous';}
58 if ($new_nickname != '') {$nickname = $new_nickname;}
59 else {$nickname = $entry['name'];}
60 if ($old_category != $new_category) {
61 $new_category_ = $new_category;
62 $new_category_ = str_replace(' ','_',$new_category_);
63 if ($old_category != '') {echo "</select>\n";}
64 echo "<select name=" . $new_category_ . " onchange='openNewForm(this)'>\n";
65 echo " <option value=" . $new_category_ . ">" . $new_category . "</option>\n";
66 $old_category = $new_category;
68 echo " <option value='" . $rootdir .
69 '/patient_file/encounter/load_form.php?formname=' .
70 urlencode($entry['directory']) . "'>" . xl_form_title($nickname) . "</option>\n";
72 echo "</select>\n";
75 // This shows Layout Based Form names just like the above.
77 $lres = sqlStatement("SELECT * FROM list_options " .
78 "WHERE list_id = 'lbfnames' ORDER BY seq, title");
79 if (sqlNumRows($lres)) {
80 echo "<select name='lbfnames' onchange='openNewForm(this)'>\n";
81 echo "<option value='lbfnames'>" . xl('Layout Based') . "</option>\n";
82 while ($lrow = sqlFetchArray($lres)) {
83 $option_id = $lrow['option_id']; // should start with LBF
84 $title = $lrow['title'];
85 echo "<option value='$rootdir/patient_file/encounter/load_form.php?" .
86 "formname=$option_id'>" . xl_form_title($title) . "</option>\n";
88 echo "</select>\n";
91 echo "</FORM>\n";
93 </dl>
95 </body>
96 </html>