<script>
    jQuery(document).ready(function(){                                              
        jQuery("#operation").change(function () {                                        
                                                    
            var len = jQuery("#group:checked").length;
            if (len < 1) {
                alert("لم تقم باختيار أى عنصر");
                jQuery(".defaultOpt").attr("selected", "selected");
                return false;
            } else {
                if (jQuery("option.delete").is(":selected")) {
                    var answer = confirm('هل أنت متأكد من حذف هذه العناصر؟');
                    if (answer == false) {
                        jQuery(".defaultOpt").attr("selected", "selected");                        
                        return false;
                    }
                }
                jQuery("#form").submit();
            }                                            
        });     
    });     
</script>
<!-- Data Grid Start -->
<div class="block">
    <div class="title lightTextShadow"><?php echo $this->lang->line('title_visits_list'); ?> : <?= $user_detail->user_username ?></div>    
    <div class="content">              
        <a href="<?= base_url() ?>authorization/admin_users/" class="button sub inlineBlock rnd3 lightTextShadow">
            <span><?php echo $this->lang->line('button_users'); ?><img src="<?= base_url() ?>global/modules/admin/images/plus-small.gif" width="12" height="9" alt="New new" /></span>
        </a>
        <a href="<?= base_url() ?>authorization/admin_groups" class="button sub inlineBlock rnd3 lightTextShadow">
            <span><?php echo $this->lang->line('button_groups'); ?></span>
        </a>
        <!-- Notification boxes -->
        <?php echo $this->template->flash_msg(); ?>
        <?php if ($user_visits == FALSE) : ?>
            <br/>            
            <p class="block boxStyle notice attention"><a href="javascript:void(0)" class="close"></a><b>تنبيه!</b>لا توجد بيانات مضافة<p>
            <?php else : ?>
            <form method="post" action="<?= base_url() ?>authorization/admin_users/operation/" id="form">                
                <table class="dataGrid tableSorter boxStyle" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                        <tr>                            
                            <th>مسلسل</th>
                            <th><?= lang('pa_vi_title') ?></th>
                            <th><?= lang('pa_vi_link') ?></th>
                            <th><?= lang('pa_vi_time') ?></th> 
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $counter = 1;
                        foreach ($users as $row) :
                            ?>
                            <tr <?php
                    if ($counter % 2 == 1) {
                        echo "class='odd'";
                    }
                            ?>>                                
                                <td class="align-center"><?php echo $counter; ?></td>
                                <td><?= $row['pa_vi_title'] ?></td>
                                <td><a href="<?= base_url() . $row['pa_vi_link'] ?>" onclick="window.open(this.href); return false;"><?= lang('pa_vi_link') ?></a></td>
                                <td><?= date("d - m - Y | H:i ", $row['pa_vi_time']) ?></td>
                            </tr>
                            <?php
                            $counter++;
                        endforeach;
                        ?>
                    </tbody>
                </table>
                <div class="pager">
                    <div class="resultsCount"><b><?php echo $row + 1 ?></b> - <b><?php echo $row + 10 ?></b> / <em><?php echo $total_rows; ?></em></div>
                    <?php echo $links; ?>
                    <fieldset class="formList inlineBlock">
                        <p align="center"><?php echo $this->lang->line('choose_operation'); ?>:
                            <select class="select rnd5" id="operation" name="operation" onchange="" >
                                <option class="defaultOpt" value=""  >--<?php echo $this->lang->line('choose'); ?>--</option>
                                <option class="oButton" value="active"   ><?php echo $this->lang->line('active'); ?></option>
                                <option class="oButton" value="inactive" ><?php echo $this->lang->line('disactive'); ?></option>
                                <option class="oButton delete" value="delete" ><?php echo $this->lang->line('delete'); ?></option>
                            </select>
                        </p>
                    </fieldset>                    
                </div>
            </form>
        <?php endif; ?>
    </div>
</div><!-- Data Grid End -->


<!-- Form elements -->

<div class="grid_12">

    <div class="float-right">

        <a href="<?= base_url() ?>authorization/admin_users" class="button">

            <span>قائمة المستخدمين<img src="<?= base_url() ?>global/modules/admin/images/plus-small.gif" width="12" height="9" alt="New new" /></span>

        </a>

    </div>

    <div class="module">

        <h2><span><?php echo lang('title_visits_list'); ?> : <?= $user_detail->user_username ?></span></h2>

        <div class="module-body">

            <?php echo form_open('visitors/admin_visitors/show', array('id' => 'visitor_display')) ?>

            <?php echo $this->template->flash_msg(); ?>           

            

            <?php if ($user_visits == FALSE) { ?>



                <br/>

                <span class="notification n-attention"><?php echo lang('msg_empty'); ?></span>

            <?php } else { ?>                             

                <!--<div class="module">-->

                <h2><span><?= lang('title_visits_list'); ?></span></h2>

                <!--<div class="module-table-body">-->

                <table id="pageTable" >

                    <thead>

                        <tr>

                            <th>#</th>

                            <th><?= lang('pa_vi_title') ?></th>

                            <th><?= lang('pa_vi_link') ?></th>

                            <th><?= lang('pa_vi_time') ?></th>                                                                                 

                        </tr>

                    </thead>

                    <tbody>

                        <?php

                        $i = 0;

                        foreach ($user_visits as $row) {

                            $i++;

                            ?>

                            <tr <?php if ($i % 2 == 0) echo "class='alt'" ?>>

                                <td><?= $i ?></td>

                                <td><?= $row['pa_vi_title'] ?></td>

                                <td><a href="<?= base_url() . $row['pa_vi_link'] ?>" onclick="window.open(this.href); return false;"><?= lang('pa_vi_link') ?></a></td>                                                                 

                                <td><?= date("d - m - Y | H:i ", $row['pa_vi_time']) ?></td>                                                                 

                            </tr>

                        <?php } ?>

                    </tbody>

                </table>

                <div class="pager" id="pagePager">

                    <div>

                        <?php echo $this->pagination->create_links(); ?>

                    </div>

                </div>



                <div style="clear: both"></div>

                <!--</div>  End .module-table-body -->

                <!--</div>   End .module -->



            <?php } ?>

        </div> <!-- End .module-body -->

    </div>  <!-- End .module -->

    <div style="clear:both;"></div>

</div> <!-- End .grid_12 -->



