Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<html>
<head>
<style type="text/css">
@page {
header: html_def;
footer: html_def;
margin: 15mm;
margin-top: 30mm;
margin-bottom: 22mm;
}
.logo {
max-width: 220px;
max-height: 71px;
width: auto;
height: auto;
margin: 0;
}
#ticket_thread .message,
#ticket_thread .response,
#ticket_thread .note {
margin-top:10px;
border:1px solid #aaa;
border-bottom:2px solid #aaa;
}
#ticket_thread .header {
text-align:left;
border-bottom:1px solid #aaa;
padding:3px;
width: 100%;
table-layout: fixed;
}
#ticket_thread .message .header {
background:#C3D9FF;
}
#ticket_thread .response .header {
background:#DDD;
}
#ticket_thread .note .header {
background:#FFE;
}
#ticket_thread .info {
padding:5px;
background: snow;
border-top: 0.3mm solid #ccc;
}
table.meta-data {
width: 100%;
}
table.custom-data {
margin-top: 10px;
}
table.custom-data th {
width: 25%;
}
table.custom-data th,
table.meta-data th {
text-align: right;
background-color: #ddd;
padding: 3px 8px;
}
table.meta-data td {
padding: 3px 8px;
}
.faded {
color:#666;
}
.pull-left {
float: left;
}
.pull-right {
float: right;
}
.flush-right {
text-align: right;
}
.flush-left {
text-align: left;
}
.ltr {
direction: ltr;
unicode-bidi: embed;
}
.headline {
border-bottom: 2px solid black;
font-weight: bold;
}
div.hr {
border-top: 0.2mm solid #bbb;
margin: 0.5mm 0;
font-size: 0.0001em;
}
.thread-entry, .thread-body {
page-break-inside: avoid;
}
<?php include ROOT_DIR . 'css/thread.css'; ?>
</style>
</head>
<body>
<htmlpageheader name="def" style="display:none">
<?php if ($logo = $cfg->getClientLogo()) { ?>
<img src="cid:<?php echo $logo->getKey(); ?>" class="logo"/>
<?php } else { ?>
<img src="<?php echo INCLUDE_DIR . 'fpdf/print-logo.png'; ?>" class="logo"/>
<?php } ?>
<div class="hr"> </div>
<table><tr>
<td class="flush-left"><?php echo (string) $ost->company; ?></td>
<td class="flush-right"><?php echo Format::daydatetime(Misc::gmtime()); ?></td>
</tr></table>
</htmlpageheader>
<htmlpagefooter name="def" style="display:none">
<div class="hr"> </div>
<table width="100%"><tr><td class="flush-left">
Ticket #<?php echo $ticket->getNumber(); ?> printed by
<?php echo $thisclient->getName()->getFirst(); ?> on
<?php echo Format::daydatetime(Misc::gmtime()); ?>
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
</td>
<td class="flush-right">
Page {PAGENO}
</td>
</tr></table>
</htmlpagefooter>
<!-- Ticket metadata -->
<h1>Ticket #<?php echo $ticket->getNumber(); ?></h1>
<table class="meta-data" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th><?php echo __('Status'); ?></th>
<td><?php echo $ticket->getStatus(); ?></td>
<th><?php echo __('Name'); ?></th>
<td><?php echo $ticket->getOwner()->getName(); ?></td>
</tr>
<tr>
<th><?php echo __('Priority'); ?></th>
<td><?php echo $ticket->getPriority(); ?></td>
<th><?php echo __('Email'); ?></th>
<td><?php echo $ticket->getEmail(); ?></td>
</tr>
<tr>
<th><?php echo __('Department'); ?></th>
<td><?php echo $ticket->getDept(); ?></td>
<th><?php echo __('Phone'); ?></th>
<td><?php echo $ticket->getPhoneNumber(); ?></td>
</tr>
<tr>
<th><?php echo __('Create Date'); ?></th>
<td><?php echo Format::datetime($ticket->getCreateDate()); ?></td>
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<th><?php echo __('Source'); ?></th>
<td><?php echo $ticket->getSource(); ?></td>
</tr>
</tbody>
</table>
<!-- Custom Data -->
<?php
foreach (DynamicFormEntry::forTicket($ticket->getId()) as $form) {
// Skip core fields shown earlier in the ticket view
// TODO: Rewrite getAnswers() so that one could write
// ->getAnswers()->filter(not(array('field__name__in'=>
// array('email', ...))));
$answers = array_filter($form->getAnswers(), function ($a) {
return !in_array($a->getField()->get('name'),
array('email','subject','name','priority'))
&& !$a->getField()->get('private');
});
if (count($answers) == 0)
continue;
?>
<table class="custom-data" cellspacing="0" cellpadding="4" width="100%" border="0">
<tr><td colspan="2" class="headline flush-left"><?php echo $form->getTitle(); ?></th></tr>
<?php foreach($answers as $a) {
if (!($v = $a->display())) continue; ?>
<tr>
<th><?php
echo $a->getField()->get('label');
?>:</th>
<td><?php
echo $v;
?></td>
</tr>
<?php } ?>
</table>
<?php
$idx++;
} ?>
<!-- Ticket Thread -->
<h2><?php echo $ticket->getSubject(); ?></h2>
<div id="ticket_thread">
<?php
$types = array('M', 'R');
if ($thread = $ticket->getThreadEntries($types)) {
$threadTypes=array('M'=>'message','R'=>'response', 'N'=>'note');
foreach ($thread as $entry) { ?>
<div class="thread-entry <?php echo $threadTypes[$entry['thread_type']]; ?>">
<table class="header"><tr><td>
<span><?php
echo Format::datetime($entry['created']);?></span>
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<span style="padding:0 1em" class="faded title"><?php
echo Format::truncate($entry['title'], 100); ?></span>
</td>
<td class="flush-right faded title" style="white-space:no-wrap">
<?php
echo Format::htmlchars($entry['name'] ?: $entry['poster']); ?></span>
</td>
</tr></table>
<div class="thread-body">
<div><?php echo $entry['body']->display('pdf'); ?></div>
</div>
<?php
if ($entry['attachments']
&& ($tentry = $ticket->getThreadEntry($entry['id']))
&& ($files = $tentry->getAttachments())) { ?>
<div class="info">
<?php foreach ($files as $F) { ?>
<div>
<span><?php echo $F['name']; ?></span>
<span class="faded">(<?php echo Format::file_size($F['size']); ?>)</span>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<?php }
} ?>
</div>
</body>
</html>