Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to show filter also when no result was found #11501

Merged
merged 2 commits into from
Aug 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
186 changes: 93 additions & 93 deletions components/com_content/views/category/tmpl/default_articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,23 @@
}
?>

<?php if (empty($this->items)) : ?>

<?php if ($this->params->get('show_no_articles', 1)) : ?>
<p><?php echo JText::_('COM_CONTENT_NO_ARTICLES'); ?></p>
<?php endif; ?>

<?php else : ?>

<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm" class="form-inline">
<?php if ($this->params->get('show_headings') || $this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) :?>
<?php if ($this->params->get('show_headings') || $this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) :?>
<fieldset class="filters btn-toolbar clearfix">
<?php if ($this->params->get('filter_field') != 'hide') :?>
<div class="btn-group">
<?php if ($this->params->get('filter_field') != 'tag') :?>
<div class="btn-group">
<?php if ($this->params->get('filter_field') != 'tag') :?>
<label class="filter-search-lbl element-invisible" for="filter-search">
<?php echo JText::_('COM_CONTENT_' . $this->params->get('filter_field') . '_FILTER_LABEL') . '&#160;'; ?>
</label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_CONTENT_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_CONTENT_' . $this->params->get('filter_field') . '_FILTER_LABEL'); ?>" />
<?php else :?>
<select name="filter_tag" id="filter_tag" onchange="document.adminForm.submit();" >
<option value=""><?php echo JText::_('JOPTION_SELECT_TAG'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')); ?>
</select>
<?php endif; ?>
</div>
<?php else :?>
<select name="filter_tag" id="filter_tag" onchange="document.adminForm.submit();" >
<option value=""><?php echo JText::_('JOPTION_SELECT_TAG'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')); ?>
</select>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
Expand All @@ -73,8 +65,16 @@
<input type="hidden" name="limitstart" value="" />
<input type="hidden" name="task" value="" />
</fieldset>
<?php endif; ?>

<?php if (empty($this->items)) : ?>

<?php if ($this->params->get('show_no_articles', 1)) : ?>
<p><?php echo JText::_('COM_CONTENT_NO_ARTICLES'); ?></p>
<?php endif; ?>

<?php else : ?>

<table class="category table table-striped table-bordered table-hover">
<?php
$headerTitle = '';
Expand All @@ -91,7 +91,7 @@
$headerHits = 'headers="categorylist_header_hits"';
$headerEdit = 'headers="categorylist_header_edit"';
?>
<thead>
<thead>
<tr>
<th id="categorylist_header_title">
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
Expand Down Expand Up @@ -121,87 +121,87 @@
<th id="categorylist_header_edit"><?php echo JText::_('COM_CONTENT_EDIT_ITEM'); ?></th>
<?php endif; ?>
</tr>
</thead>
</thead>
<?php endif; ?>
<tbody>
<?php foreach ($this->items as $i => $article) : ?>
<?php if ($this->items[$i]->state == 0) : ?>
<tr class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
<?php else: ?>
<?php foreach ($this->items as $i => $article) : ?>
<?php if ($this->items[$i]->state == 0) : ?>
<tr class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
<?php else: ?>
<tr class="cat-list-row<?php echo $i % 2; ?>" >
<?php endif; ?>
<td <?php echo $headerTitle; ?> class="list-title">
<?php if (in_array($article->access, $this->user->getAuthorisedViewLevels())) : ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language)); ?>">
<?php echo $this->escape($article->title); ?>
</a>
<?php else: ?>
<?php
echo $this->escape($article->title) . ' : ';
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
$link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language)));
?>
<a href="<?php echo $link; ?>" class="register">
<?php echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE'); ?>
</a>
<?php endif; ?>
<td <?php echo $headerTitle; ?> class="list-title">
<?php if (in_array($article->access, $this->user->getAuthorisedViewLevels())) : ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language)); ?>">
<?php echo $this->escape($article->title); ?>
</a>
<?php else: ?>
<?php
echo $this->escape($article->title) . ' : ';
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
$link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language)));
?>
<a href="<?php echo $link; ?>" class="register">
<?php echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE'); ?>
</a>
<?php endif; ?>
<?php if ($article->state == 0) : ?>
<span class="list-published label label-warning">
<?php if ($article->state == 0) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php endif; ?>
<?php if (strtotime($article->publish_up) > strtotime(JFactory::getDate())) : ?>
<span class="list-published label label-warning">
<?php endif; ?>
<?php if (strtotime($article->publish_up) > strtotime(JFactory::getDate())) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JNOTPUBLISHEDYET'); ?>
</span>
<?php endif; ?>
<?php if ((strtotime($article->publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != JFactory::getDbo()->getNullDate()) : ?>
<span class="list-published label label-warning">
<?php endif; ?>
<?php if ((strtotime($article->publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != JFactory::getDbo()->getNullDate()) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JEXPIRED'); ?>
</span>
<?php endif; ?>
</td>
<?php if ($this->params->get('list_show_date')) : ?>
<td <?php echo $headerDate; ?> class="list-date small">
<?php
echo JHtml::_(
'date', $article->displayDate,
$this->escape($this->params->get('date_format', JText::_('DATE_FORMAT_LC3')))
); ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_author', 1)) : ?>
<td <?php echo $headerAuthor; ?> class="list-author">
<?php if (!empty($article->author) || !empty($article->created_by_alias)) : ?>
<?php $author = $article->author ?>
<?php $author = ($article->created_by_alias ? $article->created_by_alias : $author);?>
<?php if (!empty($article->contact_link) && $this->params->get('link_author') == true) : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', $article->contact_link, $author)); ?>
<?php else: ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
</td>
<?php if ($this->params->get('list_show_date')) : ?>
<td <?php echo $headerDate; ?> class="list-date small">
<?php
echo JHtml::_(
'date', $article->displayDate,
$this->escape($this->params->get('date_format', JText::_('DATE_FORMAT_LC3')))
); ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_author', 1)) : ?>
<td <?php echo $headerAuthor; ?> class="list-author">
<?php if (!empty($article->author) || !empty($article->created_by_alias)) : ?>
<?php $author = $article->author ?>
<?php $author = ($article->created_by_alias ? $article->created_by_alias : $author);?>
<?php if (!empty($article->contact_link) && $this->params->get('link_author') == true) : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', $article->contact_link, $author)); ?>
<?php else: ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_hits', 1)) : ?>
<td <?php echo $headerHits; ?> class="list-hits">
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_hits', 1)) : ?>
<td <?php echo $headerHits; ?> class="list-hits">
<span class="badge badge-info">
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT', $article->hits); ?>
</span>
</td>
<?php endif; ?>
<?php if ($isEditable) : ?>
<td <?php echo $headerEdit; ?> class="list-edit">
<?php if ($article->params->get('access-edit')) : ?>
<?php echo JHtml::_('icon.edit', $article, $params); ?>
<?php endif; ?>
</td>
</td>
<?php endif; ?>
<?php if ($isEditable) : ?>
<td <?php echo $headerEdit; ?> class="list-edit">
<?php if ($article->params->get('access-edit')) : ?>
<?php echo JHtml::_('icon.edit', $article, $params); ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
Expand All @@ -214,16 +214,16 @@
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<div class="pagination">

<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>

<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</form>
<?php endif; ?>
</form>