making forms compatible with new frame layout
[openemr.git] / contrib / forms / evaluation / C_FormEvaluation.class.php
blob8c970f49958953b071ab6d2efc41e8402b954dee
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once ($GLOBALS['fileroot'] . "/library/forms.inc");
5 require_once ($GLOBALS['fileroot'] . "/library/sql.inc");
6 require_once("FormEvaluation.class.php");
8 class C_FormEvaluation extends Controller {
10 var $template_dir;
12 function C_FormEvaluation($template_mod = "general") {
13 parent::Controller();
14 $this->template_mod = $template_mod;
15 $this->template_dir = dirname(__FILE__) . "/templates/evaluation/";
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() {
22 $evaluation = new FormEvaluation();
23 $this->assign("checks",$evaluation->_form_layout());
24 $this->assign("evaluation",$evaluation);
25 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
28 function view_action($form_id) {
29 if (is_numeric($form_id)) {
30 $evaluation = new FormEvaluation($form_id);
32 else {
33 $evaluation = new FormEvaluation();
35 $this->assign("VIEW",true);
36 $this->assign("checks",$evaluation->_form_layout());
37 $this->assign("evaluation",$evaluation);
38 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
42 function default_action_process() {
43 if ($_POST['process'] != "true")
44 return;
45 $this->evaluation = new FormEvaluation($_POST['id']);
46 parent::populate_object($this->evaluation);
48 $this->evaluation->persist();
49 if ($GLOBALS['encounter'] == "") {
50 $GLOBALS['encounter'] = date("Ymd");
52 addForm($GLOBALS['encounter'], "Evaluation Form", $this->evaluation->id, "evaluation", $GLOBALS['pid'], $_SESSION['userauthorized']);
54 if (!empty($_POST['cpt_code'])) {
55 $sql = "select * from codes where code ='" . mysql_real_escape_string($_POST['cpt_code']) . "' order by id";
57 $results = sqlQ($sql);
59 $row = mysql_fetch_array($results);
60 if (!empty($row)) {
61 addBilling( date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'],$row['modifier'],$row['units'],$row['fee']);
66 $_POST['process'] = "";
67 return;