Highway to PSR2
[openemr.git] / contrib / forms / scanned_notes / report.php
blob51d2d56a7f0ea6db278178147b5f2735d4315901
1 <?php
2 // Copyright (C) 2006-2012 Rod Roark <rod@sunsetsystems.com>
3 //
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.
9 include_once("../../globals.php");
10 include_once($GLOBALS["srcdir"] . "/api.inc");
12 function scanned_notes_report($pid, $useless_encounter, $cols, $id)
14 global $webserver_root, $web_root, $encounter;
16 // In the case of a patient report, the passed encounter is vital.
17 $thisenc = $useless_encounter ? $useless_encounter : $encounter;
19 $count = 0;
21 $data = sqlQuery("SELECT * " .
22 "FROM form_scanned_notes WHERE " .
23 "id = '$id' AND activity = '1'");
25 if ($data) {
26 if ($data['notes']) {
27 echo " <span class='bold'>Comments: </span><span class='text'>";
28 echo nl2br($data['notes']) . "</span><br />\n";
31 for ($i = -1; true; ++$i) {
32 $suffix = ($i < 0) ? "" : "-$i";
33 $imagepath = $GLOBALS['OE_SITE_DIR'] .
34 "/documents/$pid/encounters/${thisenc}_$id$suffix.jpg";
35 $imageurl = "$web_root/sites/" . $_SESSION['site_id'] .
36 "/documents/$pid/encounters/${thisenc}_$id$suffix.jpg";
37 if (is_file($imagepath)) {
38 echo " <img src='$imageurl'";
39 // Flag images with excessive width for possible stylesheet action.
40 $asize = getimagesize($imagepath);
41 if ($asize[0] > 750) {
42 echo " class='bigimage'";
45 echo " />\n";
46 echo " <br />\n";
47 } else {
48 if ($i >= 0) {
49 break;