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


PHP JCommentsFactory::getDbo方法代码示例

本文整理汇总了PHP中JCommentsFactory::getDbo方法的典型用法代码示例。如果您正苦于以下问题:PHP JCommentsFactory::getDbo方法的具体用法?PHP JCommentsFactory::getDbo怎么用?PHP JCommentsFactory::getDbo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JCommentsFactory的用法示例。


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

示例1: getUserGroups

 public static function getUserGroups()
 {
     static $groups = array();
     if (!count($groups)) {
         if (JCOMMENTS_JVERSION == '1.0') {
             $db = JCommentsFactory::getDbo();
             $db->setQuery('SELECT a.name, a.name AS text, a.group_id as id, COUNT(DISTINCT b.group_id) AS level' . ' FROM #__core_acl_aro_groups AS a' . ' LEFT JOIN `#__core_acl_aro_groups` AS b ON a.lft > b.lft AND a.rgt < b.rgt' . ' WHERE a.name NOT IN ("ROOT", "USERS", "Public Backend")' . ' GROUP BY a.group_id' . ' ORDER BY a.lft ASC');
             $groups = $db->loadObjectList();
             // for backward compatibility
             self::updateUserGroups($groups);
         } else {
             if (JCOMMENTS_JVERSION == '1.5') {
                 $db = JFactory::getDbo();
                 $db->setQuery('SELECT a.name, a.name AS text, a.id, COUNT(DISTINCT b.id) AS level' . ' FROM #__core_acl_aro_groups AS a' . ' LEFT JOIN `#__core_acl_aro_groups` AS b ON a.lft > b.lft AND a.rgt < b.rgt' . ' WHERE a.name NOT IN ("ROOT", "USERS", "Public Backend")' . ' GROUP BY a.id' . ' ORDER BY a.lft ASC');
                 $groups = $db->loadObjectList();
                 // for backward compatibility
                 self::updateUserGroups($groups);
             } else {
                 if (JCOMMENTS_JVERSION == '1.7') {
                     $db = JFactory::getDbo();
                     $db->setQuery('SELECT CASE WHEN a.id = 1 THEN \'Public\' ELSE a.title END AS name, a.title AS text, a.id, COUNT(DISTINCT b.id) AS level' . ' FROM #__usergroups AS a' . ' LEFT JOIN `#__usergroups` AS b ON a.lft > b.lft AND a.rgt < b.rgt' . ' GROUP BY a.id' . ' ORDER BY a.lft ASC');
                     $groups = $db->loadObjectList();
                 }
             }
         }
     }
     return $groups;
 }
开发者ID:enjoy2000,项目名称:smcd,代码行数:28,代码来源:user.php


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