73 lines
2.1 KiB
PHP
Executable file
73 lines
2.1 KiB
PHP
Executable file
<div class="related">
|
|
<h3><?php __('Attachments in this Email');?></h3>
|
|
<?php if (!empty($attachments)):?>
|
|
<table cellpadding = "0" cellspacing = "0">
|
|
<tr>
|
|
|
|
<th><?php __('Name'); ?></th>
|
|
<th><?php __('Type'); ?></th>
|
|
<th><?php __('Size'); ?></th>
|
|
<th class="actions"><?php __('Actions');?></th>
|
|
</tr>
|
|
<?php
|
|
$i = 0;
|
|
foreach ($attachments as $emailAttachment):
|
|
$class = null;
|
|
if ($i++ % 2 == 0) {
|
|
$class = ' class="altrow"';
|
|
}
|
|
?>
|
|
<tr<?php echo $class;?>>
|
|
|
|
<td><?php echo $emailAttachment['filename'];?></td>
|
|
<td>
|
|
<? if($emailAttachment['type'] == 'application/pdf') {
|
|
echo $html->image('pdf_type.png');
|
|
}
|
|
else if($emailAttachment['type'] == 'application/msword') {
|
|
echo $html->image('document_type.png', array('alt'=>'application/msword'));
|
|
}
|
|
else if($emailAttachment['type'] == 'application/vnd.ms-excel') {
|
|
echo $html->image('spreadsheet_document_type.png');
|
|
}
|
|
else if($emailAttachment['type'] == 'image/jpeg') {
|
|
echo $html->image('image_type.png');
|
|
}
|
|
else if($emailAttachment['type'] == 'text/plain') {
|
|
echo $html->image('text-x-generic.png');
|
|
}
|
|
else {
|
|
echo $html->image('unknown_type.png');
|
|
}
|
|
?>
|
|
|
|
</td>
|
|
<td><?php echo $number->toReadableSize($emailAttachment['size']);?></td>
|
|
|
|
|
|
<td class="actions">
|
|
<?php // echo $html->link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'download', $emailAttachment['id'])); ?>
|
|
|
|
|
|
<?php
|
|
//Allowed types to view in the browser.
|
|
|
|
$allowedTypes['text/plain'] = 1;
|
|
$allowedTypes['text/html'] = 1;
|
|
$thisType = $emailAttachment['type'];
|
|
if(isset($allowedTypes[$thisType])) {
|
|
echo "<button class=\"viewButton\" id=\"{$emailAttachment['id']}\">View</button>";
|
|
}
|
|
else {
|
|
echo "<button class=\"downloadButton\" id=\"{$emailAttachment['id']}\">Download</button>";
|
|
//echo $html->link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'download', $emailAttachment['id']));
|
|
} ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|