<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Newslettter activity users
      </h1>
      <ol class="breadcrumb">
        <li><a href="<?php echo base_url().'admin';?>"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">List</li>
      </ol>
    </section>
    <form action="" method="post">
    <section class="content">
      <div class="row">
        <?php echo $this->utility->showMsg();?>
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Management</h3>
                <a class="btn btn-primary margin-right pull-right" href="<?php echo base_url()?>admin/activity/add">Add</a>
              </div>
               
              <div></div>
            <!-- /.box-header -->
            <div class="box-body">
            <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>Week</th>
                  <th>Couple of the week</th>
                  <th>Lady of the week</th>
                  <th>Gentleman of the week</th>
                  <th>Status</th>
                  <th>Action</th>
                </tr>
                </thead>
                 <?php if(count($couple_lady)>0)
                {?>
                <tbody>
               <?php
                $sent=0;
                $ladyImage = array();
                $lady = array();
                foreach ($couple_lady as $data) 
                {
                  $lady = getValue('feu_userdetails',array('user_id'=>$data['lady']));
                  if(!empty($lady) && $lady['avatar_file_id']>0)
                  {
                    $ladyImage = getValue('sys_files',array('id'=>$lady['avatar_file_id']));
                    //echo $this->db->last_query();
                  }
                  $gentleman = getValue('feu_userdetails',array('user_id'=>$data['gentleman']));
                  if(!empty($gentleman) && $gentleman['avatar_file_id']>0)
                  {
                    $gentlemanImage = getValue('sys_files',array('id'=>$gentleman['avatar_file_id']));
                    //echo $this->db->last_query();
                  }
                ?>
                <tr>
                    <td><?php echo $data['start_date'].' --- '.$data['end_date']; ?></td>
                    <td><?php echo $data['username'].' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="'.base_url().'assets/userfiles/'.$data['path'].'/'.$data['filename'].'.'.$data['extension'].'" width="80">'; ?></td>
                    <td><?php echo $lady['username'].' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="'.base_url().'assets/userfiles/'.$ladyImage['path'].'/'.$ladyImage['filename'].'.'.$ladyImage['extension'].'" width="80">'; ?></td>
                    <td><?php echo $gentleman['username'].' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="'.base_url().'assets/userfiles/'.$gentlemanImage['path'].'/'.$gentlemanImage['filename'].'.'.$gentlemanImage['extension'].'" width="80">'; ?></td>
                    <td><?php if(time()<=strtotime($data['end_date'])){ echo 'Yet to be send'; }else{ echo 'Sent'; } ?></td>
                    <td><a href="<?php echo base_url();?>admin/activity/delete/<?php echo base64_encode($data['id']);?>" title="Delete" onclick="return confirm('Are you sure to delete ?');"><span class="fa fa-ban"></span></a></td>
                </tr>

               <?php } ?>

                </tbody>
                <?php } ?>
                <tfoot>
               
                </tfoot>
              </table>
              
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->

    </section>
    </form>
    <style type="text/css">
      .dataTables_info, .dataTables_paginate {   
      /*display: none;*/
      }
    </style>

    
<script>
  $(function () {
    $("#example1").DataTable();

    $('.custom_pagination a').click(function(e){
      e.preventDefault();
      $('#search_frm').attr('action',$(this).attr('href'));
      $('#search_frm').submit();
    })
  });
</script>
<style type="text/css">
  .dataTables_length, .dataTables_filter{ display: none; }
</style>