本文整理汇总了PHP中Komento::getUsergroups方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::getUsergroups方法的具体用法?PHP Komento::getUsergroups怎么用?PHP Komento::getUsergroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Komento
的用法示例。
在下文中一共展示了Komento::getUsergroups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateUserGroups
public function updateUserGroups($component)
{
$userGroups = Komento::getUsergroups();
$userGroupIDs = array();
foreach ($userGroups as $userGroup) {
$userGroupIDs[] = $userGroup->id;
}
$sql = Komento::getSql();
$sql->select('#__komento_acl')->column('cid')->where('component', $component)->where('type', 'usergroup');
$current = $sql->loadResultArray();
Komento::import('helper', 'acl');
$defaultset = KomentoACLHelper::getEmptySet(true);
$json = Komento::getJSON();
$defaultset = $json->encode($defaultset);
foreach ($userGroupIDs as $userGroupID) {
if (!in_array($userGroupID, $current)) {
$table = Komento::getTable('acl');
$table->cid = $userGroupID;
$table->component = $component;
$table->type = 'usergroup';
$table->rules = $defaultset;
$table->store();
}
}
}
示例2: getContentIds
public function getContentIds($categories = '')
{
$db = Komento::getDBO();
$query = '';
if (empty($categories)) {
$groups = Komento::getUsergroups();
$gids = array();
foreach ($groups as $group) {
$gids[] = $group->id;
}
$user = JFactory::getUser();
$result = array();
// Get all the categories first
$query = 'SELECT ' . $db->nameQuote('id') . ' FROM ' . $db->nameQuote('#__easyblog_category') . ' WHERE ' . $db->nameQuote('private') . ' = ' . $db->quote('0');
if (!$user->guest) {
$query .= ' OR ' . $db->nameQuote('private') . ' = ' . $db->quote('1');
}
$db->setQuery($query);
$result = array_merge($result, $db->loadResultArray());
$query = 'SELECT DISTINCT (' . $db->nameQuote('a') . '.' . $db->nameQuote('id') . ') FROM ' . $db->nameQuote('#__easyblog_category') . ' AS ' . $db->nameQuote('a');
$query .= ' LEFT JOIN ' . $db->nameQuote('#__easyblog_category_acl') . ' AS ' . $db->nameQuote('b');
$query .= ' ON ' . $db->nameQuote('b') . '.' . $db->nameQuote('category_id') . ' = ' . $db->nameQuote('a') . '.' . $db->nameQuote('id');
$query .= ' WHERE ' . $db->nameQuote('a') . '.' . $db->nameQuote('private') . ' = ' . $db->quote('2');
$query .= ' AND ' . $db->nameQuote('b') . '.' . $db->nameQuote('acl_id') . ' = ' . $db->quote('1');
$query .= ' AND ' . $db->nameQuote('b') . '.' . $db->nameQuote('content_id') . ' IN (' . $gids . ')';
$db->setQuery($query);
$result = array_merge($result, $db->loadResultArray());
$categories = implode(',', $result);
$query = 'SELECT ' . $db->nameQuote('id') . ' FROM ' . $db->nameQuote('#__easyblog_post');
$query .= ' WHERE ' . $db->nameQuote('category_id') . ' IN (' . $categories . ')';
$query .= ' ORDER BY ' . $db->nameQuote('id');
} else {
if (is_array($categories)) {
$categories = implode(',', $categories);
}
$query = 'SELECT `id` FROM ' . $db->nameQuote('#__easyblog_post') . ' WHERE `category_id` IN (' . $categories . ') ORDER BY `id`';
}
$db->setQuery($query);
return $db->loadResultArray();
}
示例3: getUsergroupsMultilist
public function getUsergroupsMultilist()
{
$usergroups = Komento::getUsergroups();
foreach ($usergroups as $usergroup) {
$usergroup->treename = str_repeat('.   ', $usergroup->depth) . ($usergroup->depth > 0 ? '|_ ' : '') . $usergroup->title;
}
return $usergroups;
}
示例4: getUsergroupState
function getUsergroupState($filter_usergroup = '')
{
$result = Komento::getUsergroups();
$usergroups = array();
foreach ($result as $item) {
$usergroups[] = JHTML::_('select.option', $item->id, str_repeat('|—', $item->depth) . ' ' . $item->title);
}
return JHTML::_('select.genericlist', $usergroups, 'id', 'class="inputbox" .fa- onchange="submitform();"', 'value', 'text', $filter_usergroup);
}