1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
4
|
|
|
// |
5
|
|
|
// eTraxis - Records tracking web-based system |
6
|
|
|
// Copyright (C) 2010-2011 Artem Rodygin |
7
|
|
|
// |
8
|
|
|
// This program is free software: you can redistribute it and/or modify |
9
|
|
|
// it under the terms of the GNU General Public License as published by |
10
|
|
|
// the Free Software Foundation, either version 3 of the License, or |
11
|
|
|
// (at your option) any later version. |
12
|
|
|
// |
13
|
|
|
// This program is distributed in the hope that it will be useful, |
14
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
// GNU General Public License for more details. |
17
|
|
|
// |
18
|
|
|
// You should have received a copy of the GNU General Public License |
19
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
20
|
|
|
// |
21
|
|
|
//------------------------------------------------------------------------------ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @package eTraxis |
25
|
|
|
* @ignore |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
/**#@+ |
29
|
|
|
* Dependency. |
30
|
|
|
*/ |
31
|
|
|
require_once('../engine/engine.php'); |
32
|
|
|
require_once('../dbo/views.php'); |
33
|
|
|
/**#@-*/ |
34
|
|
|
|
35
|
|
|
init_page(LOAD_TAB); |
36
|
|
|
|
37
|
|
|
// check that requested view exists |
38
|
|
|
|
39
|
|
|
$id = ustr2int(try_request('id')); |
40
|
|
|
$view = view_find($id); |
41
|
|
|
|
42
|
|
|
if (!$view) |
|
|
|
|
43
|
|
|
{ |
44
|
|
|
debug_write_log(DEBUG_NOTICE, 'View cannot be found.'); |
45
|
|
|
exit; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
// local JS functions |
49
|
|
|
|
50
|
|
|
$resTitle = ustrprocess(get_js_resource(RES_VIEW_X_ID), ustr2js($view['view_name'])); |
51
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
52
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
53
|
|
|
|
54
|
|
|
$xml = <<<JQUERY |
55
|
|
|
<script> |
56
|
|
|
|
57
|
|
|
function viewModify () |
58
|
|
|
{ |
59
|
|
|
jqModal("{$resTitle}", "modify.php?id={$id}", "{$resOK}", "{$resCancel}", "$('#modifyform').submit()"); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
</script> |
63
|
|
|
JQUERY; |
64
|
|
|
|
65
|
|
|
// generate buttons and generate view information |
66
|
|
|
|
67
|
|
|
$xml .= '<button url="index.php">' . get_html_resource(RES_BACK_ID) . '</button>' |
68
|
|
|
. '<buttonset>' |
69
|
|
|
. '<button action="viewModify()">' . get_html_resource(RES_MODIFY_ID) . '</button>' |
70
|
|
|
. '<button url="delete.php?id=' . $id . '" prompt="' . get_html_resource(RES_CONFIRM_DELETE_VIEWS_ID) . '">' . get_html_resource(RES_DELETE_ID) . '</button>' |
71
|
|
|
. '</buttonset>' |
72
|
|
|
. '<group title="' . get_html_resource(RES_GENERAL_INFO_ID) . '">' |
73
|
|
|
. '<text label="' . get_html_resource(RES_VIEW_NAME_ID) . '">' . ustr2html($view['view_name']) . '</text>' |
74
|
|
|
. '</group>'; |
75
|
|
|
|
76
|
|
|
echo(xml2html($xml)); |
77
|
|
|
|
78
|
|
|
?> |
79
|
|
|
|
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.