
<?php
/**
 * @see Mage_Downloadable_Block_Customer_Products_List
 */
?>

<?php $_items = $this->getItems(); ?>
<div class="page-title">
    <h2><?php echo Mage::helper('downloadable')->__('My Downloadable Products') ?></h2>
</div>
<div class="line"></div>
<div class="dashboard">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php echo $this->getChildHtml('pager'); ?>
<?php if(count($_items)): ?>
    <table class="data-table" id="my-downloadable-products-table">
        <col width="1" />
        <col width="1" />
        <col />
        <col width="1" />
        <col width="1" />
        <thead>
            <tr>
                <th><?php echo Mage::helper('downloadable')->__('Order #') ?></th>
                <th><?php echo Mage::helper('downloadable')->__('Date') ?></th>
                <th><?php echo Mage::helper('downloadable')->__('Title') ?></th>
                <th><?php echo Mage::helper('downloadable')->__('Status') ?></th>
                <th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Remaining Downloads') ?></span></th>
            </tr>
        </thead>
        <tbody>
            <?php $_odd = ''; ?>
            <?php foreach ($_items as $_item): ?>
                <tr>
                    <td><a href="<?php echo $this->getOrderViewUrl($_item->getPurchased()->getOrderId()) ?>" title="<?php echo Mage::helper('downloadable')->__('View Order') ?>"><?php echo $_item->getPurchased()->getOrderIncrementId() ?></a></td>
                    <td><span class="nobr"><?php echo $this->formatDate($_item->getPurchased()->getCreatedAt()) ?></span></td>
                    <td><?php echo $this->escapeHtml($_item->getPurchased()->getProductName()) ?> - <a href="<?php echo $this->getDownloadUrl($_item) ?>" title="<?php echo Mage::helper('downloadable')->__('Start Download') ?>" <?php echo $this->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo $this->escapeHtml($_item->getLinkTitle()); ?></a></td>
                    <td><em><?php echo Mage::helper('downloadable')->__(ucfirst($_item->getStatus())) ?></em></td>
                    <td><?php echo $this->getRemainingDownloads($_item) ?></td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <script type="text/javascript">decorateTable('my-downloadable-products-table')</script>
<?php else: ?>
    <p><?php echo Mage::helper('downloadable')->__('You have not purchased any downloadable products yet.'); ?></p>
<?php endif; ?>
<?php echo $this->getChildHtml('pager'); ?>
<div class="buttons-set">
    <p class="back-link"><a class="button" href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
</div>
</div> <!--dashboard-->