Fixes #240 show the sidebar regardless of number of articles

merge-requests/2/head
Mike Koch 9 years ago
parent 494fe73078
commit e950f7fce8

@ -1596,23 +1596,11 @@ function manage_category() {
<?php
$result = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='{$catid}' ORDER BY `sticky` DESC, `art_order` ASC");
$num = hesk_dbNumRows($result);
if ($num == 0)
{
echo '<p>'.$hesklang['kb_no_art'].' &nbsp; <a href="manage_knowledgebase.php?a=add_article&amp;catid='.$catid.'"><i class="fa fa-plus" style="color: green;font-size:16px"></i></a> <a href="manage_knowledgebase.php?a=add_article&amp;catid='.$catid.'"><b>'.$hesklang['kb_i_art2'].'</b></a></p>';
}
else
{
/* Get number of sticky articles */
$res2 = hesk_dbQuery("SELECT COUNT(*) FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='{$catid}' AND `sticky` = '1' ");
$num_sticky = hesk_dbResult($res2);
$num_nosticky = $num - $num_sticky;
$secondCol = $catid == 1 ? 'col-md-12' : 'col-md-8';
$secondStyle = $catid == 1 ? 'margin-left: 25px' : 'padding-right: 40px';
?>
<div class="row">
<?php if ($catid != 1): ?>
<div class="col-md-4">
<div style="margin-left:25px">
<div class="panel panel-default">
@ -1666,7 +1654,22 @@ function manage_category() {
</div>
</div>
</div>
<div class="col-md-8" style="padding-right:40px">
<?php endif; ?>
<div class="<?php echo $secondCol; ?>" style="<?php echo $secondStyle; ?>">
<?php
if ($num == 0)
{
echo '<p>'.$hesklang['kb_no_art'].' &nbsp; <a href="manage_knowledgebase.php?a=add_article&amp;catid='.$catid.'"><i class="fa fa-plus" style="color: green;font-size:16px"></i></a> <a href="manage_knowledgebase.php?a=add_article&amp;catid='.$catid.'"><b>'.$hesklang['kb_i_art2'].'</b></a></p>';
}
else
{
/* Get number of sticky articles */
$res2 = hesk_dbQuery("SELECT COUNT(*) FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='{$catid}' AND `sticky` = '1' ");
$num_sticky = hesk_dbResult($res2);
$num_nosticky = $num - $num_sticky;
?>
<h3><?php echo $hesklang['kb_cat_art']; ?> <small style="float:right"><?php echo '<a href="manage_knowledgebase.php?a=add_article&amp;catid='.$catid.'"><i class="fa fa-plus"></i></a> <a href="manage_knowledgebase.php?a=add_article&amp;catid='.$catid.'"><b>'.$hesklang['kb_i_art2'].'</b></a>'; ?></small></h3>
<div class="footerWithBorder blankSpace"></div>
@ -1793,35 +1796,15 @@ function manage_category() {
} // End while
?>
</table>
</div>
</div>
<?php
}
} // END if hide article list
} ?>
/* Manage Category (except the default one) */
if ($catid != 1)
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
</td>
<td class="roundcornersright">&nbsp;</td>
</tr>
<tr>
<td><img src="../img/roundcornerslb.jpg" width="7" height="7" alt="" /></td>
<td class="roundcornersbottom"></td>
<td width="7" height="7"><img src="../img/roundcornersrb.jpg" width="7" height="7" alt="" /></td>
</tr>
</table>
</div>
</div>
<?php
} // END if $catid != 1
<?php } // END if hide article list
echo '&nbsp;<br />&nbsp;';

Loading…
Cancel
Save