cmc-sales/views/elements/email_attachments.ctp
Karl Cordes 4347aee5f0 Changes
2009-11-04 17:12:12 +11:00

58 lines
1.6 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['EmailAttachment']['name'];?></td>
<td>
<? if($emailAttachment['EmailAttachment']['type'] == 'application/pdf') {
echo $html->image('pdf_type.png');
}
else if($emailAttachment['EmailAttachment']['type'] == 'application/msword') {
echo $html->image('document_type.png');
}
else if($emailAttachment['EmailAttachment']['type'] == 'application/vnd.ms-excel') {
echo $html->image('spreadsheet_document_type.png');
}
else if($emailAttachment['EmailAttachment']['type'] == 'image/jpeg') {
echo $html->image('image_type.png');
}
else if($emailAttachment['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['EmailAttachment']['size']);?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'download', $emailAttachment['EmailAttachment']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>