psr2 fix
[openemr.git] / controllers / C_InsuranceCompany.class.php
blob8bea5af2a27d15fff646330e380876965858fd8f
1 <?php
4 class C_InsuranceCompany extends Controller
7 var $template_mod;
8 var $icompanies;
10 function __construct($template_mod = "general")
12 parent::__construct();
13 $this->icompanies = array();
14 $this->template_mod = $template_mod;
15 $this->assign("FORM_ACTION", $GLOBALS['webroot']."/controller.php?" . attr($_SERVER['QUERY_STRING']));
16 $this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
17 $this->assign("STYLE", $GLOBALS['style']);
18 $this->assign("SUPPORT_ENCOUNTER_CLAIMS", $GLOBALS['support_encounter_claims']);
19 $this->InsuranceCompany = new InsuranceCompany();
22 function default_action()
24 return $this->list_action();
27 function edit_action($id = "", $patient_id = "", $p_obj = null)
29 if ($p_obj != null && get_class($p_obj) == "insurancecompany") {
30 $this->icompanies[0] = $p_obj;
31 } elseif (get_class($this->icompanies[0]) != "insurancecompany") {
32 $this->icompanies[0] = new InsuranceCompany($id);
35 $x = new X12Partner();
36 $this->assign("x12_partners", $x->_utility_array($x->x12_partner_factory()));
38 $this->assign("insurancecompany", $this->icompanies[0]);
39 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_edit.html");
42 function list_action($sort = "")
45 if (!empty($sort)) {
46 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("", $sort));
47 } else {
48 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
51 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
55 function edit_action_process()
57 if ($_POST['process'] != "true") {
58 return;
61 //print_r($_POST);
62 if (is_numeric($_POST['id'])) {
63 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
64 } else {
65 $this->icompanies[0] = new InsuranceCompany();
68 parent::populate_object($this->icompanies[0]);
70 $this->icompanies[0]->persist();
71 $this->icompanies[0]->populate();
73 //echo "action processeed";
74 $_POST['process'] = "";
75 header('Location:'.$GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&action=list");//Z&H