Closes #277 Add visual indicator for stickied KB articles
This commit is contained in:
parent
9fd5b31ac1
commit
41fe2bc6f5
@ -99,7 +99,7 @@ function hesk_kbTopArticles($how_many, $index = 1)
|
|||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
/* Get list of articles from the database */
|
/* Get list of articles from the database */
|
||||||
$res = hesk_dbQuery("SELECT `t1`.`id`,`t1`.`subject`,`t1`.`views` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` AS `t1`
|
$res = hesk_dbQuery("SELECT `t1`.`id`,`t1`.`subject`,`t1`.`views`,`t1`.`sticky` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` AS `t1`
|
||||||
LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_categories` AS `t2` ON `t1`.`catid` = `t2`.`id`
|
LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_categories` AS `t2` ON `t1`.`catid` = `t2`.`id`
|
||||||
WHERE `t1`.`type`='0' AND `t2`.`type`='0'
|
WHERE `t1`.`type`='0' AND `t2`.`type`='0'
|
||||||
ORDER BY `t1`.`sticky` DESC, `t1`.`views` DESC, `t1`.`art_order` ASC LIMIT ".intval($how_many));
|
ORDER BY `t1`.`sticky` DESC, `t1`.`views` DESC, `t1`.`art_order` ASC LIMIT ".intval($how_many));
|
||||||
@ -116,7 +116,7 @@ function hesk_kbTopArticles($how_many, $index = 1)
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
/* Get list of articles from the database */
|
/* Get list of articles from the database */
|
||||||
$res = hesk_dbQuery("SELECT `t1`.`id`,`t1`.`subject`,`t1`.`dt`, `t1`.`views` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` AS `t1`
|
$res = hesk_dbQuery("SELECT `t1`.`id`,`t1`.`subject`,`t1`.`dt`, `t1`.`views`,`t1`.`sticky` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` AS `t1`
|
||||||
LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_categories` AS `t2` ON `t1`.`catid` = `t2`.`id`
|
LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_categories` AS `t2` ON `t1`.`catid` = `t2`.`id`
|
||||||
WHERE `t1`.`type`='0' AND `t2`.`type`='0'
|
WHERE `t1`.`type`='0' AND `t2`.`type`='0'
|
||||||
ORDER BY `t1`.`sticky` DESC, `t1`.`views` DESC, `t1`.`art_order` ASC LIMIT ".intval($how_many));
|
ORDER BY `t1`.`sticky` DESC, `t1`.`views` DESC, `t1`.`art_order` ASC LIMIT ".intval($how_many));
|
||||||
@ -138,10 +138,18 @@ function hesk_kbTopArticles($how_many, $index = 1)
|
|||||||
}
|
}
|
||||||
while ($article = hesk_dbFetchAssoc($res))
|
while ($article = hesk_dbFetchAssoc($res))
|
||||||
{
|
{
|
||||||
|
$icon = 'fa fa-file';
|
||||||
|
$style = '';
|
||||||
|
|
||||||
|
if ($article['sticky']) {
|
||||||
|
$icon = 'glyphicon glyphicon-pushpin';
|
||||||
|
$style = 'style="color: #FF0000"';
|
||||||
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-xs-8 col-sm-9" '.$colspan.'>
|
<td class="col-xs-8 col-sm-9" '.$colspan.'>
|
||||||
<i class="fa fa-file"></i> <a href="knowledgebase.php?article='.$article['id'].'">'.$article['subject'].'</a>
|
<i class="'.$icon.'" '.$style.'></i> <a href="knowledgebase.php?article='.$article['id'].'">'.$article['subject'].'</a>
|
||||||
</td>
|
</td>
|
||||||
';
|
';
|
||||||
if ($hesk_settings['kb_views']) {
|
if ($hesk_settings['kb_views']) {
|
||||||
@ -246,10 +254,18 @@ function hesk_kbLatestArticles($how_many, $index = 1)
|
|||||||
$colspan = $hesk_settings['kb_date'] ? '' : 'colspan="2"';
|
$colspan = $hesk_settings['kb_date'] ? '' : 'colspan="2"';
|
||||||
while ($article = hesk_dbFetchAssoc($res))
|
while ($article = hesk_dbFetchAssoc($res))
|
||||||
{
|
{
|
||||||
|
$icon = 'fa fa-file';
|
||||||
|
$style = '';
|
||||||
|
|
||||||
|
if ($article['sticky']) {
|
||||||
|
$icon = 'glyphicon glyphicon-pushpin';
|
||||||
|
$style = 'style="color: #FF0000"';
|
||||||
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-xs-9" '.$colspan.'>
|
<td class="col-xs-9" '.$colspan.'>
|
||||||
<i class="fa fa-file"></i> <a href="knowledgebase.php?article='.$article['id'].'">'.$article['subject'].'</a>
|
<i class="'.$icon.'" '.$style.'></i> <a href="knowledgebase.php?article='.$article['id'].'">'.$article['subject'].'</a>
|
||||||
</td>';
|
</td>';
|
||||||
if ($hesk_settings['kb_date']) {
|
if ($hesk_settings['kb_date']) {
|
||||||
echo '<td class="col-xs-3">' . hesk_date($article['dt'], true) . '</td>';
|
echo '<td class="col-xs-3">' . hesk_date($article['dt'], true) . '</td>';
|
||||||
|
@ -486,13 +486,20 @@ function hesk_show_kb_category($catid, $is_search = 0) {
|
|||||||
/* Print most popular/sticky articles */
|
/* Print most popular/sticky articles */
|
||||||
if ($hesk_settings['kb_numshow'] && $cat['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;
|
$num = 1;
|
||||||
while ($art = hesk_dbFetchAssoc($res))
|
while ($art = hesk_dbFetchAssoc($res))
|
||||||
{
|
{
|
||||||
|
$icon = 'glyphicon glyphicon-file';
|
||||||
|
$style = '';
|
||||||
|
if ($art['sticky'])
|
||||||
|
{
|
||||||
|
$icon = 'glyphicon glyphicon-pushpin';
|
||||||
|
$style = 'style="color: #FF0000"';
|
||||||
|
}
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td> <span class="glyphicon glyphicon-file"></span>
|
<td '.$style.'> <span class="'.$icon.'"></span>
|
||||||
<a href="knowledgebase.php?article='.$art['id'].'" class="article">'.$art['subject'].'</a></td>
|
<a href="knowledgebase.php?article='.$art['id'].'" class="article">'.$art['subject'].'</a></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
@ -553,7 +560,7 @@ function hesk_show_kb_category($catid, $is_search = 0) {
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$res = hesk_dbQuery("SELECT `id`, `subject`, LEFT(`content`, ".max(200, $hesk_settings['kb_substrart'] * 2).") AS `content`, `rating` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='{$catid}' AND `type`='0' ORDER BY `sticky` DESC, `art_order` ASC");
|
$res = hesk_dbQuery("SELECT `id`, `subject`, `sticky`, LEFT(`content`, ".max(200, $hesk_settings['kb_substrart'] * 2).") AS `content`, `rating` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='{$catid}' AND `type`='0' ORDER BY `sticky` DESC, `art_order` ASC");
|
||||||
if (hesk_dbNumRows($res) == 0)
|
if (hesk_dbNumRows($res) == 0)
|
||||||
{
|
{
|
||||||
echo '<tr><td><i>'.$hesklang['noac'].'</i></td></tr>';
|
echo '<tr><td><i>'.$hesklang['noac'].'</i></td></tr>';
|
||||||
@ -562,8 +569,18 @@ function hesk_show_kb_category($catid, $is_search = 0) {
|
|||||||
{
|
{
|
||||||
while ($article = hesk_dbFetchAssoc($res))
|
while ($article = hesk_dbFetchAssoc($res))
|
||||||
{
|
{
|
||||||
|
$icon = 'fa fa-file';
|
||||||
|
$color = '';
|
||||||
|
$style = '';
|
||||||
|
|
||||||
$txt = hesk_kbArticleContentPreview($article['content']);
|
$txt = hesk_kbArticleContentPreview($article['content']);
|
||||||
|
|
||||||
|
if ($article['sticky'])
|
||||||
|
{
|
||||||
|
$icon = 'glyphicon glyphicon-pushpin';
|
||||||
|
$style = 'style="color: #FF0000"';
|
||||||
|
}
|
||||||
|
|
||||||
if ($hesk_settings['kb_rating'])
|
if ($hesk_settings['kb_rating'])
|
||||||
{
|
{
|
||||||
$alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated'];
|
$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 '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<i class="fa fa-file"></i>
|
<i class="'.$icon.'" '.$style.'></i>
|
||||||
<a href="knowledgebase.php?article='.$article['id'].'">'.$article['subject'].'</a>
|
<a href="knowledgebase.php?article='.$article['id'].'">'.$article['subject'].'</a>
|
||||||
<br>
|
<br>
|
||||||
<span class="indent-15">'.$txt.'</span>
|
<span class="indent-15">'.$txt.'</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user