public static function onCCK_Storage_LocationAfterRender(&$buffer, &$data, $uri = array()) { $app = JFactory::getApplication(); if ($uri['layout']) { return; } if ($uri['view'] == 'featured') { $data['return_view'] = 'featured'; $tag = '&return=featured'; } else { $data['return_view'] = ''; $tag = ''; } $class = JCck::on('3.4') ? ' class="hasTooltip"' : ''; $data['doIntegration'] = false; $data['multilanguage'] = $data['options']->get('multilanguage', 0); if ($data['multilanguage']) { $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)" (.*)>#U'; } else { $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)"#'; } $data['search_alt'] = '#<a href = "javascript://" onclick="listItemTask\\(\'cb([0-9]*)\', \'articles.archive\'\\)">(.*)</a>#sU'; if (JCckDevHelper::hasLanguageAssociations() && $data['multilanguage']) { $query = 'SELECT a.pk, a.cck, b.key, c.language FROM #__cck_core AS a' . ' LEFT JOIN #__associations AS b ON ( b.id = a.pk AND context = "com_content.item" )' . ' LEFT JOIN #__content AS c ON c.id = a.pk' . ' WHERE storage_location="joomla_article"'; $list_assoc = JCckDatabase::loadObjectListArray('SELECT a.id, a.key, b.language FROM #__associations AS a LEFT JOIN #__content AS b ON ( b.id = a.id AND a.context = "com_content.item" )', 'key', 'language'); } else { $query = 'SELECT pk, cck FROM #__cck_core WHERE storage_location="joomla_article"'; $list_assoc = array(); } $list = JCckDatabase::loadObjectList($query, 'pk'); $buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list, $list_assoc); }
public static function loadObjectListArray($query, $akey, $key = null) { static $cache = array(); $idx = md5($query); if (!isset($cache[$idx])) { $cache[$idx] = parent::loadObjectListArray($query, $akey, $key); } return $cache[$idx]; }
protected static function _setTaxes($zones) { $db = JFactory::getDbo(); $null = $db->getNullDate(); $now = JFactory::getDate()->toSql(); $zones[] = 0; $query = 'SELECT a.id, a.title, a.type, a.tax, a.tax_amount, a.groups, a.target' . ' FROM #__cck_more_ecommerce_taxes AS a' . ' LEFT JOIN #__cck_more_ecommerce_zone_tax AS b ON b.tax_id = a.id' . ' WHERE a.published = 1' . ' AND (a.publish_up = ' . JCckDatabase::quote($null) . ' OR ' . 'a.publish_up <= ' . JCckDatabase::quote($now) . ')' . ' AND (a.publish_down = ' . JCckDatabase::quote($null) . ' OR ' . 'a.publish_down >= ' . JCckDatabase::quote($now) . ')' . ' AND b.zone_id IN (' . implode(',', $zones) . ')' . ' ORDER BY a.title'; $taxes = JCckDatabase::loadObjectListArray($query, 'type'); return $taxes; }
public static function getFields($element, $item, $featured = '', $exclusion = false, $force = false, $pos = '') { jimport('cck.construction.field.generic_more'); $table = $element . '_field'; if (!isset($item->id)) { $fields = array(); if ($featured != '') { $where = 'WHERE ' . $featured . ' AND a.storage != "dev" AND ( a.storage_table NOT LIKE "#__cck_store_form_%" )'; $fields = JCckDatabase::loadObjectList('SELECT DISTINCT a.id, a.title, a.name, a.folder, a.type, a.label FROM #__cck_core_fields AS a ' . $where . ' ORDER BY a.ordering ASC'); if (count($fields)) { $list = array(); foreach ($fields as $f) { $f->position = $pos; $list[$pos][] = $f; } $fields = $list; } } return $fields; } if ($exclusion !== false) { $query = 'SELECT a.fieldid FROM #__cck_core_' . $table . ' AS a WHERE a.' . $element . 'id = ' . (int) $item->id . ' AND a.client = "' . $item->client . '"'; $fields = JCckDatabase::loadColumn($query); if (!is_array($fields)) { return ''; } $fields = implode(',', $fields); } else { $and = $force === true ? ' ' . $featured : ''; $query = ' SELECT DISTINCT a.id, a.title, a.name, a.folder, a.type, a.label, c.client, ' . plgCCK_FieldGeneric_More::gm_getConstruction_Columns($table, '_get') . ' FROM #__cck_core_fields AS a ' . ' LEFT JOIN #__cck_core_' . $table . ' AS c ON c.fieldid = a.id' . ' WHERE c.' . $element . 'id = ' . (int) $item->id . ' AND c.client = "' . $item->client . '"' . $and . ' ORDER BY c.ordering ASC'; $fields = JCckDatabase::loadObjectListArray($query, 'position'); if (!$fields) { return array(); } } return $fields; }
public static function getFields($search, $client, $excluded = '', $idx = true, $cck = false) { $where = ' WHERE b.name = "' . $search . '"'; // Client if ($client != 'all') { $and = array(); if (!is_array($client)) { $client = array($client); } if (count($client)) { foreach ($client as $k => $v) { $and[] = 'c.client = "' . $v . '"'; } $where .= ' AND (' . implode(' OR ', $and) . ')'; } } // Exclude if ($excluded != '') { $where .= ' AND a.id NOT IN (' . $excluded . ')'; } // Access $user = JFactory::getUser(); $access = implode(',', $user->getAuthorisedViewLevels()); $where .= ' AND c.access IN (' . $access . ')'; $query = ' SELECT ' . self::getFieldColumns_asString('a') . ', c.client,' . ' c.label as label2, c.variation, c.variation_override, c.required, c.required_alert, c.validation, c.validation_options, c.live, c.live_options, c.live_value, c.markup, c.markup_class, c.match_collection, c.match_mode, c.match_options, c.match_value, c.stage, c.access, c.restriction, c.restriction_options, c.computation, c.computation_options, c.conditional, c.conditional_options, c.position' . ' FROM #__cck_core_fields AS a ' . ' LEFT JOIN #__cck_core_search_field AS c ON c.fieldid = a.id' . ' LEFT JOIN #__cck_core_searchs AS b ON b.id = c.searchid' . $where . ' GROUP BY c.client, c.fieldid' . ' ORDER BY c.ordering ASC'; $fields = $idx ? JCckDatabase::loadObjectListArray($query, 'client', 'name') : JCckDatabase::loadObjectList($query, 'client'); //# if (!count($fields)) { $fields = array(); if (count($client)) { foreach ($client as $k => $v) { $fields[$v] = array(); } } } return $fields; }