3 // Copyright (C) 2009 Aron Racho <aron@mi-squared.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
9 require_once($GLOBALS['fileroot'] . "/library/forms.inc");
10 require_once("FormSnellen.class.php");
12 class C_FormSnellen
extends Controller
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 FormSnellen();
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 FormSnellen($form_id);
38 $form = new FormSnellen();
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") {
52 $this->form
= new FormSnellen($_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'])) {
61 $GLOBALS['encounter'],
66 $_SESSION['userauthorized']
68 $_POST['process'] = "";