function getItemList(&$ids = null, $cid = null, &$userid = 0) { $db = JFactory::getDBO(); if ($ids === null) { require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'classes' . DS . 'flexicontent.categories.php'; require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'models' . DS . 'category.php'; $saved_cid = JRequest::getVar('cid', ''); // save cid ... $saved_layout = JRequest::getVar('layout'); // save layout ... $saved_option = JRequest::getVar('option'); // save option ... $saved_view = JRequest::getVar('view'); // save layout ... //$target_layout = $mcats_selection || !$catid ? 'mcats' : ''; //JRequest::setVar('layout', $target_layout); //JRequest::setVar($target_layout=='mcats' ? 'cids' : 'cid', $limit_filters_to_cat ? $catid : 0); JRequest::setVar('layout', ''); JRequest::setVar('cid', $cid); JRequest::setVar('option', 'com_flexicontent'); JRequest::setVar('view', 'category'); // Get/Create current category model ... according to configuaration set above into the JRequest variables ... $catmodel = new FlexicontentModelCategory(); $category = $catmodel->getCategory($pk = null, $raiseErrors = false, $checkAccess = false); $query = $catmodel->_buildQuery(false, $count_total = false); $db->setQuery($query, 0, 50000); $list = $db->loadColumn(); $list = is_array($list) ? $list : array(); // Restore variables JRequest::setVar('cid', $saved_cid); // restore cid JRequest::setVar('layout', $saved_layout); // restore layout JRequest::setVar('option', $saved_option); // restore option JRequest::setVar('view', $saved_view); // restore view return $list; } else { // Retrieving specific item data $query = 'SELECT i.*, ie.*,' . ' CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(":", i.id, i.alias) ELSE i.id END as slug,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as categoryslug' . ' FROM #__content AS i' . ' JOIN #__flexicontent_items_ext AS ie on ie.item_id = i.id' . ' JOIN #__categories AS cc ON cc.id = ' . $cid . ' WHERE i.id IN (' . implode(',', $ids) . ')'; $db->setQuery($query); try { $list = $db->loadObjectList('id'); } catch (Exception $e) { if ($db->getErrorNum()) { JError::raiseWarning($db->getErrorNum(), $db->getErrorMsg() . "<br />" . $query . "<br />"); } return array(); } $list = is_array($list) ? $list : array(); return $list; } }
// allowed filters are set in the category options (configuration) $saved_cid = JRequest::getVar('cid', ''); // save cid ... $saved_layout = JRequest::getVar('layout'); // save layout ... $saved_option = JRequest::getVar('option'); // save option ... $saved_view = JRequest::getVar('view'); // save layout ... $target_layout = $mcats_selection || !$catid ? 'mcats' : ''; JRequest::setVar('layout', $target_layout); JRequest::setVar($target_layout == 'mcats' ? 'cids' : 'cid', $limit_filters_to_cat ? $catid : 0); JRequest::setVar('option', 'com_flexicontent'); JRequest::setVar('view', 'category'); // Get/Create current category model ... according to configuaration set above into the JRequest variables ... $catmodel = new FlexicontentModelCategory(); $catparams = $catmodel->getParams(); // Get current's view category parameters this will if needed to get category specific filters ... $catmodel->_buildItemWhere($wherepart = 'where', $counting = true); $catmodel->_buildItemFromJoin($counting = true); // ALL filters if ($display_filter_list == 0) { // WARNING: this CASE is supposed to get ALL filters regardless category, // but __ALL_FILTERS__ ignores the 'use_filters' parameter, so we must check it separetely // ... $params->set('filters_order', 1); // respect filters ordering if so configured in category $filters = !$params->get('use_filters', 0) ? array() : FlexicontentFields::getFilters('filters', '__ALL_FILTERS__', $catparams); } else { if ($display_filter_list == 1) { // ... $params->set('filters_order', 1); // respect filters ordering if so configured in category $filters = FlexicontentFields::getFilters('filters', 'use_filters', $catparams); } else {
// 2. Get category, this is needed so that we get only the allowed filters of the category // allowed filters are set in the category options (configuration) $saved_cid = JRequest::getVar('cid', ''); // save cid ... $saved_layout = JRequest::getVar('layout'); // save layout ... $saved_option = JRequest::getVar('option'); // save option ... $saved_view = JRequest::getVar('view'); // save layout ... $target_layout = $mcats_selection || !$catid ? 'mcats' : ''; JRequest::setVar('layout', $target_layout); JRequest::setVar($target_layout=='mcats' ? 'cids' : 'cid', $limit_filters_to_cat ? $catid : 0); JRequest::setVar('option', 'com_flexicontent'); JRequest::setVar('view', 'category'); // Get/Create current category model ... according to configuaration set above into the JRequest variables ... $catmodel = new FlexicontentModelCategory(); $catparams = $catmodel->getParams(); // Get current's view category parameters this will if needed to get category specific filters ... $catmodel->_buildItemWhere($wherepart='where', $counting=true); $catmodel->_buildItemFromJoin($counting=true); // ALL filters if ($display_filter_list==0) { // WARNING: this CASE is supposed to get ALL filters regardless category, // but __ALL_FILTERS__ ignores the 'use_filters' parameter, so we must check it separetely // ... $params->set('filters_order', 1); // respect filters ordering if so configured in category $filters = ! $params->get('use_filters', 0) ? array() : FlexicontentFields::getFilters('filters', '__ALL_FILTERS__', $catparams); } // Filter selected in category configuration else if ($display_filter_list==1) { // ... $params->set('filters_order', 1); // respect filters ordering if so configured in category