minor changes to prior commit
[openemr.git] / interface / expand_contract_js.php
blobfd7ff49b3ce74d1a7d137b95dff101399997bd24
1 <?php
2 /**
3 * expand contract jquery script
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Ranganath Pathak <pathak@scrs1.org>
8 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
11 // ensure that $user_settings_php_path, $arr_files_php variables are set in the script calling this script
13 $( document ).ready(function() {
14 $('.expand_contract').click(function() {
15 var elementTitle = $(this).prop('title');
16 var contractTitle = '<?php echo xla('Click to Contract and set to henceforth open in Centered mode'); ?>';
17 var expandTitle = '<?php echo xla('Click to Expand and set to henceforth open in Expanded mode'); ?>';
18 var arrFiles = <?php echo json_encode($arr_files_php) ?>;
20 if (elementTitle == contractTitle) {
21 elementTitle = expandTitle;
22 $(this).toggleClass('fa-expand fa-compress');
23 $('.expandable').toggleClass('container container-fluid');
24 if ($(arrFiles).length) {
25 $.each(arrFiles, function (index, value) {
26 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php", { target: arrFiles[index].trim(), setting: 0 });
27 });
29 } else if (elementTitle == expandTitle) {
30 elementTitle = contractTitle;
31 $(this).toggleClass('fa-compress fa-expand');
32 $('.expandable').toggleClass('container-fluid container');
33 if ($(arrFiles).length) {
34 $.each(arrFiles, function (index, value) {
35 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php", { target: arrFiles[index].trim(), setting: 1 });
36 });
39 $(this).prop('title', elementTitle);
40 });
41 });