<?php
/**
 * @package     SP Soccer
 * @author      JoomShaper http://www.joomshaper.com
 * @copyright   Copyright (C) 2010 - 2016 JoomShaper. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die('Restricted access');

?>
<div id="spsoccer" class="spsoccer view-spsoccer-tournament">
	<div class="spsoccer-tournament">

		<div class="spsoccer-container">

			<div class="spsoccer-row-fluid">
				<div class="torunament-info">
					<div class="tournament-header">
						<h2 class="soccer-title"><?php echo $this->item->title; ?></h2>
					</div>
				</div> <!-- /.spsoccer-col-lg -->
			</div> <!-- /.spsoccer-row -->

		  	<div id="tournament-fixture">
		  		<!-- has Sessions -->
				<?php if(!empty($this->sessions)) {?>

					<?php
						foreach ($this->sessions as $session) {
						// has session matches
						if (!empty($session->session_matches)) {
					?>
					<div class="spsoccer-fixture-wrapper">
						<h3 class="text-center title"><span><?php echo $session->title; ?></span></h3>

						<?php foreach ($session->session_matches as $session_match) {
							$session_match->team_one_info->logo = SpsoccerHelper::hasImg($session_match->team_one_info->logo);
							$session_match->team_two_info->logo = SpsoccerHelper::hasImg($session_match->team_two_info->logo);

						?>

							<!-- START:: fixture -->
							<div class="item-list-wrap">

								<div class="spsoccer-col-lg-4 spsoccer-col-md-4 spsoccer-col-sm-12 text-left">
									<img class="spsoccer-img-thumbnail spsoccer-img-responsive" src="<?php echo $session_match->team_one_info->logo; ?>" alt="<?php echo $session_match->team_one_info->title; ?>">
									<a href="<?php echo $session_match->team_one_url; ?>">
										<span class="spsoccer-team-name"><?php echo $session_match->team_one_info->title; ?></span>
									</a>
								</div> <!-- /.spsoccer-col-lg -->

								<div class="spsoccer-col-lg-4 spsoccer-col-md-4 spsoccer-col-sm-12 text-center">
									<div class="spsoccer-match-date-time">
										<span><?php echo $session_match->match_date; ?></span>,
										<span><?php echo $session_match->match_time; ?></span>
									</div>
									<p class="spsoccer-match-location">
										<a href="<?php echo $session_match->location_url ?>">
											<?php echo $session_match->match_location->title; ?>
										</a>
									</p>
								</div><!-- /.spsoccer-col-lg -->

								<div class="spsoccer-col-lg-4 spsoccer-col-md-4 spsoccer-col-sm-12 text-right">
									<a href="<?php echo $session_match->team_two_url; ?>">
										<span class="spsoccer-team-name"><?php echo $session_match->team_two_info->title; ?></span>
									</a>
									<img class="spsoccer-img-thumbnail spsoccer-img-responsive" src="<?php echo $session_match->team_two_info->logo; ?>" alt="<?php echo $session_match->team_two_info->title; ?>">
								</div><!-- /.spsoccer-col-lg -->

							</div>
							<!-- /.spsoccer-row -->

							<?php //print_r($session_match); ?>

						<?php } // END:: forech $session_matches ?>
					</div> <!-- ./spsoccer-group-wrapper -->
					<?php } // END:: has session match  ?>
					<?php } // END:: forech $this->sessions  ?>
				<?php } // END:: !empty sessions ?>

		  	</div> <!-- /.tournament-fixture -->

		</div> <!-- /. spsoccer-container -->

	</div> <!-- /.spsoccer-tournament -->
</div> <!-- /#spsoccer .spsoccer -->
