cmc-sales/app/views/elements/product_attachment_table.ctp
2013-03-23 16:25:52 +11:00

60 lines
2 KiB
PHP
Executable file

<?php if (!empty($files)):?>
<table cellpadding = "0" cellspacing = "0" class="filetable">
<tr>
<th><?php __('Date Added'); ?></th>
<th><?php __('Name'); ?></th>
<th><?php __('Type'); ?></th>
<th><?php __('Size'); ?></th>
<th><?php __('Description'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($files as $file):
$class = null;
if ($i % 2 == 0) {
$class = ' class="altrow"';
}
$i++;
?>
<tr<?php echo $class;?>>
<td><?php echo $time->nice($file['ProductAttachment']['created']);?></td>
<td><?php echo $html->link($file['ProductAttachment']['name'], array('controller'=>'product_attachments', 'action' => 'download/', $file['ProductAttachment']['id']));?></td>
<td><?php
if($file['ProductAttachment']['type'] == 'application/pdf') {
echo $html->image('pdf_type.png');
}
else if($file['ProductAttachment']['type'] == 'application/msword') {
echo $html->image('document_type.png');
}
else if($file['ProductAttachment']['type'] == 'message/rfc822') {
echo $html->image('message_type.png');
}
else if($file['ProductAttachment']['type'] == 'application/vnd.ms-excel') {
echo $html->image('spreadsheet_document_type.png');
}
else if($file['EnquiryFile']['type'] == 'image/jpeg') {
echo $html->image('image_type.png');
}
else {
echo $html->image('unknown_type.png');
}
?></td>
<td><?php echo $number->toReadableSize($file['ProductAttachment']['size']);?></td>
<td><?php echo $file['ProductAttachment']['description'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'product_attachments', 'action'=>'download/', $file['ProductAttachment']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Add An Attachment to this Enquiry', true), array('controller'=> 'product_attachments', 'action'=>'add/productid:'.$product['Product']['id']));?> </li>
</ul>
</div>