1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <!-- Generated by Hand -->
4 Copyright (C) 2011 Julia Longtin <julia.longtin@gmail.com>
6 This program is free software; you can redistribute it and/or
7 Modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 <xsl:stylesheet version=
"1.0"
12 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform">
13 <xsl:output method=
"xml" omit-xml-declaration=
"yes"/>
14 <xsl:include href=
"common_objects.xslt"/>
15 <xsl:strip-space elements=
"*"/>
16 <xsl:template match=
"/">
17 <xsl:apply-templates select=
"form"/>
19 <!-- The variable telling field_objects.xslt what form is calling it -->
20 <xsl:variable name=
"page">report
</xsl:variable>
21 <!-- if fetchrow has contents, a variable with that name will be created by field_objects.xslt, and all fields created by it will retreive values from it. -->
22 <xsl:variable name=
"fetchrow">xyzzy
</xsl:variable>
23 <xsl:template match=
"form">
24 <xsl:text disable-output-escaping=
"yes"><![CDATA[
<?php
26 * this file's contents are included in both the encounter page as a 'quick summary' of a form, and in the medical records' reports page.
29 /* for $GLOBALS[], ?? */
30 require_once('../../globals.php');
31 /* for acl_check(), ?? */
32 require_once($GLOBALS['srcdir'].'/api.inc');
34 /* The name of the function is significant and must match the folder name */
35 function ]]
></xsl:text>
36 <xsl:value-of select=
"safename" />
37 <xsl:text disable-output-escaping=
"yes"><![CDATA[_report( $pid, $encounter, $cols, $id) {
40 <xsl:apply-templates select=
"table"/>
41 <xsl:text disable-output-escaping=
"yes"><![CDATA[
42 /* an array of all of the fields' names and their types. */
43 $field_names = array(]]
></xsl:text>
44 <xsl:for-each select=
"//field">
45 <xsl:text disable-output-escaping=
"yes"><![CDATA[']]
></xsl:text>
46 <xsl:value-of select=
"@name" />
47 <xsl:text disable-output-escaping=
"yes"><![CDATA[' =
> ']]
></xsl:text>
48 <xsl:value-of select=
"@type" />
49 <xsl:text disable-output-escaping=
"yes"><![CDATA[']]
></xsl:text>
50 <xsl:if test=
"position()!=last()">,
</xsl:if>
52 <xsl:text disable-output-escaping=
"yes"><![CDATA[);
53 /* an array of the lists the fields may draw on. */
54 $lists = array(]]
></xsl:text>
55 <xsl:for-each select=
"//field[@type='radio_group' or @type='checkbox_group' or @type='scrolling_list_multiples']">
56 <xsl:text disable-output-escaping=
"yes"><![CDATA[']]
></xsl:text>
57 <xsl:value-of select=
"@name" />
58 <xsl:text disable-output-escaping=
"yes"><![CDATA[' =
> array(]]
></xsl:text>
59 <xsl:for-each select=
"*">
60 <xsl:text disable-output-escaping=
"yes"><![CDATA[']]
></xsl:text>
61 <xsl:value-of select=
"./text()" />
62 <xsl:text disable-output-escaping=
"yes"><![CDATA[' =
> ']]
></xsl:text>
63 <xsl:value-of select=
"./text()" />
64 <xsl:text disable-output-escaping=
"yes"><![CDATA[']]
></xsl:text>
65 <xsl:if test=
"following-sibling::*">,
</xsl:if>
67 <xsl:text disable-output-escaping=
"yes"><![CDATA[)]]
></xsl:text>
68 <xsl:if test=
"position()!=last()">,
</xsl:if>
70 <xsl:if test=
"//table[@type='form']">
71 <xsl:text disable-output-escaping=
"yes"><![CDATA[);
72 $data = formFetch($table_name, $id);
75 <xsl:if test=
"//table[@type='extended']">
76 <xsl:text disable-output-escaping=
"yes"><![CDATA[);
77 $data = sqlQuery('select * from '.$table_name.
" where pid='".$pid.
"' and id='".$id.
"' order by date DESC limit 0,1");
80 <xsl:text disable-output-escaping=
"yes"><![CDATA[ if ($data) {
84 foreach($data as $key =
> $value) {
85 if ($key == 'id' || $key == 'pid' || $key == 'user' ||
86 $key == 'groupname' || $key == 'authorized' ||
87 $key == 'activity' || $key == 'date' ||
88 $value == '' || $value == '
0000-
00-
00 00:
00:
00' ||
91 /* skip built-in fields and
"blank data". */
95 /* display 'yes' instead of 'on'. */
100 /* remove the time-of-day from the 'date' fields. */
101 if ($field_names[$key] == 'date')
103 $dateparts = split(' ', $value);
104 $value = $dateparts[
0];
107 /* replace underscores with spaces, and uppercase all words. */
108 /* this is a primitive form of converting the column names into something displayable. */
109 $key=ucwords(str_replace('_',' ',$key));
112 echo '
<td><span class=bold
>'.xl(
"$mykey").':
</span><span class=text
>'.xl(
"$myval").'
</span></td>';
116 if ($count == $cols) {
118 echo '
</tr><tr>' . PHP_EOL;
122 echo '
</tr></table><hr>';
125 ]]
></xsl:text></xsl:template>