<?php
///////////////////////////////////////////////
///  PilotAwardsSystem v2.0 by php-mods.eu  ///
///            Author php-mods.eu           ///
///            Packed at 8/12/2019          ///
///     Copyright (c) 2019, php-mods.eu     ///
///////////////////////////////////////////////

?>
<h3>Awards Administration</h3>
<table id="tabledlist" class="tablesorter">
<thead>
<tr>
    <th width="70%" colspan="2" align="center">Award Category Title</td>
    <th width="10%" align="center">Total Awards</th>
    <th width="30%" colspan="2">&nbsp;</td>
</tr>
</thead>
<tbody>
<?php
if(!$awardadm) {echo '<tr><td colspan="4"><center>There are no any award categories</center></td></tr>';}
else { foreach($awardadm as $adm) {
    $total_awards = count(AwardData::category_awards($adm->id));?>
<tr>
<td width="50%" align="center"><?php echo $adm->name; ?></td>
<td width="6%" align="center">
<?php if($adm->ai == 1){echo '<font color="green"><b>Shown</b></font>';}
      elseif($adm->ai == 0){echo '<font color="red"><b>Hidden</b></font>';} ?>
</td>
    <td align="center"><?php echo $total_awards; ?></td>
<td width="22%" align="center"><a href="<?php echo SITE_URL; ?>/admin/index.php/awards/category_edit/<?php echo $adm->id; ?>" class="button">Edit Category</a>
    <?php if($total_awards == 0) { ?>
        <a href="<?php echo SITE_URL; ?>/admin/index.php/awards/categorydelete/<?php echo $adm->id; ?>" class="button" onclick="return confirm('Are you sure you want to remove this category?');">Delete Category</a></td>
    <?php } else {
        echo '<font color="red"><b>Delete N/A</b></font>';
    }?>
<td width="22%" align="center"><a href="<?php echo SITE_URL; ?>/admin/index.php/awards/award_category/<?php echo $adm->id; ?>" class="button">View Details</a></td>
</tr>
<?php } } ?>
<tr><td colspan="5" align="center"><a href="<?php echo SITE_URL; ?>/admin/index.php/awards/category_add" class="button">Add a new Award Category</a></td></tr>
</tbody>
</table>