<?php include('header.php'); ?>
<style>
	.collName{
		color: #fff;
		display:block;
		text-align:center;
		font-family: 'Philosopher', sans-serif;
	}
	.collName:hover{
		color: #fff;
	}
</style>
<?php
	include('manager/includes/connection.php');
	$getCollections = mysql_query("select * from news order by id");
	$collCount = mysql_num_rows($getCollections);
	$collList='';
	if($collCount>0){
		while($row = mysql_fetch_array($getCollections)){
			$cid = $row['id'];
			$name = $row['name'];
			$thumb = $row['thumb'];
			
										$galleryList='';
										$getGallery = mysql_query("select * from news_gallery where nid = '$cid'");
										$galleryCount = mysql_num_rows($getGallery);
										$gallRow = mysql_fetch_array($getGallery);

										$galleryList.='<div class="item active">
															 <img src="news/'.$cid.'/gallery/'.$gallRow['path'].'" class="img-responsive galleryImg">
															</div>';

										if($galleryCount>0){
											while($gallRows = mysql_fetch_array($getGallery)){
												$galleryList.='<div class="item">
															 <img src="news/'.$cid.'/gallery/'.$gallRows['path'].'" class="img-responsive galleryImg">
															</div>';
											}
										}
			
			$collList.='<div class="col-md-3" style="margin-top:20px;">
								<div class="col-sm-12" style="padding:0;">
									<a href="#" class="collName" data-toggle="modal" data-target="#myModalNews'.$cid.'"><img src="news/'.$cid.'/thumb/'.$thumb.'" class="img-responsive"></a>
								</div>
								<div class="col-sm-12" style="padding:0;">
									<a href="#" class="collName" data-toggle="modal" data-target="#myModalNews'.$cid.'">'.$name.'</a>
								</div>
							</div>
							
							<div class="modal fade" id="myModalNews'.$cid.'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
												  <div class="modal-dialog modal-lg" role="document">
													<div class="modal-content" style="border-radius:0;">
													  <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="myModalLabel">'.$name.'</h4>
													  </div>
													  <div class="modal-body">
														<div id="myCarouselCam'.$cid.'" class="carousel slide" data-ride="carousel">
														  <!-- Wrapper for slides -->
														  <div class="carousel-inner" role="listbox">
															'.$galleryList.'
														  </div>

														  <!-- Left and right controls -->
														  <a class="left carousel-control" href="#myCarouselCam'.$cid.'" role="button" data-slide="prev">
															<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
															<span class="sr-only">Previous</span>
														  </a>
														  <a class="right carousel-control" href="#myCarouselCam'.$cid.'" role="button" data-slide="next">
															<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
															<span class="sr-only">Next</span>
														  </a>
														</div>
													  </div>
													</div>
												  </div>
												</div>';
		}
	}else{
		$collList.='News not found!';
	}
?>

<?php
	include('manager/includes/connection.php');
	$getCollections = mysql_query("select * from campaign order by id");
	$collCount = mysql_num_rows($getCollections);
	$collList1='';
	if($collCount>0){
		while($row = mysql_fetch_array($getCollections)){
			$cid = $row['id'];
			$name = $row['name'];
			$thumb = $row['thumb'];
			
			$galleryList='';
										$getGallery = mysql_query("select * from campaign_gallery where cid = '$cid'");
										$galleryCount = mysql_num_rows($getGallery);
										$gallRow = mysql_fetch_array($getGallery);

										$galleryList.='<div class="item active">
															 <img src="campaign/'.$cid.'/gallery/'.$gallRow['path'].'" class="img-responsive galleryImg">
															</div>';

										if($galleryCount>0){
											while($gallRows = mysql_fetch_array($getGallery)){
												$galleryList.='<div class="item">
															 <img src="campaign/'.$cid.'/gallery/'.$gallRows['path'].'" class="img-responsive galleryImg">
															</div>';
											}
										}
			
			$collList1.='<div class="col-md-3">
								<div class="col-sm-12" style="padding:0;">
									<a href="#" class="collName" style="color:#000;" data-toggle="modal" data-target="#myModalCam'.$cid.'"><img src="campaign/'.$cid.'/thumb/'.$thumb.'" class="img-responsive"></a>
								</div>
								<div class="col-sm-12" style="padding:0;">
									<a href="#" class="collName" style="color:#000;" data-toggle="modal" data-target="#myModalCam'.$cid.'">'.$name.'</a>
								</div>
							</div>
							
							<div class="modal fade" id="myModalCam'.$cid.'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
												  <div class="modal-dialog modal-lg" role="document">
													<div class="modal-content" style="border-radius:0;">
													  <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="myModalLabel">'.$name.'</h4>
													  </div>
													  <div class="modal-body">
														<div id="myCarousel'.$cid.'" class="carousel slide" data-ride="carousel">
														  <!-- Wrapper for slides -->
														  <div class="carousel-inner" role="listbox">
															'.$galleryList.'
														  </div>

														  <!-- Left and right controls -->
														  <a class="left carousel-control" href="#myCarousel'.$cid.'" role="button" data-slide="prev">
															<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
															<span class="sr-only">Previous</span>
														  </a>
														  <a class="right carousel-control" href="#myCarousel'.$cid.'" role="button" data-slide="next">
															<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
															<span class="sr-only">Next</span>
														  </a>
														</div>
													  </div>
													</div>
												  </div>
												</div>';
		}
	}else{
		$collList1.='Campaigns not found!';
	}
?>


<?php
	// Get Video List
	$getVideoList=mysql_query("select * from news_videos");
	$videoList='';
	$vCount = mysql_num_rows($getVideoList);
	if($vCount>0){
		while($vRows = mysql_fetch_array($getVideoList)){
			$vid = $vRows['id'];
			$name = $vRows['name'];
			$url = $vRows['url'];
			
			$videoList.='<div class="col-md-4" style="margin-top:30px;">
								<div class="col-sm-12" style="padding:0;">
									<iframe width="100%" height="315px" src="'.$url.'" frameborder="0" allowfullscreen></iframe>
								</div>
								<div class="col-sm-12" style="padding:0;text-align:center;padding:10px 0;background:#1c1b17;">
									<a href="#" class="collName">'.$name.'</a>
								</div>
							</div>';
		}
	}else{
		$videoList.='Videos not found!';
	}
?>

</head>
    <body class="fixed-header">
			<?php include('nav.php'); ?>
			
            <section class="mySection pageHeader">
				<div class="container">
					<div class="row">
						<div class="col-sm-12"><h1>Media</h1></div>
					</div>
				</div>
			</section>
			
            <section class="mySection orangeColor">
				<div class="container">
					<div class="row">
						<div class="col-sm-12">
							<h1 style="text-align:left;">News / PR News</h1>
						</div>
						<div class="col-sm-12">
							<?php echo $collList; ?>
						</div>				
					</div>
					<div class="row" style="padding-top:30px;">
						<div class="col-sm-12">
							<h1 style="text-align:left;margin-bottom:0;">News / PR Videos</h1>
						</div>
						<div class="col-sm-12">
							<?php echo $videoList; ?>
						</div>				
					</div>
				</div>
			</section>
			
            <section class="mySection creamColor">
				<div class="container">
					<div class="row">
						<div class="col-sm-12">
							<h1 style="text-align:left;">Campaign</h1>
						</div>
						<div class="col-sm-12">
							<?php echo $collList1; ?>
						</div>							
					</div>
				</div>
			</section>
						
      		<?php include('footer.php'); ?>
			<?php include('footerjs.php'); ?>
    </body>
</html>