<?php
	session_start();
    header('Content-Type: application/json; charset=utf-8');
	  
	include('settings.php');

	$role = $_SESSION['role_user'];
	
	if( $_SESSION['locale'] == 'en' ){
		$main = 'Administration';
		$users = 'Users';
		$reports = 'Reports';
		$catalogue = 'Catalogue';
		$part = 'Part';
		$partnumber = 'Part Number';
		$partcoreinfo = 'Part Core Info';
		$partcomponentinfo = 'Part Component Info';
		$partspecifcations = 'Part Specifcations';
		$parttorquespec = 'Part Torque Spec';
		$partfunctionalspec = 'Part Functional Spec';
	}elseif( $_SESSION['locale'] == 'ru' ){
		$main = 'Administration';
		$users = 'Users';
		$reports = 'Reports';
		$catalogue = 'Catalogue';
		$part = 'Part';
		$partnumber = 'Part Number';
		$partcoreinfo = 'Part Core Info';
		$partcomponentinfo = 'Part Component Info';
		$partspecifcations = 'Part Specifcations';
		$parttorquespec = 'Part Torque Spec';
		$partfunctionalspec = 'Part Functional Spec';
	}elseif( $_SESSION['locale'] == 'ua' ){
		$main = 'Administration';
		$users = 'Users';
		$reports = 'Reports';
		$catalogue = 'Catalogue';
		$part = 'Part';
		$partnumber = 'Part Number';
		$partcoreinfo = 'Part Core Info';
		$partcomponentinfo = 'Part Component Info';
		$partspecifcations = 'Part Specifcations';
		$parttorquespec = 'Part Torque Spec';
		$partfunctionalspec = 'Part Functional Spec';
	}

	
	if ($role == 1) 
	$admin_tree = "
	,
{
    text:'".$main."',
    id: 'main',
    expanded: false,
    children:[
	{
        text:'".$users."',
        id:'users',
        leaf:true
    },
	{
        text:'Roles',
        id:'roles',
        leaf:true
    },
	{
        text:'Rights',
        id:'rights',
        leaf:true
    },
	{
        text:'Task status',
        id:'taskStatus',
        leaf:true
    },
	{
        text:'Task type',
        id:'taskType',
        leaf:true
    },
	{
        text:'Order status',
        id:'orderStatus',
        leaf:true
    },
	{
        text:'Clients',
        id:'clients',
        leaf:true
    },
	{
        text:'Log of activity',
        id:'logs',
        leaf:true
    }
	]
},
{
    text:'".$catalogue."',
    expanded: false,
    children:[
		{
        text:'".$part."',
        id:'part',
        leaf:true
		},
		{
        text:'".$partnumber."',
        id:'part_number',
        leaf:true
		},
		{
        text:'".$partcoreinfo."',
        id:'part_core_info',
        leaf:true
		},
		{
        text:'".$partcomponentinfo."',
        id:'part_component_info',
        leaf:true
		},
		{
        text:'".$partspecifcations."',
        id:'part_specifcations',
        leaf:true
		},
		{
        text:'".$parttorquespec."',
        id:'part_torque_spec',
        leaf:true
		},
		{
        text:'".$partfunctionalspec."',
        id:'part_functional_spec',
        leaf:true
		}
		
	]
}
	";
	else $admin_tree = "";
	
	echo "{ 
text: '.',
children: [

{
    text:'Dashboard',
    expanded: true,
    children:[{
        text:'Workflow driven',
        id:'workflow_driven',
        leaf: true
		}, {
        text:'User driven',
        id:'User_driven',
        leaf: true
		}]
},
{
    text:'Workflow',
    expanded: false,
    children:[
		{
        text:'New task',
        id:'new_task',
        leaf:true
		},
		{
        text:'In queue',
        id:'in_queue',
        leaf:true
		},
		
		{
        text:'In progress',
        id:'in_progress',
        leaf:true
		},
		{
        text:'Completed',
        id:'completed',
        leaf:true
		},
		{
        text:'Overdue',
        id:'overdue',
        leaf:true
		}
	]
},
{
    text:'".$reports."',
    expanded: false,
    children:[
	{
        text:'KPI',
        id:'kpi',
        leaf:true
    }
	]
}".$admin_tree."
]
}";
	
	
?>
