psr12 fixes for new PHP_CodeSniffer (#4795)
[openemr.git] / interface / forms / ros / C_FormROS.class.php
blobd637f0cfd0dd790f1b91b5ed2e1accc18f4375a2
1 <?php
3 /**
4 * ROS form
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once($GLOBALS['fileroot'] . "/library/forms.inc");
14 require_once("FormROS.class.php");
16 use OpenEMR\Common\Csrf\CsrfUtils;
18 class C_FormROS extends Controller
20 var $template_dir;
22 function __construct($template_mod = "general")
24 parent::__construct();
25 $returnurl = 'encounter_top.php';
26 $this->template_mod = $template_mod;
27 $this->template_dir = dirname(__FILE__) . "/templates/ros/";
28 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
29 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
30 $this->assign("STYLE", $GLOBALS['style']);
31 $this->assign("CSRF_TOKEN_FORM", CsrfUtils::collectCsrfToken());
34 function default_action()
36 $ros = new FormROS();
37 $this->assign("form", $ros);
38 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
41 function view_action($form_id)
44 if (is_numeric($form_id)) {
45 $ros = new FormROS($form_id);
46 } else {
47 $ros = new FormROS();
50 $this->assign("form", $ros);
51 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
54 function default_action_process()
56 if ($_POST['process'] != "true") {
57 return;
60 $this->ros = new FormROS($_POST['id']);
62 parent::populate_object($this->ros);
63 $this->ros->persist();
65 if ($GLOBALS['encounter'] == "") {
66 $GLOBALS['encounter'] = date("Ymd");
69 if (empty($_POST['id'])) {
70 addForm($GLOBALS['encounter'], "Review Of Systems", $this->ros->id, "ros", $GLOBALS['pid'], $_SESSION['userauthorized']);
71 $_POST['process'] = "";
74 return;