2 // Copyright (C) 2009-2017 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
11 require_once("../../globals.php");
12 require_once("$srcdir/acl.inc");
13 require_once("$srcdir/options.inc.php");
14 require_once("$srcdir/patient.inc");
16 $CPR = 4; // cells per row
18 // The form name is passed to us as a GET parameter.
19 $formname = isset($_GET['formname']) ?
$_GET['formname'] : '';
21 $tmp = sqlQuery("SELECT title, notes FROM list_options WHERE " .
22 "list_id = 'lbfnames' AND option_id = ? AND activity = 1 LIMIT 1", array($formname));
23 $formtitle = $tmp['title'];
25 // Extract parameters from this form's list item entry.
26 $jobj = json_decode($tmp['notes'], true);
27 if (!empty($jobj['columns'])) {
28 $CPR = intval($jobj['columns']);
31 if (!empty($jobj['size' ])) {
32 $FONTSIZE = intval($jobj['size']);
35 // Check access control.
36 if (!empty($jobj['aco'])) {
37 $LBF_ACO = explode('|', $jobj['aco']);
40 if (!acl_check('admin', 'super') && !empty($LBF_ACO)) {
41 if (!acl_check($LBF_ACO[0], $LBF_ACO[1])) {
42 die(xlt('Access denied'));
46 $fres = sqlStatement("SELECT * FROM layout_options " .
47 "WHERE form_id = ? AND uor > 0 " .
48 "ORDER BY group_name, seq", array($formname));
52 <?php
html_header_show();?
>
56 font
-family
: Arial
, Helvetica
, sans
-serif
;
62 padding
: 5pt
5pt
5pt
5pt
;
68 border
-color
: #000000;
86 border
-width
: 0 0 1px
0;
87 border
-color
: #999999;
108 <body bgcolor
='#ffffff'>
111 <?php
echo genFacilityTitle($formtitle, -1); ?
>
113 <span
class='subhead'>
114 <?php
echo xlt('Patient') ?
>: ________________________________________
 
;
115 <?php
echo xlt('Clinic') ?
>: ____________________
 
;
116 <?php
echo xlt('Date') ?
>: ____________________
<br
/> 
;<br
/>
123 global $item_count, $cell_count;
124 if ($item_count > 0) {
132 global $cell_count, $CPR;
134 if ($cell_count > 0) {
135 for (; $cell_count < $CPR;
148 if (strlen($last_group) > 0) {
159 while ($frow = sqlFetchArray($fres)) {
160 $this_group = $frow['group_name'];
161 $titlecols = $frow['titlecols'];
162 $datacols = $frow['datacols'];
163 $data_type = $frow['data_type'];
164 $field_id = $frow['field_id'];
165 $list_id = $frow['list_id'];
168 // if (isset($result[$field_id])) $currvalue = $result[$field_id];
170 // Handle a data category (group) change.
171 if (strcmp($this_group, $last_group) != 0) {
173 if (strlen($last_group) > 0) {
177 $group_name = substr($this_group, 1);
178 $last_group = $this_group;
179 echo "<b>" . text(xl_layout_label($group_name)) . "</b>\n";
181 echo "<div class='section'>\n";
182 echo " <table border='0' cellpadding='0'>\n";
185 // Handle starting of a new row.
186 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
188 echo " <tr style='height:30pt'>";
191 if ($item_count == 0 && $titlecols == 0) {
195 // Handle starting of a new label cell.
196 if ($titlecols > 0) {
198 echo "<td colspan='" . attr($titlecols) . "' width='10%'";
199 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
200 if ($cell_count == 2) {
201 echo " style='padding-left:10pt'";
205 $cell_count +
= $titlecols;
212 if ($frow['title']) {
213 echo (text(xl_layout_label($frow['title'])) . ":");
220 // Handle starting of a new data cell.
223 echo "<td colspan='" . attr($datacols) . "' width='40%'";
224 if ($data_type < 21 ||
$data_type > 25) {
225 echo " class='under'";
228 if ($cell_count > 0) {
229 echo " style='padding-left:5pt;'";
233 $cell_count +
= $datacols;
237 generate_print_field($frow, $currvalue);
245 <!-- This should really be in the onload handler but that seems to be unreliable
and can crash Firefox
3. -->
246 <script language
='JavaScript'>
247 var win
= top
.printLogPrint ? top
: opener
.top
;
248 win
.printLogPrint(window
);