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
|
|
|
/**#@-*/ |
35
|
|
|
|
36
|
|
|
init_page(LOAD_TAB); |
37
|
|
|
|
38
|
|
|
if (get_user_level() != USER_LEVEL_ADMIN) |
39
|
|
|
{ |
40
|
|
|
debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
41
|
|
|
exit; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
// check that requested project exists |
45
|
|
|
|
46
|
|
|
$id = ustr2int(try_request('id')); |
47
|
|
|
$project = project_find($id); |
48
|
|
|
|
49
|
|
|
if (!$project) |
50
|
|
|
{ |
51
|
|
|
debug_write_log(DEBUG_NOTICE, 'Project cannot be found.'); |
52
|
|
|
exit; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
// local JS functions |
56
|
|
|
|
57
|
|
|
$resTitle = get_js_resource(RES_NEW_TEMPLATE_ID); |
58
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
59
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
60
|
|
|
|
61
|
|
|
$xml = <<<JQUERY |
62
|
|
|
<script> |
63
|
|
|
|
64
|
|
|
function templateCreate () |
65
|
|
|
{ |
66
|
|
|
jqModal("{$resTitle}", "tcreate.php?id={$id}", "{$resOK}", "{$resCancel}", "$('#createform').submit()"); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
</script> |
70
|
|
|
JQUERY; |
71
|
|
|
|
72
|
|
|
// get list of templates |
73
|
|
|
|
74
|
|
|
$sort = $page = NULL; |
75
|
|
|
$list = templates_list($id, $sort, $page); |
76
|
|
|
|
77
|
|
|
$from = $to = 0; |
78
|
|
|
|
79
|
|
|
// generate buttons |
80
|
|
|
|
81
|
|
|
$xml .= (MAX_TEMPLATES_NUMBER == 0 || $list->rows < MAX_TEMPLATES_NUMBER |
|
|
|
|
82
|
|
|
? '<button action="templateCreate()">' |
83
|
|
|
: '<button disabled="true">') |
84
|
|
|
. get_html_resource(RES_CREATE_ID) |
85
|
|
|
. '</button>'; |
86
|
|
|
|
87
|
|
|
// generate list of templates |
88
|
|
|
|
89
|
|
|
if ($list->rows != 0) |
|
|
|
|
90
|
|
|
{ |
91
|
|
|
$columns = array |
92
|
|
|
( |
93
|
|
|
RES_TEMPLATE_NAME_ID, |
94
|
|
|
RES_TEMPLATE_PREFIX_ID, |
95
|
|
|
RES_CRITICAL_AGE_ID, |
96
|
|
|
RES_FROZEN_TIME_ID, |
97
|
|
|
RES_DESCRIPTION_ID, |
98
|
|
|
); |
99
|
|
|
|
100
|
|
|
$bookmarks = gen_xml_bookmarks($page, $list->rows, $from, $to, 'tindex.php?id=' . $id . '&'); |
|
|
|
|
101
|
|
|
|
102
|
|
|
$xml .= '<list>' |
103
|
|
|
. '<hrow>'; |
104
|
|
|
|
105
|
|
View Code Duplication |
for ($i = 1; $i <= count($columns); $i++) |
106
|
|
|
{ |
107
|
|
|
$smode = ($sort == $i ? ($i + count($columns)) : $i); |
108
|
|
|
|
109
|
|
|
$xml .= "<hcell url=\"tindex.php?id={$id}&sort={$smode}\">" |
110
|
|
|
. get_html_resource($columns[$i - 1]) |
111
|
|
|
. '</hcell>'; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
$xml .= '</hrow>'; |
115
|
|
|
|
116
|
|
|
$list->seek($from - 1); |
117
|
|
|
|
118
|
|
|
for ($i = $from; $i <= $to; $i++) |
119
|
|
|
{ |
120
|
|
|
$row = $list->fetch(); |
121
|
|
|
|
122
|
|
|
$color = $row['is_locked'] ? 'red' : NULL; |
123
|
|
|
|
124
|
|
|
$xml .= "<row url=\"tview.php?id={$row['template_id']}\" color=\"{$color}\">" |
125
|
|
|
. '<cell>' . ustr2html($row['template_name']) . '</cell>' |
126
|
|
|
. '<cell>' . ustr2html($row['template_prefix']) . '</cell>' |
127
|
|
|
. '<cell>' . ustr2html($row['critical_age']) . '</cell>' |
128
|
|
|
. '<cell>' . ustr2html($row['frozen_time']) . '</cell>' |
129
|
|
|
. '<cell>' . ustr2html($row['description']) . '</cell>' |
130
|
|
|
. '</row>'; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
$xml .= '</list>' |
134
|
|
|
. $bookmarks; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
echo(xml2html($xml)); |
138
|
|
|
|
139
|
|
|
?> |
140
|
|
|
|
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.