Code type module improvements:
[openemr.git] / interface / patient_file / encounter / trend_form.php
blob015a5918435b30e6319eaee39a9579d2fc41ad92
1 <?php
2 // Copyright (C) 2010 Brady Miller <brady@sparmy.com>
3 // Modified 2011 Rod Roark <rod@sunsetsystems.com>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 $special_timeout = 3600;
11 include_once("../../globals.php");
13 $formname = $_GET["formname"];
14 $is_lbf = substr($formname, 0, 3) === 'LBF';
16 if ($is_lbf) {
17 // Determine the default field ID and its title for graphing.
18 // This is from the last graphable field in the form.
19 $default = sqlQuery("SELECT field_id, title FROM layout_options WHERE " .
20 "form_id = ? AND uor > 0 AND edit_options LIKE '%G%' " .
21 "ORDER BY group_name DESC, seq DESC, title DESC LIMIT 1",
22 array($formname));
25 //Bring in the style sheet
27 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
28 <?php
29 // Hide the current value css entries. This is currently specific
30 // for the vitals form but could use this mechanism for other
31 // forms.
32 // Hiding classes:
33 // currentvalues - input boxes
34 // valuesunfocus - input boxes that are auto-calculated
35 // editonly - the edit and cancel buttons
36 // Showing class:
37 // readonly - the link back to summary screen
38 // Also customize the 'graph' class to look like links.
40 <style>
41 .currentvalues { display: none;}
42 .valuesunfocus { display: none;}
43 .editonly { display: none;}
45 .graph {color:#0000cc;}
47 #chart {
48 border-style:solid;
49 border-width:2px;
50 margin:0em 1em 2em 2em;
52 </style>
54 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
55 <script type="text/javascript" src="../../../library/openflashchart/js/json/json2.js"></script>
56 <script type="text/javascript" src="../../../library/openflashchart/js/swfobject.js"></script>
57 <script type="text/javascript">
59 // variable that holds graph information for the open_flash_chart_data() function
60 var data;
62 // Function that is built into swfobject.js script that will collect the
63 // data used for the graph.
64 function open_flash_chart_data()
66 return JSON.stringify(data);
69 // Show the selected chart in the 'chart' div element
70 function show_graph(table_graph, name_graph, title_graph)
72 top.restoreSession();
73 $.ajax({ url: '../../../library/openflashchart/graphs.php',
74 type: 'POST',
75 data: ({ table: table_graph,
76 name: name_graph,
77 title: title_graph
78 }),
79 dataType: "json",
80 success: function(returnData){
81 // place the raw graph data in the data variable
82 data=returnData;
83 // this function will automatically call open_flash_chart_data() in order to collect the raw data
84 swfobject.embedSWF('../../../library/openflashchart/open-flash-chart.swf', "chart", "650", "200", "9.0.0");
85 // ensure show the chart div
86 $('#chart').show();
88 error: function() {
89 // hide the chart div
90 $('#chart').hide();
92 });
95 $(document).ready(function(){
97 // Use jquery to show the 'readonly' class entries
98 $('.readonly').show();
100 // Place click callback for graphing
101 $(".graph").click(function(e){ show_graph('<?php echo $is_lbf ? $formname : 'form_vitals'; ?>', this.id, $(this).text()) });
103 // Show hovering effects for the .graph links
104 $(".graph").hover(
105 function(){
106 $(this).css({color:'#ff5555'}); //mouseover
108 function(){
109 $(this).css({color:'#0000cc'}); // mouseout
113 // show blood pressure graph by default
114 <?php if ($is_lbf) { ?>
115 show_graph('<?php echo $formname; ?>','<?php echo $default['field_id']; ?>','<?php echo $default['title']; ?>');
116 <?php } else { ?>
117 show_graph('form_vitals','bps','');
118 <?php } ?>
120 </script>
122 <?php
123 if ($is_lbf) {
124 // Use the List Based Forms engine for all LBFxxxxx forms.
125 include_once("$incdir/forms/LBF/new.php");
127 else {
129 // ensure the path variable has no illegal characters
130 check_file_dir_name($formname);
132 include_once("$incdir/forms/$formname/new.php");