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 <?php
html_header_show();?
>
33 <title
><?php
echo xlt("Edit Layout Properties"); ?
></title
>
34 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
37 td
{ font
-size
:10pt
; }
40 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js?v=<?php echo $v_js_includes; ?>"></script
>
41 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
42 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery/dist/jquery.min.js"></script
>
43 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
45 <script language
="JavaScript">
47 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
49 // The name of the input element to receive a found code.
50 var current_sel_name
= '';
52 // This invokes the "dynamic" find-code popup.
53 function sel_related(elem
, codetype
) {
54 current_sel_name
= elem ? elem
.name
: '';
55 var url
= '<?php echo $rootdir ?>/patient_file/encounter/find_code_dynamic.php';
56 if (codetype
) url +
= '?codetype=' +
encodeURIComponent(codetype
);
57 dlgopen(url
, '_blank', 800, 500);
60 // This is for callback by the find-code popup.
61 // Appends to or erases the current list of related codes.
62 function set_related(codetype
, code
, selector
, codedesc
) {
63 var f
= document
.forms
[0];
64 // frc will be the input element containing the codes.
65 var frc
= f
[current_sel_name
];
71 s +
= codetype +
':' + code
;
79 // This is for callback by the find-code popup.
80 // Deletes the specified codetype:code from the active input element.
81 function del_related(s
) {
82 var f
= document
.forms
[0];
83 my_del_related(s
, f
[current_sel_name
], false);
86 // This is for callback by the find-code popup.
87 // Returns the array of currently selected codes with each element in codetype:code format.
88 function get_related() {
89 var f
= document
.forms
[0];
90 if (current_sel_name
) {
91 return f
[current_sel_name
].value
.split(';');
100 <body
class="body_top">
103 if ($_POST['form_submit'] && !$alertmsg) {
104 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
110 "grp_subtitle = ?, " .
113 $_POST['form_subtitle'],
114 intval($_POST['form_columns']),
119 "grp_subtitle = ?, " .
120 "grp_mapping = ?, " .
122 "grp_activity = ?, " .
123 "grp_repeats = ?, " .
124 "grp_columns = ?, " .
126 "grp_issue_type = ?, " .
127 "grp_aco_spec = ?, " .
128 "grp_services = ?, " .
129 "grp_products = ?, " .
132 $_POST['form_title'],
133 $_POST['form_subtitle'],
134 $_POST['form_mapping'],
135 intval($_POST['form_seq']),
136 empty($_POST['form_activity']) ?
0 : 1,
137 intval($_POST['form_repeats']),
138 intval($_POST['form_columns']),
139 intval($_POST['form_size']),
140 $_POST['form_issue'],
142 empty($_POST['form_services']) ?
'' : (empty($_POST['form_services_codes']) ?
'*' : $_POST['form_services_codes']),
143 empty($_POST['form_products']) ?
'' : (empty($_POST['form_products_codes']) ?
'*' : $_POST['form_products_codes']),
144 empty($_POST['form_diags' ]) ?
'' : (empty($_POST['form_diags_codes' ]) ?
'*' : $_POST['form_diags_codes' ]),
149 // They have edited an existing layout.
150 $sqlvars[] = $layout_id;
151 $sqlvars[] = $group_id;
153 "UPDATE layout_group_properties SET $sets " .
154 "WHERE grp_form_id = ? AND grp_group_id = ?",
157 } else if (!$group_id) {
158 // They want to add a new layout. New groups not supported here.
159 $form_form_id = $_POST['form_form_id'];
160 if (preg_match('/(LBF|LBT)[0-9A-Za-z_]+/', $form_form_id)) {
162 "SELECT grp_form_id FROM layout_group_properties WHERE " .
163 "grp_form_id = ? AND grp_group_id = ''",
167 $sqlvars[] = $form_form_id;
169 "INSERT INTO layout_group_properties " .
170 "SET $sets, grp_form_id = ?, grp_group_id = ''",
173 $layout_id = $form_form_id;
175 $alertmsg = xl('This layout ID already exists');
178 $alertmsg = xl('Invalid layout ID');
182 // Close this window and redisplay the layout editor.
184 echo "<script language='JavaScript'>\n";
186 echo " alert(" . js_escape($alertmsg) . ");\n";
188 echo " if (opener.refreshme) opener.refreshme(" . js_escape($layout_id) . ");\n";
189 echo " window.close();\n";
190 echo "</script></body></html>\n";
197 'grp_subtitle' => '',
198 'grp_mapping' => 'Clinical',
200 'grp_activity' => '1',
201 'grp_repeats' => '0',
202 'grp_columns' => '4',
204 'grp_issue_type' => '',
205 'grp_aco_spec' => '',
206 'grp_services' => '',
207 'grp_products' => '',
213 "SELECT * FROM layout_group_properties WHERE " .
214 "grp_form_id = ? AND grp_group_id = ?",
215 array($layout_id, $group_id)
218 die(xlt('This layout does not exist.'));
223 <form method
='post' action
='edit_layout_props.php?<?php echo "layout_id=" . attr_url($layout_id) . "&group_id=" . attr_url($group_id); ?>'>
224 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
227 <table border
='0' width
='100%'>
228 <?php
if (empty($layout_id)) { ?
>
230 <td valign
='top' width
='1%' nowrap
>
231 <?php
echo xlt('Layout ID'); ?
>
234 <input type
='text' size
='31' maxlength
='31' name
='form_form_id'
236 <?php
echo xlt('Visit form ID must start with LBF. Transaction form ID must start with LBT.') ?
>
241 <?php
if (empty($group_id)) { ?
>
243 <td valign
='top' width
='1%' nowrap
>
244 <?php
echo xlt('Title'); ?
>
247 <input type
='text' size
='40' name
='form_title' style
='width:100%'
248 value
='<?php echo attr($row['grp_title
']); ?>' />
254 <td valign
='top' width
='1%' nowrap
>
255 <?php
echo xlt('Subtitle'); ?
>
258 <input type
='text' size
='40' name
='form_subtitle' style
='width:100%'
259 value
='<?php echo attr($row['grp_subtitle
']); ?>' />
263 <?php
if (empty($group_id)) { ?
>
266 <td valign
='top' width
='1%' nowrap
>
267 <?php
echo xlt('Category'); ?
>
270 <input type
='text' size
='40' name
='form_mapping' style
='width:100%'
271 value
='<?php echo attr($row['grp_mapping
']); ?>' />
276 <td valign
='top' width
='1%' nowrap
>
277 <?php
echo xlt('Active'); ?
>
280 <input type
='checkbox' name
='form_activity' <?php
echo ($row['grp_activity']) ?
"checked" : ""; ?
> />
285 <td valign
='top' width
='1%' nowrap
>
286 <?php
echo xlt('Sequence'); ?
>
289 <input type
='text' size
='4' name
='form_seq'
290 value
='<?php echo attr($row['grp_seq
']); ?>' />
295 <td valign
='top' width
='1%' nowrap
>
296 <?php
echo xlt('Repeats'); ?
>
299 <input type
='text' size
='4' name
='form_repeats'
300 value
='<?php echo attr($row['grp_repeats
']); ?>' />
307 <td valign
='top' nowrap
>
308 <?php
echo xlt('Layout Columns'); ?
>
311 <select name
='form_columns'>
313 echo "<option value='0'>" . xlt('Default') . "</option>\n";
314 for ($cols = 2; $cols <= 10; ++
$cols) {
315 echo "<option value='" . attr($cols) . "'";
316 if ($cols == $row['grp_columns']) {
319 echo ">" . text($cols) . "</option>\n";
326 <?php
if (empty($group_id)) { ?
>
329 <td valign
='top' nowrap
>
330 <?php
echo xlt('Font Size'); ?
>
333 <select name
='form_size'>
335 echo "<option value='0'>" . xlt('Default') . "</option>\n";
336 for ($size = 5; $size <= 15; ++
$size) {
337 echo "<option value='" . attr($size) . "'";
338 if ($size == $row['grp_size']) {
341 echo ">" . text($size) . "</option>\n";
349 <td valign
='top' nowrap
>
350 <?php
echo xlt('Issue Type'); ?
>
353 <select name
='form_issue'>
354 <option value
=''></option
>
356 $itres = sqlStatement(
357 "SELECT type, singular FROM issue_types " .
358 "WHERE category = ? AND active = 1 ORDER BY singular",
359 array($GLOBALS['ippf_specific'] ?
'ippf_specific' : 'default')
361 while ($itrow = sqlFetchArray($itres)) {
362 echo "<option value='" . attr($itrow['type']) . "'";
363 if ($itrow['type'] == $row['grp_issue_type']) {
366 echo ">" . xlt($itrow['singular']) . "</option>\n";
374 <td valign
='top' nowrap
>
375 <?php
echo xlt('Access Control'); ?
>
378 <select name
='form_aco' style
='width:100%'>
379 <option value
=''></option
>
381 $gacl = new gacl_api();
382 // collect and sort all aco objects
383 $list_aco_objects = $gacl->get_objects(null, 0, 'ACO');
384 ksort($list_aco_objects);
385 foreach ($list_aco_objects as $seckey => $dummy) {
389 asort($list_aco_objects[$seckey]);
390 $aco_section_data = $gacl->get_section_data($seckey, 'ACO');
391 $aco_section_title = $aco_section_data[3];
392 echo " <optgroup label='" . xla($aco_section_title) . "'>\n";
393 foreach ($list_aco_objects[$seckey] as $acokey) {
394 $aco_id = $gacl->get_object_id($seckey, $acokey, 'ACO');
395 $aco_data = $gacl->get_object_data($aco_id, 'ACO');
396 $aco_title = $aco_data[0][3];
397 echo " <option value='" . attr("$seckey|$acokey") . "'";
398 if ("$seckey|$acokey" == $row['grp_aco_spec']) {
401 echo ">" . xlt($aco_title) . "</option>\n";
403 echo " </optgroup>\n";
411 <td valign
='top' width
='1%' nowrap
>
412 <input type
='checkbox' name
='form_services' <?php
echo ($row['grp_services']) ?
"checked" : ""; ?
> />
413 <?php
echo xlt('Show Services Section'); ?
>
416 <input type
='text' size
='40' name
='form_services_codes' onclick
='sel_related(this, "MA")' style
='width:100%'
417 value
='<?php echo ($row['grp_services
'] != '*') ? attr($row['grp_services
']) : ""; ?>' />
422 <td valign
='top' width
='1%' nowrap
>
423 <input type
='checkbox' name
='form_products' <?php
echo ($row['grp_products']) ?
"checked" : ""; ?
> />
424 <?php
echo xlt('Show Products Section'); ?
>
427 <input type
='text' size
='40' name
='form_products_codes' onclick
='sel_related(this, "PROD")' style
='width:100%'
428 value
='<?php echo ($row['grp_products
'] != '*') ? attr($row['grp_products
']) : ""; ?>' />
433 <td valign
='top' width
='1%' nowrap
>
434 <input type
='checkbox' name
='form_diags' <?php
echo ($row['grp_diags']) ?
"checked" : ""; ?
> />
435 <?php
echo xlt('Show Diagnoses Section'); ?
>
438 <input type
='text' size
='40' name
='form_diags_codes' onclick
='sel_related(this, "ICD10")' style
='width:100%'
439 value
='<?php echo ($row['grp_diags
'] != '*') ? attr($row['grp_diags
']) : ""; ?>' />
448 <input type
='submit' name
='form_submit' value
='<?php echo xla('Submit
'); ?>' />
451 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
456 <script language
='JavaScript'>
459 echo " alert(" . js_escape($alertmsg) . ");\n";
460 echo " window.close();\n";