<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Admin &gt; Blog &gt; Komentar</title>
    <?php include_once(VIEWPATH. 'includes/head.php'); ?>
    <style type="text/css">
    h4.media-heading{font-size:16px}
    .media-body>.nav>li{font-size: 11px;}
    .media-body>.nav>li>span{position:relative;display:block;}
    </style>
  </head>
  <body>
    <?php include_once(VIEWPATH. 'admin/_navbar.php'); ?>
    <div class="container">
      <ul class="breadcrumb">
        <li><a href="<?php echo site_url();?>"><i class="fa fa-home"></i></a></li>
        <li><a href="<?php echo site_url('admin');?>">Admin Panel</a></li>
        <li><a href="<?php echo site_url('admin/modules/blog');?>">Blog</a></li>
        <li class="active"><span>Komentar</span></li>
      </ul>
      <div class="row">
        <div class="col-sm-4 col-md-3">
          <?php include(dirname(__FILE__).'/_sidebar.php');?>
        </div>
        <div class="col-sm-8 col-md-9">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3><span class="pull-right"><?php echo $total;?></span><i class="fa fa-comments"></i> Komentar</h3>
            </div>
            <div class="panel-body" style="padding-bottom: 0;">
              <div class="row">
                <div class="col-sm-4 col-md-3" style="margin-bottom: 15px;">
                  <a class="btn btn-danger btn-block" data-toggle="modal" data-target="#myModal" href="<?php echo site_url('admin/modules/blog/hapus-semua-komentar/'.$post_id);?>"><i class="fa fa-trash"></i> Hapus semua</a>
                </div>
                <div class="col-sm-offset-4 col-sm-4 col-md-offset-6 col-md-3" style="margin-bottom: 15px;">
                  <div class="dropdown">
                    <button type="button" id="filter" class="btn btn-default btn-block" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-filter"></i> <?php echo $status == 0 ? 'Semua' : ($status == 1 ? 'Dimoderasi' : 'Disetujui');?> <i class="caret"></i></button>
                    <ul class="dropdown-menu" aria-labelledby="filter">
                      <li class="<?php echo $status == 0 ? 'active' : '';?>"><a href="<?php echo site_url('admin/modules/blog/komentar/'.$post_id.'/0/1');?>">Semua</a></li>
                      <li class="<?php echo $status == 1 ? 'active' : '';?>"><a href="<?php echo site_url('admin/modules/blog/komentar/'.$post_id.'/1/1');?>">Moderasi</a></li>
                      <li class="<?php echo $status == 2 ? 'active' : '';?>"><a href="<?php echo site_url('admin/modules/blog/komentar/'.$post_id.'/2/1');?>">Disetujui</a></li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
            <?php if (!$results):?>
            <div class="panel-body"><div class="alert alert-warning">Belum ada komentar.</div></div>
            <?php else:?>
            <div class="list-group">
              <?php foreach ($results as $comment): ?>
              <div class="list-group-item" id="comment-<?php echo $comment->bc_id;?>">
                <div class="media">
                  <div class="media-left" style="font-size: 40px;"><i class="<?php echo $comment->us_id ? 'fa fa-user' : 'fa fa-user-secret';?>"></i></div>
                  <div class="media-body">
                    <div class="media-heading">
                      <?php if ($comment->us_id):?>
                      <a href="<?php echo site_url('admin/users/profil/'.$comment->us_id);?>"><strong><?php echo html_escape($comment->bc_nama);?></strong></a>
                      <?php else:?>
                      <strong><?php echo html_escape($comment->bc_nama);?></strong>
                      <?php endif;?>
                      <span class="text-muted">pada postingan</span>
                      <a href="<?php echo site_url('blog/'.$comment->bp_slug);?>"><?php echo html_escape($comment->bp_judul);?></a>
                    </div>
                    <p class="text-muted"><i class="fa fa-calendar-o"></i> <?php echo format_tanggal($comment->bc_tanggal);?> | <a href="mailto:<?php echo $comment->bc_email;?>?Subject=<?php echo rawurlencode('Re: '.$comment->bp_judul);?>" target="_top"><i class="fa fa-envelope-o"></i> <?php echo $comment->bc_email;?></a></p>
                    <p><?php echo nl2br(auto_link(html_escape($comment->bc_komentar),'url', true));?></p>
                    <ul class="nav nav-pills">
                      <?php if ($comment->bc_moderasi):?>
                      <li role="presentation"><a href="<?php echo site_url('admin/modules/blog/konfirm-komentar/'.$comment->bc_id);?>" style="padding: 5px 10px"><i class="fa fa-check"></i> Menyetujui</a></li>
                      <?php endif;?>
                      <li role="presentation"><a href="<?php echo site_url('admin/modules/blog/hapus-komentar/'.$comment->bc_id.'?redirect='.urlencode(current_url()));?>" style="padding: 5px 10px"><span class="text-danger"><i class="fa fa-times"></i> Hapus</span></a></li>
                    </ul>
                  </div>
                </div>
              </div>
              <?php endforeach; ?>
            </div>
            <?php if (ceil($total/$this->system->get_set('list_per_page')) > 1):?>
            <div class="panel-body"><?php echo pagination(site_url('admin/modules/blog/komentar/'.($post_id ? $post_id : '0').'/'.$status),$start,$total,$this->system->set['list_per_page'],'/%d');?></div>
            <?php endif;?>
            <?php endif;?>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>
</html>