<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="robots" content="noindex, nofollow">
	<title><?= $school_info['school_name']; ?></title>
	<link rel="icon" type="image/x-icon" href="<?php echo base_url(); ?>common_assets/fav.png">
	<!--styles links-->
	<!-- <link rel="stylesheet" href="https://cdn.datatables.net/fixedcolumns/4.2.1/css/fixedColumns.bootstrap4.min.css"> -->
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/fixedColumns.bootstrap4.min.css">

	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/bootstrap.min.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/jquery-ui.min.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/all.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/owl-carousel/css/owl.carousel.min.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/style-admin.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/style-admin-responsive.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/jquery.dataTables.min.css">
	<!--  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/style.css">
  	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/responsive.css">  -->
	<!-- <link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/fontawesome.min.css" /> -->
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/nepali.datepicker.v3.7.min.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/bootstrap4-toggle.min.css">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/bootstrap-select.css">

	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/datatable/buttons.dataTables.min.css">
	<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/bootstrap-float-label.min.css" />
	<!--<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.semanticui.min.css">-->
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/datatable/dt-custom.css">
	<!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.8/semantic.min.css">-->
	<link href="<?php echo base_url(); ?>assets_admin/css/cwc-font.css" rel="stylesheet">

	<script src="<?php echo base_url(); ?>assets_student/js/jquery-3.6.0.min.js"></script>
	<script src="<?php echo base_url(); ?>assets_admin/js/jquery.validate.js"></script>

	<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/sweetalert/sweet-alert.css">
	<script src="<?php echo base_url(); ?>assets_admin/sweetalert/sweet-alert.js"></script>


</head>

<body class="mob_bg">

	<?php if (isset($_SESSION['admin_id'])) { ?>

		<header id="header" class="responsive-width">
			<div class="search-bar-wrap">
				<!-- <input type="text" name="" placeholder="Search..">
				<button class="search-btn"><i class="fas fa-search"></i></button> -->
			</div>
			<div class="user-login-section">

				<div class="user-wrap">
					<div class="user-login-head">
						<img src="<?= base_url(); ?>assets_admin/images/A.png">
						<h5><span class="user-name"><?php echo $_SESSION['admin_name']; ?></span><i class="fa fa-caret-down" aria-hidden="true"></i><i class="fa fa-caret-up" aria-hidden="true"></i></h5>
					</div>
					<div class="login-wrap-open">
						<ul>
							<!--li><a href="<?= base_url(); ?>admin/my-profile"><span><i class="fa fa-user" aria-hidden="true"></i></span>My Profile</a></li-->
							<li>
								<a href="<?php echo base_url() . 'admin/admin-change-password'; ?>">
									<span><i class="fas fa-lock"></i></span>Change Password
								</a>
							</li>
							<li>
								<a href="<?php echo base_url() . 'admin-logout'; ?>">
									<span><i class="fas fa-sign-out-alt"></i></span>Sign Out
								</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="mobileMenu">
				<i class="fas fa-bars"></i>
			</div>
			<div class="mob_screen">
				<h3>To use <img src="<?= base_url(); ?>assets_admin/images/<?= $logo['logo']; ?>"> on your mobile, install the
					<img src="<?= base_url(); ?>assets_admin/images/<?= $logo['logo']; ?>"> mobile app. <h3>
						<a href=""><img src="<?= base_url(); ?>assets_admin/images/google_play.png" /> </a>
			</div>
		</header>
		<aside id="mySidebar" class="sideMenu" id="style-2">
			<div class="logo-wrap">
				<img src="<?= base_url(); ?>common_assets/<?= $school_info['logo']; ?>">
			</div>

			<?php /*?><ul class="side-list">
        <?php 
            if(!isset($currentURL)) $currentURL = '';
        
        $url = explode(base_url(), $currentURL); ?>
        <?php if(isset($menulist)) {foreach($menulist as $menu){ ?>
        <li class="list <?php if($url[1]==$menu['page_link']){echo 'active'; } ?> "> 
            <a href="<?= base_url(); ?><?= $menu['page_link']; ?>">
                <img src="<?= base_url(); ?>assets_admin/images/<?= $menu['inactive_icon']; ?>" class="icon-inactive">
                <img src="<?= base_url(); ?>assets_admin/images/<?= $menu['active_icon']; ?>" class="icon-active">
                <span><?= $menu['menu_name']; ?></span>
            </a>
        </li>
        <?php } } ?>
        </ul><?php */ ?>
			<!--<ul>
		<li class="list ">
			<a href="subject-create.html" class="dropdown" id="dropdownMenuButton1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				<img src="../assets/images/subject1.png" class="icon-inactive">
				<img src="../assets/images/subject2.png" class="icon-active">
				<span>Subjects</span>
			</a>		
		</li>
		<li class="list active "> 
			<a  href="#" id="btn-1" class="dropdown-toggle" data-toggle="collapse" data-target="#submenu1" aria-expanded="false">
				<img src="../assets/images/dashboard1.png" class="icon-inactive">
				<img src="../assets/images/dashboard2.png" class="icon-active">
				<span>Dashboard</span>
			</a>
			<div class="nav collapse" id="submenu1" role="menu" aria-labelledby="btn-1">
				<a class="dropdown-item active" href="#">Submenu 1</a>
				<a class="dropdown-item" href="#">option 2 submenu</a>
				<a class="dropdown-item" href="#">Something submenu</a>
			</div>
		</li>
	</ul>-->

			<ul class="side-list admin-sidebar">
				<?php
				if (!isset($currentURL))
					$currentURL = '';
				$url = explode(base_url() . 'index.php/', $currentURL);
				//echo $currentURL;
				//echo '<pre>';print_r($url);	

				$CI = &get_instance();
				$CI->load->model('Admin_model');

				$adminMenuHere = $CI->Admin_model->get_admin_menu();


				$adminRolePerms = $CI->Admin_model->get_admin_role_permissions("admin_role_ids IN(" . $_SESSION['admin_role_ids'] . ")");

				if (!empty($adminRolePerms)) {
					$arpStr = '';
					$arpArr = array();
					foreach ($adminRolePerms as $arp) {
						if ($arpStr == '')
							$arpStr = $arp['menu_ids'];
						else
							$arpStr .= ',' . $arp['menu_ids'];
					}
					$arpArr = array_unique(explode(',', $arpStr));


					if (!empty($adminMenuHere)) {
						// dd($adminMenuHere);
						foreach ($adminMenuHere as $key => $menuData) {
							if (in_array($key, $arpArr)) {
								if (isset($menuData[$key]) && !empty($menuData[$key])) {
									$smPageLinks = array();
									foreach ($menuData[$key] as $tmactive) {
										array_push($smPageLinks, $tmactive['page_link']);
									}
									//echo '<pre>'; print_r($smPageLinks);
									//echo $url[1];
									$mmmActive = '';
									if (in_array($url[1], $smPageLinks))
										$mmmActive = 'active';
				?>
									<li class="list listWithDrpdwn <?php echo $mmmActive; ?>">
										<a href="javascript:void(0)" id="btn-1" class="dropdown-toggle " data-toggle="collapse" data-target="#<?php echo $menuData['menu_name'] . '-submenu'; ?>" aria-expanded="false">
											<!-- <img src="<?php echo base_url(); ?>assets_admin/images/<?php echo $menuData['inactive_icon']; ?>" class="icon-inactive"> -->
											<img src="<?php echo base_url(); ?>assets_admin/images/<?php echo $menuData['active_icon']; ?>" class="icon-active">
											<span><?php echo $menuData['menu_name']; ?></span>
										</a>
										<div class="nav collapse" id="<?php echo $menuData['menu_name'] . '-submenu'; ?>" role="menu" aria-labelledby="btn-1">

											<?php
											foreach ($menuData[$key] as $subMenu) {
											?>
												<a class="dropdown-item <?php if ($url[1] == $subMenu['page_link']) { ?>active<?php } ?>" href="<?php echo base_url() . $subMenu['page_link']; ?>"><?php echo $subMenu['menu_name']; ?></a>
											<?php
											}
											?>
										</div>
									</li>
								<?php
								} else {
								?>
									<li class="list <?php if ($url[1] == $menuData['page_link']) { ?>active<?php } ?>">
										<a href="<?php echo base_url() . $menuData['page_link']; ?>" class="dropdown">
											<!-- <img src="<?php echo base_url(); ?>assets_admin/images/<?php echo $menuData['inactive_icon']; ?>" class="icon-inactive"> -->
											<img src="<?php echo base_url(); ?>assets_admin/images/<?php echo $menuData['active_icon']; ?>" class="icon-active">
											<span><?php echo $menuData['menu_name']; ?></span>
										</a>
									</li>
				<?php
								}
							}
						}
					}
				}
				?>
			</ul>

		</aside>
	<?php } ?>