diff --git a/interface/main/left_nav.php b/interface/main/left_nav.php index 303dbb30fea..d1d589c977e 100644 --- a/interface/main/left_nav.php +++ b/interface/main/left_nav.php @@ -1113,6 +1113,7 @@ function selpopup(selobj) { + diff --git a/interface/super/rules/controllers/alerts/controller.php b/interface/super/rules/controllers/alerts/controller.php index c565008957a..b411f76cef5 100644 --- a/interface/super/rules/controllers/alerts/controller.php +++ b/interface/super/rules/controllers/alerts/controller.php @@ -1,23 +1,37 @@ viewBean->rules = $c->populate(); - $this->set_view("list.php"); + $this->set_view("list_actmgr.php"); } - function _action_submit() { - - //$this->viewBean->name = _post("name"); - //$this->viewBean->age = _post("age"); + + function _action_submitactmgr() { - $ids = _post("id"); - $actives = _post("active"); - $passives = _post("passive"); - $reminders = _post("reminder"); + + $ids = $_POST["id"]; + $actives = $_POST["active"]; + $passives = $_POST["passive"]; + $reminders = $_POST["reminder"]; // The array of check-boxes we get from the POST are only those of the checked ones with value 'on'. @@ -52,15 +66,12 @@ function _action_submit() { } - //print_r($actives_final); - //print_r($passives_final); - //print_r($reminders_final); // Reflect the changes to the database. - $c = new CdrActivationManager(); + $c = new CdrAlertManager(); $c->update($ids, $actives_final, $passives_final, $reminders_final); - $this->forward("default"); + $this->forward("listactmgr"); } } diff --git a/interface/super/rules/controllers/alerts/model/CdrHelper.class.php b/interface/super/rules/controllers/alerts/model/CdrHelper.class.php deleted file mode 100644 index 6608bd8953e..00000000000 --- a/interface/super/rules/controllers/alerts/model/CdrHelper.class.php +++ /dev/null @@ -1,153 +0,0 @@ - -id = $rule_id; - $this->pid = $pid; - $this->active_flag = $active_alert_flag; - $this->passive_flag = $passive_alert_flag; - $this->reminder_flag = $patient_reminder_flag; - } - - function active_alert_flag() { - return $this->active_flag; - } - - function passive_alert_flag() { - return $this->passive_flag; - } - - function get_rule() { - $this->rule = $this->getrulenamefromid(); - return $this->rule; - } - - function get_id() { - return $this->id; - } - - function patient_reminder_flag() { - return $this->reminder_flag; - } - - function get_default_practice_setting_status() { - - if ( $this->pid == "0") { - return "ON"; - } - else { - return "OFF"; - } - } - - function update_table() { - - $query = "UPDATE clinical_rules SET active_alert_flag = " . $this->active_flag . - ", passive_alert_flag = " . $this->passive_flag . - ", patient_reminder_flag = " . $this->reminder_flag . - " WHERE id = " . "'" . $this->id . "'" ; - - //echo $query . "
\n"; - sqlStatement($query); - - } - - function update_patient_reminder_alert($pid, $id, $patient_reminder_flag) { - - $query = "UPDATE clinical_rules SET patient_reminder_flag = " . $patient_reminder_flag . - " WHERE id = " . "'" . $id . "'" . " AND pid = " . "'" . $pid . "'"; - - //echo $query . "
\n"; - sqlStatement($query); - - } - - function delete_patient_reminder_alert($pid, $id) { - - $query = "DELETE FROM clinical_rules WHERE id = " . "'" . $id . "'" . " AND pid = " . "'" . $pid . "'"; - - //echo $query . "
\n"; - sqlStatement($query); - - } - - function add_patient_reminder_alert($pid, $id, $row, $patient_reminder_flag) { - - $query = "INSERT INTO clinical_rules (id, pid, active_alert_flag, passive_alert_flag, cqm_flag, cqm_code, amc_flag, amc_code, patient_reminder_flag ) ". - "VALUES (". "'" . $row['id'] . "', " . - $pid . ", " . - $row['active_alert_flag'] . ", " . - $row['passive_alert_flag'] . ", " . - $row['cqm_flag'] . ", " . - "'" . $row['cqm_code'] . "', " . - $row['amc_flag'] . ", " . - "'". $row['amc_code'] . "', " . - $patient_reminder_flag . ")"; - - - //echo $query . "
\n"; - sqlStatement($query); - } - - - function add_edit_del_patient_specific_alert($pid, $id, $patient_reminder_flag) { - - // Check if a patient specific row already exists. If it does, update accordingly. - $query = "SELECT * FROM clinical_rules WHERE id = " . "'" . $id . "'" . " AND pid = " . "'" . $pid . "'"; - //echo $query . "
\n"; - $rez = sqlStatement($query); - - if ( sqlFetchArray($rez) > 0) { - if ( $patient_reminder_flag == '2' ) { // DEFAULT radio button selected - $this->delete_patient_reminder_alert($pid, $id); - } - else { // ON/OFF radio button selected - $this->update_patient_reminder_alert($pid, $id, $patient_reminder_flag); - } - return; - } - else { - if ( $patient_reminder_flag == '2' ) { // DEFAULT radio button selected - return; - } - - } - - // No patient specic row exists. Create one. - $query = "SELECT * FROM clinical_rules WHERE id=" . "'" . $id . "'" . " AND pid='0'"; - //echo $query . "
\n"; - $rez = sqlStatement($query); - for($iter=0; $row=sqlFetchArray($rez); $iter++) { - $this->add_patient_reminder_alert($pid, $id, $row, $patient_reminder_flag); - return; - } - - } - - - function getrulenamefromid() { - $rez = sqlStatement("SELECT `title` FROM `list_options` " . - "WHERE option_id=?", array($this->id) ); - - - for($iter=0; $row=sqlFetchArray($rez); $iter++) { - return $row['title']; - } - - } - - -} -?> \ No newline at end of file diff --git a/interface/super/rules/controllers/alerts/view/list.php b/interface/super/rules/controllers/alerts/view/list_actmgr.php similarity index 55% rename from interface/super/rules/controllers/alerts/view/list.php rename to interface/super/rules/controllers/alerts/view/list_actmgr.php index 7f99f2a4a90..d70eb2cefd9 100644 --- a/interface/super/rules/controllers/alerts/view/list.php +++ b/interface/super/rules/controllers/alerts/view/list_actmgr.php @@ -1,44 +1,56 @@ -
+ + + + + + + + +
+ +
+ +  + + - + - + - + - + rules as $rule) {?> - + active_alert_flag() == "1"){ ?> - + - + passive_alert_flag() == "1"){ ?> - + - + patient_reminder_flag() == "1"){ ?> - + - + - +
     
get_rule() ) );?>get_rule()) );?>       get_id() ); ?> />get_id()); ?> />
-
-
diff --git a/interface/super/rules/controllers/alerts/model/CdrActivationManager.class.php b/interface/super/rules/library/CdrAlertManager.class.php similarity index 61% rename from interface/super/rules/controllers/alerts/model/CdrActivationManager.class.php rename to interface/super/rules/library/CdrAlertManager.class.php index 74d6a2ede47..d83996f27c3 100644 --- a/interface/super/rules/controllers/alerts/model/CdrActivationManager.class.php +++ b/interface/super/rules/library/CdrAlertManager.class.php @@ -1,17 +1,30 @@ update_table(); } - } -} // end of CdrActivationManager +} // end of CdrAlertManager ?> diff --git a/interface/super/rules/library/CdrHelper.class.php b/interface/super/rules/library/CdrHelper.class.php new file mode 100644 index 00000000000..771788aabd6 --- /dev/null +++ b/interface/super/rules/library/CdrHelper.class.php @@ -0,0 +1,68 @@ + +id = $rule_id; + $this->rule = getLabel($this->id,'clinical_rules'); + $this->active_flag = $active_alert_flag; + $this->passive_flag = $passive_alert_flag; + $this->reminder_flag = $patient_reminder_flag; + } + + function active_alert_flag() { + return $this->active_flag; + } + + function passive_alert_flag() { + return $this->passive_flag; + } + + function get_rule() { + return $this->rule; + } + + function get_id() { + return $this->id; + } + + function patient_reminder_flag() { + return $this->reminder_flag; + } + + function update_table() { + + $query = "UPDATE clinical_rules SET active_alert_flag = ?" . + ", passive_alert_flag = ?" . + ", patient_reminder_flag = ?" . + " WHERE id = ?"; + + sqlStatement($query, array($this->active_flag,$this->passive_flag,$this->reminder_flag,$this->id) ); + + } + +} +?>