<form name="myform" action=""  method="post">
    <table class="table table-striped">
        <thead>
            <tr>
                <th><input type="checkbox" name="all_user" id="all_user" onchange="toggleAllUserSelection(document.myform.user_id)"/></th>
                <th>User ID</th>
                <th>Profile Picture</th>
                <th>User Name</th>
                <th>User Email</th>
                <th>Contact Number</th>
                <th>Role</th>
                <th>Status</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <?php
            $i = 1;
            foreach ($users as $v_user) {
                ?>
                <tr>
                    <td><input name="user_id" id="user_id<?php echo $v_user->user_id; ?>" type="checkbox"  value="<?php echo $v_user->user_id; ?>" onchange="setUserIdList(this.value);"/></td>
                    <td><?php echo $v_user->user_id ?></td>
                    <td><img src="<?php echo base_url() . $v_user->user_image_thumb; ?>" width="50" height="50"> </td>
                    <td><?php echo $v_user->first_name . ' ' . $v_user->last_name; ?></td>
                    <td><?php echo $v_user->user_email ?></td>
                    <td><?php echo $v_user->contact_number ?></td>
                    <td>
                        <?php
                        if ($v_user->user_role_id == '1') {
                            echo 'babbamamma';
                        }
                        if ($v_user->user_role_id == '2') {
                            echo 'Account';
                        }
                        if ($v_user->user_role_id == '3') {
                            echo 'Resource';
                        }
                        if ($v_user->user_role_id == '4') {
                            echo 'Register';
                        }
                        ?><br>
                        <a href="#" class="" data-toggle="modal" data-target="#changeRole">Change Role</a>
                    </td>
                    <td><?php
                        if ($v_user->status == '1') {
                            echo '<p style="color:limegreen;">Active</p>';
                            ?>
                            <a href="<?php echo base_url(); ?>super_admin/make_user_inactive/<?php echo $v_user->user_id; ?>"><i class="fa fa-user-times" title="Inactive"></i></a>
                            <?php
                        } else if ($v_user->status == '2') {
                            echo '<p style="color:red;">Inactive</p>';
                            ?>

                            <a href="<?php echo base_url(); ?>super_admin/make_user_active/<?php echo $v_user->user_id; ?>">
                                <i class="fa fa-user-plus" title="Active"></i></a>
                            <?php
                        } else {
                            echo '<p style="color:blue;">Archived';
                            ?>
                            <a href="<?php echo base_url(); ?>super_admin/make_user_active/<?php echo $v_user->user_id; ?>"><i class="fa fa-user-plus" title="Active"></i> </a>
                        <?php } ?>
                    </td>

                    <td>
                        <a href="<?php echo base_url(); ?>super_admin/edit_user_information/<?php echo $v_user->user_id; ?>"><div class="span1"><i class="fa fa-edit">Edit</i></div></a>
                        <?php if ($v_user->status != 3) { ?><a href="<?php echo base_url(); ?>super_admin/delete_user/<?php echo $v_user->user_id; ?>" onclick="return checkAction('delete');"><i class="fa fa-remove">Delete</i></a><?php } ?>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
    <br>
</form>

<div class="col-lg-12 col-md-12 col-sm-12" >
    <hr>
    <form name="pagination">
        <div class="col-lg-2 col-md-2 col-sm-2">
            <label for="per_page_user">Per Page: </label>
            <select name="per_page" onchange="setPerPage(this.value);">
                <option value='0'>0</option>
                <option value='10'>10</option>
                <option value='25'>25</option>
                <option value='50'>50</option>
                <option value='100'>100</option>
                <option value='200'>200</option>
                <option value='250'>250</option>
                <option value='500'>500</option>
                <option value='all'>All</option>
            </select><p>This Page :<?php echo $this_page . '/' . $total_user; ?></p>
        </div>

        <div class="col-lg-2 col-md-2 col-sm-2">
            <a href="<?php echo base_url(); ?>super_admin/user_list/<?php echo $user_role . '/' . '1'; ?>" class='btn btn-sm btn-success'>Start</a>
            <a href="<?php echo base_url(); ?>super_admin/user_list/<?php echo $user_role . '/' . '1'; ?>" class='btn btn-sm btn-success'>Prev</a>
        </div>
        <div class='col-lg-5 col-md-5 col-sm-5'>
            <?php
            $limit = $this->session->userdata('per_page');
            if ($limit == NULL) {
                $limit = 10;
            }
            $number_of_pages = $total_user / $limit;
            ?>
            <?php for ($i = 0; $i < $number_of_pages; $i++) { ?>
                <a href="<?php echo base_url(); ?>super_admin/<?php echo 'user_list' . '/' . $this->uri->segment(3) . '/' . $this->uri->segment(4) . '/' . $i * $limit; ?>" class='btn btn-sm btn-default'><?php echo $i; ?></a>
            <?php } ?>
        </div>
        <div class="col-lg-2 col-md-2 col-sm-2">
            <a href="<?php echo base_url(); ?>super_admin/user_list/<?php echo $user_role . '/' . '1'; ?>" class='btn btn-sm btn-success'>Next</a>
            <a href="<?php echo base_url(); ?>super_admin/user_list/<?php echo $user_role . '/' . '1'; ?>" class='btn btn-sm btn-success'>Last</a>
        </div>
    </form>
    <br>
    <hr>
</div>

<script type="text/javascript">
                    document.forms['pagination'].elements['per_page'].value = '<?php echo $limit; ?>';
                    document.forms['control_form'].elements['user_status'].value = '<?php echo $this->session->userdata('status'); ?>';
                    document.forms['control_form'].elements['user_role_id2'].value = '<?php echo $this->session->userdata('role_id'); ?>';
</script>