<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Communicator
      </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>

    <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/message/send">Add Event Message</a>
             </div>
               
              <div></div>
            <!-- /.box-header -->
            <div class="box-body">
            <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>#</th>
                  <th>Date</th>
                  <th>Category</th>
                  <th>Title</th>
                  <th>Language</th>
                  <th>Subject</th>
                  <th>Receipent</th>
                  <th>Opened</th>
                  <th>Clicked</th>
                  <th>Answered</th>
                  <th>Action</th>
                </tr>
                </thead>
              <?php if(count($datas)>0)
                {?>
                <tbody>
               <?php
                $i=1;
                foreach ($datas as $data) 
                {
                ?>
                <tr>
                    <td><?php echo $i; ?></td>
                    <td><?php echo $data['date']; ?></td>
                    <td><?php if($data['category']==1) { echo 'Email'; }else{ echo 'SMS'; } ?></td>
                    <td><?php if($data['event_id']==1000000){ echo 'TEST'; } else { echo $data['title'];} ?></td>
                    <td><?php if($data['language_id']==1) { echo 'DE'; }elseif($data['language_id']==2){ echo 'EN'; }else{ echo 'ES'; } ?></td>
                    <td><?php echo $data['subject']; ?></td>
                    <td><?php echo $data['receipent']; ?></td>
                    <td><?php echo $data['open']; ?></td>
                    <td><?php echo $data['click']; ?></td>
                    <td>----</td>
                    <td><a href="<?php echo base_url();?>admin/message/communicator_details/<?php echo base64_encode($data['id']);?>" title="Details"><span class="fa fa-eye"></span></a></td>
                </tr>

               <?php $i++; } ?>
                
               <?php }else{ ?>
               <tr><td colspan="8">No records found...</td></tr>
               <?php } ?>
                </tbody>
                <tfoot>
               
                </tfoot>
              </table>
              
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    

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

    $('.custom_pagination a').click(function(e){
      e.preventDefault();
      $('#search_frm').attr('action',$(this).attr('href'));
      $('#search_frm').submit();
    })
  });
</script>