本文整理汇总了PHP中Komento::getUsersByGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::getUsersByGroup方法的具体用法?PHP Komento::getUsersByGroup怎么用?PHP Komento::getUsersByGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Komento
的用法示例。
在下文中一共展示了Komento::getUsersByGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUsergroups
public function getUsergroups( $type )
{
$config = Komento::getConfig();
$gids = '';
switch( $type )
{
case 'confirm':
break;
case 'pending':
case 'moderate':
$gids = $config->get( 'notification_to_usergroup_pending' );
break;
case 'report':
$gids = $config->get( 'notification_to_usergroup_reported' );
break;
case 'reply':
$gids = $config->get( 'notification_to_usergroup_reply' );
break;
case 'comment':
case 'new':
default:
$gids = $config->get( 'notification_to_usergroup_comment' );
break;
}
if( !empty( $gids ) )
{
if( !is_array( $gids ) )
{
$gids = explode( ',', $gids );
}
$users = array();
$ids = array();
foreach( $gids as $gid )
{
$ids = $ids + Komento::getUsersByGroup( $gid );
}
foreach( $ids as $id )
{
$tmp = JFactory::getUser( $id );
$user = array(
'id' => $tmp->id,
'fullname' => $tmp->name,
'email' => $tmp->email
);
$users[$tmp->email] = (object) $user;
}
return $users;
}
return array();
}
示例2: getNotificationTarget
public function getNotificationTarget( $target, $action, $comment )
{
$ids = array();
switch( $target )
{
case 'usergroup':
$gids = $this->config->get( 'notification_es_to_usergroup_' . $action );
if( !empty( $gids ) )
{
if( !is_array( $gids ) )
{
$gids = explode( ',', $gids );
}
foreach( $gids as $gid )
{
$ids += Komento::getUsersByGroup( $gid );
}
}
break;
case 'author':
if( $this->config->get( 'notification_es_to_author' ) )
{
$application = Komento::loadApplication( $comment->component )->load( $comment->cid );
$author = $application->getAuthorId();
if( !empty( $author ) )
{
$ids = array( $author );
}
}
break;
case 'parent':
if( !empty( $comment->parent_id ) )
{
$parent = Komento::getTable( 'comments' );
$state = $parent->load( $comment->parent_id );
if( $state && !empty( $parent->created_by ) )
{
$ids = array( $parent->created_by );
}
}
break;
case 'owner':
if( !empty( $comment->created_by ) )
{
$ids = array( $comment->created_by );
}
break;
case 'participant':
if( $this->config->get( 'notification_es_to_participant' ) )
{
$options = array(
'component' => $comment->component,
'cid' => $comment->cid,
'noguest' => true,
'state' => 1
);
$model = Komento::getModel( 'comments' );
$ids = $model->getUsers( $options );
}
break;
}
return $ids;
}