<?php
/**
 * Copyright © 2015 tokitheme.com. All rights reserved.

 * @author Blue Sky Team <contact@tokitheme.com>
 */
 
	if($this->getConfig('customers_submit'))
	{
		if($this->getConfig('allow_guest'))
			$urlsubmit = $this->getUrl('testimonial/form');
		else{
			if($this->checklogin())
				$urlsubmit = $this->getUrl('testimonial/form');
			else
				$urlsubmit = $this->getUrl('customer/account/login');
		}
		$show_submit = true;
	}else{
		$show_submit = false;
	}	
?>
<?php  
$mediaUrl = $this->getMediabaseUrl();
$_testimonialrecords = $this->getCollection(); 
if($_testimonialrecords && count($_testimonialrecords))
{
?>
<div class="pt-testimonial-item">
   <ul class="testimonial-item">
	<?php
		foreach ($_testimonialrecords as $tetimonial) 
		{
	?>
			<li>

				<div class="testimonial-image pull-left">
					<?php $path = $tetimonial->getData('avatar'); ?>
					<img src="<?php echo $mediaUrl . $tetimonial->getData('avatar');?>" alt="<?php echo __($tetimonial->getData('name')); ?>" />
				</div>
				<div class="media-body">
					<h3 class="testimonial-name"><?php echo __($tetimonial->getData('name')); ?></h3>
					<div class="testimonial-job"><?php echo __($tetimonial->getData('job')); ?></div>
					<div class="testimonial-created-time"><?php echo __(date('F d, Y', strtotime($tetimonial['created_time']))); ?></div>
					<div class="testimonial-website"><?php echo __($tetimonial->getData('website')); ?></div>
					<div class="testimonial-address"><?php echo __($tetimonial->getData('address')); ?></div>
					<div class="testimonial-testimonial"><?php echo __($tetimonial->getData('testimonial')); ?></div>
				</div>
			</li>
		
	<?php
		}
	?>
	</ul>
	<?php 
}
?>
</div>
<?php if($show_submit): ?>
	<div class="add-more-testimonial">
		<a class="action submit primary" data-toggle="modal" href="<?php echo $urlsubmit; ?>">
			<span><?php echo __('Add New Testimonial') ?></span>
		</a>
	</div>
<?php  endif;?>
<?php if ($block->getPagerHtml()): ?>
        <div class="order-products-toolbar toolbar bottom"><?php echo $block->getPagerHtml(); ?></div>
<?php endif ?>