2 // Copyright (C) 2009 Aron Racho <aron@mi-squared.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
8 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
9 require_once ($GLOBALS['fileroot'] . "/library/forms.inc");
10 require_once("FormROM.class.php");
12 class C_FormROM
extends Controller
{
16 function C_FormROM($template_mod = "general") {
18 $this->template_mod
= $template_mod;
19 $this->template_dir
= dirname(__FILE__
) . "/templates/";
20 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
21 $this->assign("DONT_SAVE_LINK",$GLOBALS['form_exit_url']);
22 $this->assign("STYLE", $GLOBALS['style']);
25 function default_action() {
26 $form = new FormROM();
27 $this->assign("data",$form);
28 return $this->fetch($this->template_dir
. $this->template_mod
. "_new.html");
31 function view_action($form_id) {
32 if (is_numeric($form_id)) {
33 $form = new FormROM($form_id);
36 $form = new FormROM();
38 $dbconn = $GLOBALS['adodb']['db'];
39 $this->assign("data",$form);
40 return $this->fetch($this->template_dir
. $this->template_mod
. "_new.html");
43 function default_action_process() {
44 if ($_POST['process'] != "true")
46 $this->form
= new FormROM($_POST['id']);
47 parent
::populate_object($this->form
);
48 $this->form
->persist();
49 if ($GLOBALS['encounter'] == "") {
50 $GLOBALS['encounter'] = date("Ymd");
52 if (empty($_POST['id'])) {
53 addForm($GLOBALS['encounter'], "Range of Motion", $this->form
->id
, "rom",
54 $GLOBALS['pid'], $_SESSION['userauthorized']);
55 $_POST['process'] = "";