<?php
/**
 * Avalanche for Magento 1.8+
 * Designed by Fast Division (http://fastdivision.com)
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file license.txt.
 * It is also available through the world-wide-web at this URL:
 * http://fastdivision.com/legal/license.txt
 *
 * @author     Fast Division
 * @version    1.5.0
 * @copyright  Copyright 2013 Fast Division
 * @license    http://fastdivision.com/legal/license.txt
 */
?>
<?php if($this->getProductData()->getId()): ?>
<div class="product-review">
	<h1><?php echo $this->__('Review Details') ?></h1>
	<h2 style="margin: 0; background: none; color: #333">
		<?php echo $this->escapeHtml($this->getProductData()->getName()) ?>
	</h2>
	<div id="review-summary" class="white-box-inner">
		<?php echo $this->getReviewsSummaryHtml($this->getProductData()) ?><br>
	</div>

	<?php if( $this->getRating() && $this->getRating()->getSize()): ?>
		<h3><?php echo ($this->isReviewOwner()) ? $this->__('Your Rating') : $this->__('Rating:'); ?></h3>
		<div class="white-box-inner">
			<table><tr><td style="width: 140px">
				<a href="<?php echo $this->getProductData()->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductData()->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($this->getProductData(), 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->escapeHtml($this->getProductData()->getName()) ?>" /></a>
			</td><td style="vertical-align: middle">
	       	 <table class="ratings-table">
		        <?php foreach ($this->getRating() as $_rating): ?>
		        <?php if($_rating->getPercent()): ?>
		            <tr>
		                <th class="a-left" style="padding-right:10px"><?php echo $this->escapeHtml($_rating->getRatingCode()) ?></th>
		                <td class="a-right" style="padding-top:2px">
		                    <div class="rating-box">
		                    	<span class="stars rating<?php echo round(ceil($_rating->getPercent()) / 20) ?>" title="<?php echo round(ceil($_rating->getPercent()) / 20) ?>"></span>
		                    </div>
		                </td>
		            </tr>
		        <?php endif; ?>
		        <?php endforeach; ?>
		        </table><br>
			</td></tr></table>
		</div>
	<?php endif; ?>
	
	<h3><?php if ($this->isReviewOwner()): ?>
        <?php echo $this->__('Your Review - %s', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
    <?php else :?>
        <?php echo $this->__('Review - %s', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
    <?php endif;?></h3>
	<div class="white-box-inner">
	 	<p><?php echo nl2br($this->escapeHtml($this->getReviewData()->getDetail())) ?></p>
	</div>
	
	<div class="box-action">
        <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to My Reviews') ?></a></p>
    </div>
</div>
<?php endif; ?>
