<?php include("homepage.php");
include('connection.php');
?>

<!DOCTYPE html>
<html>
<head>
<title><?php echo constant("psj"); ?></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../pages/assets/css/bootstrap.min.css"> 
<link rel="stylesheet" type="text/css" href="../pages/assets/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../pages/assets/css/animate.css">
<link rel="stylesheet" type="text/css" href="../pages/assets/css/li-scroller.css">
<link rel="stylesheet" type="text/css" href="../pages/assets/css/slick.css">
<link rel="stylesheet" type="text/css" href="../pages/assets/css/theme.css">
<link rel="stylesheet" type="text/css" href="../pages/assets/css/style.css">
<link rel="stylesheet" type="text/css" href="../pages/assets/css/style2.css">
<!--[if lt IE 9]>
<script src="../assets/js/html5shiv.min.js"></script>
<script src="../assets/js/respond.min.js"></script>
<![endif]-->
<style>
#nv_menu a:hover{

background:rgb(221,97,47);
color:white;
} 
h1{color:rgb(221,97,47);}
</style>
<script>

$('#english').click(function(){  
        //alert(window.location.href);  
          var english=document.getElementById('english').text;
          
                  //  document.getElementById('para').style.visibility = "hidden";      
            $.ajax({
              url: "homepage.php",
           type     : 'GET',
             data: ({english: english}),
                  cache: false,
                  dataType: "text",
                  success: onSuccess
                });
    $("#resultLog").ajaxError(function(event, request, settings, exception) {
          $("#resultLog").html("Error Calling: " + settings.url + "<br />HTTP Code: " + request.status);
        });
function onSuccess(data)
        {
       // alert(data);
      $("#resultLog").html("Result: " + data);
      var english1=document.getElementById('english').text;      
      if (typeof(Storage) != "undefined") 
    {
    localStorage.setItem("type", english1);

     }	
     // window.location.href='index.php?english='+english1;
      window.location.href='gallery.php?english='+localStorage.getItem("type");
        }
        });
         
    
    $('#marathi').click(function(){    
          var marathi=document.getElementById('marathi').text;   
        //  document.getElementById('para').style.visibility = "hidden";
            $.ajax({
              url: "homepage.php",
           type     : 'GET',
             data: ({marathi: marathi}),
                  cache: false,
                  dataType: "text",
                  success: onSuccess
                });
    $("#resultLog").ajaxError(function(event, request, settings, exception) {
          $("#resultLog").html("Error Calling: " + settings.url + "<br />HTTP Code: " + request.status);
        });
function onSuccess(data)
        {
       // alert(data);
      $("#resultLog").html("Result: " + data);
      var marathi1=document.getElementById('marathi').text;  
      if (typeof(Storage) != "undefined") 
    {
    localStorage.setItem("type", marathi1);

     }	    
      window.location.href='gallery.php?marathi='+localStorage.getItem("type");
        }
        });
        
 var lang; 
function typeeng(lang)
{
//alert('hello');
	 var type1=localStorage.getItem("type");  
 window.location.href="gallery.php?english="+lang;
	
	}    
  
   function typemarathi(lang)
{
//alert('hello');
	 var type1=localStorage.getItem("type");  
 window.location.href="gallery.php?marathi="+lang;
	
	}     


</script>

</head>
<body>
<div id="preloader">
  <div id="status">&nbsp;</div>
</div>
<a class="scrollToTop" href="#" style="border-color:rgb(221,97,47);"><i class="fa fa-angle-up"></i></a>
<div class="container">
  <div class="box_wrapper">
    
    <header id="header" style="border-color:rgb(221,97,47);">
     
   <?php include("header.php") ?>
       
    <section id="contentbody">
     
                
<div class="row" align="center"> 
<h1 align="center" style="<?php echo $bgcolor; ?>"><?php echo constant("GALLERY");?></h1>
<div class="col-sm-12" >
<div class="container">
 <?php include("homepage.php"); ?> 
 
  <?php
               
														$english=$_GET['english'];
														$marathi=$_GET['marathi'];
														if($english!="English" || $marathi=="मराठी")
        

 {
		 echo'<table class="table table-bordered" style="width:90%" align="center">
<tr>
<td style="width:10%" align="center">Sr No.</td>
<td style="width:60%" align="center">Event Name</td>
<td style="width:10%" align="center">Date</td>
<td style="width:10%" align="center">Photo</td>
<td style="width:10%" align="center">Video</td>
</tr>';  
$i=0;
mysqli_query($GLOBALS["___mysqli_ston"], "set NAMES utf8_unicode_ci");
 $f_id=$_GET['f_id'];
if($f_id==101 || $f_id==201 || $f_id==301 || $f_id==401 || $f_id==501 || $f_id==601 || $f_id==701 ||$f_id==801 || $f_id==901 || $f_id==1001 || $f_id==2001 || $f_id==3001 || $f_id==4001 || $f_id==5001 || $f_id==6001 || $f_id==7001 || $f_id==8001)
{
 $sql="SELECT * FROM `gallary1` where Department_name='$f_id'";
 }
 else 
 {
 	$sql="SELECT * FROM `gallary1`";
 }
  //  echo $sql;
            $res=mysqli_query($GLOBALS["___mysqli_ston"], $sql) or die('Query Failed: 4'. mysqli_error($GLOBALS["___mysqli_ston"]));
            while($row=mysqli_fetch_assoc($res))
 {
 	
   	 $e_id=$row['e_id'];
    $event =$row['event'];
    $Date=$row['date'];
    $url=$row['url'];
     
    $sql1="SELECT * FROM `photo` where event_id='$e_id'";
    $res1=mysqli_query($GLOBALS["___mysqli_ston"], $sql1) or die('Query Failed: 5'. mysqli_error($GLOBALS["___mysqli_ston"]));
    while($row1=mysqli_fetch_assoc($res1))
    {
    			$photo=$row1['photo'];
    }
    $sql2="SELECT * FROM `video` where event_id='$e_id'";
				$res2=mysqli_query($GLOBALS["___mysqli_ston"], $sql2)or die('Query Failed: 4' . mysqli_error($GLOBALS["___mysqli_ston"]));
				while($rw = mysqli_fetch_assoc($res2))
				{
						$video=$rw['video'];
				}
						$i++;
    echo' <tr>
        <td align ="center">'.	$i.'</td>
        <td align ="center">'.$event.'</td>
        <td align ="center">'.$Date.'</td>';
        $e_id = urlencode(base64_encode("$e_id"));
        if($photo != '' && $video != '')
   					{
   									echo '<td align ="center"><a href="photo.php?e_id='.$e_id.'"><button class="btn btn-info" type="button"  style=" font-size:15pt; border-radius: 50px; ">'.फोटो.'</button></a></td>
              <td align ="center"><a href="video.php?e_id='.$e_id.'"><button class="btn btn-danger" type="button"  style=" font-size:15pt; border-radius: 50px;">'.विडीओ.'</button></a></td>
            
        ';
   					}
        else if($photo != '')
        {
        			echo '<td align ="center"><a href="photo.php?e_id='.$e_id.'"><button class="btn btn-info" type="button"  style=" font-size:15pt; border-radius: 50px; ">'.फोटो.'</button></a></td>
        			      <td align ="center"><a href="video.php?e_id='.$e_id.'"><button class="btn btn-danger" type="button"  style=" font-size:15pt; border-radius: 50px; background-color: gainsboro ;border-color: gainsboro ;" disabled>'.विडीओ.'</button></a></td>';
        }
        else if($video != '')
        {
        echo '<td align ="center"><a href="photo.php?e_id='.$e_id.'"><button class="btn btn-info" type="button"  style=" font-size:15pt; border-radius: 50px; background-color: gainsboro ;border-color: gainsboro ;" disabled>'.फोटो.'</button></a></td>
              <td align ="center"><a href="video.php?e_id='.$e_id.'"><button class="btn btn-danger" type="button"  style=" font-size:15pt; border-radius: 50px;">'.विडीओ.'</button></a></td>
            
        '; 
   					}
   					
   					echo '</tr>';
 }
echo'</table>';
}     
 																	 else
 																			               {
		 echo'<table class="table table-bordered" style="width:90%" align="center">
<tr>
<td style="width:10%" align="center">Sr No.</td>
<td style="width:60%" align="center">Event Name</td>
<td style="width:10%" align="center">Date</td>
<td style="width:10%" align="center">Photo</td>
<td style="width:10%" align="center">Video</td>
</tr>';  
$i=0;
mysqli_query($GLOBALS["___mysqli_ston"], "set NAMES utf8_unicode_ci");
 $f_id=$_GET['f_id'];
if($f_id==101 || $f_id==201 || $f_id==301 || $f_id==401 || $f_id==501 || $f_id==601 || $f_id==701 ||$f_id==801 || $f_id==901 || $f_id==1001 || $f_id==2001 || $f_id==3001 || $f_id==4001 || $f_id==5001 || $f_id==6001 || $f_id==7001 || $f_id==8001)
{
 $sql="SELECT * FROM `gallary1` where Department_name='$f_id'";
 }
 else 
 {
 	$sql="SELECT * FROM `gallary1`";
 }
  //  echo $sql;
            $res=mysqli_query($GLOBALS["___mysqli_ston"], $sql) or die('Query Failed: 4'. mysqli_error($GLOBALS["___mysqli_ston"]));
            while($row=mysqli_fetch_assoc($res))
 {
 	
   	 $e_id=$row['e_id'];
    $event =$row['event'];
    $Date=$row['date'];
    $url=$row['url'];
     
    $sql1="SELECT * FROM `photo` where event_id='$e_id'";
    $res1=mysqli_query($GLOBALS["___mysqli_ston"], $sql1) or die('Query Failed: 5'. mysqli_error($GLOBALS["___mysqli_ston"]));
    while($row1=mysqli_fetch_assoc($res1))
    {
    			$photo=$row1['photo'];
    }
    $sql2="SELECT * FROM `video` where event_id='$e_id'";
				$res2=mysqli_query($GLOBALS["___mysqli_ston"], $sql2)or die('Query Failed: 4' . mysqli_error($GLOBALS["___mysqli_ston"]));
				while($rw = mysqli_fetch_assoc($res2))
				{
						$video=$rw['video'];
				}
						$i++;
    echo' <tr>
        <td align ="center">'.	$i.'</td>
        <td align ="center">'.$event.'</td>
        <td align ="center">'.$Date.'</td>';
        $e_id = urlencode(base64_encode("$e_id"));
        if($photo != '' && $video != '')
   					{
   									echo '<td align ="center"><a href="photo.php?e_id='.$e_id.'"><button class="btn btn-info" type="button"  style=" font-size:15pt; border-radius: 50px; ">Photo</button></a></td>
              <td align ="center"><a href="video.php?e_id='.$e_id.'"><button class="btn btn-danger" type="button"  style=" font-size:15pt; border-radius: 50px;">Video</button></a></td>
            
        ';
   					}
        else if($photo != '')
        {
        			echo '<td align ="center"><a href="photo.php?e_id='.$e_id.'"><button class="btn btn-info" type="button"  style=" font-size:15pt; border-radius: 50px; ">Photo</button></a></td>
        			      <td align ="center"><a href="video.php?e_id='.$e_id.'"><button class="btn btn-danger" type="button"  style=" font-size:15pt; border-radius: 50px; background-color: gainsboro ;border-color: gainsboro ;" disabled>Video</button></a></td>';
        }
        else if($video != '')
        {
        echo '<td align ="center"><a href="photo.php?e_id='.$e_id.'"><button class="btn btn-info" type="button"  style=" font-size:15pt; border-radius: 50px; background-color: gainsboro ;border-color: gainsboro ;" disabled>Photo</button></a></td>
              <td align ="center"><a href="video.php?e_id='.$e_id.'"><button class="btn btn-danger" type="button"  style=" font-size:15pt; border-radius: 50px;">Video</button></a></td>
            
        '; 
   					}
   					
   					echo '</tr>';
 }
echo'</table>';
}          
               
              ?> 
          </div>
       
    
                 
 </div>  
      
      
         
        </div>
        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
          <div class="row">
            <div class="right_bar">
              <div class="single_leftbar wow fadeInDown">
         
                
                
              </div>
           
              
              
            
            </div>
          </div>
        </div>
     
    </section>
    
 
  <div>
   <?php include("footer.php") ?>

  </div>
   </div>
  </div> 

<script src="../pages/assets/js/jquery.min.js"></script>
<script src="../pages/assets/js/wow.min.js"></script>
<script src="../pages/assets/js/bootstrap.min.js"></script>
<script src="../pages/assets/js/slick.min.js"></script>
<script src="../pages/assets/js/jquery.li-scroller.1.0.js"></script>
<script src="../pages/assets/js/custom.js"></script>
</body>
</html>