<?= $this->extend('App\Views\website\index') ?>
<?= $this->section('content') ?>
<section class="about-hero" style="background: linear-gradient(rgba(17, 26, 76, 0.8), rgba(17, 26, 76, 0.8)), 
url('<?= base_url(); ?>assets/images/Nalubaale-HPP-UEGCL.jpg') no-repeat;background-size: cover;background-position: center center;">
  <div class="container">
      <?php if(empty($downloadCat)):?>
        <h2 data-aos="fade-up">Publications</h2>
        <nav class="breadcrumb" data-aos="fade-up">
            <a href="<?= base_url(); ?>">Home</a> &raquo; <span class="ms-2">Publications</span>
        </nav>
    <?php else:?>
        <h2 data-aos="fade-up"><?= $downloadCat['name']; ?> Publications</h2>
        <nav class="breadcrumb" data-aos="fade-up">
            <a href="<?= base_url(); ?>">Home</a> &raquo; <a href="<?= base_url('publications'); ?>">Publications</a> &raquo; <span class="ms-2"><?= $downloadCat['name']; ?></span>
        </nav>
    <?php endif;?>
  </div>
</section>
<section class="downloads">
    <div class="container">
        <div class="row">
        <div class="col-xl-9 col-md-8 mb-3">
            <div class="table-responsive">
                <table class="table" id="downloads-list">
                    <thead>
                        <tr>
                            <th>Date</th>
                            <th>Publication</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($downloads as $d):?>
                        <tr class="align-items-center">
                            <td><small><?= date('jS, M Y', strtotime($d->published_date));?></small></td>
                            <td>
                                <h4><?= $d->title; ?></h4>
                                <div class="d-flex bd-highlight meta">
                                    <div class="bd-highlight p-1"><i class="bi bi-file-earmark me-2"></i> <span class="badge bg-info bg-opacity-5"0><?= $d-> 	file_type;?></span></div>
                                    <div class="bd-highlight p-1"><i class="bi bi-download"></i> <?= $d->file_size;?>KB</div>
                                    <div class="bd-highlight p-1"><i class="bi bi-collection"></i> <span class="badge bg-primary bg-opacity-50"><?= $d->category_name;?></span></div>
                                </div>
                            </td>
                            <td>
                                <?php if($d->access == "Public"):?>
                                    <a href="<?= base_url('publications/download-file='.$d->id) ?>" class="btn btn-outline-dark">
                                        <i class="bi bi-download"></i> Download</a>
                                <?php else:?>
                                    <a href="<?= base_url('member/login'); ?>" class="btn btn-outline-secondary"><i class="bi bi-download"></i> Members Only</a>
                                <?php endif;?>
                            </td>
                        </tr>
                        <?php endforeach;?>
                    </tbody>
                </table>
            </div>
        </div><!-- main area !-->
        <div class="col-xl-3 col-md-4 mb-3">
            <div class="card card-body rounded-0 sidebar-cat mb-3" data-aos="fade-up">
                <h3>More Publications</h3>
                <ul>
                    <?php foreach($download_categories as $cat):?>
                        <li><a href="<?= base_url('publications/category='.$cat->alias); ?>"><?= $cat->name; ?> <span class="badge bg-danger rounded-pill">→</span></a> </li>
                    <?php endforeach;?>
                </ul>
            </div><!-- publications !-->
            <?= $this->include('App\Views\website\\pages\sidebarz') ?>
        </div>
        </div>
    </div>
</section>




<script type="text/javascript">
      $(document).ready(function () {
          $('#downloads-list').DataTable();
      });

</script>
<?= $this->endSection() ?>