Highway to PSR2
[openemr.git] / contrib / forms / hp_tje_primary / C_FormHpTje.class.php
blob5e1cc254b5f6445b4d511a56b946374ec7b86c73
1 <?php
3 require_once($GLOBALS['fileroot'] . "/library/forms.inc");
4 require_once("FormHpTjePrimary.class.php");
6 class C_FormHpTje extends Controller
9 var $template_dir;
11 function __construct($template_mod = "general")
13 parent::__construct();
14 $this->template_mod = $template_mod;
15 $this->template_dir = dirname(__FILE__) . "/templates/hp_tje/";
16 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
17 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
18 $this->assign("STYLE", $GLOBALS['style']);
21 function default_action()
23 $hptje_primary = new FormHpTjePrimary();
24 $this->assign("hptje_primary", $hptje_primary);
25 $this->assign("checks", $hptje_primary->_form_layout());
26 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
29 function view_action($form_id)
31 if (is_numeric($form_id)) {
32 $hptje_primary = new FormHpTjePrimary($form_id);
33 } else {
34 $hptje_primary = new FormHpTjePrimary();
37 $this->assign("hptje_primary", $hptje_primary);
38 $this->assign("checks", $hptje_primary->_form_layout());
39 $this->assign("VIEW", true);
40 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
43 function default_action_process()
45 if ($_POST['process'] != "true") {
46 return;
49 $this->hptje_primary = new FormHpTjePrimary($_POST['id']);
50 parent::populate_object($this->hptje_primary);
52 $this->hptje_primary->persist();
53 if ($GLOBALS['encounter'] == "") {
54 $GLOBALS['encounter'] = date("Ymd");
57 addForm($GLOBALS['encounter'], "Head Pain TJE", $this->hptje_primary->id, "hp_tje_primary", $GLOBALS['pid'], $_SESSION['userauthorized']);
58 $_POST['process'] = "";
59 return;