<?php

//initilize the page
require_once("inc/init.php");
require 'controller/session.php';
include 'controller/mailCode.php';
include 'controller/profileCode.php';

//require UI configuration (nav, ribbon, etc.)
require_once("inc/config.ui.php");

/*---------------- PHP Custom Scripts ---------

YOU CAN SET CONFIGURATION VARIABLES HERE BEFORE IT GOES TO NAV, RIBBON, ETC. */

if (!$_SESSION['hash']) {
	header("Location:lock.php");
}

/* ---------------- END PHP Custom Scripts ------------- */

//include header
//you can add your custom css in $page_css array.
//Note: all css files are inside css/ folder
$page_css[] = "style.css";
include("inc/header.php");

//include left panel (navigation)
//follow the tree in inc/config.ui.php
include("inc/nav.php");

?>
<!-- ==========================CONTENT STARTS HERE ========================== -->
<!-- MAIN PANEL -->
<div id="main" role="main">
	<?php
		include("inc/ribbon.php");
	?>

	<!-- MAIN CONTENT -->
	<div id="content">

	</div>
	<!-- END MAIN CONTENT -->
	
</div>
<!-- END MAIN PANEL -->

<!-- FOOTER -->
	<?php
		include("inc/footer.php");
	?>
<!-- END FOOTER -->

<!-- ==========================CONTENT ENDS HERE ========================== -->

<?php 
	//include required scripts
	include("inc/scripts.php"); 
	//include footer
	?>
	<script type="text/javascript">
	var admin = '<?php echo $_SESSION['isAdmin'] ?>';
	
	if (admin!="ADMIN") {
		$("a[title|='Setup']").addClass('hidden');
		$("a[title|='Semester Reports']").addClass('hidden');
		$("a[title|='Forms']").addClass('hidden');
		$("a[title|='Tables']").addClass('hidden');
		$("a[title|='Class List']").addClass('hidden');
		$("a[title|='Semester Reports SMS']").addClass('hidden');

	}

		 
		$(document).ready(function(){
			setInterval(function (){
				$.get('controller/mailCode2.php',function(data){
				$('#counter').html(data);
			});
         }, 1000);
		});

		setInterval(function (){
				$.get('controller/notCode.php',function(data){
				$('#badgeCount').html(data);
			
			});
         }, 1000);


		setInterval(function (){
				$.get('controller/notCode.php',function(data){
				$('#msgCount').html("Msg("+data+")");
			
			});
         }, 1000);

		$('#search-fld').keyup(function(){
			var search_term = $('#search-fld').val();
			var data = {
				search_term:search_term
			};
			$.post('ajax/controller/searchCode.php',data,function(res){
				console.log(res);
				$('#results').html(res);
			});
		});

		$('#search-mobile').keyup(function(){
			var search_term = $('#search-fld').val();
			var data = {
				search_term:search_term
			};
			$.post('ajax/controller/searchCode.php',data,function(res){
				$('#results').html(res);
			});
		});
	</script>