<?php $__env->startSection('meta-content'); ?>
	<meta name="twitter:card" value="photo"/>
	<meta name="twitter:site" value="<?php echo '@'.$settings->twitter_page_id; ?>"/>
	<meta property="og:type" content="article" />
	<meta property="og:site_name" content="<?php echo $settings->website_name; ?>"/>
	<meta property="og:url" content="<?php echo Request::url(); ?>"/>
	<meta property="og:title" content="<?php echo Lang::get('words.download'); ?> <?php echo $title; ?> <?php echo Lang::get('words.tracks'); ?>"/>
	<meta property="og:description" content="<?php echo Lang::get('words.download'); ?> <?php echo $title; ?> <?php echo Lang::get('words.tracks'); ?>"/>
	<title><?php echo Lang::get('words.download'); ?> <?php echo $title; ?> <?php echo Lang::get('words.tracks'); ?></title>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<?php
	$downloadLink = '';
	if($settings->downloadable) {
		$downloadLink = '<button title="'.Lang::get("words.download").'" class="btn btn-transparent btn-circle track-download"><span class="fa fa-download"></span></button>';
	}
?>

<div class="row">
	<div class="album-header hidden-xs">
		<div class="text-center">
			<?php echo htmlspecialchars_decode($settings->banner_ad); ?>

		</div>
		<?php if($max): ?><h2 style="margin-bottom:0" class="text-muted"><?php echo Lang::get('words.search'); ?> <?php echo $title; ?> (<?php echo $max; ?>)</h2><?php endif; ?>
	</div>
	<div class="table-responsive">
		<table class="table album-tracks">
			<thead>
				<tr>
					<th><?php echo Lang::get('words.title'); ?></th>
					<th class="hidden-480"><?php echo Lang::get('words.duration'); ?></th>
					<th class="text-center"><?php echo Lang::get('words.actions'); ?></th>
				</tr>
			</thead>
			<tbody class="scroll-container">
			<?php foreach($tracks as $track): ?>
				<?php 
				$sharelink = URL::to('track/'.htmlspecialchars($track['title']).'/'.$track['id'].'/'.$track['duration']);
				?>
				<tr class="scroll-items" data-title="<?php echo $track['title']; ?>" data-share="<?php echo $sharelink; ?>" data-trackid="<?php echo $track['id']; ?>">
					<td>
						<button class="btn btn-transparent btn-circle pull-left track-play-list">
							<span class="fa fa-play"></span>
						</button>
						<div class="track-album pull-left" title="<?php echo $track['title']; ?>">
							<a class="tt-title pjax" title="<?php echo $track['title']; ?>" href="<?php echo $sharelink; ?>"><?php echo htmlspecialchars($track['title']); ?></a>
						</div>
						<div class="clearfix"></div>
					</td>
					<td class="hidden-480">
						<?php echo Custom::formatMilliseconds($track['duration']); ?>

					</td>
					<td class="text-center">
						<?php echo $downloadLink; ?>

						<button title="<?php echo Lang::get('words.add-to-playlist'); ?>" class="btn btn-transparent btn-circle" data-toggle="modal" data-target="#track-playlist-modal"><span class="fa fa-plus"></span></button>
						<button title="<?php echo Lang::get('words.share'); ?>" class="btn btn-transparent btn-circle" data-toggle="modal" data-target="#social-share-modal"><span class="fa fa-share-alt"></span></button>
					</td>
				</tr>
			<?php endforeach; ?>
			</tbody>
		</table>
		<?php echo $pagination; ?>

	</div>
</div>

<?php if(!Auth::guest()): ?>

<?php $playlists = Playlist::where('user_id', Auth::user()->id)->select(array('id','title'))->take(50)->get(); ?>
<div class="modal fade" id="track-playlist-modal" tabindex="-1" role="dialog" aria-labelledby="deleteProductModalLabel" aria-hidden="true">
	<div class="modal-dialog">
    	<div class="modal-content">
      		<div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title"><?php echo Lang::get('words.add-to-playlist'); ?></h4>
      		</div>
      		<form id="track-playlist-form" role="form" method="post" action="<?php echo URL::to('user/playlist/track/add'); ?>">
	      		<div class="modal-body">
			    	<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
			    	<input type="hidden" name="trackid" value="">
			    	<input type="hidden" name="ttitle" value="">
		            <div class="funkyradio" style="height:320px; overflow-y:scroll">
		            	<?php foreach($playlists as $i => $playlistm): ?>
		            		<div class="funkyradio-success">
					            <input type="radio" name="playlist" value="<?php echo $playlistm->id; ?>" id="radio<?php echo $i; ?>" />
					            <label for="radio<?php echo $i; ?>"><?php echo $playlistm->title; ?></label>
					        </div>
		            	<?php endforeach; ?>
		            </div>
	      		</div>
	      		<div class="modal-footer">
	        		<input type="submit" class="btn btn-danger btn-block" value="<?php echo Lang::get('words.add-track'); ?>">
	      		</div>
	      	</form>
    	</div>
	</div>
</div>
<?php endif; ?>

<div class="modal fade" id="social-share-modal" tabindex="-1" role="dialog" aria-labelledby="social-share-modalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="social-share-modalLabel"><i class="fa fa-share-alt"></i> <?php echo Lang::get('words.share'); ?></h4>
      </div>
      <div class="modal-body">
    	<div class="ft-social text-center">
			<a target="_blank" title="Share" class="btn btn-circle bg-facebook"><span class="fa fa-facebook"></span></a>
			<a target="_blank" title="Share" class="btn btn-circle bg-twitter"><span class="fa fa-twitter"></span></a>
			<a target="_blank" title="Share" class="btn btn-circle bg-google"><span class="fa fa-google-plus"></span></a>
			<a target="_blank" title="Share" class="btn btn-circle bg-linkedin"><span class="fa fa-linkedin"></span></a>
			<a target="_blank" title="Share" class="btn btn-circle bg-digg"><span class="fa fa-digg"></span></a>
			<a target="_blank" title="Share" class="btn btn-circle bg-stumble"><span class="fa fa-stumbleupon"></span></a>
			<a target="_blank" title="Share" class="btn btn-circle bg-pinterest"><span class="fa fa-pinterest"></span></a>
			<a target="_blank" title="Share" class="btn btn-circle bg-vk"><span class="fa fa-vk"></span></a>
		</div>
      </div>
    </div>
  </div>
</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('index', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>