<script>
	fbq('track', 'Search');
</script>
<body class="videoListingBody">
	<main>
		<div class="container-fluid">
			<?php include(VIEWPATH . "includes/top-bar.php"); ?>
			<div class='container explore-again-container'>
				<a class='explore-again-btn' href='<?php echo base_url(); ?>category-select'><i class="fa fa-angle-left" aria-hidden="true"></i>Explore Again</a>
			</div>
			<?php
			if(!empty($videos)){
				?>
				<div class="videoListing-firstContainer">
					<div class="container-fluid">
						<div class="row">
							<div class="col-md-2 sidebar-wrapper">
							</div>
							<div class="col-md-8">
								<div class="row">
									<div class="col-md-10">
										<h6 class="videoListing-titleText">How about these<?php
										if (!empty($category)) {
											echo " <b>{$category['title']}</b> ";
										}
										?>jobs?</h6>
									</div>
									<div class="col-md-2 pull-right">
										<div class='play-all-button'>
											<i class="fa fa-play" aria-hidden="true"></i>Play All
										</div>
									</div>
								</div>
								<!--<div class="row">
								<div class="col-md-10 videoListing-navbar">
								<div class="inside">
								<ul class="nav navbar-nav">
								<?php
								foreach ($categories as $category) {
									if($category['category_count'] > 0){
										?>
										<li class="videoListing-navbarTags">
										<a href="#">
										<div>
										<?php echo $category['title']; ?>
										<span class="noti">
										<?php echo $category['category_count']; ?>
										</span>
										</div>
										</a>
										</li>
										<?php
									}
								}
								?>
								</ul>
								</div>
								</div>
								<div class="col-md-2 videoListing-navbar">
								<a href="category-select" class='try-button pull-right'>Explore Again</a>
								</div>
								</div>-->
								<div class="row videoTemplate-videosRows videoListing-videoTemplateRows">
									<?php
									foreach ($videos as $video) {
										?>
										<div class="col-xs-6  col-md-4 videoTemplate-videosWrapper videoListing-videoTemplateWrapper">
											<a href="<?php echo base_url(); ?>video-playing/<?php echo $video['id']; ?>/<?= $video['seo-title'];?>">
												<div class="videoTemplate-videos" style="--background-image: url(https://img.youtube.com/vi/<?php echo $video['youtube_id']; ?>/mqdefault.jpg);">
													<img src="https://img.youtube.com/vi/<?php echo $video['youtube_id']; ?>/mqdefault.jpg" />
													<div class="videoTemplate-videosTags">
														<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
														<!-- <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> -->
														WATCHED
													</div>
													<img class="videoTemplate-videosPlay" src="img/play.png" width="38" height="37">
													<div class="videoTemplate-videosDescription">
														<?php
														$title = ( strlen($video['title']) > 25 ) ? substr($video['title'],0,25) . "..." : $video['title'];
														echo $title;
														?>
													</div>
													<div class="videoTemplate-videosTime"><?php echo $video['duration']; ?></div>
												</div>
											</a>
										</div>
										<?php
									}
									?>

								</div>
								<!-- <div class="row videoTemplate-videosRows">
								</div> -->
							</div>
						</div>
					</div>
				</div>
				<?php
			}else{
				?>
				<div class="videoListing-firstContainer">
					<div class="container-fluid">
						<div class="row">
							<div class="col-md-2 sidebar-wrapper">
							</div>
							<div class="col-md-8">
								<div class="row">
									<p class="videoListing-noResultsFoundCursive">
										Oh no!
									</p>
									<p class="videoListing-noResultsFoundText">
										No results found
										<span class="videoListing-noResultsFoundCategoriesSelected">
											<?php
											//                                    echo implode(",",array_map(function($item){
											//                                        return $item['title'];
											//                                    },$categories));
											?>
										</span>
									</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				<?php
			}
			?>


			<div class="videoListing-secondContainer">
				<div class="container-fluid">
					<div class="row">
						<div class="col-md-offset-2 col-md-8">
							<?php
							if(!empty($custom_sliders)){
								foreach ($custom_sliders as $slider_title => $slider_videos) {
									?>
									<div class="row">
										<div class="col-md-10">
											<h6 class="videoListing-titleText"><?php echo $slider_title;?></h6>
										</div>
										<div class="col-md-2 pull-right">
											<div class='play-all-button'>
												<i class="fa fa-play" aria-hidden="true"></i>Play All
											</div>
										</div>
									</div>

									<div class="row videoTemplate-videosRows videoListing-videoTemplateRows">
										<?php
										if(!empty($slider_videos)){
											foreach ($slider_videos as $video) {
												?>
												<div class="col-xs-6 col-md-4 videoTemplate-videosWrapper videoListing-videoTemplateWrapper">
													<a href="video-playing/<?php echo $video['id']; ?>/<?=$video['seo-title'];?>">
														<div class="videoTemplate-videos" style="--background-image: url(https://img.youtube.com/vi/<?php echo $video['youtube_id']; ?>/mqdefault.jpg);">
															<img src="https://img.youtube.com/vi/<?php echo $video['youtube_id']; ?>/mqdefault.jpg" />
															<div class="videoTemplate-videosTags">
																<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
																<!-- <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> -->
																WATCHED
															</div>
															<img class="videoTemplate-videosPlay" src="img/play.png" width="38" height="37">
															<div class="videoTemplate-videosDescription">
																<?php
																$title = ( strlen($video['title']) > 25 ) ? substr($video['title'],0,25) . "..." : $video['title'];
																echo $title;
																?>
															</div>
															<div class="videoTemplate-videosTime"><?php echo $video['duration']; ?></div>
														</div>
													</a>
												</div>
												<?php
											}
										}
										?>


									</div>

									<?php
								}
							}

							?>
						</div>
					</div>
				</div>
			</div>
			<div class='container explore-again-container'>
				<a class='explore-again-btn' href='<?php echo base_url(); ?>category-select'><i class="fa fa-angle-left" aria-hidden="true"></i>Explore Again</a>
			</div>
		</div>
		</div>
	</main>
</body>