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/records.php'); |
33
|
|
|
/**#@-*/ |
34
|
|
|
|
35
|
|
|
init_page(LOAD_CONTAINER, GUEST_IS_ALLOWED); |
36
|
|
|
|
37
|
|
|
// check that requested record exists |
38
|
|
|
|
39
|
|
|
$id = ustr2int(try_request('id')); |
40
|
|
|
$record = record_find($id); |
41
|
|
|
|
42
|
|
|
if (!$record) |
43
|
|
|
{ |
44
|
|
|
debug_write_log(DEBUG_NOTICE, 'Record cannot be found.'); |
45
|
|
|
header('Location: index.php'); |
46
|
|
|
exit; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
// get current user's permissions and verify them |
50
|
|
|
|
51
|
|
|
$permissions = record_get_permissions($record['template_id'], $record['creator_id'], $record['responsible_id']); |
52
|
|
|
|
53
|
|
View Code Duplication |
if (!can_record_be_displayed($permissions)) |
54
|
|
|
{ |
55
|
|
|
if (get_user_level() == USER_LEVEL_GUEST) |
56
|
|
|
{ |
57
|
|
|
debug_write_log(DEBUG_NOTICE, 'Guest must be logged in.'); |
58
|
|
|
save_cookie(COOKIE_URI, $_SERVER['REQUEST_URI']); |
59
|
|
|
header('Location: ../logon/index.php'); |
60
|
|
|
exit; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
debug_write_log(DEBUG_NOTICE, 'Record cannot be displayed.'); |
64
|
|
|
header('Location: index.php'); |
65
|
|
|
exit; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
// page's title |
69
|
|
|
|
70
|
|
|
$title = ustrprocess(get_html_resource(RES_RECORD_X_ID), record_id($id, $record['template_prefix'])); |
71
|
|
|
|
72
|
|
|
// count some of records data |
73
|
|
|
|
74
|
|
|
$rs = dal_query('comments/list.sql', $record['record_id'], ($permissions & PERMIT_CONFIDENTIAL_COMMENTS) ? EVENT_CONFIDENTIAL_COMMENT : EVENT_UNUSED); |
75
|
|
|
$comments = $rs->rows; |
|
|
|
|
76
|
|
|
|
77
|
|
|
$rs = dal_query('attachs/list.sql', $record['record_id'], 'attachment_id'); |
78
|
|
|
$attachments = $rs->rows; |
|
|
|
|
79
|
|
|
|
80
|
|
|
$rs = dal_query('depends/parents.sql', $record['record_id']); |
81
|
|
|
$parents = $rs->rows; |
|
|
|
|
82
|
|
|
|
83
|
|
|
$rs = dal_query('depends/list.sql', $record['record_id']); |
84
|
|
|
$subrecords = $rs->rows; |
|
|
|
|
85
|
|
|
|
86
|
|
|
// generate breadcrumbs and tabs |
87
|
|
|
|
88
|
|
|
$resSearch = $_SESSION[VAR_SEARCH_MODE] |
89
|
|
|
? ustr2html($_SESSION[VAR_SEARCH_TEXT]) |
90
|
|
|
: get_html_resource(RES_SEARCH_ID); |
91
|
|
|
|
92
|
|
|
$xml = '<onready>' |
93
|
|
|
. '$(".search").val("' . $resSearch . '");' |
94
|
|
|
. '</onready>' |
95
|
|
|
. '<breadcrumbs>' |
96
|
|
|
. '<breadcrumb url="index.php">' . get_html_resource(RES_RECORDS_ID) . '</breadcrumb>' |
97
|
|
|
. '<breadcrumb url="view.php?id=' . $id . '">' . $title . '</breadcrumb>' |
98
|
|
|
. '</breadcrumbs>' |
99
|
|
|
. '<tabs>' |
100
|
|
|
. '<tab url="record.php?id=' . $record['record_id'] . '">' . record_id($record['record_id'], $record['template_prefix']) . '</tab>' |
101
|
|
|
. '<tab url="history.php?id=' . $record['record_id'] . '">' . get_html_resource(RES_HISTORY_ID) . '</tab>' |
102
|
|
|
. '<tab url="changes.php?id=' . $record['record_id'] . '">' . get_html_resource(RES_CHANGES_ID) . '</tab>' |
103
|
|
|
. '<tab url="fields.php?id=' . $record['record_id'] . '">' . get_html_resource(RES_FIELDS_ID) . '</tab>' |
104
|
|
|
. '<tab url="comments.php?id=' . $record['record_id'] . '">' . sprintf('%s (%u)', get_html_resource(RES_COMMENTS_ID), $comments) . '</tab>' |
105
|
|
|
. '<tab url="attachments.php?id=' . $record['record_id'] . '">' . sprintf('%s (%u)', get_html_resource(RES_ATTACHMENTS_ID), $attachments) . '</tab>' |
106
|
|
|
. '<tab url="parents.php?id=' . $record['record_id'] . '">' . sprintf('%s (%u)', get_html_resource(RES_PARENT_RECORDS_ID), $parents) . '</tab>' |
107
|
|
|
. '<tab url="subrecords.php?id=' . $record['record_id'] . '">' . sprintf('%s (%u)', get_html_resource(RES_SUBRECORDS_ID), $subrecords) . '</tab>' |
108
|
|
|
. '</tabs>'; |
109
|
|
|
|
110
|
|
|
echo(xml2html($xml, $title)); |
111
|
|
|
|
112
|
|
|
?> |
113
|
|
|
|
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.