chore: complete integration of flex-3.20 (alpine 3.20) into ci (#7538)
[openemr.git] / interface / usergroup / facility_admin.php
bloba328a03d3aff6d638cf0498680c67a538db78e46
1 <?php
3 /**
4 * facility_admin.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
14 require_once("$srcdir/options.inc.php");
16 use OpenEMR\Common\Acl\AclMain;
17 use OpenEMR\Common\Csrf\CsrfUtils;
18 use OpenEMR\Common\Twig\TwigContainer;
19 use OpenEMR\Core\Header;
20 use OpenEMR\Services\FacilityService;
22 // Ensure authorized
23 if (!AclMain::aclCheckCore('admin', 'users')) {
24 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Facility Admin")]);
25 exit;
28 $facilityService = new FacilityService();
30 $alertmsg = '';
31 $use_validate_js = 1;
32 require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php");
33 //Gets validation rules from Page Validation list.
34 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
35 $rules = collectValidationPageRules("/interface/usergroup/facilities_add.php");
37 $my_fid = $_GET['fid'] ?? '';
38 $pc = new POSRef();
39 $resPBE = $facilityService->getPrimaryBusinessEntity(array("excludedId" => ($my_fid ?? null)));
40 $disabled = (!empty($resPBE) && sizeof($resPBE) > 0) ? 'disabled' : '';
42 $args = [
43 'collectThis' => (empty($rules)) ? "undefined" : json_sanitize($rules["facility-add"]["rules"]),
44 'forceClose' => (isset($_POST["mode"]) && $_POST["mode"] == "facility") ? true : false,
45 'erxEnabled' => $GLOBALS['erx_enable'],
46 'alertMsg' => trim($alertmsg) ? true : false,
47 'disablePBE' => $disabled,
48 'pos_code' => $pc->get_pos_ref(),
49 'mode' => 'edit',
50 'my_fid' => $my_fid,
51 'facility' => $facilityService->getById($my_fid),
54 $twig = new TwigContainer(null, $GLOBALS["kernel"]);
55 $t = $twig->getTwig();
56 echo $t->render("super/facilities/form.html.twig", $args);