當前位置: 首頁>>代碼示例>>PHP>>正文


PHP flexicontent_db::buildCatOrderBy方法代碼示例

本文整理匯總了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;
//.........這裏部分代碼省略.........
開發者ID:khetsothea,項目名稱:flexicontent-cck,代碼行數:101,代碼來源:helper.php

示例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);
 }
開發者ID:noxidsoft,項目名稱:flexicontent-cck,代碼行數:15,代碼來源:category.php

示例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);
 }
開發者ID:khetsothea,項目名稱:flexicontent-cck,代碼行數:15,代碼來源:flexicontent.php


注:本文中的flexicontent_db::buildCatOrderBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。