<?php 
$curr_page = $this->uri->segment(5);
if($curr_page=='')
  $curr_page = 0;
$dl = default_lang();
?>
                <table id="all-posts" class="table table-hover table-advance">

           <thead>

               <tr>

                  <th class="numeric"><input type="checkbox" id="select_all"></th>

                  <th class="numeric">#</th>

                  <th class="numeric"><?php echo lang_key('media');?></th>

                  <th class="numeric"><?php echo lang_key('title');?></th>

                   <th class="numeric"><?php echo lang_key('source');?></th>

                  <th class="numeric"><?php echo lang_key('category');?></th>

                  <th class="numeric"><?php echo lang_key('category_2');?></th>

                  <th class="numeric"><?php echo lang_key('link');?></th>

                  <th class="numeric"><?php echo lang_key('featured');?></th>

                   <th class="numeric"><?php echo lang_key('actions');?></th>






               </tr>

           </thead>

           <tbody>

          <?php $i=1;foreach($posts->result() as $row):  
                $detail_link = post_detail_url($row);
          ?>

               <tr>

                  <td data-title="#" class="numeric"><input type="checkbox" name="id[]" value="<?php echo $row->id;?>"></td>
                  
                  <td data-title="#" class="numeric"><?php echo $i;?></td>

                  <td data-title="<?php echo lang_key('image');?>" class="numeric"><img class="thumbnail" style="width:50px;margin-bottom:0px;" src="<?php echo $row->media;?>" /></td>

                  <td data-title="<?php echo lang_key('title');?>" class="numeric"><?php echo $row->title;?></td>

                   <td data-title="<?php echo lang_key('source');?>" class="numeric"><?php echo get_source_title_by_id($row->source_id);?></td>

                   <td data-title="<?php echo lang_key('category');?>" class="numeric"><?php echo get_category_title_by_id($row->category);?></td>

                   <td data-title="<?php echo lang_key('category_2');?>" class="numeric"><?php echo get_category_title_by_id($row->sub_category);?></td>

                   <td data-title="<?php echo lang_key('link');?>" class="numeric"><a href="<?php echo post_detail_url($row);?>"><?php echo $row->title;?></a></td>

                   <td data-title="<?php echo lang_key('featured');?>" class="numeric">
                      <?php echo ($row->featured==1)?'<span class="label label-success">'.lang_key('yes').'</span>':'<span class="label label-info">'.lang_key('no').'</span>';?>
                    </td>

                   <td data-title="<?php echo lang_key('actions');?>" class="numeric">
                       <div class="btn-group">
                           <a class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-cog"></i> <?php echo lang_key('action');?> <span class="caret"></span></a>
                           <ul class="dropdown-menu dropdown-info">
                               <?php if($row->featured==0){?>
                               <li><a href="<?php echo site_url('admin/content/makefeatured/'.$row->id);?>"><?php echo lang_key('make_featured');?></a></li>
                               <?php }else{?>
                               <li><a href="<?php echo site_url('admin/content/removefeatured/'.$row->id);?>"><?php echo lang_key('remove_featured');?></a></li>
                               <?php }?>

                               <li><a href="<?php echo site_url('admin/content/createnews/'.$row->id);?>"><?php echo lang_key('edit');?></a></li>
                               <li><a href="<?php echo site_url('admin/content/deletenews/0/'.$row->id);?>"><?php echo lang_key('delete');?></a></li>
                           </ul>
                       </div>
                   </td>

                   </ul>

                    </div>

                  </td>

               </tr>

            <?php $i++;endforeach;?>   

           </tbody>

        </table>

          <div class="pagination pull-right">
            <ul class="pagination pagination-colory"><?php echo $pages;?></ul>
          </div>
          <div class="pull-right">
            <img src="<?php echo base_url('assets/images/loading.gif');?>" style="width:20px;margin:5px;display:none" class="loading">
          </div>
          <div class="clearfix"></div>