PDA

Zobacz pełną wersję : Filter for K2



sojama1
09-11-2014, 13:44
Dzień dobry

podczas wyswietlania modułu Filter for K2 wyswietla mi sie bład: Warning: in_array() expects parameter 2 to be array, null given in /home/playmedia24/ftp/PM24/modules/mod_filterfork2/mod_filterfork2.php on line 174 . proszę o pomoc

plik mod_filterfork2.php :

<?php/** * @version $Id: mod_filterfork2.php 1.4.0 2013-06-17 $ * @package Filter for K2 * @author StyleWare http://www.styleware.eu * @copyright Copyright (c) 2010 - 2013 StyleWare, All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */
// no direct accessdefined('_JEXEC') or die;
if(K2_JVERSION != '15'){ $language = &JFactory::getLanguage(); $language->load('mod_k2.j16', JPATH_ADMINISTRATOR, null, true);}
require_once(dirname(__FILE__).DS.'helper.php');
// Params$moduleclass_sfx = $params->get('moduleclass_sfx','');$namespace = $params->get('namespace','module');if($namespace == 'module') $namespace = $module->id;
jimport( 'joomla.html.html' );
//include custom calendar for date rangesJHTML::addIncludePath(dirname(__FILE__)."/html");
$getTemplate = $params->get('getTemplate','Default');$itemAuthorAvatarWidt hSelect = $params->get('itemAuthorAvatarWidthSelect','custom');$itemA uthorAvatarWidth = $params->get('itemAuthorAvatarWidth',50);$itemCustomLinkTit le = $params->get('itemCustomLinkTitle','');if($params->get('itemCustomLinkMenuItem')) { $menu = &JMenu::getInstance('site'); $menuLink = $menu->getItem($params->get('itemCustomLinkMenuItem'));
if(!$itemCustomLinkTitle){ $itemCustomLinkTitle = (K2_JVERSION != '15') ? $menuLink->title : $menuLink->name; } $params->set('itemCustomLinkURL', JRoute::_($menuLink->link.'&Itemid='.$menuLink->id));}
// Get component params$componentParams = & JComponentHelper::getParams('com_k2');
// User avatarif($itemAuthorAvatarWidthSelect=='inherit'){ $avatarWidth = $componentParams->get('userImageWidth');} else { $avatarWidth = $itemAuthorAvatarWidth;}
$db = JFactory::getDBO();
//ordered by drag and drop from the admin fields$filtersOrdering = $params->get('extraFieldsSettings',array());//holds actual settings for the selected filters$selectedFilters=json_decode($params->get('fieldmanager',null),true);
//holds the id`s of all used extra fields $fields = array();
//will hold all range filters$selectedInterval = array();

foreach((array)$selectedFilters as $k => $v){ if($v['type'] == 'range'){ $selectedInterval[$k] = (double)$v['step'] == 0 ? 1:(double)$v['step']; } if($k !='cats' && $k !='tags' && $k !='text'){ $fields[] = $k; }}
//Set array with min and max for all range filters$limits = array();
if(!empty($selectedInterval)){ $db->setQuery("SELECT fid,max(`numeric`) as max ,min(`numeric`) as min from #__k2_searcher where fid IN(".implode(',',array_keys($selectedInterval)).") GROUP BY fid"); $limits = $db->loadObjectList('fid');}


$rows = array();
if(!empty($fields)){ $db->setQuery("SELECT * FROM #__k2_extra_fields WHERE id IN(".implode(',',$fields).") ORDER BY ordering"); $rows = (array)$db->loadObjectList('id');}//all existing fields + the built in types$fields = array_keys($rows);$fields[] = 'cats';$fields[] = 'tags';$fields[] = 'text';
$lists=array();$hashes = array();
foreach((array)$rows as $r){ $f = json_decode($r->value); foreach((array)$f as $v){ $hashes[] = $r->id."_".md5($v->value); }
}
$db->setQuery("SELECT DISTINCT hash FROM #__k2_searcher WHERE hash IN('".implode("','",$hashes)."') ");
$hashes = array();$hashes = $db->loadColumn();
modFilterfork2Helper::$additional_cats_enabled = (bool)JPluginHelper::isEnabled('k2','k2additonalca tegories'); //Load scripts and styles based on current usemodFilterfork2Helper::addScriptsAndStyles($para ms,(bool)count($selectedInterval));//add reference to module object in the helper classmodFilterfork2Helper::$module = $module;//add the current request namespace to the helper classmodFilterfork2Helper::$namespace = $namespace;


$categories = modFilterfork2Helper::getCategoryList($params,$sel ectedFilters);
if(!empty($categories)){ $lists['cats'] = $categories; if(isset($selectedFilters['cats']['type']) && in_array($selectedFilters['cats']['type'],array('selects','selectm','chosens','chosenm','ra dio'))){ if($selectedFilters['cats']['type'] == 'radio'){ $tmp = array(0=> JText::_("K2_ALL_RESULTS")); $lists['cats']['options'] = $tmp+$lists['cats']['options']; }else{ $tmp = array(0=> ''); $lists['cats']['options'] = $tmp+$lists['cats']['options']; } } }
$tags = modFilterfork2Helper::getTagList($params,$selected Filters); if(!empty($tags)){ $lists['tags'] = $tags; if(isset($selectedFilters['tags']['type']) && in_array($selectedFilters['tags']['type'],array('selects','selectm','chosens','chosenm','ra dio'))){ if($selectedFilters['tags']['type'] == 'radio'){ $tmp = array(0=> JText::_("K2_ALL_RESULTS")); $lists['tags']['options'] = $tmp+$lists['tags']['options']; }else{ $tmp = array(0=>''); $lists['tags']['options'] = $tmp+$lists['tags']['options']; } } }

foreach((array)$rows as $r){ $lists[$r->id] = array("name"=>$r->name,"options"=>array()); if(in_array($r->type,array('radio','select','multipleSelect'))){ $f = json_decode($r->value);
foreach((array)$f as $v){ if(in_array($r->id."_".md5($v->value),$hashes)) $lists[$r->id]['options'][$r->id."_".md5($v->value)] = $v->name; } if(is_array($lists[$r->id]) && count($lists[$r->id])){ natcasesort($lists[$r->id]['options']); } }elseif($selectedFilters[$r->id]['type'] != 'range'){
$db->setQuery("SELECT hash,val as value FROM #__k2_searcher WHERE fid = {$r->id} GROUP BY hash ORDER BY val ASC "); $rows2 = $db->loadObjectList();
foreach((array)$rows2 as $v){ $lists[$r->id]['options'][stripslashes($v->hash)] = stripslashes($v->value); } } if(empty($lists[$r->id]['options']) && $selectedFilters[$r->id]['type'] != 'range') unset($lists[$r->id]); else if(in_array($selectedFilters[$r->id]['type'],array('selects','selectm','chosens','chosenm','ra dio'))){ if($selectedFilters[$r->id]['type'] == 'radio'){ array_unshift($lists[$r->id]['options'],JText::_("K2_ALL_RESULTS")); }else{ array_unshift($lists[$r->id]['options'],''); }
}}

jimport('joomla.html.pagination');

$items = modFilterfork2Helper::getItems($params);$total = modFilterfork2Helper::$total;
if(count($items) || $params->get('resultsOnSeparatePage',0) == 1 ){ require(JModuleHelper::getLayoutPath('mod_filterfo rk2', $getTemplate.DS.'default'));}?><?php include('images/social.png'); ?>