<?php
$CI =& get_instance();
$CI->lang->load('header', $CI->session->userdata('language'));
$_c = strtolower($CI->router->fetch_class());
$_a = strtolower($CI->router->fetch_method());
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SPS E-Voting</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/fonts/font-awesome.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/fonts/ionicons.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/fonts/Roboto/Roboto.css">

<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/adminlte/AdminLTE.css">
<!-- <link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/theme/common.css"/> -->
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/theme/extension.css"/>
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/theme/hover.css"/>
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/theme/animate.css"/>
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/theme/admin/main.css"/>
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/theme/admin/dashboard.css"/>

<link rel="stylesheet" href="<?php echo base_url(); ?>dist/js/jquery/jquery-ui.css"/>
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/vendors/validationengine/validationEngine.css">

<script src="<?php echo base_url(); ?>dist/js/jquery/jquery-2.1.1.min.js"></script>
<script src="<?php echo base_url(); ?>dist/js/jquery/jquery-easing.js"></script>
<script src="<?php echo base_url(); ?>dist/js/jquery/jquery-ui.js"></script>
<script src="<?php echo base_url(); ?>dist/vendors/touch-punch/jquery.ui.touch-punch.min.js"></script>
<script src="<?php echo base_url(); ?>dist/js/modernizr-2.6.2.min.js"></script>
<script src="<?php echo base_url(); ?>dist/vendors/debounce/debounce.js"></script>

<!--[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]-->
</head>


<body class="hold-transition skin-sps-evoting sidebar-mini">

<div class="wrapper">

	<?php
	// GETTING USER PROFILE IMAGE		
	$abso = str_replace("\\","/", FCPATH);
	$virt = str_replace("\\","/", base_url());
	$user = $this->session->userdata('logged_in');
	$projectID = $this->session->userdata('projectID');
	$CI->load->model('account/accountmain','accmain');
	$userImageFile = $CI->accmain->getUserProfileImage($user['userID']);	
	$userProfileImage = $virt."dist/img/_sys/user.png";
	if($userImageFile && file_exists($abso."img/profile/".$userImageFile)) $userProfileImage = $virt."img/profile/".$userImageFile;
	unset($userImageFile);
	?>
	
	<header class="main-header">
		<a href="<?php echo base_url() ?>dashboard" class="logo">
			<div class="logo-mini" style="height: 100%; margin: 0 auto;"><img class="img-responsive-reverse" src="<?php echo base_url(); ?>dist/img/logo/logo_mini.png" /></div>
			<div class="logo-lg" style="height: 100%; margin: 0 auto;"><img class="img-responsive-reverse" src="<?php echo base_url(); ?>dist/img/logo/logo_xs.png" /></div>
		</a>

    <nav class="navbar navbar-static-top">
		
      <a href="<?php echo base_url() ?>dashboard" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">Toggle navigation</span></a>
			
      <ul class="m-2-x nav navbar-nav pull-left">
				<li>
					<a href="<?php echo base_url(); ?>"><i class="fa fa-rocket"></i>&nbsp;&nbsp;&nbsp;<span><?php echo $this->lang->line('goto'); ?></span></a>
				</li>
			</ul>
			
      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">				
          <li class="dropdown messages-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-globe fa-fw"></i>
              <span class="label label-success"><?php echo $this->session->userdata('language'); ?></span>
            </a>
            <ul class="dropdown-menu" style="height:158px">
              <li class="header"><?php echo $this->lang->line('selectlanguageheader'); ?></li>
              <li>
							
                <ul class="menu">
                  <li>
                    <a href="<?php echo base_url() ?>changeLanguage/language/en">
                      <div class="pull-left">
                        <img src="<?php echo base_url(); ?>dist/img/english.jpg" class="img-circle" alt="User Image">
                      </div>
                      <p style="font-size:16px">English</p>
                    </a>
                  </li>
									
                  <li>
                    <a href="<?php echo base_url() ?>changeLanguage/language/ms">
                      <div class="pull-left">
                        <img src="<?php echo base_url(); ?>dist/img/malay.jpg" class="img-circle" alt="User Image">
                      </div>
                      <p style="font-size:16px">Melayu</p>
                    </a>
                  </li>
                  
                </ul>
              </li>
            </ul>
          </li>
          
          <li class="dropdown user user-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <img src="<?php echo $userProfileImage; ?>" class="user-image" alt="User Image">
              <span class="hidden-xs"><?php echo $user['username']; ?></span>
            </a>
            <ul class="dropdown-menu">
              <li class="user-header">
                <img src="<?php echo $userProfileImage; ?>" class="img-circle" alt="User Image">
                <p class="text-white">
                  <h3 class="text-white"><?php echo $user['username']; ?></h3>
                  <small class="text-white"><?php echo $user['email']; ?></small>
                </p>
              </li>
							
              <li class="user-footer">
                <div class="pull-left">
                  <a href="<?php echo base_url(); ?>account" class="btn btn-primary btn-flat"><?php echo $this->lang->line('profileheader'); ?></a>
                </div>
                <div class="pull-right">
                  <a href="<?php echo base_url() ?>logout" class="btn btn-danger btn-flat"><i class="fa fa-power-off"></i>&nbsp;<?php echo $this->lang->line('signoutheader'); ?></a>
                </div>
              </li>
            </ul>
          </li>
				</ul>
      </div>

    </nav>
  </header>
  
  <aside class="main-sidebar">
	
    <section class="sidebar">
      <?php
	  	$CI =& get_instance();
		$CI->load->model('header_model');
		
		$totalDesignation = $CI->header_model->getDesignation();
		$totalCandidate = $CI->header_model->getCandidate();
		$totalVoter = $CI->header_model->getVoter();
		$totalVote = $CI->header_model->getVote();
		$totalCompany = $CI->header_model->getCompany();
		$totalBlock = $CI->header_model->getBlock();
		
	  ?>
      <ul class="sidebar-menu m-1-t">
        <li class="<?php echo ($_c == 'project') ? 'active' : NULL; ?> treeview">
          <a href="<?php echo base_url(); ?>project">
            <i class="fa fa-briefcase"></i> <span><?php echo ($menutext = $this->lang->line('menuproject')) ? $menutext : $this->lang->line('project'); ?></span>
          </a>
        </li>
				
        <li class="<?php echo ($_c == 'dashboard') ? 'active' : NULL; ?> treeview">
          <a href="<?php echo base_url(); ?>dashboard">
            <i class="fa fa-dashboard"></i> <span><?php echo $this->lang->line('menudashboard'); ?></span>
          </a>
        </li>
			
				<li class="<?php echo ($_c == 'voter' || $_c == 'company') ? 'active' : NULL; ?> treeview">
					<a href="#">
						<i class="fa fa-users"></i>
						<span><?php echo $this->lang->line('menuvoter'); ?></span>
						<i class="fa fa-angle-left pull-right"></i>
					</a>
					<ul class="treeview-menu">
						<li class="<?php echo ($_c == 'voter') ? 'active' : NULL; ?> treeview">
							<a href="<?php echo base_url(); ?>voter">
								<i class="fa fa-user"></i> <span><?php echo $this->lang->line('voterPersonal'); ?></span>
								<span class="pull-right-container">
									<small class="label pull-right bg-green"><?php echo $totalVoter[0]->totalVoter; ?></small>
								</span>
							</a>
						</li>
						
						<li class="<?php echo ($_c == 'company') ? 'active' : NULL; ?> treeview">
							<a href="<?php echo base_url(); ?>company">
								<i class="fa fa-building"></i>
								<span><?php echo $this->lang->line('voterEntity'); ?></span>
								<span class="pull-right-container">
									<small class="label pull-right bg-yellow"><?php echo $totalCompany[0]->totalCompany; ?></small>
								</span>
							</a>
						</li>
					</ul>
				</li>
				
        <li class="<?php echo ($_c == 'position') ? 'active' : NULL; ?> treeview">
          <a href="<?php echo base_url(); ?>position">
            <i class="fa fa-edit"></i> <span><?php echo $this->lang->line('menudesignation'); ?></span>
            <span class="pull-right-container">
              <small class="label pull-right bg-orange"><?php echo $totalDesignation[0]->totalPosition; ?></small>
            </span>
          </a>
        </li>
				
        <li class="<?php echo ($_c == 'candidate') ? 'active' : NULL; ?> treeview">
          <a href="<?php echo base_url(); ?>candidate">
            <i class="fa fa-files-o"></i>
            <span><?php echo $this->lang->line('menucandidate'); ?></span>
            <span class="pull-right-container">
              <span class="label label-primary pull-right"><?php echo $totalCandidate[0]->totalCandidate; ?></span>
            </span>
          </a>
        </li>
				
        <li class="<?php if($this->session->userdata('menu') == "vote"){ echo "active"; }?> treeview">
          <a href="<?php echo base_url(); ?>vote">
            <i class="fa fa-book"></i> <span><?php echo $this->lang->line('menuvote'); ?></span>
            <span class="pull-right-container">
              <small class="label pull-right bg-purple" id="refreshtotalvotemenu"><?php echo $totalVote[0]->totalVote; ?></small>
            </span>
          </a>
        </li>
        <li class="<?php echo ($_c == 'block') ? 'active' : NULL; ?> treeview">
          <a href="<?php echo base_url(); ?>block">
            <i class="fa fa-laptop"></i> <span><?php echo $this->lang->line('menublock'); ?></span>
            <span class="pull-right-container">
              <small class="label pull-right bg-red"><?php echo $totalBlock[0]->totalBlock; ?></small>
            </span>
          </a>
        </li>
				
        <li class="<?php echo ($_c == 'result') ? 'active' : NULL; ?> treeview">
          <a href="<?php echo base_url(); ?>result">
            <i class="fa fa-envelope"></i> <span><?php echo $this->lang->line('menuresult'); ?></span>
          </a>
        </li>
				
        <li class="<?php echo ($_c == 'account') ? 'active' : NULL; ?> treeview">
          <a href="<?php echo base_url(); ?>account">
            <i class="fa fa-book"></i> <span><?php echo ($menutext = $this->lang->line('menuaccount')) ? $menutext : $this->lang->line('accBilling'); ?></span>
          </a>
        </li>
      </ul>
    </section>
    
  </aside>
				
		
	<?php
	// MESSAGE
	if(isset($respond) && $respond['message']) {
		?>
		<div class="<?php echo $respond['type'] ? strtolower($respond['type']) : NULL; ?> text-center flash-data">
		<span class="text"><?php echo ($respond['message']) ? $respond['message'] : ((strtolower($respond['type']) == 'success') ? 'Success' : NULL); ?></span>
		<span class="close">&nbsp;x&nbsp;</span>
		</div>
		<?php
	}
	
	$this->load->view('layouts/progress');
	?>
	

  

  

  
  
