<?php 
			// Project ID
			$pid 	= $_GET['pid'];
			$xuid 	= $_GET['xuid'];
			$lang 	= $_GET['lang'];
			$onload	= $_GET['onload'];			
			include('field_names.php'); 			
			include('users.php'); 
			include('menu_checks.php'); 						
?>

<?php

include('r_dbc.php');

$sql = "SELECT pid as pidx,desc_project from ccprojects where pid in (".$usprojects.") and pid != '".$pid."' order by pid";

$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
      while($row = mysqli_fetch_assoc($result)) {
		$pidx 			= $row["pidx"];
		$desc_project 	= $row["desc_project"];
		}
} 
mysqli_close($conn);


?>


<?php
// MIDS
include('r_dbc.php');

$mixcnt = 0;
$sql = "SELECT menu_order,mid,desc_manager from ccmanager_id where pid = '".$pid."' and delta_col=0 order by mid";

$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
      while($row = mysqli_fetch_assoc($result)) {
		$menu_order		= $row["menu_order"];
		$midx 			= $row["mid"];
		$desc_managerx 	= $row["desc_manager"];
		
	  if ($menu_order == 1) { $mid1 = $midx; $desc_manager1 = $desc_managerx; }
	  if ($menu_order == 2) { $mid2 = $midx; $desc_manager2 = $desc_managerx; }
	  if ($menu_order == 3) { $mid3 = $midx; $desc_manager3 = $desc_managerx; }	  
	  if ($menu_order == 4) { $mid4 = $midx; $desc_manager4 = $desc_managerx; }	  
	  if ($menu_order == 5) { $mid5 = $midx; $desc_manager5 = $desc_managerx; }	  
	  if ($menu_order == 6) { $mid6 = $midx; $desc_manager6 = $desc_managerx; }	  
	  if ($menu_order == 7) { $mid7 = $midx; $desc_manager7 = $desc_managerx; }	  
	  if ($menu_order == 8) { $mid8 = $midx; $desc_manager8 = $desc_managerx; }	  
	  if ($menu_order == 9) { $mid9 = $midx; $desc_manager9 = $desc_managerx; }	  

		
		}
} 
mysqli_close($conn);

?>

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./font-awesome/css/font-awesome.min.css">
<style>
body {
  background: url('bg.jpg') no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

</style>
<style>
body {margin:0;font-family:Arial}

.topnav {
  overflow: hidden;
  background-color: #333;
}

.topnav a {
  float: left;
  display: block;
  color: #f2f2f2;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
}

.active {
  background-color: #4CAF50;
  color: white;
}

.topnav .icon {
  display: none;
}

.dropdown {
  float: left;
  overflow: hidden;
}

.dropdown .dropbtn {
  font-size: 17px;    
  border: none;
  outline: none;
  color: white;
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit;
  margin: 0;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}

.dropdown-content a {
  float: none;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.topnav a:hover, .dropdown:hover .dropbtn {
  background-color: #555;
  color: white;
}

.dropdown-content a:hover {
  background-color: #ddd;
  color: black;
}

.dropdown:hover .dropdown-content {
  display: block;
}

@media screen and (max-width: 600px) {
  .topnav a:not(:first-child), .dropdown .dropbtn {
    display: none;
  }
  .topnav a.icon {
    float: right;
    display: block;
  }
}

@media screen and (max-width: 600px) {
  .topnav.responsive {position: relative;}
  .topnav.responsive .icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  .topnav.responsive a {
    float: none;
    display: block;
    text-align: left;
  }
  .topnav.responsive .dropdown {float: none;}
  .topnav.responsive .dropdown-content {position: relative;}
  .topnav.responsive .dropdown .dropbtn {
    display: block;
    width: 100%;
    text-align: left;
  }
}
</style>
</head>
<body>

<?php
$menu_line = "menu.php?pid=".$pid."&xuid=".$xuid."&lang=".$lang;

// REPORTS COLUMN

$rep1 = "<a href='r_calendar.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 	target=_blank >".$n_calendar."</a>";
$rep2 = "<a href='r_centers.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 	target=_blank >".$n_centers_totals."</a>";
$rep3 = "<a href='r_center_one.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 	target=_blank >".$n_centers."</a>";
$rep4 = "<a href='r_categs.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 		target=_blank >".$n_categs_totals."</a>";
$rep5 = "<a href='r_categ_one.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 	target=_blank >".$n_categs."</a>";
$rep6 = "<a href='r_tags.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 		target=_blank >".$n_tags."</a>";
$rep7 = "";

// VIEWS COLUMNS

$view1 = "<a href='r_centers_progress.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 		target=_blank >".$n_centers_progress."</a>";
$view2 = "<a href='r_categs_progress.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 		target=_blank >".$n_categs_progress."</a>";
$view3 = "";
$view4 = "";
$view5 = "";
$view6 = "";
// AVAILABLE ONLY FOR ADMINISTRATORS
if ($usrole == "admin") {
$view7 = "<a href='r_views.php?pid=".$pid."&lang=".$lang."&xuid=".$xuid."' 		target=_blank >".$title_views."</a>";
}
elseif ($usrole != "admin") {
$view7 = "-";
}	

// STRUCTURE COLUMNS
$st_ccgrp 			= "";
$msg_ccgrp 			= "$n_centers_groups";
$msg_ccgrp_class 	= "";

$st_cc 				= "";
$msg_cc 			= "$n_centers";
$msg_cc_class 		= "";

$st_catgrp 			= "";
$msg_catgrp 		= "$n_categs_groups";
$msg_catgrp_class 	= "";

$st_cat 			= "";
$msg_cat 			= "$n_categs";
$msg_cat_class 		= "";


if ($cnt_ccgrp 	== 0) 
	{ 	
		$st_ccgrp 			= "style='color:tomato'"; 	
		$ficon_ccgrp 		= "<span style='color:tomato'><i class='fas fa-exclamation-triangle blink'></i></span>";	
		$msg_ccgrp 			= "$nadd $n_centers_groups";
		$msg_ccgrp_class 	= "class='blink'";
	}
if ($cnt_cc 	== 0) 
	{ 
		$st_cc	 			= "style='color:tomato'"; 	
		$ficon_cc 			= "<span style='color:tomato'><i class='fas fa-exclamation-triangle blink'></i></span>";	
		$msg_cc 			= "$nadd $n_centers";
		$msg_cc_class 		= "class='blink'";		
	}
if ($cnt_catgrp	== 0) 
	{ 
		$st_catgrp 			= "style='color:tomato'"; 	
		$ficon_catgrp 		= "<span style='color:tomato'><i class='fas fa-exclamation-triangle blink'></i></span>";	
		$msg_catgrp			= "$nadd $n_categs_groups";
		$msg_catgrp_class 	= "class='blink'";				
	}
if ($cnt_cat 	== 0) 
	{ 
		$st_cat	 			= "style='color:tomato'"; 	
		$ficon_cat			= "<span style='color:tomato'><i class='fas fa-exclamation-triangle blink'></i></span>";	
		$msg_cat			= "$nadd $n_categs";
		$msg_cat_class 		= "class='blink'";						
	}


$struc1 = "<td class='w3-animate-opacity'> $ficon_ccgrp 	<a href='nf_centersg.php?pid=$pid&xuid=$xuid&lang=$lang'	$msg_ccgrp_class	$st_ccgrp 	>$msg_ccgrp</a></td>";
$struc2 = "<td class='w3-animate-opacity'> $ficon_cc 		<a href='nf_centers.php?pid=$pid&xuid=$xuid&lang=$lang' 	$msg_cc_class		$st_cc		>$msg_cc</a></td>";
$struc3 = "<td class='w3-animate-opacity'> $ficon_catgrp 	<a href='nf_categsg.php?pid=$pid&xuid=$xuid&lang=$lang' 	$msg_catgrp_class	$st_catgrp	>$msg_catgrp</a></td>";
$struc4 = "<td class='w3-animate-opacity'> $ficon_cat		<a href='nf_categs.php?pid=$pid&xuid=$xuid&lang=$lang' 		$msg_cat_class		$st_cat		>$msg_cat</a></td>";
// CLASSES AVAILABLE ONLY FOR ADMINISTRATORS
if ($usrole == "admin") {
	$struc5 = "<td class='w3-animate-opacity'><a href='nf_manid.php?pid=$pid&xuid=$xuid&lang=$lang' >$nmanagers</a></td>";
}
elseif ($usrole != "admin") {
$struc5 = "-";
}	

	$struc6 = "<td class='w3-animate-opacity'></td>";
	$struc7 = "<td class='w3-animate-opacity'></td>";	

?>




<div class="topnav" id="myTopnav">
  <a href="#home" class="active"><?php echo $nmenu ?></a>

   <div class="dropdown">
    <button class="dropbtn"><?php echo $forms_name ?> 
      <i class="fa fa-caret-down"></i>
    </button>
    <div class="dropdown-content">
		<a href="dashboard.php?pid=<?php echo $pid ?>&xuid=<?php echo $xuid ?>&lang=<?php echo $lang ?>"><?php echo $n_adminpanel ?></a>
		<a href="nf_manager.php?pid=<?php echo $pid ?>&xuid=<?php echo $xuid ?>&lang=<?php echo $lang ?>&mid=<?php echo $mid1 ?>" ><?php echo $desc_manager1 ?></a>
		<a href="nf_manager.php?pid=<?php echo $pid ?>&xuid=<?php echo $xuid ?>&lang=<?php echo $lang ?>&mid=<?php echo $mid2 ?>" ><?php echo $desc_manager2 ?></a>
		<a href="nf_manager.php?pid=<?php echo $pid ?>&xuid=<?php echo $xuid ?>&lang=<?php echo $lang ?>&mid=<?php echo $mid3 ?>" ><?php echo $desc_manager3 ?></a>
		<a href="nf_manager.php?pid=<?php echo $pid ?>&xuid=<?php echo $xuid ?>&lang=<?php echo $lang ?>&mid=<?php echo $mid4 ?>" ><?php echo $desc_manager4 ?></a>
		<a href="nf_manager.php?pid=<?php echo $pid ?>&xuid=<?php echo $xuid ?>&lang=<?php echo $lang ?>&mid=<?php echo $mid5 ?>" ><?php echo $desc_manager5 ?></a>
	</div>
  </div>

   <div class="dropdown">
    <button class="dropbtn"><?php echo $reps_name ?> 
      <i class="fa fa-caret-down"></i>
    </button>
    <div class="dropdown-content">
		<?php echo $rep1 ?>
		<?php echo $rep2 ?>
		<?php echo $rep3 ?>
		<?php echo $rep4 ?>
		<?php echo $rep5 ?>
		<?php echo $rep6 ?>
		<?php echo $rep7 ?>
		<?php echo $rep8 ?>		
	</div>
  </div> 
  
  <a href="#about">About</a>
  <a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a>
</div>

<div style="padding-left:16px">
  <h2>Responsive Topnav with Dropdown</h2>
  <p>Resize the browser window to see how it works.</p>
  <p>Hover over the dropdown button to open the dropdown menu.</p>
</div>

<script>
function myFunction() {
  var x = document.getElementById("myTopnav");
  if (x.className === "topnav") {
    x.className += " responsive";
  } else {
    x.className = "topnav";
  }
}
</script>

</body>
</html>
