2 // Copyright (C) 2010 Brady Miller <brady@sparmy.com>
3 // Modified 2011 Rod Roark <rod@sunsetsystems.com>
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';
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",
25 //Bring in the style sheet
27 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
29 // Hide the current value css entries. This is currently specific
30 // for the vitals form but could use this mechanism for other
33 // currentvalues - input boxes
34 // valuesunfocus - input boxes that are auto-calculated
35 // editonly - the edit and cancel buttons
37 // readonly - the link back to summary screen
38 // Also customize the 'graph' class to look like links.
41 .currentvalues
{ display
: none
;}
42 .valuesunfocus
{ display
: none
;}
43 .editonly
{ display
: none
;}
45 .graph
{color
:#0000cc;}
50 margin
:0em
1em
2em
2em
;
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
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
)
73 $
.ajax({ url
: '../../../library/openflashchart/graphs.php',
75 data
: ({ table
: table_graph
,
80 success
: function(returnData
){
81 // place the raw graph data in the data variable
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
95 $
(document
).ready(function(){
97 // Use jquery to show the 'readonly' class entries
98 $
('.readonly').show();
100 // Place click callback for graphing
101 <?php
if ($is_lbf) { ?
>
102 // For LBF the <td> has an id of label_id_$fieldid
103 $
(".graph").click(function(e
){ show_graph('<?php echo $formname; ?>', this
.id
.substring(9), $
(this
).text()) });
105 $
(".graph").click(function(e
){ show_graph('form_vitals', this
.id
, $
(this
).text()) });
108 // Show hovering effects for the .graph links
111 $
(this
).css({color
:'#ff5555'}); //mouseover
114 $
(this
).css({color
:'#0000cc'}); // mouseout
118 // show blood pressure graph by default
119 <?php
if ($is_lbf) { ?
>
120 show_graph('<?php echo $formname; ?>','<?php echo $default['field_id
']; ?>','<?php echo $default['title
']; ?>');
122 show_graph('form_vitals','bps','');
129 // Use the List Based Forms engine for all LBFxxxxx forms.
130 include_once("$incdir/forms/LBF/new.php");
134 // ensure the path variable has no illegal characters
135 check_file_dir_name($formname);
137 include_once("$incdir/forms/$formname/new.php");