1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
4
|
|
|
// |
5
|
|
|
// eTraxis - Records tracking web-based system |
6
|
|
|
// Copyright (C) 2006-2010 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
|
|
|
// views list is submitted |
38
|
|
|
|
39
|
|
|
if (try_request('submitted') == 'delete') |
40
|
|
|
{ |
41
|
|
|
$views = array(); |
42
|
|
|
|
43
|
|
|
foreach ($_REQUEST as $request) |
44
|
|
|
{ |
45
|
|
|
if (substr($request, 0, 4) == 'view') |
46
|
|
|
{ |
47
|
|
|
array_push($views, intval(substr($request, 4))); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
debug_write_log(DEBUG_NOTICE, 'Delete selected views.'); |
52
|
|
|
views_delete($views); |
53
|
|
|
|
54
|
|
|
exit; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
// get list of views |
58
|
|
|
|
59
|
|
|
$sort = $page = NULL; |
60
|
|
|
$list = views_list($sort, $page); |
61
|
|
|
|
62
|
|
|
$from = $to = 0; |
63
|
|
|
|
64
|
|
|
// local JS functions |
65
|
|
|
|
66
|
|
|
$resTitle = get_js_resource(RES_NEW_VIEW_ID); |
67
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
68
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
69
|
|
|
|
70
|
|
|
$xml = <<<JQUERY |
71
|
|
|
<script> |
72
|
|
|
|
73
|
|
|
function viewCreate () |
74
|
|
|
{ |
75
|
|
|
jqModal("{$resTitle}", "create.php", "{$resOK}", "{$resCancel}", "$('#createform').submit()"); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
function performAction (action) |
79
|
|
|
{ |
80
|
|
|
$("#views :input[name=submitted]").val(action); |
81
|
|
|
$("#views").submit(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
</script> |
85
|
|
|
JQUERY; |
86
|
|
|
|
87
|
|
|
// generate list of views |
88
|
|
|
|
89
|
|
|
$xml .= '<button action="viewCreate()">' . get_html_resource(RES_CREATE_ID) . '</button>'; |
90
|
|
|
|
91
|
|
|
if ($list->rows != 0) |
|
|
|
|
92
|
|
|
{ |
93
|
|
|
$columns = array |
94
|
|
|
( |
95
|
|
|
RES_VIEW_NAME_ID, |
96
|
|
|
); |
97
|
|
|
|
98
|
|
|
$bookmarks = gen_xml_bookmarks($page, $list->rows, $from, $to, 'list.php?'); |
|
|
|
|
99
|
|
|
|
100
|
|
|
$xml .= '<button action="performAction(\\\'delete\\\')" prompt="' . get_js_resource(RES_CONFIRM_DELETE_VIEWS_ID) . '">' . get_html_resource(RES_DELETE_ID) . '</button>' |
101
|
|
|
. '<form name="views" action="list.php" success="reloadTab">' |
102
|
|
|
. '<list>' |
103
|
|
|
. '<hrow>' |
104
|
|
|
. '<hcell checkboxes="true"/>'; |
105
|
|
|
|
106
|
|
View Code Duplication |
for ($i = 1; $i <= count($columns); $i++) |
107
|
|
|
{ |
108
|
|
|
$smode = ($sort == $i ? ($i + count($columns)) : $i); |
109
|
|
|
|
110
|
|
|
$xml .= "<hcell url=\"list.php?sort={$smode}\">" |
111
|
|
|
. get_html_resource($columns[$i - 1]) |
112
|
|
|
. '</hcell>'; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
$xml .= '</hrow>'; |
116
|
|
|
|
117
|
|
|
$list->seek($from - 1); |
118
|
|
|
|
119
|
|
|
for ($i = $from; $i <= $to; $i++) |
120
|
|
|
{ |
121
|
|
|
$row = $list->fetch(); |
122
|
|
|
|
123
|
|
|
$xml .= "<row name=\"view{$row['view_id']}\" url=\"view.php?id={$row['view_id']}\">" |
124
|
|
|
. '<cell>' . ustr2html($row['view_name']) . '</cell>' |
125
|
|
|
. '</row>'; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
$xml .= '</list>' |
129
|
|
|
. '</form>' |
130
|
|
|
. $bookmarks; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
echo(xml2html($xml)); |
134
|
|
|
|
135
|
|
|
?> |
|
|
|
|
136
|
|
|
|
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.