mirror of
https://github.com/humhub/humhub.git
synced 2025-01-18 22:58:06 +01:00
Merge branch 'master' of https://github.com/humhub/humhub
This commit is contained in:
commit
15969e2006
@ -16,10 +16,8 @@ Getting Started
|
||||
|
||||
Administration
|
||||
---------------------
|
||||
* [User](admin-user.md)
|
||||
* [Spaces](admin-spaces.md)
|
||||
* [Authentication](admin-authentication.md)
|
||||
* [Advanced Configuration](admin-adv-config.md)
|
||||
* [Authentication](admin-authentication.md)
|
||||
* [Console](admin-adv-console.md)
|
||||
* [Search](admin-adv-search.md)
|
||||
* [XSendFile](admin-adv-xsendfile.md)
|
||||
|
@ -31,7 +31,7 @@ You can overwrite the default HumHub / Yii configuration in the folder `/protect
|
||||
|
||||
## Configurations
|
||||
|
||||
# Language
|
||||
### Language
|
||||
|
||||
|
||||
**Restrict Languages:**
|
||||
@ -72,9 +72,3 @@ return array (
|
||||
'What\'s on your mind?' => 'Wie geht es dir heute?',
|
||||
);
|
||||
```
|
||||
|
||||
# Further available params
|
||||
|
||||
The following params are available to ch
|
||||
|
||||
- **moduleAutoloadPaths** - Can be used to change the path of your modules folder
|
||||
|
@ -248,16 +248,12 @@ class MembershipController extends \humhub\modules\content\components\ContentCon
|
||||
*/
|
||||
public function actionMembersList()
|
||||
{
|
||||
$query = User::find();
|
||||
$query->join('LEFT JOIN', 'space_membership', 'space_membership.user_id=user.id');
|
||||
$query->andWhere(['space_membership.status' => Membership::STATUS_MEMBER]);
|
||||
$query->andWhere(['user.status' => User::STATUS_ENABLED]);
|
||||
$query->andWhere(['space_id' => $this->getSpace()->id]);
|
||||
$query->orderBy(['space_membership.group_id' => SORT_DESC]);
|
||||
|
||||
$title = Yii::t('SpaceModule.controllers_MembershipController', "<strong>Members</strong>");
|
||||
|
||||
return $this->renderAjaxContent(UserListBox::widget(['query' => $query, 'title' => $title]));
|
||||
return $this->renderAjaxContent(UserListBox::widget([
|
||||
'query' => Membership::getSpaceMembersQuery($this->getSpace()),
|
||||
'title' => $title
|
||||
]));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace humhub\modules\space\models;
|
||||
|
||||
use Yii;
|
||||
use humhub\modules\user\models\User;
|
||||
use humhub\modules\content\models\WallEntry;
|
||||
use humhub\modules\activity\models\Activity;
|
||||
use humhub\modules\comment\models\Comment;
|
||||
@ -176,4 +177,24 @@ class Membership extends \yii\db\ActiveRecord
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a user query for space memberships
|
||||
*
|
||||
* @since 1.1
|
||||
* @param Space $space
|
||||
* @param boolean $membersOnly Only return approved members
|
||||
* @return \humhub\modules\user\components\ActiveQueryUser
|
||||
*/
|
||||
public static function getSpaceMembersQuery($space, $membersOnly = true)
|
||||
{
|
||||
$query = User::find()->active();
|
||||
$query->join('LEFT JOIN', 'space_membership', 'space_membership.user_id=user.id');
|
||||
if ($membersOnly) {
|
||||
$query->andWhere(['space_membership.status' => self::STATUS_MEMBER]);
|
||||
}
|
||||
$query->andWhere(['space_id' => $space->id]);
|
||||
$query->defaultOrder();
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,12 +34,10 @@ class Members extends Widget
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$memberQuery = $this->space->getMemberships();
|
||||
$memberQuery->joinWith('user');
|
||||
$memberQuery->limit($this->maxMembers);
|
||||
$memberQuery->where(['user.status' => \humhub\modules\user\models\User::STATUS_ENABLED]);
|
||||
$query = \humhub\modules\space\models\Membership::getSpaceMembersQuery($this->space);
|
||||
$query->limit($this->maxMembers);
|
||||
|
||||
return $this->render('members', ['space' => $this->space, 'maxMembers' => $this->maxMembers, 'members' => $memberQuery->all()]);
|
||||
return $this->render('members', ['space' => $this->space, 'maxMembers' => $this->maxMembers, 'users' => $query->all()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,18 +7,15 @@ use yii\helpers\Html;
|
||||
<?php echo \humhub\widgets\PanelMenu::widget(['id' => 'space-members-panel']); ?>
|
||||
<div class="panel-heading"><?php echo Yii::t('SpaceModule.widgets_views_spaceMembers', '<strong>Space</strong> members'); ?></div>
|
||||
<div class="panel-body">
|
||||
<?php foreach ($members as $membership) : ?>
|
||||
<?php $user = $membership->user; ?>
|
||||
<?php if($membership->status === \humhub\modules\space\models\Membership::STATUS_MEMBER) : ?>
|
||||
<a href="<?php echo $user->getUrl(); ?>">
|
||||
<img src="<?php echo $user->getProfileImage()->getUrl(); ?>" class="img-rounded tt img_margin"
|
||||
height="24" width="24" alt="24x24" data-src="holder.js/24x24"
|
||||
style="width: 24px; height: 24px;" data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="<?php echo Html::encode($user->displayName); ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($users as $user) : ?>
|
||||
<a href="<?php echo $user->getUrl(); ?>">
|
||||
<img src="<?php echo $user->getProfileImage()->getUrl(); ?>" class="img-rounded tt img_margin"
|
||||
height="24" width="24" alt="24x24" data-src="holder.js/24x24"
|
||||
style="width: 24px; height: 24px;" data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="<?php echo Html::encode($user->displayName); ?>">
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php if (count($members) == $maxMembers) : ?>
|
||||
<?php if (count($users) == $maxMembers) : ?>
|
||||
<br>
|
||||
<a href="<?php echo $space->createUrl('/space/membership/members-list'); ?>" data-target="#globalModal" class="btn btn-default btn-sm"><?php echo Yii::t('SpaceModule.widgets_views_spaceMembers', 'Show all'); ?></a>
|
||||
<?php endif; ?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
|
||||
* @copyright Copyright (c) 2016 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
@ -18,15 +18,27 @@ use yii\db\ActiveQuery;
|
||||
class ActiveQueryUser extends ActiveQuery
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit to active users
|
||||
*
|
||||
* @return \humhub\modules\user\components\ActiveQueryUser
|
||||
*/
|
||||
public function active()
|
||||
{
|
||||
$this->andWhere(['user.status' => \humhub\modules\user\models\User::STATUS_ENABLED]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds default user order (e.g. by lastname)
|
||||
*
|
||||
* @return \humhub\modules\user\components\ActiveQueryUser
|
||||
*/
|
||||
public function defaultOrder()
|
||||
{
|
||||
$this->joinWith('profile');
|
||||
$this->addOrderBy(['profile.lastname' => SORT_ASC]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user