当前位置: 首页>>代码示例>>PHP>>正文


PHP flexicontent_db类代码示例

本文整理汇总了PHP中flexicontent_db的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_db类的具体用法?PHP flexicontent_db怎么用?PHP flexicontent_db使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了flexicontent_db类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkin

 /**
  * Check in a record
  *
  * @since	1.5
  */
 function checkin()
 {
     $tbl = 'flexicontent_categories';
     $redirect_url = 'index.php?option=com_flexicontent&view=categories';
     flexicontent_db::checkin($tbl, $redirect_url, $this);
     return;
     // true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:13,代码来源:categories.php

示例2: buildItemOrderBy

	/**
	 * Build the order clause of item listings
	 * precedence: $request_var ==> $order ==> $config_param ==> $default_order_col (& $default_order_dir)
	 * @access private
	 * @return string
	 */
	static function buildItemOrderBy(&$params=null, &$order='', $request_var='orderby', $config_param='orderby', $i_as='i', $rel_as='rel', $default_order_col_1st='', $default_order_dir_1st='', $sfx='', $support_2nd_lvl=false)
	{
		// Use global params ordering if parameters were not given
		if (!$params) $params = JComponentHelper::getParams( 'com_flexicontent' );
		
		$order_fallback = 'rdate';  // Use as default or when an invalid ordering is requested
		$orderbycustomfield   = (int) $params->get('orderbycustomfield'.$sfx, 1);    // Backwards compatibility, defaults to enabled *
		$orderbycustomfieldid = (int) $params->get('orderbycustomfieldid'.$sfx, 0);  // * but this needs to be set in order for field ordering to be used
		
		// 1. If a FORCED -ORDER- is not given, then use ordering parameters from configuration. NOTE: custom field ordering takes priority
		if (!$order) {
			$order = ($orderbycustomfield && $orderbycustomfieldid)  ?  'field'  :  $params->get($config_param.$sfx, $order_fallback);
		}
		
		// 2. If allowing user ordering override, then get ordering from HTTP request variable
		$order = $params->get('orderby_override') && ($request_order = JRequest::getVar($request_var.$sfx)) ? $request_order : $order;
		
		// 3. Check various cases of invalid order, print warning, and reset ordering to default
		if ($order=='field' && !$orderbycustomfieldid ) {
			// This can occur only if field ordering was requested explicitly, otherwise an not set 'orderbycustomfieldid' will prevent 'field' ordering
			echo "Custom field ordering was selected, but no custom field is selected to be used for ordering<br/>";
			$order = $order_fallback;
		}
		if ($order=='commented') {
			if (!file_exists(JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php')) {
				echo "jcomments not installed, you need jcomments to use 'Most commented' ordering OR display comments information.<br>\n";
				$order = $order_fallback;
			} 
		}
		
		$order_col_1st = $default_order_col_1st;
		$order_dir_1st = $default_order_dir_1st;
		flexicontent_db::_getOrderByClause($params, $order, $i_as, $rel_as, $order_col_1st, $order_dir_1st, $sfx);
		$order_arr[1] = $order;
		$orderby = ' ORDER BY '.$order_col_1st.' '.$order_dir_1st;
		
		
		// ****************************************************************
		// 2nd level ordering, (currently only supported when no SFX given)
		// ****************************************************************
		
		if ($sfx!='' || !$support_2nd_lvl) {
			$orderby .= $order_col_1st != $i_as.'.title'  ?  ', '.$i_as.'.title'  :  '';
			$order_arr[2] = '';
			$order = $order_arr;
			return $orderby;
		}
		
		$order = '';  // Clear this, thus force retrieval from parameters (below)
		$sfx='_2nd';  // Set suffix of second level ordering
		$order_fallback = 'alpha';  // Use as default or when an invalid ordering is requested
		$orderbycustomfield   = (int) $params->get('orderbycustomfield'.$sfx, 1);    // Backwards compatibility, defaults to enabled *
		$orderbycustomfieldid = (int) $params->get('orderbycustomfieldid'.$sfx, 0);  // * but this needs to be set in order for field ordering to be used
		
		// 1. If a FORCED -ORDER- is not given, then use ordering parameters from configuration. NOTE: custom field ordering takes priority
		if (!$order) {
			$order = ($orderbycustomfield && $orderbycustomfieldid)  ?  'field'  :  $params->get($config_param.$sfx, $order_fallback);
		}
		
		// 2. If allowing user ordering override, then get ordering from HTTP request variable
		$order = $request_var && ($request_order = JRequest::getVar($request_var.$sfx)) ? $request_order : $order;
		
		// 3. Check various cases of invalid order, print warning, and reset ordering to default
		if ($order=='field' && !$orderbycustomfieldid ) {
			// This can occur only if field ordering was requested explicitly, otherwise an not set 'orderbycustomfieldid' will prevent 'field' ordering
			echo "Custom field ordering was selected, but no custom field is selected to be used for ordering<br/>";
			$order = $order_fallback;
		}
		if ($order=='commented') {
			if (!file_exists(JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php')) {
				echo "jcomments not installed, you need jcomments to use 'Most commented' ordering OR display comments information.<br>\n";
				$order = $order_fallback;
			} 
		}
		
		$order_col_2nd = '';
		$order_dir_2nd = '';
		if ($order!='default') {
			flexicontent_db::_getOrderByClause($params, $order, $i_as, $rel_as, $order_col_2nd, $order_dir_2nd, $sfx);
			$order_arr[2] = $order;
			$orderby .= ', '.$order_col_2nd.' '.$order_dir_2nd;
		}
		
		// Order by title after default ordering
		$orderby .= ($order_col_1st != $i_as.'.title' && $order_col_2nd != $i_as.'.title')  ?  ', '.$i_as.'.title'  :  '';
		$order = $order_arr;
		return $orderby;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:94,代码来源:flexicontent.helper.php

示例3: addfav

 /**
  * Method to add a favourite
  *
  * @access	public
  * @return	boolean	True on success
  * @since	1.0
  */
 function addfav()
 {
     return flexicontent_db::addfav($type = 1, $this->_id, JFactory::getUser()->id);
 }
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:11,代码来源:category.php

示例4: _buildItemWhere

 /**
  * Method to build the WHERE clause
  *
  * @access private
  * @return string
  */
 function _buildItemWhere()
 {
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     // Get the view's parameters
     $cparams = $this->_params;
     // Date-Times are stored as UTC, we should use current UTC time to compare and not user time (requestTime),
     //  thus the items are published globally at the time the author specified in his/her local clock
     //$app  = JFactory::getApplication();
     //$now  = FLEXI_J16GE ? $app->requestTime : $app->get('requestTime');   // NOT correct behavior it should be UTC (below)
     //$date = JFactory::getDate();
     //$now  = FLEXI_J16GE ? $date->toSql() : $date->toMySQL();              // NOT good if string passed to function that will be cached, because string continuesly different
     $_nowDate = 'UTC_TIMESTAMP()';
     //$db->Quote($now);
     $nullDate = $db->getNullDate();
     // First thing we need to do is to select only the requested FAVOURED items
     $where = ' WHERE fav.userid = ' . (int) $user->get('id');
     // Get privilege to view non viewable items (upublished, archived, trashed, expired, scheduled).
     // NOTE:  ACL view level is checked at a different place
     if (FLEXI_J16GE) {
         $ignoreState = $user->authorise('flexicontent.ignoreviewstate', 'com_flexicontent');
     } else {
         if (FLEXI_ACCESS) {
             $ignoreState = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'ignoreviewstate', 'users', $user->gmid) : 1;
         } else {
             $ignoreState = $user->gid > 19;
         }
     }
     // author has 19 and editor has 20
     if (!$ignoreState) {
         // Limit by publication state. Exception: when displaying personal user items or items modified by the user
         $where .= ' AND ( i.state IN (1, -5) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         // Limit by publish up/down dates. Exception: when displaying personal user items or items modified by the user
         $where .= ' AND ( ( i.publish_up = ' . $this->_db->Quote($nullDate) . ' OR i.publish_up <= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         $where .= ' AND ( ( i.publish_down = ' . $this->_db->Quote($nullDate) . ' OR i.publish_down >= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
     }
     $where .= !FLEXI_J16GE ? ' AND i.sectionid = ' . FLEXI_SECTION : '';
     /*
      * If we have a filter, and this is enabled... lets tack the AND clause
      * for the filter onto the WHERE clause of the item query.
      */
     // ****************************************
     // Create WHERE clause part for Text Search
     // ****************************************
     $text = JRequest::getString('filter', JRequest::getString('q', ''), 'default');
     // Check for LIKE %word% search, for languages without spaces
     $filter_word_like_any = $cparams->get('filter_word_like_any', 0);
     $phrase = $filter_word_like_any ? JRequest::getWord('searchphrase', JRequest::getWord('p', 'any'), 'default') : JRequest::getWord('searchphrase', JRequest::getWord('p', 'exact'), 'default');
     $si_tbl = 'flexicontent_items_ext';
     $search_prefix = $cparams->get('add_search_prefix') ? 'vvv' : '';
     // SEARCH WORD Prefix
     $text = !$search_prefix ? trim($text) : preg_replace('/(\\b[^\\s,\\.]+\\b)/u', $search_prefix . '$0', trim($text));
     $words = preg_split('/\\s\\s*/u', $text);
     if (strlen($text)) {
         $ts = 'ie';
         $escaped_text = FLEXI_J16GE ? $db->escape($text, true) : $db->getEscaped($text, true);
         $quoted_text = $db->Quote($escaped_text, false);
         switch ($phrase) {
             case 'natural':
                 $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ') ';
                 break;
             case 'natural_expanded':
                 $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' WITH QUERY EXPANSION) ';
                 break;
             case 'exact':
                 $stopwords = array();
                 $shortwords = array();
                 if (!$search_prefix) {
                     $words = flexicontent_db::removeInvalidWords($words, $stopwords, $shortwords, $si_tbl, 'search_index', $isprefix = 0);
                 }
                 if (empty($words)) {
                     // All words are stop-words or too short, we could try to execute a query that only contains a LIKE %...% , but it would be too slow
                     JRequest::setVar('ignoredwords', implode(' ', $stopwords));
                     JRequest::setVar('shortwords', implode(' ', $shortwords));
                     $_text_match = ' 0=1 ';
                 } else {
                     // speed optimization ... 2-level searching: first require ALL words, then require exact text
                     $newtext = '+' . implode(' +', $words);
                     $quoted_text = FLEXI_J16GE ? $db->escape($newtext, true) : $db->getEscaped($newtext, true);
                     $quoted_text = $db->Quote($quoted_text, false);
                     $exact_text = $db->Quote('%' . $escaped_text . '%', false);
                     $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' IN BOOLEAN MODE) AND ' . $ts . '.search_index LIKE ' . $exact_text;
                 }
                 break;
             case 'all':
                 $stopwords = array();
                 $shortwords = array();
                 if (!$search_prefix) {
                     $words = flexicontent_db::removeInvalidWords($words, $stopwords, $shortwords, $si_tbl, 'search_index', $isprefix = 1);
                 }
                 JRequest::setVar('ignoredwords', implode(' ', $stopwords));
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:favourites.php

示例5: foreach

foreach ($this->tmpls as $tmpl) {
	$layouts[] = $tmpl->name;
}
$layouts = implode("','", $layouts);

$this->document->addScriptDeclaration("
	window.addEvent('domready', function() {
		activatePanel('blog');
	});
	");
dump($this->row);
*/
?>

<?php 
$useAssocs = flexicontent_db::useAssociations();
// Load JS tabber lib
$this->document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/tabber-minimized.js', FLEXI_VERSION);
$this->document->addStyleSheetVersion(JURI::root(true) . '/components/com_flexicontent/assets/css/tabber.css', FLEXI_VERSION);
$this->document->addScriptDeclaration(' document.write(\'<style type="text/css">.fctabber{display:none;}<\\/style>\'); ');
// temporarily hide the tabbers until javascript runs
$js = "\n\tjQuery(document).ready(function(){\n\t\tfc_bindFormDependencies('#flexicontent', 0, '');\n\t});\n";
?>

<style>
.current:after{
	clear: both;
	content: "";
	display: block;
}
</style>
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:31,代码来源:default.php

示例6: display


//.........这里部分代码省略.........
                }
            }
        }
        // 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
        $fieldtypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = false, $_published = true);
        $fftypes = array();
        foreach ($fieldtypes as $field_group => $ft_types) {
            $fftypes[] = $field_group;
            foreach ($ft_types as $field_type => $ftdata) {
                $fftypes[] = array('value' => $ftdata->field_type, 'text' => $ftdata->friendly);
            }
            $fftypes[] = '';
        }
        $lists['field_type'] = flexicontent_html::buildfieldtypeslist($fftypes, 'jform[field_type]', $row->field_type, $_grouped ? 1 : 0, $_attribs);
        //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'));
                $valueseditable_fieldname = FLEXI_J16GE ? 'jform[valueseditable]' : 'valueseditable';
                $lists['valueseditable'] = JHTML::_('select.radiolist', $valueseditable, $valueseditable_fieldname, '', 'value', 'text', $row->valueseditable);
            }
            $edithelp[] = JHTML::_('select.option', 0, JText::_('FLEXI_EDIT_HELP_NONE'));
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:view.html.php

示例7: 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');
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:31,代码来源:default_results.php

示例8: useAssociations

 /**
  * Method to determine if J3.1+ associations should be used
  *
  * @return  boolean True if using J3 associations; false otherwise.
  */
 public function useAssociations()
 {
     return flexicontent_db::useAssociations();
 }
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:9,代码来源:category.php

示例9: display

    function display($tpl = null)
    {
        // ***********
        // Batch tasks
        // ***********
        $app = JFactory::getApplication();
        $jinput = $app->input;
        $task = $jinput->get('task', '', 'cmd');
        $cid = $jinput->get('cid', array(), 'array');
        if ($task == 'copy') {
            $behaviour = $jinput->get('copy_behaviour', 'copy/move', 'string');
            $this->setLayout('copy');
            $this->_displayCopyMove($tpl, $cid, $behaviour);
            return;
        }
        // ********************
        // Initialise variables
        // ********************
        global $globalcats;
        $option = $jinput->get('option', '', 'cmd');
        $view = $jinput->get('view', '', 'cmd');
        $cparams = JComponentHelper::getParams('com_flexicontent');
        $user = JFactory::getUser();
        $db = JFactory::getDBO();
        $document = JFactory::getDocument();
        $session = JFactory::getSession();
        $bind_limit = $jinput->get('bind_limit', 1000, 'int');
        // Some flags
        $enable_translation_groups = flexicontent_db::useAssociations();
        //$cparams->get("enable_translation_groups");
        $print_logging_info = $cparams->get('print_logging_info');
        // Get model
        $model = $this->getModel();
        // ***********
        // Get filters
        // ***********
        $count_filters = 0;
        // File id filtering
        $fileid_to_itemids = $session->get('fileid_to_itemids', array(), 'flexicontent');
        $filter_fileid = $model->getState('filter_fileid');
        if ($filter_fileid) {
            $count_filters++;
        }
        // Order type, order, order direction
        $filter_order_type = $model->getState('filter_order_type');
        $filter_order = $model->getState('filter_order');
        $filter_order_Dir = $model->getState('filter_order_Dir');
        // Category filtering
        $filter_cats = $model->getState('filter_cats');
        $filter_subcats = $model->getState('filter_subcats');
        $filter_catsinstate = $model->getState('filter_catsinstate');
        if ($filter_cats) {
            $count_filters++;
        }
        if ($filter_subcats != 1) {
            $count_filters++;
        }
        if ($filter_catsinstate != 1) {
            $count_filters++;
        }
        // Other filters
        $filter_tag = $model->getState('filter_tag');
        $filter_lang = $model->getState('filter_lang');
        $filter_type = $model->getState('filter_type');
        $filter_author = $model->getState('filter_author');
        $filter_state = $model->getState('filter_state');
        $filter_access = $model->getState('filter_access');
        // Support for using 'ALL', 'ORPHAN' fake states, by clearing other values
        if (is_array($filter_state) && in_array('ALL', $filter_state)) {
            $filter_state = array('ALL');
        }
        if (is_array($filter_state) && in_array('ORPHAN', $filter_state)) {
            $filter_state = array('ORPHAN');
        }
        // Count active filters
        if ($filter_tag) {
            $count_filters++;
        }
        if ($filter_lang) {
            $count_filters++;
        }
        if ($filter_type) {
            $count_filters++;
        }
        if ($filter_author) {
            $count_filters++;
        }
        if ($filter_state) {
            $count_filters++;
        }
        if ($filter_access) {
            $count_filters++;
        }
        // Date filters
        $date = $model->getState('date');
        $startdate = $model->getState('startdate');
        $enddate = $model->getState('enddate');
        $startdate = $db->escape(trim(JString::strtolower($startdate)));
        $enddate = $db->escape(trim(JString::strtolower($enddate)));
        if ($startdate) {
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:view.html.php

示例10: copyitems


//.........这里部分代码省略.........
             //print_r($row->fulltext); exit;
             // Create a new item in the content fc_items_ext table
             $row->store();
             // Not doing a translation, we start a new language group for the new item
             if ($translate_method == 0) {
                 $row->lang_parent_id = 0;
                 //$row->id;
                 $row->store();
             }
             // ***********************************************************
             // Copy custom fields, translating the fields if so configured
             // ***********************************************************
             $doTranslation = $translate_method == 3 || $translate_method == 4;
             $query = 'SELECT fir.*, f.* ' . ' FROM #__flexicontent_fields_item_relations as fir' . ' LEFT JOIN #__flexicontent_fields as f ON f.id=fir.field_id' . ' WHERE item_id = ' . $sourceid;
             $this->_db->setQuery($query);
             $fields = $this->_db->loadObjectList();
             //echo "<pre>"; print_r($fields); exit;
             if ($doTranslation) {
                 $this->translateFieldValues($fields, $row, $lang_from, $lang_to);
             }
             //foreach ($fields as $field)  if ($field->field_type!='text' && $field->field_type!='textarea') { print_r($field->value); echo "<br><br>"; }
             foreach ($fields as $field) {
                 if (strlen($field->value)) {
                     $query = 'INSERT INTO #__flexicontent_fields_item_relations (`field_id`, `item_id`, `valueorder`, `suborder`, `value`)' . ' VALUES(' . $field->field_id . ', ' . $row->id . ', ' . $field->valueorder . ', ' . $field->suborder . ', ' . $this->_db->Quote($field->value) . ')';
                     $this->_db->setQuery($query);
                     $this->_db->execute();
                 }
             }
             if ($use_versioning) {
                 $v = new stdClass();
                 $v->item_id = (int) $item->id;
                 $v->version_id = 1;
                 $v->created = $item->created;
                 $v->created_by = $item->created_by;
                 //$v->comment		= 'copy version.';
                 $this->_db->insertObject('#__flexicontent_versions', $v);
             }
             // get the items versions
             $query = 'SELECT *' . ' FROM #__flexicontent_items_versions' . ' WHERE item_id = ' . $sourceid . ' AND version = ' . $curversion;
             $this->_db->setQuery($query);
             $curversions = $this->_db->loadObjectList();
             foreach ($curversions as $cv) {
                 $query = 'INSERT INTO #__flexicontent_items_versions (`version`, `field_id`, `item_id`, `valueorder`, `suborder`, `value`)' . ' VALUES(1 ,' . $cv->field_id . ', ' . $row->id . ', ' . $cv->valueorder . ', ' . $cv->suborder . ', ' . $this->_db->Quote($cv->value) . ')';
                 $this->_db->setQuery($query);
                 $this->_db->execute();
             }
             // get the item categories
             $query = 'SELECT catid' . ' FROM #__flexicontent_cats_item_relations' . ' WHERE itemid = ' . $sourceid;
             $this->_db->setQuery($query);
             $cats = $this->_db->loadColumn();
             foreach ($cats as $cat) {
                 $query = 'INSERT INTO #__flexicontent_cats_item_relations (`catid`, `itemid`)' . ' VALUES(' . $cat . ',' . $row->id . ')';
                 $this->_db->setQuery($query);
                 $this->_db->execute();
             }
             if ($keeptags) {
                 // get the item tags
                 $query = 'SELECT tid' . ' FROM #__flexicontent_tags_item_relations' . ' WHERE itemid = ' . $sourceid;
                 $this->_db->setQuery($query);
                 $tags = $this->_db->loadColumn();
                 foreach ($tags as $tag) {
                     $query = 'INSERT INTO #__flexicontent_tags_item_relations (`tid`, `itemid`)' . ' VALUES(' . $tag . ',' . $row->id . ')';
                     $this->_db->setQuery($query);
                     $this->_db->execute();
                 }
             }
             if ($method == 3) {
                 $this->moveitem($row->id, $maincat, $seccats);
             } else {
                 if ($method == 99 && ($maincat || $seccats)) {
                     $row->catid = $maincat ? $maincat : $row->catid;
                     $this->moveitem($row->id, $row->catid, $seccats);
                 }
             }
             // Load item model and save it once, e.g. updating Joomla featured FLAG data
             //$itemmodel = new FlexicontentModelItem();
             //$itemmodel->getItem($row->id);
             //$itemmodel->store((array)$row);
             // If new item is a tranlation, load the language associations of item
             // that was copied, and save the associations, adding the new item to them
             if ($method == 99 && $item->language != '*' && $row->language != '*' && flexicontent_db::useAssociations()) {
                 $associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $item->id);
                 // associations of item that was copied
                 $_data = array();
                 foreach ($associations as $tag => $association) {
                     $_data['associations'][$tag] = (int) $association->id;
                 }
                 $_data['associations'][$row->language] = $row->id;
                 // Add new item itself
                 $_data['associations'][$item->language] = $item->id;
                 // unneeded, done by saving ...
                 $context = 'com_content';
                 flexicontent_db::saveAssociations($row, $_data, $context);
                 // Save associations, adding the new item
                 //$app->enqueueMessage( print_r($_data, true), 'message' );
             }
         }
     }
     return true;
 }
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:items.php

示例11: onDisplayField


//.........这里部分代码省略.........
        // TYPE SCOPE
        if (($method_types == 2 || $method_types == 3) && (!count($types) || empty($types[0]))) {
            $field->html = 'Content Type scope is set to include/exclude but no Types are selected in field configuration, please set to "ALL" or select types to include/exclude';
            return;
        }
        if ($method_types == 2) {
            $where[] = ' ie.type_id NOT IN (' . implode(',', $types) . ')';
        } else {
            if ($method_types == 3) {
                $where[] = ' ie.type_id IN (' . implode(',', $types) . ')';
            }
        }
        // include method
        // OTHER SCOPE LIMITS
        if ($samelangonly) {
            $where[] = $item->language == '*' ? " ie.language='*' " : " (ie.language='{$item->language}' OR ie.language='*') ";
        }
        if ($onlypublished) {
            $where[] = " i.state IN (1, -5) ";
        }
        if ($ownedbyuser == 1) {
            $where[] = " i.created_by = " . $user->id;
        } else {
            if ($ownedbyuser == 2) {
                $where[] = " i.created_by = " . $item->created_by;
            }
        }
        $where = !count($where) ? "" : " WHERE " . implode(" AND ", $where);
        // ***********************************************
        // Item retrieving query ... CREATE ORDERBY CLAUSE
        // ***********************************************
        $order = $field->parameters->get('orderby_form', 'alpha');
        // TODO: add more orderings: commented, rated
        $orderby = flexicontent_db::buildItemOrderBy($field->parameters, $order, $request_var = '', $config_param = '', $item_tbl_alias = 'i', $relcat_tbl_alias = 'rel', $default_order = '', $default_order_dir = '', $sfx = '_form', $support_2nd_lvl = false);
        // Create JOIN for ordering items by a most rated
        if (in_array('author', $order) || in_array('rauthor', $order)) {
            $orderby_join = ' LEFT JOIN #__users AS u ON u.id = i.created_by';
        }
        // *****************************************************
        // Item retrieving query ... put together and execute it
        // *****************************************************
        $query = 'SELECT i.title, i.id, i.catid, i.state, i.alias' . ", GROUP_CONCAT(rel.catid SEPARATOR ',') as catlist" . ' FROM #__content AS i ' . ($samelangonly || $method_types > 1 ? " LEFT JOIN #__flexicontent_items_ext AS ie on i.id=ie.item_id " : "") . ' JOIN #__flexicontent_cats_item_relations AS rel on i.id=rel.itemid ' . @$orderby_join . $where . " GROUP BY rel.itemid " . $orderby;
        $db->setQuery($query);
        $items_arr = $db->loadObjectList();
        if ($db->getErrorNum()) {
            echo $db->getErrorMsg();
            $field->html = '';
            return false;
        }
        // *******************************************************
        // Create category tree to use for selecting related items
        // *******************************************************
        require_once JPATH_ROOT . DS . "components" . DS . "com_flexicontent" . DS . "classes" . DS . "flexicontent.categories.php";
        $tree = flexicontent_cats::getCategoriesTree();
        // Get categories without filtering
        if ($allowed_cats) {
            foreach ($allowed_cats as $catid) {
                $allowedtree[$catid] = $tree[$catid];
            }
        }
        if ($disallowed_cats) {
            foreach ($disallowed_cats as $catid) {
                unset($tree[$catid]);
            }
            $allowedtree =& $tree;
        }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:relation.php

示例12: _loadItem


//.........这里部分代码省略.........
                     // then the item is inside in an unpublished ancestor category, thus inaccessible
                     /*$query->select('CASE WHEN badcats.id is null THEN 1 ELSE 0 END AS ancestor_cats_published');
                     		$subquery = ' (SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
                     		$subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
                     		$subquery .= 'WHERE parent.extension = ' . $db->Quote('com_content');
                     		$subquery .= ' AND parent.published <= 0 GROUP BY cat.id)';
                     		$query->join('LEFT', $subquery . ' AS badcats ON badcats.id = c.id');*/
                     if ($version) {
                         // NOTE: version_id is used by field helper file to load the specified version, the reason for left join here is to verify that the version exists
                         $query->join('LEFT', '#__flexicontent_versions AS ver ON ver.item_id = i.id AND ver.version_id = ' . $db->Quote($version));
                     }
                     // Join on contact table, to get contact data of author
                     //$query = 'SHOW TABLES LIKE "' . JFactory::getApplication()->getCfg('dbprefix') . 'contact_details"';
                     //$db->setQuery($query);
                     //$contact_details_tbl_exists = (boolean) count($db->loadObjectList());
                     //if ( $contact_details_tbl_exists) {
                     //	$query->select('contact.id as contactid' ) ;
                     //	$query->join('LEFT','#__contact_details AS contact on contact.user_id = i.created_by');
                     //}
                     // Join over the categories to get parent category titles
                     //$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias');
                     //$query->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
                     $query->where('i.id = ' . (int) $this->_id);
                     //echo $db->replacePrefix($query);
                 } else {
                     // NOTE: version_id is used by field helper file to load the specified version, the reason for left join here is to verify that the version exists
                     $version_join = $version ? ' LEFT JOIN #__flexicontent_versions AS ver ON ver.item_id = i.id AND ver.version_id = ' . $db->Quote($version) : '';
                     $where = $this->_buildItemWhere();
                     $query = 'SELECT i.*, ie.*, ' . $select_access . ($version ? 'ver.version_id,' : '') . ' c.id AS catid, i.catid as maincatid,' . ' c.published AS catpublished,' . ' c.title AS category_title, c.alias AS category_alias,' . ' ty.name as typename, ty.alias as typealias,' . ' u.name AS author, u.usertype,' . ' v.rating_count as rating_count, ROUND( v.rating_sum / v.rating_count ) AS rating, ((v.rating_sum / v.rating_count)*20) as score,' . ' 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(\':\', c.id, c.alias) ELSE c.id END as categoryslug,' . ' CASE WHEN i.publish_up = ' . $nullDate . ' OR i.publish_up <= ' . $nowDate . ' THEN 0 ELSE 1 END as publication_scheduled,' . ' CASE WHEN i.publish_down = ' . $nullDate . ' OR i.publish_down >= ' . $nowDate . ' THEN 0 ELSE 1 END as publication_expired' . ' FROM #__content AS i' . ' LEFT JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . ' LEFT JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' . ' LEFT JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id' . $limit_to_cid . ' LEFT JOIN #__categories AS c ON c.id = rel.catid' . ' LEFT JOIN #__categories AS mc ON mc.id = i.catid' . ' LEFT JOIN #__users AS u ON u.id = i.created_by' . ' LEFT JOIN #__content_rating AS v ON i.id = v.content_id' . $joinaccess . $version_join . $where;
                 }
                 $db->setQuery($query);
                 // Try to execute query directly and load the data as an object
                 if (FLEXI_FISH && $task == 'edit' && $option == 'com_flexicontent' && in_array($app->getCfg('dbtype'), array('mysqli', 'mysql'))) {
                     $data = flexicontent_db::directQuery($query);
                     $data = @$data[0];
                     //$data = $db->loadObject(null, false);   // do not, translate, this is the JoomFish overridden method of Database extended Class
                 } else {
                     $data = $db->loadObject();
                 }
                 // Check for SQL error
                 if ($db->getErrorNum()) {
                     if (FLEXI_J16GE) {
                         throw new Exception($db->getErrorMsg(), 500);
                     } else {
                         JError::raiseError(500, $db->getErrorMsg());
                     }
                 }
                 //print_r($data); exit;
                 if (!$data) {
                     return false;
                 }
                 // item not found, return
                 if ($version && !$data->version_id) {
                     JError::raiseNotice(10, JText::sprintf('NOTICE: Requested item version %d was not found', $version));
                 }
                 $item =& $data;
             }
             // -- Create the description field called 'text' by appending introtext + readmore + fulltext
             $item->text = $item->introtext;
             $item->text .= JString::strlen(trim($item->fulltext)) ? '<hr id="system-readmore" />' . $item->fulltext : "";
             //echo "<br/>Current version (Frontend Active): " . $item->version;
             //echo "<br/>Version to load: ".$version;
             //echo "<br/><b> *** db title:</b> ".$item->title;
             //echo "<br/><b> *** db text:</b> ".$item->text;
             //echo "<pre>*** item data: "; print_r($item); echo "</pre>"; exit;
             // Set number of loaded version, IMPORTANT: zero means load unversioned data
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:67,代码来源:parentclassitem.php

示例13: display


//.........这里部分代码省略.........
         // Add the templates css files if availables
         if (isset($themes->category->{$clayout}->css)) {
             foreach ($themes->category->{$clayout}->css as $css) {
                 $document->addStyleSheet($this->baseurl . '/' . $css);
             }
         }
         // Add the templates js files if availables
         if (isset($themes->category->{$clayout}->js)) {
             foreach ($themes->category->{$clayout}->js as $js) {
                 $document->addScript($this->baseurl . '/' . $js);
             }
         }
         // Set the template var
         $tmpl = $themes->category->{$clayout}->tmplvar;
     } else {
         $tmpl = '.category.default';
     }
     // @TODO trigger the plugin selectively
     // and delete the plugins tags if not active
     if ($params->get('trigger_onprepare_content_cat')) {
         JPluginHelper::importPlugin('content');
         // Allow to trigger content plugins on category description
         // NOTE: for J2.5, we will trigger the plugins as if description text was an article text, using ... 'com_content.article'
         $category->text = $category->description;
         $results = $dispatcher->trigger('onContentPrepare', array('com_content.article', &$category, &$params, 0));
         JRequest::setVar('layout', $layout);
         // Restore LAYOUT variable should some plugin have modified it
         $category->description = $category->text;
     }
     // Maybe here not to import all plugins but just those for description field or add a parameter for this
     // Anyway these events are usually not very time consuming as is the the event onPrepareContent(J1.5)/onContentPrepare(J1.6+)
     JPluginHelper::importPlugin('content');
     $noroute_cats = array_flip($globalnoroute);
     $type_attribs = flexicontent_db::getTypeAttribs($force = true, $typeid = 0);
     $type_params = array();
     foreach ($items as $item) {
         $item->event = new stdClass();
         if (!isset($type_params[$item->type_id])) {
             $type_params[$item->type_id] = new JRegistry($type_attribs[$item->type_id]);
         }
         $item->params = clone $type_params[$item->type_id];
         $item->params->merge(new JRegistry($item->attribs));
         //$item->cats = isset($item->cats) ? $item->cats : array();
         // !!! The triggering of the event onPrepareContent(J1.5)/onContentPrepare(J1.6+) of content plugins
         // !!! for description field (maintext) along with all other flexicontent
         // !!! fields is handled by flexicontent.fields.php
         // !!! Had serious performance impact
         // CODE REMOVED
         // We must check if the current category is in the categories of the item ..
         $item_in_category = false;
         if ($item->catid == $category->id) {
             $item_in_category = true;
         } else {
             foreach ($item->cats as $cat) {
                 if ($cat->id == $category->id) {
                     $item_in_category = true;
                     break;
                 }
             }
         }
         // ADVANCED CATEGORY ROUTING (=set the most appropriate category for the item ...)
         // CHOOSE APPROPRIATE category-slug FOR THE ITEM !!! ( )
         if ($item_in_category && !isset($noroute_cats[$category->id])) {
             // 1. CATEGORY SLUG: CURRENT category
             // Current category IS a category of the item and ALSO routing (creating links) to this category is allowed
             $item->categoryslug = $category->slug;
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:view.html.php

示例14: display

    function display($tpl = null)
    {
        // ***********
        // Batch tasks
        // ***********
        $app = JFactory::getApplication();
        $jinput = $app->input;
        $layout = $jinput->get('layout', '', 'cmd');
        if ($layout == 'indexer') {
            $this->indexer($tpl);
            return;
        }
        // ********************
        // Initialise variables
        // ********************
        $option = $jinput->get('option', '', 'cmd');
        $view = $jinput->get('view', '', 'cmd');
        $cparams = JComponentHelper::getParams('com_flexicontent');
        $user = JFactory::getUser();
        $db = JFactory::getDBO();
        $document = JFactory::getDocument();
        // Get model
        $model = $this->getModel();
        $print_logging_info = $cparams->get('print_logging_info');
        if ($print_logging_info) {
            global $fc_run_times;
        }
        // ***********
        // Get filters
        // ***********
        $count_filters = 0;
        // Get filter vars
        $filter_order = $model->getState('filter_order');
        $filter_order_Dir = $model->getState('filter_order_Dir');
        $filter_indextype = $model->getState('filter_indextype');
        $isADV = $filter_indextype == 'advanced';
        $filter_fieldtype = $model->getState('filter_fieldtype');
        $filter_itemtype = $model->getState('filter_itemtype');
        $filter_itemstate = $model->getState('filter_itemstate');
        if ($filter_fieldtype) {
            $count_filters++;
        }
        if ($filter_itemtype) {
            $count_filters++;
        }
        if ($filter_itemstate) {
            $count_filters++;
        }
        $search = $model->getState('search');
        $search = $db->escape(trim(JString::strtolower($search)));
        $search_itemtitle = $model->getState('search_itemtitle');
        $search_itemid = $model->getState('search_itemid');
        $search_itemid = !empty($search_itemid) ? (int) $search_itemid : '';
        if ($search_itemtitle) {
            $count_filters++;
        }
        if ($search_itemid) {
            $count_filters++;
        }
        $filter_indextype = $model->getState('filter_indextype');
        $f_active['filter_fieldtype'] = (bool) $filter_fieldtype;
        $f_active['filter_itemtype'] = (bool) $filter_itemtype;
        $f_active['filter_itemstate'] = (bool) $filter_itemstate;
        $f_active['search'] = strlen($search);
        $f_active['search_itemtitle'] = strlen($search_itemtitle);
        $f_active['search_itemid'] = (bool) $search_itemid;
        // **************************
        // Add css and js to document
        // **************************
        flexicontent_html::loadFramework('select2');
        JHTML::_('behavior.tooltip');
        $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css');
        if (FLEXI_J30GE) {
            $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css');
        } else {
            if (FLEXI_J16GE) {
                $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css');
            }
        }
        // *****************************
        // Get user's global permissions
        // *****************************
        $perms = FlexicontentHelperPerm::getPerm();
        // ************************
        // Create Submenu & Toolbar
        // ************************
        // Create Submenu (and also check access to current view)
        FLEXISubmenu('CanIndex');
        // Create document/toolbar titles
        $doc_title = JText::_('FLEXI_SEARCH_INDEX');
        $site_title = $document->getTitle();
        JToolBarHelper::title($doc_title, FLEXI_J16GE ? 'searchtext.png' : 'searchindex');
        $document->setTitle($doc_title . ' - ' . $site_title);
        // Create the toolbar
        $this->setToolbar();
        $types = $this->get('Typeslist');
        $fieldtypes = flexicontent_db::getFieldTypes($_grouped = false, $_usage = true, $_published = false);
        // Build select lists
        $lists = array();
        //build backend visible filter
//.........这里部分代码省略.........
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:101,代码来源:view.html.php

示例15: getCategoryData

 public static function getCategoryData(&$params)
 {
     if (!$params->get('apply_config_per_category', 0)) {
         return false;
     }
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $view = JRequest::getVar('view');
     $option = JRequest::getVar('option');
     $currcat_custom_display = $params->get('currcat_custom_display', 0);
     $currcat_source = $params->get('currcat_source', 0);
     // 0 item view, 1 category view, 2 both
     $isflexi_itemview = $option == 'com_flexicontent' && $view == FLEXI_ITEMVIEW;
     $isflexi_catview = $option == 'com_flexicontent' && $view == 'category';
     $currcat_valid_case = $currcat_source == 2 && ($isflexi_itemview || $isflexi_catview) || $currcat_source == 0 && $isflexi_itemview || $currcat_source == 1 && $isflexi_catview;
     if ($currcat_custom_display && $currcat_valid_case) {
         $id = JRequest::getInt('id', 0);
         // id of current item
         $cid = JRequest::getInt('cid', 0);
         // current category id of current item
         $catconf = new stdClass();
         $catconf->orderby = '';
         $catconf->fallback_maincat = $params->get('currcat_fallback_maincat', 0);
         $catconf->showtitle = $params->get('currcat_showtitle', 0);
         $catconf->showdescr = $params->get('currcat_showdescr', 0);
         $catconf->cuttitle = (int) $params->get('currcat_cuttitle', 40);
         $catconf->cutdescr = (int) $params->get('currcat_cutdescr', 200);
         $catconf->link_title = $params->get('currcat_link_title');
         $catconf->show_image = $params->get('currcat_show_image');
         $catconf->image_source = $params->get('currcat_image_source');
         $catconf->link_image = $params->get('currcat_link_image');
         $catconf->image_width = (int) $params->get('currcat_image_width', 80);
         $catconf->image_height = (int) $params->get('currcat_image_height', 80);
         $catconf->image_method = (int) $params->get('currcat_image_method', 1);
         $catconf->show_default_image = (int) $params->get('currcat_show_default_image', 0);
         // parameter not added yet
         $catconf->readmore = (int) $params->get('currcat_currcat_readmore', 1);
         if ($catconf->fallback_maincat && !$cid && $id) {
             $query = 'SELECT catid FROM #__content WHERE id = ' . $id;
             $db->setQuery($query);
             $cid = $db->loadResult();
         }
         if ($cid) {
             $cids = array($cid);
         }
     }
     if (empty($cids)) {
         $catconf = new stdClass();
         // Check if using a dynamic set of categories, that was decided by getItems()
         $dynamic_cids = $params->get('dynamic_catids', false);
         $static_cids = $params->get('catids', array());
         $cids = $dynamic_cids ? unserialize($dynamic_cids) : $static_cids;
         $cids = !is_array($cids) ? array($cids) : $cids;
         $catconf->orderby = $params->get('cats_orderby', 'alpha');
         $catconf->showtitle = $params->get('cats_showtitle', 0);
         $catconf->showdescr = $params->get('cats_showdescr', 0);
         $catconf->cuttitle = (int) $params->get('cats_cuttitle', 40);
         $catconf->cutdescr = (int) $params->get('cats_cutdescr', 200);
         $catconf->link_title = $params->get('cats_link_title');
         $catconf->show_image = $params->get('cats_show_image');
         $catconf->image_source = $params->get('cats_image_source');
         $catconf->link_image = $params->get('cats_link_image');
         $catconf->image_width = (int) $params->get('cats_image_width', 80);
         $catconf->image_height = (int) $params->get('cats_image_height', 80);
         $catconf->image_method = (int) $params->get('cats_image_method', 1);
         $catconf->show_default_image = (int) $params->get('cats_show_default_image', 0);
         // parameter not added yet
         $catconf->readmore = (int) $params->get('cats_readmore', 1);
     }
     if (empty($cids) || !count($cids)) {
         return false;
     }
     // initialize variables
     $orderby = '';
     if ($catconf->orderby) {
         $orderby = flexicontent_db::buildCatOrderBy($params, $catconf->orderby, $request_var = '', $config_param = '', $cat_tbl_alias = 'c', $user_tbl_alias = 'u', $default_order = '', $default_order_dir = '');
     }
     $query = 'SELECT c.id, c.title, c.description, c.params ' . (FLEXI_J16GE ? '' : ', c.image ') . ', CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ' FROM #__categories AS c' . (FLEXI_J16GE ? ' LEFT JOIN #__users AS u ON u.id = c.created_user_id' : '') . ' WHERE c.id IN (' . implode(',', $cids) . ')' . $orderby;
     $db->setQuery($query);
     $catdata_arr = $db->loadObjectList('id');
     if ($db->getErrorNum()) {
         JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()), 'error');
     }
     if (!$catdata_arr) {
         return false;
     }
     $joomla_image_path = $app->getCfg('image_path', FLEXI_J16GE ? '' : 'images' . DS . 'stories');
     foreach ($catdata_arr as $i => $catdata) {
         $catdata->params = new JRegistry($catdata->params);
         // Category Title
         $catdata->title = flexicontent_html::striptagsandcut($catdata->title, $catconf->cuttitle);
         $catdata->showtitle = $catconf->showtitle;
         // Category image
         $catdata->image = FLEXI_J16GE ? $catdata->params->get('image') : $catdata->image;
         $catimage = "";
         if ($catconf->show_image) {
             $catdata->introtext =& $catdata->description;
             $catdata->fulltext = "";
             if ($catconf->image_source && $catdata->image && JFile::exists(JPATH_SITE . DS . $joomla_image_path . DS . $catdata->image)) {
                 $src = JURI::base(true) . "/" . $joomla_image_path . "/" . $catdata->image;
//.........这里部分代码省略.........
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:101,代码来源:helper.php


注:本文中的flexicontent_db类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。