<?php
include 'session.php';
include("connect.php");
require_once 'web_constant.php';
date_default_timezone_set("Asia/Kolkata");

$userPermissions = [];
$permissionsArray = array();
$values=array();
$bdd=new DB();
$permissionResult = $bdd->getAll("SELECT page,button FROM permissions WHERE user_id =" . $_SESSION['ticl_admin_id'],$values);
if ($permissionResult) {
    foreach ($permissionResult as $permission) {
        $userPermissions[] = $permission['page'];
		//$userPermissions[]['button'] = $permission['button'];
		$page = $permission['page'];
		$buttons = explode(',', $permission['button']);
		if (!isset($permissionResult[$page])) {
			$permissionsArray[$page] = array();
		}
		$permissionsArray[$page] = array_merge($permissionsArray[$page], $buttons);
    }
}

/*$permissionsArray = array();

foreach ($permissionResult as $row) {
    $tabs = $row['page'];
    $submenus = explode(',', $row['button']);

    if (!isset($permissionsArray[$tabs])) {
        $permissionsArray[$tabs] = array();
    }

    $permissionsArray[$tabs] = array_merge($permissionsArray[$tabs], $submenus);
}*/
$bdd->disconnect();
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <link rel="shortcut icon" href="#">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php echo web_constant::$comp_name ?></title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
  <link rel="stylesheet" href="bower_components/jquery-ui/css/jquery-ui.min.css">
  <link rel="stylesheet" href="dist/css/mystyle.css">
  
  <link rel="stylesheet" href="assets/datatables.min.css">
  
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font 
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

  <script src="https://cdn.ckeditor.com/4.11.3/full/ckeditor.js"></script> -->
</head>