This repository has been archived by the owner on Oct 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprint_settings.php
executable file
·92 lines (79 loc) · 3.26 KB
/
print_settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
*
* Copyright (C) 2007,2008 Arie Nugraha (dicarve@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/* Global application configuration */
// key to authenticate
define('INDEX_AUTH', '1');
// key to get full database access
define('DB_ACCESS', 'fa');
if (!defined('SB')) {
// main system configuration
require '../../../../sysconfig.inc.php';
// start the session
require SB.'admin/default/session.inc.php';
}
// IP based access limitation
require LIB.'ip_based_access.inc.php';
do_checkIP('smc');
do_checkIP('smc-bibliography');
require SB.'admin/default/session_check.inc.php';
require SIMBIO.'simbio_FILE/simbio_directory.inc.php';
require SIMBIO.'simbio_GUI/form_maker/simbio_form_table_AJAX.inc.php';
require SIMBIO.'simbio_GUI/table/simbio_table.inc.php';
require SIMBIO.'simbio_DB/simbio_dbop.inc.php';
if (isset($_POST['updateSettings'])) {
$setting_type = trim($_POST['settingType']);
$setting_name = $setting_type.'_print_settings';
// reset
$dbs->query(sprintf("REPLACE INTO setting (setting_name, setting_value) VALUES ('%s', '%s')",
$setting_name, $dbs->escape_string(serialize($_POST[$setting_type]))));
// write log
utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'system', $_SESSION['realname'].' change '.$setting_type.' print settings');
utility::jsAlert(__('Settings saved'));
echo '<script type="text/javascript"></script>';
}
/* Config Vars update process end */
$type = 'barcode';
if (isset($_GET['type'])) {
$type = trim($_GET['type']);
}
if (!in_array($type, array('freeloan'))) {
$type = 'barcode';
}
// include printed settings configuration file
include MDLBS.'membership/fll/printed_settings.inc.php';
// create form instance
$form = new simbio_form_table_AJAX('mainForm', $_SERVER['PHP_SELF'], 'post');
$form->submit_button_attr = 'name="updateSettings" value="'.__('Save Settings').'" class="btn btn-primary"';
// form table attributes
$form->table_attr = 'align="center" id="dataList" cellpadding="5" cellspacing="0"';
$form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
$form->table_content_attr = 'class="alterCell2"';
// load print settings from database
loadPrintSettings($dbs, $type);
$form->addAnything(__('Print setting for'), ucwords($type));
foreach ($sysconf['print'][$type] as $setting_name => $val) {
$setting_name_label = ucwords(str_ireplace('_', ' ', $setting_name));
$form->addTextField('text', $type.'['.$setting_name.']', __($setting_name_label), $val, 'style="width: 90%;"');
}
$form->addHidden('settingType', $type);
// print out the object
echo $form->printOut();
/* main content end */