yet more changes for new frame layout
[openemr.git] / interface / forms / vitals / C_FormVitals.class.php
blob5420710ff6976e3b1e72e420cfd85361c9c1f7ba
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once ($GLOBALS['fileroot'] . "/library/forms.inc");
5 require_once("FormVitals.class.php");
7 class C_FormVitals extends Controller {
9 var $template_dir;
11 function C_FormVitals($template_mod = "general") {
12 parent::Controller();
13 $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
14 $this->template_mod = $template_mod;
15 $this->template_dir = dirname(__FILE__) . "/templates/vitals/";
16 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
17 $this->assign("DONT_SAVE_LINK",$GLOBALS['webroot'] . "/interface/patient_file/encounter/$returnurl");
18 $this->assign("STYLE", $GLOBALS['style']);
21 function default_action_old() {
22 //$vitals = array();
23 //array_push($vitals, new FormVitals());
24 $vitals = new FormVitals();
25 $this->assign("vitals",$vitals);
26 $this->assign("results", $results);
27 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
30 function default_action($form_id) {
32 if (is_numeric($form_id)) {
33 $vitals = new FormVitals($form_id);
35 else {
36 $vitals = new FormVitals();
39 $dbconn = $GLOBALS['adodb']['db'];
40 $sql = "SELECT * from form_vitals where id != $form_id and pid = ".$GLOBALS['pid'];
41 $result = $dbconn->Execute($sql);
43 $i = 1;
44 while($result && !$result->EOF)
46 $results[$i]['id'] = $result->fields['id'];
47 $results[$i]['date'] = $result->fields['date'];
48 $results[$i]['activity'] = $result->fields['activity'];
49 $results[$i]['bps'] = $result->fields['bps'];
50 $results[$i]['bpd'] = $result->fields['bpd'];
51 $results[$i]['weight'] = $result->fields['weight'];
52 $results[$i]['height'] = $result->fields['height'];
53 $results[$i]['temperature'] = $result->fields['temperature'];
54 $results[$i]['temp_method'] = $result->fields['temp_method'];
55 $results[$i]['pulse'] = $result->fields['pulse'];
56 $results[$i]['respiration'] = $result->fields['respiration'];
57 $results[$i]['BMI'] = $result->fields['BMI'];
58 $results[$i]['waist_circ'] = $result->fields['waist_circ'];
59 $results[$i]['head_circ'] = $result->fields['head_circ'];
60 $results[$i++]['oxygen_saturation'] = $result->fields['oxygen_saturation'];
61 $result->MoveNext();
64 $this->assign("vitals",$vitals);
65 $this->assign("results", $results);
67 $this->assign("VIEW",true);
68 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
72 function default_action_process() {
73 if ($_POST['process'] != "true")
74 return;
75 $this->vitals = new FormVitals($_POST['id']);
77 parent::populate_object($this->vitals);
79 $this->vitals->persist();
80 if ($GLOBALS['encounter'] < 1) {
81 $GLOBALS['encounter'] = date("Ymd");
83 if(empty($_POST['id']))
85 addForm($GLOBALS['encounter'], "Vitals", $this->vitals->id, "vitals", $GLOBALS['pid'], $_SESSION['userauthorized']);
86 $_POST['process'] = "";
88 return;