3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once($GLOBALS['fileroot'] ."/library/classes/Pharmacy.class.php");
6 class C_Pharmacy
extends Controller
{
11 function C_Pharmacy($template_mod = "general") {
13 $this->pharmacies
= 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&pharmacy&");
17 $this->assign("STYLE", $GLOBALS['style']);
18 $this->assign("WEB_ROOT", $GLOBALS['webroot'] );
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) == "pharmacy") {
27 $this->pharmacies
[0] = $p_obj;
29 elseif (get_class($this->pharmacies
[0]) != "pharmacy" ) {
30 $this->pharmacies
[0] = new Pharmacy($id);
33 if (!empty($patient_id)) {
34 $this->pharmacies
[0]->set_patient_id($patient_id);
35 $this->pharmacies
[0]->set_provider($this->pharmacies
[0]->patient
->get_provider());
37 $this->assign("pharmacy", $this->pharmacies
[0]);
38 return $this->fetch($GLOBALS['template_dir'] . "pharmacies/" . $this->template_mod
. "_edit.html");
41 function list_action($sort = "") {
44 $this->assign("pharmacies", Pharmacy
::pharmacies_factory("",$sort));
47 $this->assign("pharmacies", Pharmacy
::pharmacies_factory());
49 //print_r(Prescription::prescriptions_factory($id));
50 return $this->fetch($GLOBALS['template_dir'] . "pharmacies/" . $this->template_mod
. "_list.html");
54 function edit_action_process() {
55 if ($_POST['process'] != "true")
58 if (is_numeric($_POST['id'])) {
59 $this->pharmacies
[0] = new Pharmacy($_POST['id']);
62 $this->pharmacies
[0] = new Pharmacy();
64 parent
::populate_object($this->pharmacies
[0]);
65 //print_r($this->pharmacies[0]);
66 //echo $this->pharmacies[0]->toString(true);
67 $this->pharmacies
[0]->persist();
68 //echo "action processeed";
69 $_POST['process'] = "";