本文整理汇总了PHP中flexicontent_db::buildCatOrderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_db::buildCatOrderBy方法的具体用法?PHP flexicontent_db::buildCatOrderBy怎么用?PHP flexicontent_db::buildCatOrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_db
的用法示例。
在下文中一共展示了flexicontent_db::buildCatOrderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
//.........这里部分代码省略.........
示例2: _buildCatOrderBy
/**
* Build the order clause for subcategory listing
*
* @access private
* @return string
*/
function _buildCatOrderBy()
{
$request_var = '';
$config_param = 'subcat_orderby';
$default_order = 'c.lft';
$default_order_dir = 'ASC';
// Precedence: $request_var ==> $order ==> $config_param ==> $default_order
return flexicontent_db::buildCatOrderBy($this->_params, $order = '', $request_var, $config_param, $cat_tbl_alias = 'c', $user_tbl_alias = 'u', $default_order, $default_order_dir);
}
示例3: _buildCatOrderBy
/**
* Build the order clause
*
* @access private
* @return string
*/
function _buildCatOrderBy($prefix)
{
$request_var = '';
$config_param = $prefix . 'orderby';
$default_order = $this->getState('filter_order', 'c.title');
$default_order_dir = $this->getState('filter_order_dir', 'ASC');
// Precedence: $request_var ==> $order ==> $config_param ==> $default_order
return flexicontent_db::buildCatOrderBy($this->_params, $order = '', $request_var, $config_param, $cat_tbl_alias = 'c', $user_tbl_alias = 'u', $default_order, $default_order_dir);
}