<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
$this->session = session();
  echo view('user/common_style');
?>
<link rel="stylesheet" href="<?php echo base_url('styles/fonts/Socialico/stylesheet.css');?>">
<link rel="stylesheet" href="<?php echo base_url('styles/css/table.css');?>">
<script src="<?php echo base_url('styles/js/modernizr.js');?>"></script>
<style>
  .contact_one .contact_left_content form input[type="text"]{border:0px;}
</style>
</head>
<body>
  
    <?php
      echo view('user/header');
      echo view('user/login_header');
      // echo view('user/profileboard');
    ?>
    
        <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
            <div class="table-list clearfix">
                <h4 class="other-title theme-color"><?php echo lang('language_lang.menu_loginlogs');?></h4>
                  <div class="table-responsive main-table">
                    <table>
                      <thead>
                        <tr>
                          <th><?php echo lang('language_lang.lbl_sno');?></th>
                          <th><?php echo lang('language_lang.datatime');?></th>
                          <th><?php echo lang('language_lang.admin_ipadd_lbl');?></th>
                          <th><?php echo lang('language_lang.plac_field_enable');?></th>
                          <th><?php echo lang('language_lang.text_language');?></th>
                        </tr>
                      </thead>
                      <tbody>
                       <?php

                        if($logindata)
                        { 
                          $i='0';
                          foreach ($logindata as $key)
                          {
                              $now   = date('Y-m-d H:i:s'); 
                              $start = date('Y-m-d H:i:s',strtotime($key->datatime));
                              $date1 = new DateTime($start);
                              $date2 = new DateTime($now);
                              $diff = $date2->diff($date1)->format("%h,%i,%s");
                              $diff = explode(',',$diff);

                              if($key->status=='success')
                              {
                                $label='label-success';
                              }
                              else
                              {
                                $label='label-danger';
                              }

                              $condition = "language_id = '".$key->language."'";
                              $act_lang_data = $this->common_model->GetRow("language_controls",$condition);
                            $i++;
                            ?>
                            <tr>
                              <td><?php echo $i;?></td>
                              <td><span class="grey"><?php echo date('Y-m-d H:i a',strtotime($key->datatime));?><p style="font-size:11px;">
                              <?php if($diff[0]!='0'){ echo $diff[0].' '.'hrs';}?>
                              <?php if($diff[1]!='0'){ echo $diff[1].' '.'mins';}?>
                              <?php if($diff[2]!='0'){ echo $diff[2].' '.'secs';}?></p> 

                              </span></td>
                              <td><span class="grey"><?php echo $key->ip_address;?> </span></td>
                              <td><p class="<?php echo $label;?>" style="color:white;padding-left:10px;font-weight:400"><?php echo $key->status;?></p></td>
                               <td><span class="grey"><?php echo ucwords($act_lang_data->language_name);?></span></td>
                            </tr>
                           <?
                           }
                        }?> 
                      </tbody>
                    </table>
                  </div>
            </div>

            <div class="table-list clearfix mt-20">
                <h4 class="other-title theme-color"><?php echo lang('language_lang.menu_securitylogs');?></h4>
                  <div class="table-responsive  main-table">
                    <table>
                      <thead>
                        <tr>
                          <th><?php echo lang('language_lang.lbl_sno');?></th>
                          <th><?php echo lang('language_lang.datatime');?></th>
                          <th><?php echo lang('language_lang.admin_ipadd_lbl');?></th>
                          <th><?php echo lang('language_lang.operations');?></th>
                        </tr>
                      </thead>
                      <tbody>
                       <?php
                        if($securitydata)
                        { 
                          $i='0';
                          foreach ($securitydata as $key)
                          {
                              $now   = date('Y-m-d H:i:s'); 
                              $start = date('Y-m-d H:i:s',strtotime($key->datatime));
                              $date1 = new DateTime($start);
                              $date2 = new DateTime($now);
                              $diff = $date2->diff($date1)->format("%h,%i,%s");
                              $diff = explode(',',$diff);

                              if($key->status=='success')
                              {
                                $label='label-success';
                              }
                              else
                              {
                                $label='label-danger';
                              }

                              $condition = "language_id = '".$key->language."'";
                              $act_lang_data = $this->common_model->GetRow("language_controls",$condition);
                            $i++;
                            ?>
                            <tr>
                              <td><?php echo $i;?></td>
                              <td><span class="grey"><?php echo date('Y-m-d H:i a',strtotime($key->datatime));?><p style="font-size:11px;">
                              <?php if($diff[0]!='0'){ echo $diff[0].' '.'hrs';}?>
                              <?php if($diff[1]!='0'){ echo $diff[1].' '.'mins';}?>
                              <?php if($diff[2]!='0'){ echo $diff[2].' '.'secs';}?></p> 

                              </span></td>
                              <td><span class="grey"><?php echo $key->ip_address;?> </span></td>
                              <td><span><?php echo $key->pages;?></span></td>
                            </tr>
                           <?
                           }
                        }?> 
                      </tbody>
                    </table>
                  </div>
            </div>            
        </div>
      </div>
    </div>
    </div>

<?php
 echo view('user/footer'); 
echo view('user/common_script'); 
?>
</body>
</html>
