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


PHP DiscussHelper::getUserGroupId方法代码示例

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


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

示例1: getBoardStatistics

 /**
  * Retrieves the html block for board statistics.
  *
  * @since	3.0
  * @access	public
  */
 public static function getBoardStatistics()
 {
     $theme = new DiscussThemes();
     $postModel = self::getModel('Posts');
     $totalPosts = $postModel->getTotal();
     $resolvedPosts = $postModel->getTotalResolved();
     $unresolvedPosts = $postModel->getUnresolvedCount();
     $userModel = self::getModel('Users');
     $totalUsers = $userModel->getTotalUsers();
     $latestMember = self::getTable('Profile');
     $latestMember->load($userModel->getLatestUser());
     // Total guests
     $totalGuests = $userModel->getTotalGuests();
     // Online users
     $onlineUsers = $userModel->getOnlineUsers();
     $config = DiscussHelper::getConfig();
     $gids = $config->get('main_exclude_frontend_statistics');
     $canViewStatistic = true;
     if (!empty($gids)) {
         //Remove whitespace
         $gids = str_replace(' ', '', $gids);
         $excludeGroup = explode(',', $gids);
         $my = JFactory::getUser();
         $myGroup = DiscussHelper::getUserGroupId($my);
         $result = array_intersect($myGroup, $excludeGroup);
         $canViewStatistic = empty($result) ? true : false;
     }
     $theme->set('latestMember', $latestMember);
     $theme->set('unresolvedPosts', $unresolvedPosts);
     $theme->set('resolvedPosts', $resolvedPosts);
     $theme->set('totalUsers', $totalUsers);
     $theme->set('totalPosts', $totalPosts);
     $theme->set('onlineUsers', $onlineUsers);
     $theme->set('totalGuests', $totalGuests);
     $theme->set('canViewStatistic', $canViewStatistic);
     return $theme->fetch('frontpage.statistics.php');
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:43,代码来源:helper.php

示例2: getRoleId

 public function getRoleId()
 {
     $userGroupId = DiscussHelper::getUserGroupId($this->user);
     $role = DiscussHelper::getTable('Role');
     $roleid = $role->getRoleId($userGroupId);
     return $roleid;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:7,代码来源:profile.php

示例3: getPrivateCategories

 public static function getPrivateCategories($acltype = DISCUSS_CATEGORY_ACL_ACTION_VIEW)
 {
     $db = DiscussHelper::getDBO();
     $my = JFactory::getUser();
     static $result = array();
     $excludeCats = array();
     $sig = (int) $my->id . '-' . (int) $acltype;
     if (!isset($result[$sig])) {
         if ($my->id == 0) {
             $catQuery = 'select distinct a.`id`, a.`private`';
             $catQuery .= ' from `#__discuss_category` as a';
             $catQuery .= ' 	left join `#__discuss_category_acl_map` as b on a.`id` = b.`category_id`';
             $catQuery .= ' 		and b.`acl_id` = ' . $db->Quote($acltype);
             $catQuery .= ' 		and b.`type` = ' . $db->Quote('group');
             $catQuery .= ' where a.`private` != ' . $db->Quote('0');
             $gid = array();
             $gids = '';
             if (DiscussHelper::getJoomlaVersion() >= '1.6') {
                 // $gid	= JAccess::getGroupsByUser(0, false);
                 $gid = DiscussHelper::getUserGroupId($my);
             } else {
                 $gid = DiscussHelper::getUserGids();
             }
             if (count($gid) > 0) {
                 foreach ($gid as $id) {
                     $gids .= empty($gids) ? $db->Quote($id) : ',' . $db->Quote($id);
                 }
                 $catQuery .= ' and a.`id` NOT IN (';
                 $catQuery .= '     SELECT c.category_id FROM `#__discuss_category_acl_map` as c ';
                 $catQuery .= '        WHERE c.acl_id = ' . $db->Quote($acltype);
                 $catQuery .= '        AND c.type = ' . $db->Quote('group');
                 $catQuery .= '        AND c.content_id IN (' . $gids . ') )';
             }
             $db->setQuery($catQuery);
             $result = $db->loadObjectList();
         } else {
             $result = self::getAclCategories($acltype, $my->id);
         }
         for ($i = 0; $i < count($result); $i++) {
             $item =& $result[$i];
             $item->childs = null;
             DiscussHelper::buildNestedCategories($item->id, $item, true);
             $catIds = array();
             $catIds[] = $item->id;
             DiscussHelper::accessNestedCategoriesId($item, $catIds);
             $excludeCats = array_merge($excludeCats, $catIds);
         }
         $result[$sig] = $excludeCats;
     }
     return $result[$sig];
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:51,代码来源:helper.php

示例4: getAllFields

 public function getAllFields($postId = null, $aclId = null)
 {
     if ($aclId == null || $postId == null) {
         return false;
     }
     static $loaded = array();
     $sig = (int) $postId . '-' . (int) $aclId;
     if (!isset($loaded[$sig])) {
         $my = JFactory::getUser();
         $db = DiscussHelper::getDBO();
         $myUserGroups = (array) DiscussHelper::getUserGroupId($my);
         if (empty($myUserGroups)) {
             $loaded[$sig] = array();
         } else {
             $query = 'SELECT a.*,' . ' b.' . $db->nameQuote('field_id') . ', b.' . $db->nameQuote('acl_id') . ', b.' . $db->nameQuote('content_id') . ',' . ' b.' . $db->nameQuote('content_type') . ', b.' . $db->nameQuote('status') . ',' . ' c.' . $db->nameQuote('field_id') . ', c.' . $db->nameQuote('value') . ', c.' . $db->nameQuote('post_id') . ' FROM ' . $db->nameQuote('#__discuss_customfields') . ' a' . ' LEFT JOIN ' . $db->nameQuote('#__discuss_customfields_rule') . ' b' . ' ON a.' . $db->nameQuote('id') . '=' . 'b.' . $db->nameQuote('field_id') . ' LEFT JOIN ' . $db->nameQuote('#__discuss_customfields_value') . ' c' . ' ON a.' . $db->nameQuote('id') . '=' . 'c.' . $db->nameQuote('field_id') . ' AND c.' . $db->nameQuote('post_id') . '=' . $db->Quote($postId);
             $userQuery = $query;
             $userQuery .= ' WHERE a.' . $db->nameQuote('published') . '=' . $db->Quote('1');
             $userQuery .= ' AND b.' . $db->nameQuote('content_type') . '=' . $db->Quote('user');
             $userQuery .= ' AND b.' . $db->nameQuote('acl_id') . '=' . $db->Quote($aclId);
             $userQuery .= ' AND b.' . $db->nameQuote('content_id') . '=' . $db->Quote($my->id);
             $groupQuery = $query;
             $groupQuery .= ' WHERE a.' . $db->nameQuote('published') . '=' . $db->Quote('1');
             $groupQuery .= ' AND b.' . $db->nameQuote('content_type') . '=' . $db->Quote('group');
             $groupQuery .= ' AND b.' . $db->nameQuote('acl_id') . '=' . $db->Quote($aclId);
             if (count($myUserGroups) == 1) {
                 $gid = array_pop($myUserGroups);
                 $groupQuery .= ' AND b.' . $db->nameQuote('content_id') . ' = ' . $db->Quote($gid);
             } else {
                 $groupQuery .= ' AND b.' . $db->nameQuote('content_id') . ' IN(' . implode(', ', $myUserGroups) . ')';
             }
             $masterQuery = $userQuery;
             $masterQuery .= ' UNION ';
             $masterQuery .= $groupQuery;
             $db->setQuery($masterQuery);
             $result = $db->loadObjectList();
             // @user with multiple group will generate duplicate result, hence we remove it
             if (!empty($result)) {
                 $myFinalResults = array();
                 // Remove dupes records which have no values
                 foreach ($result as $item) {
                     if (!array_key_exists($item->id, $myFinalResults)) {
                         $myFinalResults[$item->id] = $item;
                     } else {
                         if (!empty($item->id)) {
                             // If the pending item have value, replace the existing record
                             $myFinalResults[$item->id] = $item;
                         }
                     }
                 }
                 $result = $myFinalResults;
             }
             $loaded[$sig] = $result;
         }
     }
     return $loaded[$sig];
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:56,代码来源:customfields.php

示例5: str_replace

if (!JFile::exists($path)) {
    return;
}
require_once $path;
// require_once (dirname(__FILE__) . '/helper.php');
DiscussHelper::loadStylesheet("module", "mod_easydiscuss_board_statistic");
$postModel = DiscussHelper::getModel('Posts');
$totalPosts = $postModel->getTotal();
$resolvedPosts = $postModel->getTotalResolved();
$unresolvedPosts = $postModel->getUnresolvedCount();
$userModel = DiscussHelper::getModel('Users');
$totalUsers = $userModel->getTotalUsers();
$latestMember = DiscussHelper::getTable('Profile');
$latestMember->load($userModel->getLatestUser());
// Total guests
$totalGuests = $userModel->getTotalGuests();
// Online users
$onlineUsers = $userModel->getOnlineUsers();
$config = DiscussHelper::getConfig();
$gids = $config->get('main_exclude_frontend_statistics');
$canViewStatistic = true;
if (!empty($gids)) {
    //Remove whitespace
    $gids = str_replace(' ', '', $gids);
    $excludeGroup = explode(',', $gids);
    $my = JFactory::getUser();
    $myGroup = DiscussHelper::getUserGroupId($my);
    $result = array_intersect($myGroup, $excludeGroup);
    $canViewStatistic = empty($result) ? true : false;
}
require JModuleHelper::getLayoutPath('mod_easydiscuss_board_statistic');
开发者ID:pguilford,项目名称:vcomcc,代码行数:31,代码来源:mod_easydiscuss_board_statistic.php


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