Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<project name="jlcontentfieldsfilter" default="dist" basedir=".">

<property name="VERSION" value="2.0.1"/>
<property name="VERSION" value="2.0.2"/>

<tstamp>
<format property="DATE" pattern="%d.%m.%Y" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var JlContentFieldsFilter = {
this.loadData(id);
}
else if (params.autho_send === 1) {
jQuery(id).submit();
jQuery(form).submit();
}
return false;
},
Expand Down
21 changes: 20 additions & 1 deletion mod_jlcontentfieldsfilter/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ function ($f) {
$field = self::setHiddenOptions($field, $category_id, $option);
}

$displayData = array('field' => $field, 'params' => $params, 'moduleId' => $moduleId, 'rangedata' => array());
$displayData = array('field' => $field, 'params' => $params, 'moduleId' => $moduleId, 'rangedata' => array(), 'articleoptions' => array());

if (preg_match("/^range?.*?$/isu", $layout)) {
$displayData = self::addRangeData($displayData, $category_id, $option);
}

if ($layout == 'articles') {
$displayData = self::addArticlesFieldData($displayData);
}

$new[$key] = JLayoutHelper::render(
'mod_jlcontentfieldsfilter.'.$layout,
$displayData,
Expand Down Expand Up @@ -279,6 +283,21 @@ private static function addRangeData($displayData, $category_id, $option)
return $displayData;
}

private static function addArticlesFieldData($displayData) {
$field = $displayData['field'];
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('DISTINCT A.`value`, B.`title`')
->from('`#__fields_values` A')
->leftJoin('`#__content` B ON A.`value` = B.`id`')
->where('A.`field_id` ='.(int)$field->id)
->where('B.`state` = 1')
->order('B.`title` ASC');
;
$displayData['articleoptions'] = $db->setQuery($query)->loadObjectList();
return $displayData;
}

public static function getOrderingSelect($selectedOrdering, $moduleId, $option)
{
$app = JFactory::getApplication();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* JL Content Fields Filter
*
* @version 2.0.2
* @author Joomline
* @copyright (C) 2017-2020 Arkadiy Sedelnikov, Joomline. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

if (!key_exists('field', $displayData))
{
return;
}

$moduleId = $displayData['moduleId'];
$field = $displayData['field'];
$label = JText::_($field->label);
if(!empty($field->hidden)){
return;
}
$value = $field->value;

$listOptions = $displayData['articleoptions'];
$options = array();
if(is_array($listOptions)){
foreach ( $listOptions as $listOption ) {
if (!empty($listOption->title)) {
$options[] = JHtml::_('select.option', $listOption->value, $listOption->title);
}
}
}
if(!count($options)){
return;
}
?>
<label class="jlmf-label" for="<?php echo $field->name.'-'.$moduleId; ?>"><?php echo $label; ?></label>
<select
name="jlcontentfieldsfilter[<?php echo $field->id; ?>]"
id="<?php echo $field->name.'-'.$moduleId; ?>"
class="jlmf-select"
>
<option value=""><?php echo JText::_('JSELECT'); ?></option>

<?php
foreach($options as $k => $v) {
$checked = ($v->value == $value) ? ' selected="selected"' : '';
?>
<option value="<?php echo $v->value; ?>" <?php echo $checked; ?>><?php echo JText::_($v->text); ?></option>
<?php } ?>
</select>
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ protected function getOptions()
$options[] = HTMLHelper::_('select.option', 'text', Text::_('PLG_JLCONTENTFIELDSFILTER_FILTER_TEXT'));
$options[] = HTMLHelper::_('select.option', 'range', Text::_('PLG_JLCONTENTFIELDSFILTER_FILTER_RANGE'));
break;
case 'articles':
case 'articleslinked':
$options[] = HTMLHelper::_('select.option', 'articles', Text::_('PLG_JLCONTENTFIELDSFILTER_FILTER_ARTICLES'));
break;
default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions plg_system_jlcontentfieldsfilter/jlcontentfieldsfilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ public function onAfterRoute()
case 'radio':
case 'checkboxes':
case 'list':
case 'articles':
case 'articleslinked':
if(is_array($v) && count($v)){
$newVal = array();
foreach ( $v as $val ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PLG_JLCONTENTFIELDSFILTER_FILTER_TEXT="Text"
PLG_JLCONTENTFIELDSFILTER_FILTER_LAYOUT="Individual layout"
PLG_JLCONTENTFIELDSFILTER_FILTER_LAYOUT_DESC="Individual layout"
PLG_JLCONTENTFIELDSFILTER_FILTER_RANGE="Range"
PLG_JLCONTENTFIELDSFILTER_FILTER_ARTICLES="Articles"
PLG_JLCONTENTFIELDSFILTER_FILTER_ARTICLESLINKED="Linked Articles"
PLG_JLCONTENTFIELDSFILTER_FILTER_DISABLEDCATS="Excluded categories"
PLG_JLCONTENTFIELDSFILTER_FILTER_DISABLEDCATS_DESC="Categories from among the specified categories and their subcategories to be excluded to show the field in the filter module"
PLG_JLCONTENTFIELDSFILTER_FILTER_FIELD_HIDDEN_EMPTY="Hidden empty field"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PLG_JLCONTENTFIELDSFILTER_FILTER_TEXT="Texte"
PLG_JLCONTENTFIELDSFILTER_FILTER_LAYOUT="Mise en page individuelle"
PLG_JLCONTENTFIELDSFILTER_FILTER_LAYOUT_DESC="Mise en page individuelle"
PLG_JLCONTENTFIELDSFILTER_FILTER_RANGE="Range"
PLG_JLCONTENTFIELDSFILTER_FILTER_ARTICLES="Articles"
PLG_JLCONTENTFIELDSFILTER_FILTER_ARTICLESLINKED="Articles liés"
PLG_JLCONTENTFIELDSFILTER_FILTER_DISABLEDCATS="Catégories exclues"
PLG_JLCONTENTFIELDSFILTER_FILTER_DISABLEDCATS_DESC="Catégories parmi les catégories spécifiées et leurs sous-catégories à exclure pour afficher le champ dans le module filtre"
PLG_JLCONTENTFIELDSFILTER_FILTER_FIELD_HIDDEN_EMPTY="Masquer champ vide"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PLG_JLCONTENTFIELDSFILTER_FILTER_TEXT="Текст"
PLG_JLCONTENTFIELDSFILTER_FILTER_LAYOUT="Индивидуальный макет"
PLG_JLCONTENTFIELDSFILTER_FILTER_LAYOUT_DESC="Индивидуальный макет"
PLG_JLCONTENTFIELDSFILTER_FILTER_RANGE="Диапазон"
PLG_JLCONTENTFIELDSFILTER_FILTER_ARTICLES="Статьи"
PLG_JLCONTENTFIELDSFILTER_FILTER_ARTICLESLINKED="Связанные статьи"
PLG_JLCONTENTFIELDSFILTER_FILTER_DISABLEDCATS="Исключаемые категории"
PLG_JLCONTENTFIELDSFILTER_FILTER_DISABLEDCATS_DESC="Категории из числа указанных категорий и их подкатегорий, которые следует исключить для показа поля в модуле фильтра"
PLG_JLCONTENTFIELDSFILTER_FILTER_FIELD_HIDDEN_EMPTY="Скрывать пустое поле"
Expand Down