<!DOCTYPE html>
<html lang="en">
<head>
	<!-- Main navbar -->
		<?php

		$session = session();
		use App\Libraries\MyEncrypt;

		 echo view('admin/common_header'); ?>
	<!-- /main navbar -->
	<!-- Bootsrap form validation JS files -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/formValidation.js');?>"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/bootstrap.js');?>"></script>

	<!-- Theme JS files -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/tables/datatables/datatables.min.js');?>"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/tables/datatables/extensions/responsive.min.js');?>"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/forms/selects/select2.min.js');?>"></script>

	<script type="text/javascript" src="<?php echo base_url('assets/js/core/app.js');?>"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/pages/datatables_responsive.js');?>"></script>
	<!-- /theme JS files -->

	<!-- notify JS files -->
    <script type="text/javascript" src="<?php echo base_url('assets/js/plugins/notifications/jgrowl.min.js');?>"></script>
    
    <link href="<?php echo base_url('assets/css/icons/fontawesome/styles.min.css');?>" rel="stylesheet" type="text/css">

	<!-- Theme JS files -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/notifications/bootbox.min.js');?>"></script>
	<!-- /theme JS files -->
</head>

<body class="navbar-top-md-md pace-done">
<style>
.icons-list > li {
    display: inline-block;
    font-size: 26px;
    }
    .heading-elements .icons-list {
    margin-top: 5px;
}
</style>
	<!-- Fixed navbars wrapper -->
	<div class="navbar-fixed-top">

		<!-- Main navbar -->
		<?php echo view('admin/mainnav'); ?>
		<!-- /main navbar -->

		<!-- Second navbar -->
		<?php echo view('admin/secondnav'); ?>
		<!-- /second navbar -->

	</div>
	<!-- /fixed navbars wrapper -->

	<!-- Page header -->
	<div class="page-header">
		<div class="page-header-content">
			<div class="page-title">
				<h4><i id="icon-bck" class="icon-arrow-left52 position-left"></i> <span class="text-semibold"><?php echo lang('language_lang.checkip_lbl'); ?></h4>

				<ul class="breadcrumb breadcrumb-caret position-right">
					<?php foreach ($breadcrumbs as $breadcrumb) { if(isset($breadcrumb['href'])){?>
					    <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
					<?php } else { ?> <li><?php echo $breadcrumb['text']; ?></li><?php } } ?>
				</ul>
			</div>
			<?php echo view('admin/'.$module_name.'_header'); ?>
		</div>
	</div>
	<!-- /page header -->


	<!-- Page container -->
	<div class="page-container">

		<!-- Page content -->
		<div class="page-content">

			<!-- Main content -->
			<div class="content-wrapper">
                  <div class="row"> 
                   <div class="col-lg-6">
				<!-- Basic responsive configuration -->
				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title"><?php echo lang('language_lang.checkip_lbl'); ?></h5>
						<div class="heading-elements">
						    <ul class="icons-list">
		                		<li><a data-action="collapse"></a></li>
		                		<li><a data-action="reload"></a></li>
		                		<li><a data-action="close"></a></li>
		                	</ul>
	                	</div>
					</div>
					<table class="table datatable-responsive-block-ip table-hover">
					<colgroup>
						<col width="50%">
						<col width="50%">
						<col width="50%">
					</colgroup>
						<thead>
							<tr><th></th>
								<th class="text-center"><?php echo lang('language_lang.ip_lbl');?></th>
								<th class="text-center"><?php echo lang('language_lang.ip_quantity_lbl');?></th>
							</tr>
						</thead>
						<tbody>
						<?php
							if($ip_list) {
								$row_count = count($ip_list);
								$myencrypt = new MyEncrypt;
								foreach ($ip_list as $row) {
                                     
								     $quantity = $this->common_model->RecordCount('uusers_online','uusers_ip = "'.$row->uusers_ip.'"')

							?>
							<tr>
							    <td></td>
							    <td class="text-center"><a onclick="iplist('<?php echo $myencrypt->encode($row->uusers_ip); ?>')"><?php echo $row->uusers_ip;?></a></td>
								<td class="text-center">
									<?php echo $quantity; ?>
								</td>
							</tr>
						<?php 

								}
							}  else { 

						?>
							<?php } ?>
						</tbody>
					</table>
				</div>
				<!-- /basic responsive configuration -->
				<!-- Basic modal -->
           

                 </div>
                <div class="col-lg-6">
				<!-- Basic responsive configuration -->
				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title"><?php echo lang('language_lang.ip_Details'); ?></h5>
						<div class="heading-elements">
						    <ul class="icons-list">
		                		<li><a data-action="reload"></a></li>
		                		<li><a data-action="close"></a></li>
		                	</ul>
	                	</div>
					</div>
                  
              
                  <table class="table datatable-responsive-referral table-hover">
<colgroup>
						<col width="12%">
						<col width="12%">
						<col width="20%">
						<col width="5%">
					</colgroup>
						<thead>
							<tr>
							<th></th>

							<th class="text-center"><?php echo lang('language_lang.exp_report_sno'); ?></th>
								<th class="text-center"><?php echo lang("language_lang.plac_smtp_username"); ?></th>
								<th class="text-center"><?php echo lang("language_lang.lbl_date"); ?></th>
								<th class="text-center"><?php echo lang("language_lang.lbl_action"); ?></th>
							</tr>
						</thead>
						<tbody>
						<?php 
						if(isset($display_access)) {
                                $i=1;
								$row_count = count($display_access);
								$myencrypt = new MyEncrypt;
								foreach ($display_access as $row) {

									 if($row->user_type == 'admin' || $row->user_type == 'subadmin'){
									   	$user_condition = "id = '".$row->uusers_id."'";
									    $admin_status = $this->common_model->GetRow('admin',$user_condition);
									    $username = $admin_status->username;
								   }
									else{
										$condition = "uusersid = $row->uusers_id";
										$user = $this->common_model->GetRow("uusers",$condition);
										$username = $user->username;
									}
									?>
		
							
			<tr>								<td></td>
								<td class="text-center"><?php echo $i; ?></td>
								<td class="text-center"><?php echo $username; ?></td>
							    <td class="text-center"><?php echo $row->lastaccess; ?></td>
								<td class="text-center"><ul class="icons-list">
										<li class="dropdown">
											<a href="#" class="dropdown-toggle" data-toggle="dropdown">
												<i class="icon-menu9"></i>
											</a>

											<ul class="dropdown-menu dropdown-menu-right <?php if($row_count=='1' || $row_count=='2') { echo 'inline-drop'; }?>">
												<li><a onclick="editFunc('<?php echo $myencrypt->encode($row->user_type); ?>')" href="javascript:void(0)"><i class="fa fa-search"></i> <?php echo lang('language_lang.lbl_view');?></a></li>
												<li><a onclick="confirmdelete('<?php echo $myencrypt->encode($row->users_onlineid);?>')" href="javascript:void(0)" ><i class="fa fa-remove"></i> <?php echo lang('language_lang.delete');?></a></li>
											</ul>
										</li>
									</ul>
								</td>

							</tr>
							<?php $i++; }
							}  else { 

							 } ?>
							</tbody>
					                  </table>
              

                     
				</div>

				 <!-- Info modal -->
				<div id="modal_theme_info" class="modal fade">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header bg-info">
								<button type="button" class="close" data-dismiss="modal">&times;</button>
								<h6 class="modal-title"><?php echo lang('language_lang.account_info_menu'); ?></h6>
							</div>

							<div class="modal-body">
								
							</div>

							<div class="modal-footer">
								<button type="button" class="btn btn-info" data-dismiss="modal">Close</button>
							</div>
						</div>
					</div>
				</div>
				<!-- /info modal -->

			</div>

                 </div>
			</div>
			<!-- /main content -->

		</div>
		<!-- /page content -->


		<!-- Footer -->
		<div class="footer text-muted">
			<?php echo site_footer();?>
		</div>
		<!-- /footer -->

	</div>
	<!-- /page container -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/notifications/sweet_alert.min.js');?>"></script>

	<script type="text/javascript">
jQuery.noConflict();
		(function( $ ) {
		$(function() {

			$(document).ready(function() {

				<?php if($session->getFlashData('error_message')) { ?>
					$.jGrowl("<?php echo $session->getFlashData('error_message');?>", {
			            header: '<?php echo lang("language_lang.error");?>',
			            theme: 'bg-danger'
			        });
	            <?php } ?>
	                    
	            <?php if($session->getFlashData('success_message')) { ?>
	                $.jGrowl("<?php echo $session->getFlashData('success_message');?>", {
			            header: '<?php echo lang("language_lang.success");?>',
			            theme: 'bg-success'
			        });
	            <?php } ?>

	        
	            
	          
			  

			});
		    
		 	$('#icon-bck').on('click',function() {
				window.history.back();
			});

			



		});
		})(jQuery);

		
	
	function confirmdelete(value) {
		swal({
            title: "<?php echo lang('language_lang.delete_changeip');?>",
            showCancelButton: true,
            closeOnConfirm: false,
            confirmButtonColor: "#2196F3",
            showLoaderOnConfirm: true
        },
       function(inputValue) {
            if(inputValue === true){
             window.location.href = "<?php echo base_url('admin/checkip/delete/');?>"+'/'+value;
            }
            else {
              return false;
            }

		});
    }
     
                 function iplist(ip){
                 	var values = ip;

                 	window.location.href = "<?php echo base_url('admin/checkip/listip/');?>"+'/'+values;

                 }
	function editFunc(valus) {
        var valus1 =  valus;
        jQuery.ajax({
	        url:'<?php echo base_url('admin/checkip/view/'); ?>'+'/'+valus1,
	        success : function(resp)
	        {
	            if(resp){
	              jQuery('#modal_theme_info').modal();
	              jQuery('.modal-body').html(resp);	
	          }
	            
	        }
		});
	}
		
	</script>

</body>
</html>
