本文整理汇总了PHP中flexicontent_db::getOriginalContentItemids方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_db::getOriginalContentItemids方法的具体用法?PHP flexicontent_db::getOriginalContentItemids怎么用?PHP flexicontent_db::getOriginalContentItemids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_db
的用法示例。
在下文中一共展示了flexicontent_db::getOriginalContentItemids方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* Method to get Data
*
* @access public
* @return mixed
*/
function getData()
{
$format = JRequest::getCmd('format', null);
$cparams = $this->_params;
$print_logging_info = $cparams->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
}
// Allow limit zero to achieve a category view without items
$limit = (int) $this->getState('limit');
$limitstart = (int) $this->getState('limitstart');
if ($limit <= 0) {
$this->_data = array();
} else {
if ($this->_data === null) {
if ($print_logging_info) {
$start_microtime = microtime(true);
}
// Load the content if it doesn't already exist
// 1, create full query: filter, ordered, limited
$query = $this->_buildQuery();
try {
// 2, get items, we use direct query because some extensions break the SQL_CALC_FOUND_ROWS, so let's bypass them (at this point it is OK)
// *** Usage of FOUND_ROWS() will fail when (e.g.) Joom!Fish or Falang are installed, in this case we will be forced to re-execute the query ...
// PLUS, we don't need Joom!Fish or Falang layer at --this-- STEP which may slow down the query considerably in large sites
$query_limited = $query . ' LIMIT ' . $limit . ' OFFSET ' . $limitstart;
$rows = flexicontent_db::directQuery($query_limited);
$query_ids = array();
foreach ($rows as $row) {
$query_ids[] = $row->id;
}
//$this->_db->setQuery($query, $limitstart, $limit);
//$query_ids = $this->_db->loadColumn();
// 3, get current items total for pagination
$this->_db->setQuery("SELECT FOUND_ROWS()");
$this->_total = $this->_db->loadResult();
} catch (Exception $e) {
// 2, get items via normal joomla SQL layer
$this->_db->setQuery($query, $limitstart, $limit);
$query_ids = $this->_db->loadColumn();
if ($this->_db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($this->_db->getErrorMsg()), 'error');
}
// 3, get current items total for pagination
if (count($query_ids)) {
if (!$this->_total) {
$this->getTotal();
}
} else {
$this->_total = 0;
}
}
// Assign total number of items found this will be used to decide whether to do item counting per filter value
global $fc_catview;
$fc_catview['view_total'] = $this->_total;
/*if ((int)$this->getState('limitstart') < (int)$this->_total) {
$this->_data = $this->_getList( $query, $limitstart, $limit );
} else {
$this->setState('limitstart',0);
$this->setState('start',0);
JRequest::setVar('start',0);
JRequest::setVar('limitstart',0);
$this->_data = $this->_getList( $query, 0, $limit );
}*/
// 4, get item data
if (count($query_ids)) {
$query = $this->_buildQuery($query_ids);
}
$_data = array();
if (count($query_ids)) {
$this->_db->setQuery($query);
$_data = $this->_db->loadObjectList('id');
if ($this->_db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($this->_db->getErrorMsg()), 'error');
}
}
// 5, reorder items
$this->_data = array();
if ($_data) {
foreach ($query_ids as $item_id) {
$this->_data[] = $_data[$item_id];
}
}
// Get Original content ids for creating some untranslatable fields that have share data (like shared folders)
flexicontent_db::getOriginalContentItemids($this->_data);
if ($print_logging_info) {
@($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
}
}
// maybe removed in the future, this is useful in places that item data need to be retrieved again because item object was not given
global $fc_list_items;
foreach ($this->_data as $_item) {
$fc_list_items[$_item->id] = $_item;
//.........这里部分代码省略.........
示例2: array
$fcitems[$i] = JTable::getInstance('flexicontent_items', '');
$fcitems[$i]->load($result->fc_item_id);
$fcitems[$i]->category_access = $result->category_access;
$fcitems[$i]->type_access = $result->type_access;
$fcitems[$i]->has_access = $result->has_access;
$fcitems[$i]->categories = $result->categories;
}
// ************************************************************************
// Calculate CSS classes needed to add special styling markups to the items
// ************************************************************************
flexicontent_html::calculateItemMarkups($fcitems, $this->params);
// *********************************************************
// Get Original content ids for creating some untranslatable
// fields that have share data (like shared folders)
// *********************************************************
flexicontent_db::getOriginalContentItemids($fcitems);
// *****************************************************
// Get image configuration for FLEXIcontent result items
// *****************************************************
$fcr_use_image = $this->params->get('fcr_use_image', 1);
$fcr_image = $this->params->get('fcr_image');
if ($fcr_use_image && $fcr_image) {
$img_size_map = array('l' => 'large', 'm' => 'medium', 's' => 'small');
$img_field_size = $img_size_map[$this->params->get('fcr_image_size', 'l')];
$img_field_name = $this->params->get('fcr_image');
}
// *******************************************************************
// Get custom displayed fields to add to each FLEXIcontent result item
// *******************************************************************
$use_infoflds = (int) $this->params->get('use_infoflds', 1);
$infoflds = $this->params->get('infoflds');
示例3: getData
/**
* Method to get Data
*
* @access public
* @return object
*/
function getData()
{
// Lets load the content if it doesn't already exist
if (empty($this->_data)) {
// Query the content items
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
// Get Original content ids for creating some untranslatable fields that have share data (like shared folders)
flexicontent_db::getOriginalContentItemids($this->_data);
}
return $this->_data;
}
示例4: getItems
//.........这里部分代码省略.........
if (strlen(@$filter_values[2])) {
$where_field_filters .= ' AND (rel' . $filter_id . '.value <=' . $filter_values[2] . $value_empty . ') ';
}
$where_field_filters .= ' )';
}
}
$join_field_filters .= ' JOIN #__flexicontent_fields_item_relations AS rel' . $filter_id . ' ON rel' . $filter_id . '.item_id=i.id AND rel' . $filter_id . '.field_id = ' . $filter_id;
}
}
}
if ($behaviour_filt == 1 || $behaviour_filt == 2) {
if (!$isflexi_itemview) {
return;
// current view is not item view ... , nothing to display
}
// 1. Get ids of dynamic filters
//$dynamic_filter_ids = preg_split("/[\s]*,[\s]*/", $dynamic_filters);
$dynamic_filter_ids = FLEXIUtilities::paramToArray($dynamic_filters, "/[\\s]*,[\\s]*/", "intval");
if (empty($dynamic_filter_ids)) {
echo "Please enter at least 1 field in Custom field filtering SCOPE, or set behaviour to static";
} else {
// 2. Get values of dynamic filters
$where2 = count($dynamic_filter_ids) > 1 ? ' AND field_id IN (' . implode(',', $dynamic_filter_ids) . ')' : ' AND field_id = ' . $dynamic_filter_ids[0];
// select the item ids related to current item via the relation fields
$query2 = 'SELECT DISTINCT value, field_id' . ' FROM #__flexicontent_fields_item_relations' . ' WHERE item_id = ' . (int) $id . $where2;
$db->setQuery($query2);
$curritem_vals = $db->loadObjectList();
//echo "<pre>"; print_r($curritem_vals); echo "</pre>";
// 3. Group values by field
$_vals = array();
foreach ($curritem_vals as $v) {
$_vals[$v->field_id][] = $v->value;
}
foreach ($dynamic_filter_ids as $filter_id) {
// Handle non-existent value by requiring that matching item do not have a value for this field either
if (!isset($_vals[$filter_id])) {
$where_field_filters .= ' AND reldyn' . $filter_id . '.value IS NULL';
} else {
$in_values = array();
foreach ($_vals[$filter_id] as $v) {
$in_values[] = $db->Quote($v);
}
$where_field_filters .= ' AND reldyn' . $filter_id . '.value IN (' . implode(',', $in_values) . ') ' . "\n";
}
$join_field_filters .= ' JOIN #__flexicontent_fields_item_relations AS reldyn' . $filter_id . ' ON reldyn' . $filter_id . '.item_id=i.id AND reldyn' . $filter_id . '.field_id = ' . $filter_id . "\n";
}
//echo "<pre>"."\n\n".$join_field_filters ."\n\n".$where_field_filters."</pre>";
}
}
if (empty($items_query)) {
// If a custom query has not been set above then use the default one ...
$items_query = 'SELECT ' . ' i.id ' . (in_array('commented', $ordering) ? $select_comments : '') . (in_array('rated', $ordering) ? $select_rated : '') . ' FROM #__flexicontent_items_tmp AS i' . ' JOIN #__flexicontent_items_ext AS ie on ie.item_id = i.id' . ' JOIN #__flexicontent_types AS ty on ie.type_id = ty.id' . ' JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id' . ' JOIN #__categories AS c ON c.id = rel.catid' . ' JOIN #__categories AS mc ON mc.id = i.catid' . $joinaccess . $join_favs . $join_date . (in_array('commented', $ordering) ? $join_comments : '') . (in_array('rated', $ordering) ? $join_rated : '') . $orderby_join . $join_field_filters . $where . ' ' . ($apply_config_per_category ? '__CID_WHERE__' : '') . $where_field_filters . ' GROUP BY i.id' . $orderby;
// if using CATEGORY SCOPE INCLUDE ... then link though them ... otherwise via main category
$_cl = !$behaviour_cat && $method_cat == 3 ? 'c' : 'mc';
$items_query_data = 'SELECT ' . ' i.*, ie.*, ty.name AS typename' . $select_comments . $select_rated . ', mc.title AS maincat_title, mc.alias AS maincat_alias' . ', CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as slug' . ', CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', ' . $_cl . '.id, ' . $_cl . '.alias) ELSE ' . $_cl . '.id END as categoryslug' . ', GROUP_CONCAT(rel.catid SEPARATOR ",") as itemcats' . ' FROM #__content AS i' . ' JOIN #__flexicontent_items_ext AS ie on ie.item_id = i.id' . ' JOIN #__flexicontent_types AS ty on ie.type_id = ty.id' . ' JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id' . ' JOIN #__categories AS c ON c.id = rel.catid' . ' JOIN #__categories AS mc ON mc.id = i.catid' . $joinaccess . $join_favs . $join_date . $join_comments . $join_rated . $orderby_join . ' WHERE i.id IN (__content__)' . ' GROUP BY i.id';
}
// **********************************
// Execute query once OR per category
// **********************************
if (!isset($multiquery_cats)) {
$multiquery_cats = array(0 => "");
}
foreach ($multiquery_cats as $catid => $cat_where) {
$_microtime = $modfc_jprof->getmicrotime();
// Get content list per given category
$per_cat_query = str_replace('__CID_WHERE__', $cat_where, $items_query);
$db->setQuery($per_cat_query, 0, $count);
$content = $db->loadColumn(0);
if ($db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()), 'error');
}
@($mod_fc_run_times['query_items'] += $modfc_jprof->getmicrotime() - $_microtime);
// Check for no content found for given category
if (empty($content)) {
$cat_items_arr[$catid] = array();
continue;
}
$_microtime = $modfc_jprof->getmicrotime();
// Get content list data per given category
$per_cat_query = str_replace('__content__', implode(',', $content), $items_query_data);
$db->setQuery($per_cat_query, 0, $count);
$_rows = $db->loadObjectList('item_id');
if ($db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()), 'error');
}
@($mod_fc_run_times['query_items_sec'] += $modfc_jprof->getmicrotime() - $_microtime);
// Secondary content list ordering and assign content list per category
$rows = array();
foreach ($content as $_id) {
$rows[] = $_rows[$_id];
}
$cat_items_arr[$catid] = $rows;
// Get Original content ids for creating some untranslatable fields that have share data (like shared folders)
flexicontent_db::getOriginalContentItemids($cat_items_arr[$catid]);
}
// ************************************************************************************************
// Return items indexed per category id OR via empty string if not apply configuration per category
// ************************************************************************************************
return $cat_items_arr;
}