3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once($GLOBALS['fileroot'] ."/library/classes/InsuranceCompany.class.php");
6 class C_InsuranceCompany
extends Controller
{
11 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?" . $_SERVER['QUERY_STRING']);
16 $this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
17 $this->assign("STYLE", $GLOBALS['style']);
18 $this->InsuranceCompany
= new InsuranceCompany();
21 function default_action() {
22 return $this->list_action();
25 function edit_action($id = "",$patient_id="",$p_obj = null) {
26 if ($p_obj != null && get_class($p_obj) == "insurancecompany") {
27 $this->icompanies
[0] = $p_obj;
29 elseif (get_class($this->icompanies
[0]) != "insurancecompany" ) {
30 $this->icompanies
[0] = new InsuranceCompany($id);
33 $this->assign("insurancecompany", $this->icompanies
[0]);
34 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod
. "_edit.html");
37 function list_action($sort = "") {
40 $this->assign("icompanies", $this->InsuranceCompany
->insurance_companies_factory("",$sort));
43 $this->assign("icompanies", $this->InsuranceCompany
->insurance_companies_factory());
46 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod
. "_list.html");
50 function edit_action_process() {
51 if ($_POST['process'] != "true")
54 if (is_numeric($_POST['id'])) {
55 $this->icompanies
[0] = new InsuranceCompany($_POST['id']);
58 $this->icompanies
[0] = new InsuranceCompany();
61 parent
::populate_object($this->icompanies
[0]);
62 //print_r($this->pharmacies[0]);
63 //echo $this->pharmacies[0]->toString(true);
65 $this->icompanies
[0]->persist();
67 //echo "action processeed";
68 $_POST['process'] = "";