1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
4
|
|
|
// |
5
|
|
|
// eTraxis - Records tracking web-based system |
6
|
|
|
// Copyright (C) 2005-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/projects.php'); |
33
|
|
|
/**#@-*/ |
34
|
|
|
|
35
|
|
|
init_page(LOAD_TAB, GUEST_IS_ALLOWED); |
|
|
|
|
36
|
|
|
|
37
|
|
|
// local JS functions |
38
|
|
|
|
39
|
|
|
$resTitle = get_js_resource(RES_NEW_PROJECT_ID); |
40
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
41
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
42
|
|
|
|
43
|
|
|
$xml = <<<JQUERY |
44
|
|
|
<script> |
45
|
|
|
|
46
|
|
|
function projectCreate () |
47
|
|
|
{ |
48
|
|
|
jqModal("{$resTitle}", "create.php", "{$resOK}", "{$resCancel}", "$('#createform').submit()"); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
</script> |
52
|
|
|
JQUERY; |
53
|
|
|
|
54
|
|
|
// get list of projects |
55
|
|
|
|
56
|
|
|
$sort = $page = NULL; |
57
|
|
|
$list = projects_list($sort, $page); |
58
|
|
|
|
59
|
|
|
$from = $to = 0; |
60
|
|
|
|
61
|
|
|
// generate buttons |
62
|
|
|
|
63
|
|
|
if (get_user_level() == USER_LEVEL_ADMIN) |
64
|
|
|
{ |
65
|
|
|
$xml .= '<button action="projectCreate()">' . get_html_resource(RES_CREATE_ID) . '</button>'; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
// generate list of projects |
69
|
|
|
|
70
|
|
|
if ($list->rows != 0) |
|
|
|
|
71
|
|
|
{ |
72
|
|
|
$columns = array |
73
|
|
|
( |
74
|
|
|
RES_PROJECT_NAME_ID, |
75
|
|
|
RES_START_TIME_ID, |
76
|
|
|
RES_DESCRIPTION_ID, |
77
|
|
|
); |
78
|
|
|
|
79
|
|
|
$bookmarks = gen_xml_bookmarks($page, $list->rows, $from, $to, 'list.php?'); |
|
|
|
|
80
|
|
|
|
81
|
|
|
$xml .= '<list>' |
82
|
|
|
. '<hrow>'; |
83
|
|
|
|
84
|
|
View Code Duplication |
for ($i = 1; $i <= count($columns); $i++) |
|
|
|
|
85
|
|
|
{ |
86
|
|
|
$smode = ($sort == $i ? ($i + count($columns)) : $i); |
87
|
|
|
|
88
|
|
|
$xml .= "<hcell url=\"list.php?sort={$smode}\">" |
89
|
|
|
. get_html_resource($columns[$i - 1]) |
90
|
|
|
. '</hcell>'; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
$xml .= '</hrow>'; |
94
|
|
|
|
95
|
|
|
$list->seek($from - 1); |
96
|
|
|
|
97
|
|
|
for ($i = $from; $i <= $to; $i++) |
98
|
|
|
{ |
99
|
|
|
$row = $list->fetch(); |
100
|
|
|
|
101
|
|
|
if ($row['is_suspended']) |
102
|
|
|
{ |
103
|
|
|
$color = 'grey'; |
104
|
|
|
} |
105
|
|
|
else |
106
|
|
|
{ |
107
|
|
|
$color = NULL; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
$xml .= "<row url=\"view.php?id={$row['project_id']}\" color=\"{$color}\">" |
111
|
|
|
. '<cell>' . ustr2html($row['project_name']) . '</cell>' |
112
|
|
|
. '<cell>' . get_date($row['start_time']) . '</cell>' |
113
|
|
|
. '<cell>' . ustr2html($row['description']) . '</cell>' |
114
|
|
|
. '</row>'; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
$xml .= '</list>' |
118
|
|
|
. $bookmarks; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
echo(xml2html($xml)); |
122
|
|
|
|
123
|
|
|
?> |
124
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: