本文整理汇总了PHP中FlexicontentFields::getPropertySupport方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentFields::getPropertySupport方法的具体用法?PHP FlexicontentFields::getPropertySupport怎么用?PHP FlexicontentFields::getPropertySupport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentFields
的用法示例。
在下文中一共展示了FlexicontentFields::getPropertySupport方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFilteredSearch
static function getFilteredSearch(&$filter, $value, $return_sql = true)
{
$db = JFactory::getDBO();
// Check if field type supports advanced search
$support = FlexicontentFields::getPropertySupport($filter->field_type, $filter->iscore);
if (!$support->supportadvsearch && !$support->supportadvfilter) {
return null;
}
$valueswhere = FlexicontentFields::createFilterValueMatchSQL($filter, $value, $is_full_text = 1, $is_search = 1);
if (!$valueswhere) {
return;
}
// Decide to require all values
$display_filter_as = $filter->parameters->get('display_filter_as_s', 0);
$require_all = count($value) > 1 && !in_array($display_filter_as, array(1, 2, 3)) ? $filter->parameters->get('filter_values_require_all', 0) : 0;
$istext_input = $display_filter_as == 1 || $display_filter_as == 3;
//$colname = $istext_input ? 'fs.search_index' : 'fs.value_id';
$colname = @$filter->isindexed && !$istext_input ? 'fs.value_id' : 'fs.search_index';
$valueswhere = str_replace('_v_', $colname, $valueswhere);
// Get ALL items that have such values for the given field
$query = "SELECT " . ($require_all ? 'fs.item_id' : 'DISTINCT fs.item_id') . " FROM #__flexicontent_advsearch_index AS fs" . " WHERE fs.field_id='" . $filter->id . "' " . $valueswhere;
if ($require_all) {
// Do not use distinct on column, it makes it is very slow, despite column having an index !!
// e.g. HAVING COUNT(DISTINCT colname) = ...
// Instead the field code should make sure that no duplicate values are saved in the DB !!
$query .= ' GROUP BY fs.item_id ' . ' HAVING COUNT(*) >= ' . count($value);
}
if (!$return_sql) {
//echo "<br>FlexicontentFields::getFiltered() ".$filter->name." appying query :<br>". $query."<br>\n";
$db->setQuery($query);
$filtered = FLEXI_J16GE ? $db->loadColumn() : $db->loadResultArray();
if ($db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()), 'error');
}
return $filtered;
} else {
return ' AND i.id IN (' . $query . ')';
}
}
示例2:
$published = JHTML::image('administrator/components/com_flexicontent/assets/images/tick_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
} else {
if (!$canPublish && $row->published) {
// No privilige published
$published = JHTML::image('administrator/components/com_flexicontent/assets/images/tick_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
} else {
if (!$canPublish && !$row->published) {
// No privilige unpublished
$published = JHTML::image('administrator/components/com_flexicontent/assets/images/publish_x_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
} else {
$published = JHTML::_('jgrid.published', $row->published, $i, $ctrl);
}
}
}
//check which properties are supported by current field
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportsearch = $ft_support->supportsearch;
$supportfilter = $ft_support->supportfilter;
$supportadvsearch = $ft_support->supportadvsearch;
$supportadvfilter = $ft_support->supportadvfilter;
if ($row->issearch == 0 || $row->issearch == 1 || !$supportsearch) {
$search_dirty = 0;
$issearch = $row->issearch && $supportsearch ? "search.png" : "publish_x" . (!$supportsearch ? '_f2' : '') . ".png";
$issearch_tip = $row->issearch && $supportsearch ? $flexi_yes . ", " . $flexi_toggle : ($supportsearch ? $flexi_no . ", " . $flexi_toggle : $flexi_nosupport);
} else {
$search_dirty = 1;
$issearch = $row->issearch == -1 ? "disconnect.png" : "connect.png";
$issearch_tip = ($row->issearch == 2 ? $flexi_yes : $flexi_no) . ", " . $flexi_toggle . ", " . $flexi_rebuild;
}
$isfilter = $row->isfilter && $supportfilter ? "filter.png" : "publish_x" . (!$supportfilter ? '_f2' : '') . ".png";
$isfilter_tip = $row->isfilter && $supportfilter ? $flexi_yes . ", " . $flexi_toggle : ($supportsearch ? $flexi_no . ", " . $flexi_toggle : $flexi_nosupport);
示例3: display
function display($tpl = null)
{
//initialise variables
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
//add css to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
//add js function to overload the joomla submitform
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
JHTML::_('behavior.tooltip');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('select2');
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/admin.js');
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/validate.js');
//Load pane behavior
jimport('joomla.html.pane');
//Import File system
jimport('joomla.filesystem.file');
//Get data from the model
$model = $this->getModel();
$row = $this->get('Field');
if (FLEXI_J16GE) {
$form = $this->get('Form');
}
$types = $this->get('Typeslist');
$typesselected = $this->get('Typesselected');
//create the toolbar
if ($row->id) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_FIELD'), 'fieldedit');
} else {
JToolBarHelper::title(JText::_('FLEXI_ADD_FIELD'), 'fieldadd');
}
$ctrl = FLEXI_J16GE ? 'fields.' : '';
JToolBarHelper::apply($ctrl . 'apply');
JToolBarHelper::save($ctrl . 'save');
JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
JToolBarHelper::cancel($ctrl . 'cancel');
// Import Joomla plugin that implements the type of current flexi field
JPluginHelper::importPlugin('flexicontent_fields', $row->iscore ? 'core' : $row->field_type);
// load plugin's english language file then override with current language file
$extension_name = 'plg_flexicontent_fields_' . ($row->iscore ? 'core' : $row->field_type);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, null, true);
//check which properties are supported by current field
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportsearch = $ft_support->supportsearch;
$supportadvsearch = $ft_support->supportadvsearch;
$supportfilter = $ft_support->supportfilter;
$supportadvfilter = $ft_support->supportadvfilter;
$supportuntranslatable = $ft_support->supportuntranslatable;
$supportvalueseditable = $ft_support->supportvalueseditable;
$supportformhidden = $ft_support->supportformhidden;
$supportedithelp = $ft_support->supportedithelp;
//build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes)
$lists = array();
//build field_type list
if (!$row->field_type) {
$row->field_type = 'text';
}
if ($row->iscore == 1) {
$class = 'disabled="disabled"';
} else {
$class = '';
$_field_id = '#' . (FLEXI_J16GE ? 'jform_' : '') . 'field_type';
$_row_id = FLEXI_J16GE ? $form->getValue("id") : $row->id;
$_ctrl_task = FLEXI_J16GE ? 'task=fields.getfieldspecificproperties' : 'controller=fields&task=getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\tvar JTooltips = new Tips(jQuery('#fieldspecificproperties .hasTip'), { maxTitleChars: 50, fixed: false});\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
$lists['field_type'] = flexicontent_html::buildfieldtypeslist('field_type', $class, $row->field_type, $group = true);
//build type select list
$attribs = 'class="use_select2_lib" multiple="multiple" size="6"';
$attribs .= $row->iscore ? ' disabled="disabled"' : '';
$types_fieldname = FLEXI_J16GE ? 'jform[tid][]' : 'tid[]';
$lists['tid'] = flexicontent_html::buildtypesselect($types, $types_fieldname, $typesselected, false, $attribs);
// **************************************************************************
// Create fields for J1.5 (J2.5+ uses JForm XML file for most of form fields)
// **************************************************************************
if (!FLEXI_J16GE) {
//build formhidden selector
$formhidden[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO'));
$formhidden[] = JHTML::_('select.option', 1, JText::_('FLEXI_FRONTEND'));
$formhidden[] = JHTML::_('select.option', 2, JText::_('FLEXI_BACKEND'));
$formhidden[] = JHTML::_('select.option', 3, JText::_('FLEXI_BOTH'));
$formhidden_fieldname = FLEXI_J16GE ? 'jform[formhidden]' : 'formhidden';
$lists['formhidden'] = JHTML::_('select.radiolist', $formhidden, $formhidden_fieldname, '', 'value', 'text', $row->formhidden);
if (FLEXI_ACCESS) {
$valueseditable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_EDITOR'));
$valueseditable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_PERMISSION'));
//.........这里部分代码省略.........
示例4: display
function display($tpl = null)
{
//initialise variables
$app = JFactory::getApplication();
$option = JRequest::getVar('option');
$document = JFactory::getDocument();
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
//add css to document
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH);
// Add JS frameworks
flexicontent_html::loadFramework('select2');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH);
//Load pane behavior
jimport('joomla.html.pane');
//Import File system
jimport('joomla.filesystem.file');
//Get data from the model
$model = $this->getModel();
$row = $this->get('Field');
$form = $this->get('Form');
$types = $this->get('Typeslist');
$typesselected = $this->get('Typesselected');
//create the toolbar
if ($row->id) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_FIELD'), 'fieldedit');
} else {
JToolBarHelper::title(JText::_('FLEXI_ADD_FIELD'), 'fieldadd');
}
$ctrl = FLEXI_J16GE ? 'fields.' : '';
JToolBarHelper::apply($ctrl . 'apply');
JToolBarHelper::save($ctrl . 'save');
JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
JToolBarHelper::cancel($ctrl . 'cancel');
// Import Joomla plugin that implements the type of current flexi field
$extfolder = 'flexicontent_fields';
$extname = $row->iscore ? 'core' : $row->field_type;
JPluginHelper::importPlugin('flexicontent_fields', $row->iscore ? 'core' : $row->field_type);
// Create class name of the plugin and then create a plugin instance
$classname = 'plg' . ucfirst($extfolder) . $extname;
// Check max allowed version
if (property_exists($classname, 'prior_to_version')) {
// Set a system message with warning of failed PHP limits
$prior_to_version = $app->getUserStateFromRequest($option . '.flexicontent.prior_to_version_' . $row->field_type, 'prior_to_version_' . $row->field_type, 0, 'int');
$app->setUserState($option . '.flexicontent.prior_to_version_' . $row->field_type, $prior_to_version + 1);
if ($prior_to_version < 2) {
$close_btn = FLEXI_J30GE ? '<a class="close" data-dismiss="alert">×</a>' : '<a class="fc-close" onclick="this.parentNode.parentNode.removeChild(this.parentNode);">×</a>';
$manifest_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'manifest.xml';
$com_xml = JApplicationHelper::parseXMLInstallFile($manifest_path);
$ver_exceeded = version_compare(str_replace(' ', '.', $com_xml['version']), str_replace(' ', '.', $classname::$prior_to_version), '>=');
if ($ver_exceeded) {
echo '
<span class="fc-note fc-mssg-inline">
' . $close_btn . '
Warning: installed version of Field: \'<b>' . $extname . '</b>\' was given to be free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ' <br/> It may or may not work properly in later versions
</span>';
} else {
echo '
<span class="fc-info fc-mssg-inline">
' . $close_btn . '
Note: installed version of Field: \'<b>' . $extname . '</b>\' is given free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ', nevertheless it will continue to function after FLEXIcontent is upgraded.
</span>';
}
}
}
// load plugin's english language file then override with current language file
$extension_name = 'plg_flexicontent_fields_' . ($row->iscore ? 'core' : $row->field_type);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, null, true);
//check which properties are supported by current field
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportsearch = $ft_support->supportsearch;
$supportadvsearch = $ft_support->supportadvsearch;
$supportfilter = $ft_support->supportfilter;
$supportadvfilter = $ft_support->supportadvfilter;
$supportuntranslatable = $ft_support->supportuntranslatable;
$supportvalueseditable = $ft_support->supportvalueseditable;
$supportformhidden = $ft_support->supportformhidden;
$supportedithelp = $ft_support->supportedithelp;
//build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes)
$lists = array();
//build field_type list
if (!$row->field_type) {
$row->field_type = 'text';
}
$_attribs = ' class="use_select2_lib fc_skip_highlight" ';
if ($row->iscore == 1) {
$_attribs .= ' disabled="disabled" ';
} else {
$_field_id = 'jform_field_type';
$_row_id = $form->getValue("id");
$_ctrl_task = 'task=fields.getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\t" . (FLEXI_J30GE ? "\n\t\t\t\t\t\t\t\t\tjQuery('.hasTooltip').tooltip({'html': true,'container': jQuery('#fieldspecificproperties')});\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tvar tipped_elements = jQuery('#fieldspecificproperties .hasTip');\n\t\t\t\t\t\t\t\ttipped_elements.each(function() {\n\t\t\t\t\t\t\t\t\tvar title = this.get('title');\n\t\t\t\t\t\t\t\t\tif (title) {\n\t\t\t\t\t\t\t\t\t\tvar parts = title.split('::', 2);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:title', parts[0]);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:text', parts[1]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tvar ajax_JTooltips = new Tips(\$('fieldspecificproperties').getElements('.hasTip'), { maxTitleChars: 50, fixed: false});\n\t\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\ttabberAutomatic(tabberOptions, 'fieldspecificproperties');\n\t\t\t\t\t\t\t\tfc_bindFormDependencies('#fieldspecificproperties', 0, '');\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('#" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
//.........这里部分代码省略.........
示例5: toggleprop
/**
* Method to toggle the given property of given field
*
* @access public
* @return boolean True on success
* @since 1.0
*/
function toggleprop($cid = array(), $propname = null, &$unsupported = 0, &$locked = 0)
{
if (!$propname) {
return false;
}
$user = JFactory::getUser();
$affected = 0;
if (count($cid)) {
// Get fields information from DB
$query = 'SELECT field_type, iscore, id' . ' FROM #__flexicontent_fields' . ' WHERE id IN (' . implode(',', $cid) . ') ';
$this->_db->setQuery($query);
$rows = $this->_db->loadObjectList('id');
// Calculate fields not supporting the property
$support_ids = array();
$supportprop_name = 'support' . str_replace('is', '', $propname);
foreach ($rows as $id => $row) {
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportprop = isset($ft_support->{$supportprop_name}) ? $ft_support->{$supportprop_name} : false;
if ($supportprop) {
$support_ids[] = $id;
}
}
$unsupported = count($cid) - count($support_ids);
// Check that at least one field that supports the property was found
if (!count($support_ids)) {
return 0;
}
// Some fields are marked as 'dirty'
$dirty_properties = array('issearch', 'isadvsearch', 'isadvfilter');
$set_clause = in_array($propname, $dirty_properties) ? ' SET ' . $propname . ' = CASE ' . $propname . ' WHEN 2 THEN -1 WHEN -1 THEN 2 WHEN 1 THEN -1 WHEN 0 THEN 2 END' : ' SET ' . $propname . ' = 1-' . $propname;
// Toggle the property for fields supporting the property
$query = 'UPDATE #__flexicontent_fields' . $set_clause . ' WHERE id IN (' . implode(",", $support_ids) . ')' . ' AND ( checked_out = 0 OR ( checked_out = ' . (int) $user->get('id') . ' ) )';
$this->_db->setQuery($query);
if (!($result = $this->_db->execute())) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Get affected fields, non affected fields must have been locked by another user
$affected = $this->_db->getAffectedRows();
$locked = count($support_ids) - $affected;
}
return $affected;
}
示例6: getFilteredSearch
static function getFilteredSearch(&$filter, $value, $return_sql = true)
{
$app = JFactory::getApplication();
$db = JFactory::getDBO();
// Check if field type supports advanced search
$support = FlexicontentFields::getPropertySupport($filter->field_type, $filter->iscore);
if (!$support->supportadvsearch && !$support->supportadvfilter) {
return null;
}
// Decide to require all values
$display_filter_as = $filter->parameters->get('display_filter_as_s', 0);
$isDate = in_array($filter->field_type, array('date', 'created', 'modified')) || $filter->parameters->get('isdate', 0);
$isRange = in_array($display_filter_as, array(2, 3, 8));
$require_all_param = $filter->parameters->get('filter_values_require_all', 0);
$require_all = count($value) > 1 && !$isRange ? $require_all_param : 0;
$istext_input = $display_filter_as == 1 || $display_filter_as == 3;
$colname = @$filter->isindexed && !$istext_input || $isDate ? 'fs.value_id' : 'fs.search_index';
// Create where clause for matching the filter's values
$valueswhere = FlexicontentFields::createFilterValueMatchSQL($filter, $value, $is_full_text = 1, $is_search = 1, $colname);
if (!$valueswhere) {
return;
}
$valueswhere = str_replace('_v_', $colname, $valueswhere);
$field_tbl = 'flexicontent_advsearch_index_field_' . $filter->id;
$query = 'SHOW TABLES LIKE "' . $app->getCfg('dbprefix') . $field_tbl . '"';
$db->setQuery($query);
$tbl_exists = (bool) count($db->loadObjectList());
$field_tbl = $tbl_exists ? $field_tbl : 'flexicontent_advsearch_index';
// Get ALL items that have such values for the given field
$query = 'SELECT ' . ($require_all ? 'fs.item_id' : 'DISTINCT fs.item_id') . ' FROM #__' . $field_tbl . ' AS fs' . ' WHERE fs.field_id=' . $filter->id . $valueswhere;
if ($require_all) {
// Do not use distinct on column, it makes it is very slow, despite column having an index !!
// e.g. HAVING COUNT(DISTINCT colname) = ...
// Instead the field code should make sure that no duplicate values are saved in the DB !!
$query .= ' GROUP BY fs.item_id ' . ' HAVING COUNT(*) >= ' . count($value) . ' ORDER BY NULL';
// THIS should remove filesort in MySQL, and improve performance issue of REQUIRE ALL
}
//echo 'Filter ['. $filter->label .']: '. $query."<br/><br/>\n";
if (!$return_sql) {
//echo "<br>GET FILTERED Items (helper func) -- [".$filter->name."] using in-query ids : ". $query."<br>\n";
$db->setQuery($query);
$filtered = $db->loadColumn();
return $filtered;
} else {
if ($return_sql === 2) {
static $iids_tblname = array();
if (!isset($iids_tblname[$filter->id])) {
$iids_tblname[$filter->id] = 'fc_filter_iids_' . $filter->id;
}
$tmp_tbl = $iids_tblname[$filter->id];
try {
// Use sub-query on temporary table
$db->setQuery('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $tmp_tbl . ' (id INT, KEY(`id`))');
$db->query();
$db->setQuery('TRUNCATE TABLE ' . $tmp_tbl);
$db->query();
$db->setQuery('INSERT INTO ' . $tmp_tbl . ' ' . $query);
$db->query();
$_query = $query;
$query = 'SELECT id FROM ' . $tmp_tbl;
//echo "<br/><br/>GET FILTERED Items (helper func) -- [".$filter->name."] using temporary table: ".$query." for :".$_query ." <br/><br/>";
/*$db->setQuery($query);
$data = $db->loadObjectList();
echo "<pre>";
print_r($data);
exit;*/
} catch (Exception $e) {
// Ignore table creation error
//if ($db->getErrorNum()) echo 'SQL QUERY ERROR:<br/>'.nl2br($db->getErrorMsg());
//echo "<br/><br/>GET FILTERED Items (helper func) -- [".$filter->name."] using subquery: ".$query." <br/><br/>";
}
} else {
//echo "<br/><br/>GET FILTERED Items (helper func) -- [".$filter->name."] using subquery: ".$query." <br/><br/>";
}
}
return ' AND i.id IN (' . $query . ')';
}