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

48 lines
1.5 KiB
PHP
Executable file

<?php if (!empty($addresses)):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Address'); ?></th>
<th><?php __('City'); ?></th>
<th><?php __('State'); ?></th>
<th><?php __('Country'); ?></th>
<th><?php __('Type'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($addresses as $address):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $address['PrincipleAddress']['address'];?></td>
<td><?php echo $address['PrincipleAddress']['city'];?></td>
<td><?php echo $address['PrincipleAddress']['state'];?></td>
<td><?php echo $html->link(__($address['Country']['name'], true), array('controller'=>'countries', 'action' => 'view', $address['Country']['id']));?></td>
<td><?php
/* I was told of the evil of switch statements, but it makes sense here. */
switch($address['PrincipleAddress']['type']) {
case 0:
echo "Billing";
break;
case 1:
echo "Shipping";
break;
case 2:
echo "Both Shipping and Billing";
break;
}
?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'principle_addresses', 'action'=>'view', $address['PrincipleAddress']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=> 'principle_addresses', 'action'=>'edit', $address['PrincipleAddress']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>