3 * Edit Layout Properties.
5 * Copyright (C) 2016-2017 Rod Roark <rod@sunsetsystems.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @author Rod Roark <rod@sunsetsystems.com>
20 * @link http://www.open-emr.org
23 require_once("../globals.php");
24 require_once("$srcdir/acl.inc");
25 require_once("$phpgacl_location/gacl_api.class.php");
29 // Check authorization.
30 $thisauth = acl_check('admin', 'super');
32 die(xlt('Not authorized'));
35 $layout_id = empty($_GET['layout_id']) ?
'' : $_GET['layout_id'];
36 $group_id = empty($_GET['group_id' ]) ?
'' : $_GET['group_id' ];
40 <?php
html_header_show();?
>
41 <title
><?php
echo xlt("Edit Layout Properties"); ?
></title
>
42 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
45 td
{ font
-size
:10pt
; }
48 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js?v=<?php echo $v_js_includes; ?>"></script
>
49 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
50 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery/dist/jquery.min.js"></script
>
51 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
53 <script language
="JavaScript">
55 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
57 // The name of the input element to receive a found code.
58 var current_sel_name
= '';
60 // This invokes the "dynamic" find-code popup.
61 function sel_related(elem
, codetype
) {
62 current_sel_name
= elem ? elem
.name
: '';
63 var url
= '<?php echo $rootdir ?>/patient_file/encounter/find_code_dynamic.php';
64 if (codetype
) url +
= '?codetype=' + codetype
;
65 dlgopen(url
, '_blank', 800, 500);
68 // This is for callback by the find-code popup.
69 // Appends to or erases the current list of related codes.
70 function set_related(codetype
, code
, selector
, codedesc
) {
71 var f
= document
.forms
[0];
72 // frc will be the input element containing the codes.
73 var frc
= f
[current_sel_name
];
79 s +
= codetype +
':' + code
;
87 // This is for callback by the find-code popup.
88 // Deletes the specified codetype:code from the active input element.
89 function del_related(s
) {
90 var f
= document
.forms
[0];
91 my_del_related(s
, f
[current_sel_name
], false);
94 // This is for callback by the find-code popup.
95 // Returns the array of currently selected codes with each element in codetype:code format.
96 function get_related() {
97 var f
= document
.forms
[0];
98 if (current_sel_name
) {
99 return f
[current_sel_name
].value
.split(';');
108 <body
class="body_top">
111 if ($_POST['form_submit'] && !$alertmsg) {
112 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
118 "grp_subtitle = ?, " .
121 $_POST['form_subtitle'],
122 intval($_POST['form_columns']),
127 "grp_subtitle = ?, " .
128 "grp_mapping = ?, " .
130 "grp_activity = ?, " .
131 "grp_repeats = ?, " .
132 "grp_columns = ?, " .
134 "grp_issue_type = ?, " .
135 "grp_aco_spec = ?, " .
136 "grp_services = ?, " .
137 "grp_products = ?, " .
140 $_POST['form_title'],
141 $_POST['form_subtitle'],
142 $_POST['form_mapping'],
143 intval($_POST['form_seq']),
144 empty($_POST['form_activity']) ?
0 : 1,
145 intval($_POST['form_repeats']),
146 intval($_POST['form_columns']),
147 intval($_POST['form_size']),
148 $_POST['form_issue'],
150 empty($_POST['form_services']) ?
'' : (empty($_POST['form_services_codes']) ?
'*' : $_POST['form_services_codes']),
151 empty($_POST['form_products']) ?
'' : (empty($_POST['form_products_codes']) ?
'*' : $_POST['form_products_codes']),
152 empty($_POST['form_diags' ]) ?
'' : (empty($_POST['form_diags_codes' ]) ?
'*' : $_POST['form_diags_codes' ]),
157 // They have edited an existing layout.
158 $sqlvars[] = $layout_id;
159 $sqlvars[] = $group_id;
161 "UPDATE layout_group_properties SET $sets " .
162 "WHERE grp_form_id = ? AND grp_group_id = ?",
165 } else if (!$group_id) {
166 // They want to add a new layout. New groups not supported here.
167 $form_form_id = $_POST['form_form_id'];
168 if (preg_match('/(LBF|LBT)[0-9A-Za-z_]+/', $form_form_id)) {
170 "SELECT grp_form_id FROM layout_group_properties WHERE " .
171 "grp_form_id = ? AND grp_group_id = ''",
175 $sqlvars[] = $form_form_id;
177 "INSERT INTO layout_group_properties " .
178 "SET $sets, grp_form_id = ?, grp_group_id = ''",
181 $layout_id = $form_form_id;
183 $alertmsg = xl('This layout ID already exists');
186 $alertmsg = xl('Invalid layout ID');
190 // Close this window and redisplay the layout editor.
192 echo "<script language='JavaScript'>\n";
194 echo " alert('" . addslashes($alertmsg) . "');\n";
196 echo " if (opener.refreshme) opener.refreshme('" . attr($layout_id) . "');\n";
197 echo " window.close();\n";
198 echo "</script></body></html>\n";
205 'grp_subtitle' => '',
206 'grp_mapping' => 'Clinical',
208 'grp_activity' => '1',
209 'grp_repeats' => '0',
210 'grp_columns' => '4',
212 'grp_issue_type' => '',
213 'grp_aco_spec' => '',
214 'grp_services' => '',
215 'grp_products' => '',
221 "SELECT * FROM layout_group_properties WHERE " .
222 "grp_form_id = ? AND grp_group_id = ?",
223 array($layout_id, $group_id)
226 die(xlt('This layout does not exist.'));
231 <form method
='post' action
='edit_layout_props.php?<?php echo "layout_id=" . attr($layout_id) . "&group_id=" . attr($group_id); ?>'>
232 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
235 <table border
='0' width
='100%'>
236 <?php
if (empty($layout_id)) { ?
>
238 <td valign
='top' width
='1%' nowrap
>
239 <?php
echo xlt('Layout ID'); ?
>
242 <input type
='text' size
='31' maxlength
='31' name
='form_form_id'
244 <?php
echo xlt('Visit form ID must start with LBF. Transaction form ID must start with LBT.') ?
>
249 <?php
if (empty($group_id)) { ?
>
251 <td valign
='top' width
='1%' nowrap
>
252 <?php
echo xlt('Title'); ?
>
255 <input type
='text' size
='40' name
='form_title' style
='width:100%'
256 value
='<?php echo attr($row['grp_title
']); ?>' />
262 <td valign
='top' width
='1%' nowrap
>
263 <?php
echo xlt('Subtitle'); ?
>
266 <input type
='text' size
='40' name
='form_subtitle' style
='width:100%'
267 value
='<?php echo attr($row['grp_subtitle
']); ?>' />
271 <?php
if (empty($group_id)) { ?
>
274 <td valign
='top' width
='1%' nowrap
>
275 <?php
echo xlt('Category'); ?
>
278 <input type
='text' size
='40' name
='form_mapping' style
='width:100%'
279 value
='<?php echo attr($row['grp_mapping
']); ?>' />
284 <td valign
='top' width
='1%' nowrap
>
285 <?php
echo xlt('Active'); ?
>
288 <input type
='checkbox' name
='form_activity' <?php
if ($row['grp_activity']) {
289 echo "checked";} ?
> />
294 <td valign
='top' width
='1%' nowrap
>
295 <?php
echo xlt('Sequence'); ?
>
298 <input type
='text' size
='4' name
='form_seq'
299 value
='<?php echo attr($row['grp_seq
']); ?>' />
304 <td valign
='top' width
='1%' nowrap
>
305 <?php
echo xlt('Repeats'); ?
>
308 <input type
='text' size
='4' name
='form_repeats'
309 value
='<?php echo attr($row['grp_repeats
']); ?>' />
316 <td valign
='top' nowrap
>
317 <?php
echo xlt('Layout Columns'); ?
>
320 <select name
='form_columns'>
322 echo "<option value='0'>" . xlt('Default') . "</option>\n";
323 for ($cols = 2; $cols <= 10; ++
$cols) {
324 echo "<option value='" . attr($cols) . "'";
325 if ($cols == $row['grp_columns']) {
328 echo ">" . text($cols) . "</option>\n";
335 <?php
if (empty($group_id)) { ?
>
338 <td valign
='top' nowrap
>
339 <?php
echo xlt('Font Size'); ?
>
342 <select name
='form_size'>
344 echo "<option value='0'>" . xlt('Default') . "</option>\n";
345 for ($size = 5; $size <= 15; ++
$size) {
346 echo "<option value='" . attr($size) . "'";
347 if ($size == $row['grp_size']) {
350 echo ">" . text($size) . "</option>\n";
358 <td valign
='top' nowrap
>
359 <?php
echo xlt('Issue Type'); ?
>
362 <select name
='form_issue'>
363 <option value
=''></option
>
365 $itres = sqlStatement(
366 "SELECT type, singular FROM issue_types " .
367 "WHERE category = ? AND active = 1 ORDER BY singular",
368 array($GLOBALS['ippf_specific'] ?
'ippf_specific' : 'default')
370 while ($itrow = sqlFetchArray($itres)) {
371 echo "<option value='" . attr($itrow['type']) . "'";
372 if ($itrow['type'] == $row['grp_issue_type']) {
375 echo ">" . xlt($itrow['singular']) . "</option>\n";
383 <td valign
='top' nowrap
>
384 <?php
echo xlt('Access Control'); ?
>
387 <select name
='form_aco' style
='width:100%'>
388 <option value
=''></option
>
390 $gacl = new gacl_api();
391 // collect and sort all aco objects
392 $list_aco_objects = $gacl->get_objects(null, 0, 'ACO');
393 ksort($list_aco_objects);
394 foreach ($list_aco_objects as $seckey => $dummy) {
398 asort($list_aco_objects[$seckey]);
399 $aco_section_data = $gacl->get_section_data($seckey, 'ACO');
400 $aco_section_title = $aco_section_data[3];
401 echo " <optgroup label='" . xla($aco_section_title) . "'>\n";
402 foreach ($list_aco_objects[$seckey] as $acokey) {
403 $aco_id = $gacl->get_object_id($seckey, $acokey, 'ACO');
404 $aco_data = $gacl->get_object_data($aco_id, 'ACO');
405 $aco_title = $aco_data[0][3];
406 echo " <option value='" . attr("$seckey|$acokey") . "'";
407 if ("$seckey|$acokey" == $row['grp_aco_spec']) {
410 echo ">" . xla($aco_title) . "</option>\n";
412 echo " </optgroup>\n";
420 <td valign
='top' width
='1%' nowrap
>
421 <input type
='checkbox' name
='form_services' <?php
if ($row['grp_services']) {
422 echo "checked";} ?
> />
423 <?php
echo xlt('Show Services Section'); ?
>
426 <input type
='text' size
='40' name
='form_services_codes' onclick
='sel_related(this, "MA")' style
='width:100%'
427 value
='<?php if ($row['grp_services
'] != '*') {
428 echo attr($row['grp_services
']);} ?>' />
433 <td valign
='top' width
='1%' nowrap
>
434 <input type
='checkbox' name
='form_products' <?php
if ($row['grp_products']) {
435 echo "checked";} ?
> />
436 <?php
echo xlt('Show Products Section'); ?
>
439 <input type
='text' size
='40' name
='form_products_codes' onclick
='sel_related(this, "PROD")' style
='width:100%'
440 value
='<?php if ($row['grp_products
'] != '*') {
441 echo attr($row['grp_products
']);} ?>' />
446 <td valign
='top' width
='1%' nowrap
>
447 <input type
='checkbox' name
='form_diags' <?php
if ($row['grp_diags']) {
448 echo "checked";} ?
> />
449 <?php
echo xlt('Show Diagnoses Section'); ?
>
452 <input type
='text' size
='40' name
='form_diags_codes' onclick
='sel_related(this, "ICD10")' style
='width:100%'
453 value
='<?php if ($row['grp_diags
'] != '*') {
454 echo attr($row['grp_diags
']);} ?>' />
463 <input type
='submit' name
='form_submit' value
='<?php echo xla('Submit
'); ?>' />
466 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
471 <script language
='JavaScript'>
474 echo " alert('" . addslashes($alertmsg) . "');\n";
475 echo " window.close();\n";