Bug fix for document upload. Document entry is no longer created in
[openemr.git] / contrib / forms / snellen / C_FormSnellen.class.php
blob681c5691d56a4a9a0e9d0efc4ca5ad73f0b692ea
1 <?php
2 // Copyright (C) 2009 Aron Racho <aron@mi-squared.com>
3 //
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("FormSnellen.class.php");
12 class C_FormSnellen extends Controller {
14 var $template_dir;
16 function C_FormSnellen($template_mod = "general") {
17 parent::Controller();
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 FormSnellen();
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 FormSnellen($form_id);
35 else {
36 $form = new FormSnellen();
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")
45 return;
46 $this->form = new FormSnellen($_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'], "Snellen Eye Exam", $this->form->id, "snellen",
54 $GLOBALS['pid'], $_SESSION['userauthorized']);
55 $_POST['process'] = "";
57 return;