mirror of
https://github.com/humhub/humhub.git
synced 2025-03-14 20:19:47 +01:00
Only show visible spaces at directory space sidebar
This commit is contained in:
parent
ce137ef74b
commit
ad4a03e88a
@ -7,14 +7,23 @@
|
||||
* @since 0.5
|
||||
* @author Luke
|
||||
*/
|
||||
class SpaceStatisticsWidget extends HWidget {
|
||||
class SpaceStatisticsWidget extends HWidget
|
||||
{
|
||||
|
||||
/**
|
||||
* Executes the widgets
|
||||
*/
|
||||
public function run() {
|
||||
public function run()
|
||||
{
|
||||
$criteria = new CDbCriteria();
|
||||
$criteria->join = 'LEFT JOIN space_membership ON t.id=space_membership.space_id AND space_membership.user_id=:userId';
|
||||
$criteria->condition = 't.visibility != :visibilityNone OR space_membership.status = :statusMember';
|
||||
$criteria->params = array(
|
||||
':userId' => Yii::app()->user->id,
|
||||
':visibilityNone' => Space::VISIBILITY_NONE,
|
||||
':statusMember' => SpaceMembership::STATUS_MEMBER);
|
||||
$newSpaces = Space::model()->active()->recently(10)->findAll($criteria);
|
||||
|
||||
$newSpaces = Space::model()->active()->recently(10)->findAll();
|
||||
$statsCountSpaces = Space::model()->count();
|
||||
$statsCountSpacesHidden = Space::model()->countByAttributes(array('visibility' => Space::VISIBILITY_NONE));
|
||||
$statsSpaceMostMembers = Space::model()->find('id = (SELECT space_id FROM space_membership GROUP BY space_id ORDER BY count(*) DESC LIMIT 1)');
|
||||
|
@ -17,16 +17,13 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php foreach ($newSpaces as $space) : ?>
|
||||
<?php if ($space->visibility == Space::VISIBILITY_NONE && !$space->isMember()) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $space->getUrl(); ?>">
|
||||
<img src="<?php echo $space->getProfileImage()->getUrl(); ?>" class="img-rounded tt img_margin"
|
||||
height="40" width="40" alt="40x40" data-src="holder.js/40x40"
|
||||
style="width: 40px; height: 40px;"
|
||||
data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="<strong><?php echo $space->name; ?></strong>">
|
||||
</a>
|
||||
<?php } ?>
|
||||
<a href="<?php echo $space->getUrl(); ?>">
|
||||
<img src="<?php echo $space->getProfileImage()->getUrl(); ?>" class="img-rounded tt img_margin"
|
||||
height="40" width="40" alt="40x40" data-src="holder.js/40x40"
|
||||
style="width: 40px; height: 40px;"
|
||||
data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="<strong><?php echo $space->name; ?></strong>">
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -50,7 +47,7 @@
|
||||
data-max="<?php echo $statsCountSpaces; ?>"
|
||||
style="width: 75px; position: absolute; margin-top: 53.57142857142857px; margin-left: -112.5px; font-size: 37.5px; border: none; background-image: none; font-family: Arial; font-weight: bold; text-align: center; color: rgb(255, 236, 3); padding: 0px; -webkit-appearance: none; background-position: initial initial; background-repeat: initial initial;">
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
// animate stats
|
||||
animateKnob('#spaces-total', <?php echo $statsCountSpaces; ?>);
|
||||
});
|
||||
@ -70,7 +67,7 @@
|
||||
style="width: 75px; position: absolute; margin-top: 53.57142857142857px; margin-left: -112.5px; font-size: 37.5px; border: none; background-image: none; font-family: Arial; font-weight: bold; text-align: center; color: rgb(255, 236, 3); padding: 0px; -webkit-appearance: none; background-position: initial initial; background-repeat: initial initial;">
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
// animate stats
|
||||
animateKnob('#spaces-private', <?php echo $statsCountSpacesHidden; ?>);
|
||||
});
|
||||
@ -79,16 +76,16 @@
|
||||
<hr>
|
||||
|
||||
<?php if (isset($statsSpaceMostMembers->name)) { ?>
|
||||
<div style="text-align: center;">
|
||||
<strong><?php echo Yii::t('DirectoryModule.widgets_views_spaceStats', 'Most members'); ?>:
|
||||
</strong> <?php echo $statsSpaceMostMembers->name; ?>
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
<strong><?php echo Yii::t('DirectoryModule.widgets_views_spaceStats', 'Most members'); ?>:
|
||||
</strong> <?php echo $statsSpaceMostMembers->name; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$(function() {
|
||||
$(".knob").knob();
|
||||
});
|
||||
|
||||
@ -99,7 +96,7 @@
|
||||
$(id).animate({value: value}, {
|
||||
duration: 1000,
|
||||
easing: 'swing',
|
||||
step: function () {
|
||||
step: function() {
|
||||
$(id).val(Math.round(this.value)).trigger('change');
|
||||
}
|
||||
})
|
||||
|
@ -17,16 +17,13 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php foreach ($newSpaces as $space) : ?>
|
||||
<?php if ($space->visibility == Space::VISIBILITY_NONE && !$space->isMember()) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $space->getUrl(); ?>">
|
||||
<img src="<?php echo $space->getProfileImage()->getUrl(); ?>" class="img-rounded tt img_margin"
|
||||
height="40" width="40" alt="40x40" data-src="holder.js/40x40"
|
||||
style="width: 40px; height: 40px;"
|
||||
data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="<strong><?php echo $space->name; ?></strong>">
|
||||
</a>
|
||||
<?php } ?>
|
||||
<a href="<?php echo $space->getUrl(); ?>">
|
||||
<img src="<?php echo $space->getProfileImage()->getUrl(); ?>" class="img-rounded tt img_margin"
|
||||
height="40" width="40" alt="40x40" data-src="holder.js/40x40"
|
||||
style="width: 40px; height: 40px;"
|
||||
data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="<strong><?php echo $space->name; ?></strong>">
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -50,7 +47,7 @@
|
||||
data-max="<?php echo $statsCountSpaces; ?>"
|
||||
style="width: 75px; position: absolute; margin-top: 53.57142857142857px; margin-left: -112.5px; font-size: 37.5px; border: none; background-image: none; font-family: Arial; font-weight: bold; text-align: center; color: rgb(255, 236, 3); padding: 0px; -webkit-appearance: none; background-position: initial initial; background-repeat: initial initial;">
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
// animate stats
|
||||
animateKnob('#spaces-total', <?php echo $statsCountSpaces; ?>);
|
||||
});
|
||||
@ -70,7 +67,7 @@
|
||||
style="width: 75px; position: absolute; margin-top: 53.57142857142857px; margin-left: -112.5px; font-size: 37.5px; border: none; background-image: none; font-family: Arial; font-weight: bold; text-align: center; color: rgb(255, 236, 3); padding: 0px; -webkit-appearance: none; background-position: initial initial; background-repeat: initial initial;">
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
// animate stats
|
||||
animateKnob('#spaces-private', <?php echo $statsCountSpacesHidden; ?>);
|
||||
});
|
||||
@ -88,7 +85,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$(function() {
|
||||
$(".knob").knob();
|
||||
});
|
||||
|
||||
@ -99,7 +96,7 @@
|
||||
$(id).animate({value: value}, {
|
||||
duration: 1000,
|
||||
easing: 'swing',
|
||||
step: function () {
|
||||
step: function() {
|
||||
$(id).val(Math.round(this.value)).trigger('change');
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user