本文整理汇总了PHP中vB::isUserContextSet方法的典型用法代码示例。如果您正苦于以下问题:PHP vB::isUserContextSet方法的具体用法?PHP vB::isUserContextSet怎么用?PHP vB::isUserContextSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB
的用法示例。
在下文中一共展示了vB::isUserContextSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroupInTopic
/**
* This returns a user's additional permissions from the groupintopic table
*
* @param int
* @param int optional nodeid
*
* @return mixed Associated array of array(nodeid, groupid);
***/
public function getGroupInTopic($userid, $nodeid = false, $forceReload = false)
{
if (!isset($this->groupInTopic[$userid]) or $forceReload) {
// Only call getUserContext if we already have it, as we don't need all of the queries that it does
if (vB::isUserContextSet($userid) and !$forceReload) {
$groupInTopic = vB::getUserContext($userid)->fetchGroupInTopic();
$perms = array();
foreach ($groupInTopic as $_nodeid => $groups) {
foreach ($groups as $group) {
$perms[] = array('nodeid' => $_nodeid, 'groupid' => $group);
}
}
} else {
$params = array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'userid' => $userid);
$permQry = vB::getDbAssertor()->assertQuery('vBForum:groupintopic', $params);
$perms = array();
foreach ($permQry as $permission) {
$perms[] = array('nodeid' => $permission['nodeid'], 'groupid' => $permission['groupid']);
}
}
$this->groupInTopic[$userid] = $perms;
}
if ($nodeid) {
$results = array();
foreach ($this->groupInTopic[$userid] as $perm) {
if ($perm['nodeid'] == $nodeid) {
$results[] = $perm;
}
}
return $results;
}
return $this->groupInTopic[$userid];
}