<?php

require_once '../public/layouts/theme_1/_header.html';
require_once "../models/index/index.php";
$index = new index();
$cnct = new cnct_class();
$cnct->cnct();
//************************************* check if the user control_p_group allow him to enter this page *******
$path_parts = pathinfo(__FILE__);
$page = $path_parts['filename'];
$data['control_p_privilege'] = $page;
$data['control_p_group_id'] = $_SESSION['control_p_group_id'];
if (!$index->isAllowed($data)) {
    //if(strpos($_SERVER["HTTP_REFERER"],'?')===false) $char='?' ; else $char='&'; header('Location:'.$_SERVER["HTTP_REFERER"].$char.'note=No Permition');
    //if(strpos($_SERVER["HTTP_REFERER"],'?')===false) { $char='?' ; } else { $char='&'; } echo  '<script language="javascript" > window.location="'.$_SERVER["HTTP_REFERER"].$char.'note=No Permition"; </script>';
}
//************************************* check if the user control_p_group allow him to enter this page *******
//******************************************* constants *****************************************
$mainTable = strtolower(substr($page, 6));
//get the name of the table from the file name
$Table = $index->capitalize($mainTable);
//******************************************* constants end *************************************
//******************************************************** sub menu *****************************
$data['page'] = $page;
$menu = $index->getMenuList($data);
//********************************************************* get folder uploaded to ************************************
if (isset($_GET['table']) && isset($_GET['id'])) {
    $T = $_GET['table'];
    $I = $_GET['id'];
} elseif (isset($_GET['table']) && !isset($_GET['id']) && isset($_SESSION['context'][$_GET['table']])) {
    $T = $_GET['table'];