.inc files migration to .inc.php (#5897)
[openemr.git] / contrib / forms / rom / C_FormROM.class.php
blobfbf69830ffb36c1c1bd314d1f4fcb7f71fbe19a2
1 <?php
3 // Copyright (C) 2009 Aron Racho <aron@mi-squared.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
9 require_once($GLOBALS['fileroot'] . "/library/forms.inc.php");
10 require_once("FormROM.class.php");
12 class C_FormROM extends Controller
14 var $template_dir;
16 function __construct($template_mod = "general")
18 parent::__construct();
19 $this->template_mod = $template_mod;
20 $this->template_dir = dirname(__FILE__) . "/templates/";
21 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
22 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
23 $this->assign("STYLE", $GLOBALS['style']);
26 function default_action()
28 $form = new FormROM();
29 $this->assign("data", $form);
30 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
33 function view_action($form_id)
35 if (is_numeric($form_id)) {
36 $form = new FormROM($form_id);
37 } else {
38 $form = new FormROM();
41 $dbconn = $GLOBALS['adodb']['db'];
42 $this->assign("data", $form);
43 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
46 function default_action_process()
48 if ($_POST['process'] != "true") {
49 return;
52 $this->form = new FormROM($_POST['id']);
53 parent::populate_object($this->form);
54 $this->form->persist();
55 if ($GLOBALS['encounter'] == "") {
56 $GLOBALS['encounter'] = date("Ymd");
59 if (empty($_POST['id'])) {
60 addForm(
61 $GLOBALS['encounter'],
62 "Range of Motion",
63 $this->form->id,
64 "rom",
65 $GLOBALS['pid'],
66 $_SESSION['userauthorized']
68 $_POST['process'] = "";
71 return;