Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected function getGroups()
if ($contentMap)
{
$lang = Factory::getLanguage();
$name = '';

foreach ($contentMap as $branch)
{
Expand Down
12 changes: 12 additions & 0 deletions administrator/components/com_finder/Model/IndexModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
'type', 'type_id', 'l.type_id',
't.title', 't_title',
'url', 'l.url',
'language', 'l.language',
'indexdate', 'l.indexdate',
'content_map',
);
Expand Down Expand Up @@ -189,6 +190,10 @@ protected function getListQuery()
// Check the type filter.
$type = $this->getState('filter.type');

// Join over the language
$query->select('la.title AS language_title, la.image AS language_image')
->join('LEFT', $db->quoteName('#__languages') . ' AS la ON la.lang_code = l.language');

if (is_numeric($type))
{
$query->where($db->quoteName('l.type_id') . ' = ' . (int) $type);
Expand All @@ -211,6 +216,12 @@ protected function getListQuery()
$query->where($db->quoteName('l.published') . ' = ' . (int) $state);
}

// Filter on the language.
if ($language = $this->getState('filter.language'))
{
$query->where($db->quoteName('l.language') .' = ' . $db->quote($language));
}

// Check the search phrase.
$search = $this->getState('filter.search');

Expand Down Expand Up @@ -382,6 +393,7 @@ protected function populateState($ordering = 'l.title', $direction = 'asc')
$this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd'));
$this->setState('filter.type', $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'cmd'));
$this->setState('filter.content_map', $this->getUserStateFromRequest($this->context . '.filter.content_map', 'filter_content_map', '', 'cmd'));
$this->setState('filter.language', $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''));

// Load the parameters.
$params = ComponentHelper::getParams('com_finder');
Expand Down
8 changes: 8 additions & 0 deletions administrator/components/com_finder/View/Index/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
defined('_JEXEC') or die;

use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
Expand Down Expand Up @@ -119,6 +120,13 @@ public function display($tpl = null)

FinderHelper::addSubmenu('index');

// We do not need to filter by language when multilingual is disabled
if (!Multilanguage::isEnabled())
{
unset($this->activeFilters['language']);
$this->filterForm->removeField('language', 'filter');
}

// Check for errors.
if (count($errors = $this->get('Errors')))
{
Expand Down
11 changes: 11 additions & 0 deletions administrator/components/com_finder/forms/filter_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
>
<option value="">COM_FINDER_FILTER_SELECT_CONTENT_MAP</option>
</field>

<field
name="language"
type="contentlanguage"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
</fields>

<fields name="list">
Expand All @@ -55,6 +64,8 @@
<option value="t.title DESC">COM_FINDER_INDEX_HEADING_INDEX_TYPE_DESC</option>
<option value="l.indexdate ASC">COM_FINDER_INDEX_HEADING_INDEX_DATE_ASC</option>
<option value="l.indexdate DESC">COM_FINDER_INDEX_HEADING_INDEX_DATE_DESC</option>
<option value="language ASC" requires="multilanguage">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="language DESC" requires="multilanguage">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="l.url ASC">COM_FINDER_INDEX_HEADING_LINK_URL_ASC</option>
<option value="l.url DESC">COM_FINDER_INDEX_HEADING_LINK_URL_DESC</option>
</field>
Expand Down
11 changes: 11 additions & 0 deletions administrator/components/com_finder/tmpl/index/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;
use Joomla\Component\Finder\Administrator\Helper\FinderHelperLanguage;

Expand Down Expand Up @@ -52,6 +53,11 @@
<th scope="col" style="width:10%" class="d-none d-md-table-cell text-center">
<?php echo JHtml::_('searchtools.sort', 'COM_FINDER_INDEX_HEADING_INDEX_DATE', 'l.indexdate', $listDirn, $listOrder); ?>
</th>
<?php if (Multilanguage::isEnabled()) : ?>
<th scope="col" style="width:10%" class="nowrap d-none d-md-table-cell text-center">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'l.language', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th scope="col" style="width:15%" class="text-center d-none d-md-table-cell text-center">
<?php echo JText::_('COM_FINDER_INDEX_HEADING_DETAILS'); ?>
</th>
Expand Down Expand Up @@ -84,6 +90,11 @@
<td class="small d-none d-md-table-cell text-center">
<?php echo JHtml::_('date', $item->indexdate, JText::_('DATE_FORMAT_LC4')); ?>
</td>
<?php if (Multilanguage::isEnabled()) : ?>
<td class="small d-none d-md-table-cell text-center">
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
</td>
<?php endif; ?>
<td class="text-center d-none d-md-table-cell text-center">
<?php if ((int) $item->publish_start_date or (int) $item->publish_end_date or (int) $item->start_date or (int) $item->end_date) : ?>
<span class="icon-calendar pop hasPopover" aria-hidden="true" data-placement="left" title="<?php echo JText::_('COM_FINDER_INDEX_DATE_INFO_TITLE'); ?>" data-content="<?php echo JText::sprintf('COM_FINDER_INDEX_DATE_INFO', $item->publish_start_date, $item->publish_end_date, $item->start_date, $item->end_date); ?>"></span>
Expand Down