<script type="text/javascript">
jQuery(function(){
    // add multiple select / deselect functionality
    jQuery("#selectall").click(function () {
          jQuery('.check_nf').attr('checked', this.checked);
    });
    // if all checkbox are selected, check the selectall checkbox
    // and viceversa
    jQuery(".check_nf").click(function(){
        if(jQuery(".check_nf").length == jQuery(".check_nf:checked").length) {
            jQuery("#selectall").attr("checked", "checked");
        } else {
            jQuery("#selectall").removeAttr("checked");
        }
    });
});
</script>
<div class="grid_12">
<!-- Notification boxes -->
<?php echo $this->template->flash_msg(); ?>
<div class="bottom-spacing">
<!-- Button -->
<div class="float-right">
    <a href="<?= base_url() ?>news/admin_news/overview" class="button">
    	<span><?php echo $this->lang->line('button_news');?><img src="<?= base_url() ?>global/modules/admin/images/plus-small.gif" width="12" height="9" alt="New new" /></span>
    </a>
    <a href="<?= base_url() ?>news/admin_news_category/overview" class="button">
    	<span><?php echo $this->lang->line('button_categories');?><img src="<?= base_url() ?>global/modules/admin/images/plus-small.gif" width="12" height="9" alt="Categories" /></span>
    </a>
</div>
</div>
<?php if($comments_new == FALSE) : ?>
<br/>
<span class="notification n-attention"><?php echo $this->lang->line('msg_empty_comments');?></span>
<?php else :?>
<form method="post" action="<?= base_url()?>news/admin_comments/operation/">
<!-- Example table -->
<div class="module">
<h2><span><?php echo $this->lang->line('comments_list');?></span></h2>
<div class="module-table-body">
    <table id="pageTable" class="tablesorter">
    	<thead>
            <tr>
                <th>#</th>
                <th  ><?php echo $this->lang->line('title_comment');?></th>
	        <th ><?php echo $this->lang->line('created');?></th>
                <th ><?php echo $this->lang->line('new_title');?></th>
                <th ><?php echo $this->lang->line('order');?></th>
                <th ><?php echo $this->lang->line('operation');?></th>
            </tr>
        </thead>
        <tbody>
        <?php
           $counter = 1;
           foreach($comments_new as $c) :
        ?>
        <tr class="tableRow">
            <td class="align-center"><?php echo $counter; ?></td>
            <td ><a href="<?= base_url() ?>news/admin_comments/show/<?= $c['cn_id']; ?>"><?= substr($c['cn_comment'],0,20);           ?></a></td>
            <td><?= date('Y-m-d',$c['cn_created'])?></td>
            <td><?= $c['ne_new_title']?></td>
             <td class="align-center">
                <a href="<?= base_url()?>news/admin_comments/sort/up/<?= $c['cn_id']?>"  ><img src="<?= base_url() ?>global/modules/admin/images/up.png" title="أعلى" alt="up"/></a>
                <a href="<?= base_url()?>news/admin_comments/sort/down/<?= $c['cn_id']?>" ><img src="<?= base_url() ?>global/modules/admin/images/down.png" title="أسفل" alt="down"/></a>
                </td>
             <td class="align-center">
                    <input type="checkbox" name="check_nf[]" class="check_nf"  value="<?= $c['cn_id']?>" />&nbsp;&nbsp; | &nbsp;&nbsp;
                <?php if($c['cn_hide'] == 1) : ?>
                <a href="<?= base_url() ?>news/admin_comments/deactivate/<?= $c['cn_id']; ?>"><img src="<?= base_url() ?>global/modules/admin/images/tick-circle.gif" width="16" height="16"  title="<?php echo $this->lang->line('act');?>" alt="خيارات النشر" /></a>&nbsp;&nbsp; | &nbsp;&nbsp;
               <?php else : ?>
               <a href="<?= base_url() ?>news/admin_comments/activate/<?= $c['cn_id']; ?>"><img src="<?= base_url() ?>global/modules/admin/images/minus-circle.gif" width="16" height="16" title="<?php echo $this->lang->line('inact');?>" alt="خيارات النشر النشر" /></a>&nbsp;&nbsp; | &nbsp;&nbsp;
               <?php endif;?>
                <a href="<?= base_url() ?>news/admin_comments/remove/<?= $c['cn_id']; ?>" class="delete_confirm"><img src="<?= base_url() ?>global/modules/admin/images/del.png" width="16" height="16" title="<?php echo $this->lang->line('delete');?>" alt="حذف"  /></a>
            </td>
        </tr>
            <?php
                $counter ++;
                endforeach;
            ?>
        </tbody>
    </table>
    <div class="pager" id="pagePager">
            <div>
            <img class="first" src="<?= base_url() ?>global/modules/admin/images/arrow-stop.gif" alt="first"/>
            <img class="prev" src="<?= base_url() ?>global/modules/admin/images/arrow.gif" alt="prev"/>
            <input type="text" class="pagedisplay input-short align-center"/>
            <img class="next" src="<?= base_url() ?>global/modules/admin/images/arrow-180.gif" alt="next"/>
            <img class="last" src="<?= base_url() ?>global/modules/admin/images/arrow-stop-180.gif" alt="last"/>
            <select class="pagesize input-short align-center">
                <option value="10" selected="selected">10</option>
                <option value="20">20</option>
                <option value="30">30</option>
                <option value="40">40</option>
            </select>
            </div>
    </div>
    <p style="margin-right: 77%;">
        <input type="checkbox" name="check_nf2" id="selectall" /><?php echo $this->lang->line('all');?>
    </p>
    <p align="left"><?php echo $this->lang->line('choose_operation');?>:
	 <select class="input-short" name="operation" onChange="this.form.submit()" >
          <option value=""  >--<?php echo $this->lang->line('choose');?>--</option>
          <option value="active"   ><?php echo $this->lang->line('active');?></option>
          <option value="inactive" ><?php echo $this->lang->line('disactive');?></option>
          <option value="delete" ><?php echo $this->lang->line('delete');?></option>
        </select>
    </p>
    <div style="clear: both"></div>
    </div> <!-- End .module-table-body -->
</div> <!-- End .module -->
</form>
<?php endif; ?>
</div> 
<!-- End .grid_12 -->

