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