3 * Edit Layout Properties.
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2016-2017 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/acl.inc");
17 require_once("$phpgacl_location/gacl_api.class.php");
21 // Check authorization.
22 $thisauth = acl_check('admin', 'super');
24 die(xlt('Not authorized'));
27 $layout_id = empty($_GET['layout_id']) ?
'' : $_GET['layout_id'];
28 $group_id = empty($_GET['group_id' ]) ?
'' : $_GET['group_id' ];
32 <title
><?php
echo xlt("Edit Layout Properties"); ?
></title
>
33 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
36 td
{ font
-size
:10pt
; }
39 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js?v=<?php echo $v_js_includes; ?>"></script
>
40 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
41 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery/dist/jquery.min.js"></script
>
42 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
44 <script language
="JavaScript">
46 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
48 // The name of the input element to receive a found code.
49 var current_sel_name
= '';
51 // This invokes the "dynamic" find-code popup.
52 function sel_related(elem
, codetype
) {
53 current_sel_name
= elem ? elem
.name
: '';
54 var url
= '<?php echo $rootdir ?>/patient_file/encounter/find_code_dynamic.php';
55 if (codetype
) url +
= '?codetype=' +
encodeURIComponent(codetype
);
56 dlgopen(url
, '_blank', 800, 500);
59 // This is for callback by the find-code popup.
60 // Appends to or erases the current list of related codes.
61 function set_related(codetype
, code
, selector
, codedesc
) {
62 var f
= document
.forms
[0];
63 // frc will be the input element containing the codes.
64 var frc
= f
[current_sel_name
];
70 s +
= codetype +
':' + code
;
78 // This is for callback by the find-code popup.
79 // Deletes the specified codetype:code from the active input element.
80 function del_related(s
) {
81 var f
= document
.forms
[0];
82 my_del_related(s
, f
[current_sel_name
], false);
85 // This is for callback by the find-code popup.
86 // Returns the array of currently selected codes with each element in codetype:code format.
87 function get_related() {
88 var f
= document
.forms
[0];
89 if (current_sel_name
) {
90 return f
[current_sel_name
].value
.split(';');
99 <body
class="body_top">
102 if ($_POST['form_submit'] && !$alertmsg) {
103 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
109 "grp_subtitle = ?, " .
112 $_POST['form_subtitle'],
113 intval($_POST['form_columns']),
118 "grp_subtitle = ?, " .
119 "grp_mapping = ?, " .
121 "grp_activity = ?, " .
122 "grp_repeats = ?, " .
123 "grp_columns = ?, " .
125 "grp_issue_type = ?, " .
126 "grp_aco_spec = ?, " .
127 "grp_services = ?, " .
128 "grp_products = ?, " .
131 $_POST['form_title'],
132 $_POST['form_subtitle'],
133 $_POST['form_mapping'],
134 intval($_POST['form_seq']),
135 empty($_POST['form_activity']) ?
0 : 1,
136 intval($_POST['form_repeats']),
137 intval($_POST['form_columns']),
138 intval($_POST['form_size']),
139 $_POST['form_issue'],
141 empty($_POST['form_services']) ?
'' : (empty($_POST['form_services_codes']) ?
'*' : $_POST['form_services_codes']),
142 empty($_POST['form_products']) ?
'' : (empty($_POST['form_products_codes']) ?
'*' : $_POST['form_products_codes']),
143 empty($_POST['form_diags' ]) ?
'' : (empty($_POST['form_diags_codes' ]) ?
'*' : $_POST['form_diags_codes' ]),
148 // They have edited an existing layout.
149 $sqlvars[] = $layout_id;
150 $sqlvars[] = $group_id;
152 "UPDATE layout_group_properties SET $sets " .
153 "WHERE grp_form_id = ? AND grp_group_id = ?",
156 } else if (!$group_id) {
157 // They want to add a new layout. New groups not supported here.
158 $form_form_id = $_POST['form_form_id'];
159 if (preg_match('/(LBF|LBT)[0-9A-Za-z_]+/', $form_form_id)) {
161 "SELECT grp_form_id FROM layout_group_properties WHERE " .
162 "grp_form_id = ? AND grp_group_id = ''",
166 $sqlvars[] = $form_form_id;
168 "INSERT INTO layout_group_properties " .
169 "SET $sets, grp_form_id = ?, grp_group_id = ''",
172 $layout_id = $form_form_id;
174 $alertmsg = xl('This layout ID already exists');
177 $alertmsg = xl('Invalid layout ID');
181 // Close this window and redisplay the layout editor.
183 echo "<script language='JavaScript'>\n";
185 echo " alert(" . js_escape($alertmsg) . ");\n";
187 echo " if (opener.refreshme) opener.refreshme(" . js_escape($layout_id) . ");\n";
188 echo " window.close();\n";
189 echo "</script></body></html>\n";
196 'grp_subtitle' => '',
197 'grp_mapping' => 'Clinical',
199 'grp_activity' => '1',
200 'grp_repeats' => '0',
201 'grp_columns' => '4',
203 'grp_issue_type' => '',
204 'grp_aco_spec' => '',
205 'grp_services' => '',
206 'grp_products' => '',
212 "SELECT * FROM layout_group_properties WHERE " .
213 "grp_form_id = ? AND grp_group_id = ?",
214 array($layout_id, $group_id)
217 die(xlt('This layout does not exist.'));
222 <form method
='post' action
='edit_layout_props.php?<?php echo "layout_id=" . attr_url($layout_id) . "&group_id=" . attr_url($group_id); ?>'>
223 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
226 <table border
='0' width
='100%'>
227 <?php
if (empty($layout_id)) { ?
>
229 <td valign
='top' width
='1%' nowrap
>
230 <?php
echo xlt('Layout ID'); ?
>
233 <input type
='text' size
='31' maxlength
='31' name
='form_form_id'
235 <?php
echo xlt('Visit form ID must start with LBF. Transaction form ID must start with LBT.') ?
>
240 <?php
if (empty($group_id)) { ?
>
242 <td valign
='top' width
='1%' nowrap
>
243 <?php
echo xlt('Title'); ?
>
246 <input type
='text' size
='40' name
='form_title' style
='width:100%'
247 value
='<?php echo attr($row['grp_title
']); ?>' />
253 <td valign
='top' width
='1%' nowrap
>
254 <?php
echo xlt('Subtitle'); ?
>
257 <input type
='text' size
='40' name
='form_subtitle' style
='width:100%'
258 value
='<?php echo attr($row['grp_subtitle
']); ?>' />
262 <?php
if (empty($group_id)) { ?
>
265 <td valign
='top' width
='1%' nowrap
>
266 <?php
echo xlt('Category'); ?
>
269 <input type
='text' size
='40' name
='form_mapping' style
='width:100%'
270 value
='<?php echo attr($row['grp_mapping
']); ?>' />
275 <td valign
='top' width
='1%' nowrap
>
276 <?php
echo xlt('Active'); ?
>
279 <input type
='checkbox' name
='form_activity' <?php
echo ($row['grp_activity']) ?
"checked" : ""; ?
> />
284 <td valign
='top' width
='1%' nowrap
>
285 <?php
echo xlt('Sequence'); ?
>
288 <input type
='text' size
='4' name
='form_seq'
289 value
='<?php echo attr($row['grp_seq
']); ?>' />
294 <td valign
='top' width
='1%' nowrap
>
295 <?php
echo xlt('Repeats'); ?
>
298 <input type
='text' size
='4' name
='form_repeats'
299 value
='<?php echo attr($row['grp_repeats
']); ?>' />
306 <td valign
='top' nowrap
>
307 <?php
echo xlt('Layout Columns'); ?
>
310 <select name
='form_columns'>
312 echo "<option value='0'>" . xlt('Default') . "</option>\n";
313 for ($cols = 2; $cols <= 10; ++
$cols) {
314 echo "<option value='" . attr($cols) . "'";
315 if ($cols == $row['grp_columns']) {
318 echo ">" . text($cols) . "</option>\n";
325 <?php
if (empty($group_id)) { ?
>
328 <td valign
='top' nowrap
>
329 <?php
echo xlt('Font Size'); ?
>
332 <select name
='form_size'>
334 echo "<option value='0'>" . xlt('Default') . "</option>\n";
335 for ($size = 5; $size <= 15; ++
$size) {
336 echo "<option value='" . attr($size) . "'";
337 if ($size == $row['grp_size']) {
340 echo ">" . text($size) . "</option>\n";
348 <td valign
='top' nowrap
>
349 <?php
echo xlt('Issue Type'); ?
>
352 <select name
='form_issue'>
353 <option value
=''></option
>
355 $itres = sqlStatement(
356 "SELECT type, singular FROM issue_types " .
357 "WHERE category = ? AND active = 1 ORDER BY singular",
358 array($GLOBALS['ippf_specific'] ?
'ippf_specific' : 'default')
360 while ($itrow = sqlFetchArray($itres)) {
361 echo "<option value='" . attr($itrow['type']) . "'";
362 if ($itrow['type'] == $row['grp_issue_type']) {
365 echo ">" . xlt($itrow['singular']) . "</option>\n";
373 <td valign
='top' nowrap
>
374 <?php
echo xlt('Access Control'); ?
>
377 <select name
='form_aco' style
='width:100%'>
378 <option value
=''></option
>
380 $gacl = new gacl_api();
381 // collect and sort all aco objects
382 $list_aco_objects = $gacl->get_objects(null, 0, 'ACO');
383 ksort($list_aco_objects);
384 foreach ($list_aco_objects as $seckey => $dummy) {
388 asort($list_aco_objects[$seckey]);
389 $aco_section_data = $gacl->get_section_data($seckey, 'ACO');
390 $aco_section_title = $aco_section_data[3];
391 echo " <optgroup label='" . xla($aco_section_title) . "'>\n";
392 foreach ($list_aco_objects[$seckey] as $acokey) {
393 $aco_id = $gacl->get_object_id($seckey, $acokey, 'ACO');
394 $aco_data = $gacl->get_object_data($aco_id, 'ACO');
395 $aco_title = $aco_data[0][3];
396 echo " <option value='" . attr("$seckey|$acokey") . "'";
397 if ("$seckey|$acokey" == $row['grp_aco_spec']) {
400 echo ">" . xlt($aco_title) . "</option>\n";
402 echo " </optgroup>\n";
410 <td valign
='top' width
='1%' nowrap
>
411 <input type
='checkbox' name
='form_services' <?php
echo ($row['grp_services']) ?
"checked" : ""; ?
> />
412 <?php
echo xlt('Show Services Section'); ?
>
415 <input type
='text' size
='40' name
='form_services_codes' onclick
='sel_related(this, "MA")' style
='width:100%'
416 value
='<?php echo ($row['grp_services
'] != '*') ? attr($row['grp_services
']) : ""; ?>' />
421 <td valign
='top' width
='1%' nowrap
>
422 <input type
='checkbox' name
='form_products' <?php
echo ($row['grp_products']) ?
"checked" : ""; ?
> />
423 <?php
echo xlt('Show Products Section'); ?
>
426 <input type
='text' size
='40' name
='form_products_codes' onclick
='sel_related(this, "PROD")' style
='width:100%'
427 value
='<?php echo ($row['grp_products
'] != '*') ? attr($row['grp_products
']) : ""; ?>' />
432 <td valign
='top' width
='1%' nowrap
>
433 <input type
='checkbox' name
='form_diags' <?php
echo ($row['grp_diags']) ?
"checked" : ""; ?
> />
434 <?php
echo xlt('Show Diagnoses Section'); ?
>
437 <input type
='text' size
='40' name
='form_diags_codes' onclick
='sel_related(this, "ICD10")' style
='width:100%'
438 value
='<?php echo ($row['grp_diags
'] != '*') ? attr($row['grp_diags
']) : ""; ?>' />
447 <input type
='submit' name
='form_submit' value
='<?php echo xla('Submit
'); ?>' />
450 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
455 <script language
='JavaScript'>
458 echo " alert(" . js_escape($alertmsg) . ");\n";
459 echo " window.close();\n";