<?php $this->load->view('includes/header'); ?>  
<!-- PAGE TITLE -->
<div class="page-title">                    
  <h2><span ></span><?php echo $heading_title; ?></h2>
  <div class="buttons">
    <?php echo anchor($add_link, "<span><i class='fa fa-plus'></i>Add $heading_title</span>", 'class="btn btn-primary pull-right" '); ?></div>
</div>

<!-- END PAGE TITLE -->                
<!-- PAGE CONTENT WRAPPER -->
<div class="page-content-wrap">                
  <div class="row">
    <div class="col-md-12">
      <?php
      error_message();
      validation_message();
      ?>
      
        <div>
            <?= get_flash(); ?>
        </div>
      <!-- START DEFAULT DATATABLE -->
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="table-responsive">
            <?php
            if (is_array($res) && !empty($res)) {
              echo form_open(current_url(), 'id="data_form"');
              ?>
              <table class="table">
                <?php
                $atts = array(
                    'width' => '650',
                    'height' => '400',
                    'scrollbars' => 'yes',
                    'status' => 'yes',
                    'resizable' => 'yes',
                    'screenx' => '0',
                    'screeny' => '0'
                );
                ?>
                <thead>
                  <tr>
                    <th width="31" style="text-align: center;">
                      <input type="checkbox" onclick="$('input:checkbox').not(this).prop('checked', this.checked);" /></th>
                    <th>Title</th>
                    <th>Image</th>
                    <th>Status</th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                  foreach ($res as  $pageVal) {
                    $imgdisplay = FALSE;
                    $displayorder = "0";
                    ?>
                    <tr>
                      <td>
                        <input type="checkbox" name="arr_ids[]" value="<?php echo $pageVal['id']; ?>" />
                      </td>
                      <td>
                        <?php echo $pageVal['title']; ?>
                      </td>
                      <td><img src="<?php echo get_image('gallery', $pageVal['path'], 50, 50, 'AR'); ?>"</td>
                      <td><?php echo ($pageVal['status'] == 1) ? "Active" : "In-active"; ?></td>
                      <td>
                        <?php echo anchor($edit_link.'/'.$pageVal['id'], "<span><i class='icon-edit'></i>Edit</span>", 'class="btn btn-info" '); ?>
                      </td>
                    </tr>
                    <?php
                  }
                  ?>
                </tbody>
              </table>
              <table class="list" width="100%"> 
                <tr>
                  <td align="left" style="padding:5px">
                    <input name="status_action" type="submit"  value="Activate" class="button2" id="Activate" onClick="return validcheckstatus('arr_ids[]', 'Activate', 'Record', 'u_status_arr[]');"/>

                    <input name="status_action" type="submit" class="button2" value="Deactivate" id="Deactivate"  onClick="return validcheckstatus('arr_ids[]', 'Deactivate', 'Record', 'u_status_arr[]');"/>

                    <input name="status_action" type="submit" class="button2" id="Delete" value="Delete"  onClick="return validcheckstatus('arr_ids[]', 'delete', 'Record');"/>

                  </td>
                </tr>
                </tbody>
              </table>

              <?php echo form_close(); ?>

            <?php } else { ?>
              <center><strong><?php echo "No Record(s) Found!" ?></strong></center>
            <?php } ?>
          </div>
        </div>
      </div>
      <!-- END DEFAULT DATATABLE -->
    </div>
  </div>                                

</div>
<!-- PAGE CONTENT WRAPPER -->                                
<?php $this->load->view('includes/footer'); ?>