From 41fe2bc6f56a56cb88377d1a05bbd4d2c224839d Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 3 Jul 2015 16:54:49 -0400 Subject: [PATCH] Closes #277 Add visual indicator for stickied KB articles --- inc/knowledgebase_functions.inc.php | 24 ++++++++++++++++++---- knowledgebase.php | 31 ++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/inc/knowledgebase_functions.inc.php b/inc/knowledgebase_functions.inc.php index 2e2ab031..683f66f8 100644 --- a/inc/knowledgebase_functions.inc.php +++ b/inc/knowledgebase_functions.inc.php @@ -99,7 +99,7 @@ function hesk_kbTopArticles($how_many, $index = 1) - '.$article['subject'].' + '.$article['subject'].' '; if ($hesk_settings['kb_views']) { @@ -246,10 +254,18 @@ function hesk_kbLatestArticles($how_many, $index = 1) $colspan = $hesk_settings['kb_date'] ? '' : 'colspan="2"'; while ($article = hesk_dbFetchAssoc($res)) { + $icon = 'fa fa-file'; + $style = ''; + + if ($article['sticky']) { + $icon = 'glyphicon glyphicon-pushpin'; + $style = 'style="color: #FF0000"'; + } + echo ' - '.$article['subject'].' + '.$article['subject'].' '; if ($hesk_settings['kb_date']) { echo '' . hesk_date($article['dt'], true) . ''; diff --git a/knowledgebase.php b/knowledgebase.php index 1fc2308a..8404b903 100644 --- a/knowledgebase.php +++ b/knowledgebase.php @@ -486,15 +486,22 @@ function hesk_show_kb_category($catid, $is_search = 0) { /* Print most popular/sticky articles */ if ($hesk_settings['kb_numshow'] && $cat['articles']) { - $res = hesk_dbQuery("SELECT `id`,`subject` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='{$cat['id']}' AND `type`='0' ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1) ); + $res = hesk_dbQuery("SELECT `id`,`subject`, `sticky` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='{$cat['id']}' AND `type`='0' ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1) ); $num = 1; while ($art = hesk_dbFetchAssoc($res)) { + $icon = 'glyphicon glyphicon-file'; + $style = ''; + if ($art['sticky']) + { + $icon = 'glyphicon glyphicon-pushpin'; + $style = 'style="color: #FF0000"'; + } echo ' - -        - '.$art['subject'].' - '; + +        + '.$art['subject'].' + '; if ($num == $hesk_settings['kb_numshow']) { @@ -553,7 +560,7 @@ function hesk_show_kb_category($catid, $is_search = 0) { '; @@ -562,8 +569,18 @@ function hesk_show_kb_category($catid, $is_search = 0) { { while ($article = hesk_dbFetchAssoc($res)) { + $icon = 'fa fa-file'; + $color = ''; + $style = ''; + $txt = hesk_kbArticleContentPreview($article['content']); + if ($article['sticky']) + { + $icon = 'glyphicon glyphicon-pushpin'; + $style = 'style="color: #FF0000"'; + } + if ($hesk_settings['kb_rating']) { $alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated']; @@ -577,7 +594,7 @@ function hesk_show_kb_category($catid, $is_search = 0) { echo '
'.$hesklang['noac'].'
- + '.$article['subject'].'
'.$txt.'