1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
4
|
|
|
// |
5
|
|
|
// eTraxis - Records tracking web-based system |
6
|
|
|
// Copyright (C) 2005-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/projects.php'); |
33
|
|
|
require_once('../dbo/templates.php'); |
34
|
|
|
require_once('../dbo/states.php'); |
35
|
|
|
/**#@-*/ |
36
|
|
|
|
37
|
|
|
global $state_type_res; |
38
|
|
|
global $state_responsible_res; |
39
|
|
|
|
40
|
|
|
init_page(LOAD_TAB); |
41
|
|
|
|
42
|
|
|
if (get_user_level() != USER_LEVEL_ADMIN) |
43
|
|
|
{ |
44
|
|
|
debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
45
|
|
|
exit; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
// check that requested template exists |
49
|
|
|
|
50
|
|
|
$id = ustr2int(try_request('id')); |
51
|
|
|
$template = template_find($id); |
52
|
|
|
|
53
|
|
|
if (!$template) |
54
|
|
|
{ |
55
|
|
|
debug_write_log(DEBUG_NOTICE, 'Template cannot be found.'); |
56
|
|
|
exit; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
// local JS functions |
60
|
|
|
|
61
|
|
|
$resTitle = get_js_resource(RES_NEW_STATE_ID); |
62
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
63
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
64
|
|
|
|
65
|
|
|
$xml = <<<JQUERY |
66
|
|
|
<script> |
67
|
|
|
|
68
|
|
|
function stateCreate (final) |
69
|
|
|
{ |
70
|
|
|
jqModal("{$resTitle}", "screate.php?id={$id}&final=" + final, "{$resOK}", "{$resCancel}", "$('#createform').submit()"); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
</script> |
74
|
|
|
JQUERY; |
75
|
|
|
|
76
|
|
|
// get list of states |
77
|
|
|
|
78
|
|
|
$sort = $page = NULL; |
79
|
|
|
$list = states_list($id, $sort, $page); |
80
|
|
|
|
81
|
|
|
$from = $to = 0; |
82
|
|
|
|
83
|
|
|
// generate buttons |
84
|
|
|
|
85
|
|
|
$xml .= '<buttonset>'; |
86
|
|
|
|
87
|
|
|
$xml .= ($template['is_locked'] |
88
|
|
|
? '<button action="stateCreate(0)">' |
89
|
|
|
: '<button disabled="true">') |
90
|
|
|
. get_html_resource(RES_CREATE_INTERMEDIATE_ID) |
91
|
|
|
. '</button>'; |
92
|
|
|
|
93
|
|
|
$xml .= ($template['is_locked'] |
94
|
|
|
? '<button action="stateCreate(1)">' |
95
|
|
|
: '<button disabled="true">') |
96
|
|
|
. get_html_resource(RES_CREATE_FINAL_ID) |
97
|
|
|
. '</button>'; |
98
|
|
|
|
99
|
|
|
$xml .= '</buttonset>'; |
100
|
|
|
|
101
|
|
|
// generate list of states |
102
|
|
|
|
103
|
|
|
if ($list->rows != 0) |
|
|
|
|
104
|
|
|
{ |
105
|
|
|
$columns = array |
106
|
|
|
( |
107
|
|
|
RES_STATE_NAME_ID, |
108
|
|
|
RES_STATE_ABBR_ID, |
109
|
|
|
RES_STATE_TYPE_ID, |
110
|
|
|
RES_RESPONSIBLE_ID, |
111
|
|
|
RES_NEXT_STATE_BY_DEFAULT_ID, |
112
|
|
|
); |
113
|
|
|
|
114
|
|
|
$bookmarks = gen_xml_bookmarks($page, $list->rows, $from, $to, 'sindex.php?id=' . $id . '&'); |
|
|
|
|
115
|
|
|
|
116
|
|
|
$xml .= '<list>' |
117
|
|
|
. '<hrow>'; |
118
|
|
|
|
119
|
|
View Code Duplication |
for ($i = 1; $i <= count($columns); $i++) |
120
|
|
|
{ |
121
|
|
|
$smode = ($sort == $i ? ($i + count($columns)) : $i); |
122
|
|
|
|
123
|
|
|
$xml .= "<hcell url=\"sindex.php?id={$id}&sort={$smode}\">" |
124
|
|
|
. get_html_resource($columns[$i - 1]) |
125
|
|
|
. '</hcell>'; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
$xml .= '</hrow>'; |
129
|
|
|
|
130
|
|
|
$list->seek($from - 1); |
131
|
|
|
|
132
|
|
|
for ($i = $from; $i <= $to; $i++) |
133
|
|
|
{ |
134
|
|
|
$row = $list->fetch(); |
135
|
|
|
|
136
|
|
|
$xml .= "<row url=\"sview.php?id={$row['state_id']}\">" |
137
|
|
|
. '<cell>' . ustr2html($row['state_name']) . '</cell>' |
138
|
|
|
. '<cell>' . ustr2html($row['state_abbr']) . '</cell>' |
139
|
|
|
. '<cell>' . get_html_resource($state_type_res[$row['state_type']]) . '</cell>' |
140
|
|
|
. '<cell>' . get_html_resource($state_responsible_res[$row['responsible']]) . '</cell>' |
141
|
|
|
. '<cell>' . (is_null($row['next_state']) ? sprintf('<i>%s</i>', get_html_resource(RES_NONE_ID)) : ustr2html($row['next_state'])) . '</cell>' |
142
|
|
|
. '</row>'; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
$xml .= '</list>' |
146
|
|
|
. $bookmarks; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
echo(xml2html($xml)); |
150
|
|
|
|
151
|
|
|
?> |
152
|
|
|
|
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.