PHP warning fixes
[openemr.git] / interface / super / rules / controllers / alerts / controller.php
blob0846390a251ec548dcdaed69d87590be39896ef2
1 <?php
2 // Copyright (C) 2011 Ensoftek, Inc
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // A copy of the GNU General Public License is included along with this program:
15 // openemr/interface/login/GnuGPL.html
16 // For more information write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 class Controller_alerts extends BaseController {
21 function _action_listactmgr() {
22 $c = new CdrAlertManager();
23 // Instantiating object if does not exist to avoid
24 // "creating default object from empty value" warning.
25 if (!isset($this->viewBean)) {
26 $this->viewBean = new stdClass();
28 $this->viewBean->rules = $c->populate();
29 $this->set_view("list_actmgr.php");
33 function _action_submitactmgr() {
36 $ids = $_POST["id"];
37 $actives = $_POST["active"];
38 $passives = $_POST["passive"];
39 $reminders = $_POST["reminder"];
40 $access_controls = $_POST["access_control"];
43 // The array of check-boxes we get from the POST are only those of the checked ones with value 'on'.
44 // So, we have to manually create the entitre arrays with right values.
45 $actives_final = array();
46 $passives_final = array();
47 $reminders_final = array();
50 $numrows = count($ids);
51 for ($i = 0; $i < $numrows; ++$i) {
53 if ( $actives[$i] == "on") {
54 $actives_final[] = "1";
56 else {
57 $actives_final[] = "0";;
60 if ( $passives[$i] == "on") {
61 $passives_final[] = "1";
63 else {
64 $passives_final[] = "0";;
67 if ( $reminders[$i] == "on") {
68 $reminders_final[] = "1";
70 else {
71 $reminders_final[] = "0";;
77 // Reflect the changes to the database.
78 $c = new CdrAlertManager();
79 $c->update($ids, $actives_final, $passives_final, $reminders_final, $access_controls);
80 // Instantiating object if does not exist to avoid
81 // "creating default object from empty value" warning.
82 if (!isset($this->viewBean)) {
83 $this->viewBean = new stdClass();
85 $this->forward("listactmgr");