本文整理汇总了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;
}