/** * JSON Search interface for Mentioning */ public function actionMentioning() { \Yii::$app->response->format = 'json'; $results = array(); $keyword = Yii::$app->request->get('keyword', ""); $searchResultSet = Yii::$app->search->find($keyword, ['model' => array(User::className(), Space::className()), 'pageSize' => 10]); foreach ($searchResultSet->getResultInstances() as $container) { $results[] = array('guid' => $container->guid, 'type' => $container instanceof Space ? "s" : "u", 'name' => $container->getDisplayName(), 'image' => $container instanceof Space ? Image::widget(['space' => $container, 'width' => 20]) : "<img class='img-rounded' src='" . $container->getProfileImage()->getUrl() . "' height='20' width='20' alt=''>", 'link' => $container->getUrl()); } return $results; }
/** * Returns a workspace list by json * * It can be filtered by by keyword. */ public function actionSearchJson() { \Yii::$app->response->format = 'json'; $keyword = Yii::$app->request->get('keyword', ""); $page = (int) Yii::$app->request->get('page', 1); $limit = (int) Yii::$app->request->get('limit', \humhub\models\Setting::Get('paginationSize')); $searchResultSet = Yii::$app->search->find($keyword, ['model' => \humhub\modules\space\models\Space::className(), 'page' => $page, 'pageSize' => $limit]); $json = array(); foreach ($searchResultSet->getResultInstances() as $space) { $spaceInfo = array(); $spaceInfo['guid'] = $space->guid; $spaceInfo['title'] = Html::encode($space->name); $spaceInfo['tags'] = Html::encode($space->tags); $spaceInfo['image'] = Image::widget(['space' => $space, 'width' => 24]); $spaceInfo['link'] = $space->getUrl(); $json[] = $spaceInfo; } return $json; }
<?php echo \humhub\widgets\PanelMenu::widget(['id' => 'user-spaces-panel']); ?> <div class="panel-heading"> <?php echo Yii::t('UserModule.widgets_views_userSpaces', '<strong>Member</strong> in these spaces'); ?> </div> <div class="panel-body"> <?php foreach ($spaces as $space) { ?> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $space, 'width' => 24, 'htmlOptions' => ['class' => 'current-space-image'], 'link' => 'true', 'linkOptions' => ['class' => 'tt', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Html::encode($space->name)]]); ?> <?php } ?> <?php if ($showMoreLink) { ?> <br> <br> <?php echo Html::a('Show all', $user->createUrl('/user/profile/space-membership-list'), ['class' => 'pull-right btn btn-sm btn-default', 'data-target' => '#globalModal']); ?> <?php }
echo Yii::t('SpaceModule.widgets_views_profileHeader', 'Close'); ?> </button>'> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $space, 'width' => 140]); ?> </a> <?php } else { ?> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $space, 'width' => 140]); ?> <?php } ?> <!-- check if the current user is the profile owner and can change the images --> <?php if ($space->isAdmin()) { ?> <form class="fileupload" id="profilefileupload" action="" method="POST" enctype="multipart/form-data" style="position: absolute; top: 0; left: 0; opacity: 0; height: 140px; width: 140px;"> <input type="file" name="spacefiles[]"> </form>
<ul class="media-list notLoaded" id="space-menu-spaces"> <?php foreach ($memberships as $membership) { ?> <?php $newItems = $membership->countNewItems(); ?> <li> <a href="<?php echo $membership->space->getUrl(); ?> "> <div class="media"> <!-- Show space image --> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $membership->space, 'width' => 24, 'htmlOptions' => ['class' => 'pull-left']]); ?> <div class="media-body"> <strong><?php echo Html::encode($membership->space->name); ?> </strong> <?php if ($newItems != 0) { ?> <div class="badge badge-space pull-right" style="display:none"><?php echo $newItems; ?> </div> <?php
<li> <div class="media"> <!-- Follow Handling --> <div class="pull-right"> <?php if (!Yii::$app->user->isGuest && !$space->isMember()) { $followed = $space->isFollowedByUser(); echo Html::a(Yii::t('DirectoryModule.views_directory_members', 'Follow'), 'javascript:setFollow("' . $space->createUrl('/space/space/follow') . '", "' . $space->id . '")', array('class' => 'btn btn-info btn-sm ' . ($followed ? 'hide' : ''), 'id' => 'button_follow_' . $space->id)); echo Html::a(Yii::t('DirectoryModule.views_directory_members', 'Unfollow'), 'javascript:setUnfollow("' . $space->createUrl('/space/space/unfollow') . '", "' . $space->id . '")', array('class' => 'btn btn-primary btn-sm ' . ($followed ? '' : 'hide'), 'id' => 'button_unfollow_' . $space->id)); } ?> </div> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $space, 'width' => 50, 'htmlOptions' => ['class' => 'media-object'], 'link' => 'true', 'linkOptions' => ['class' => 'pull-left']]); ?> <?php if ($space->isMember()) { ?> <i class="fa fa-user space-member-sign tt" data-toggle="tooltip" data-placement="top" title="" data-original-title="<?php echo Yii::t('DirectoryModule.views_directory_spaces', 'You are a member of this space'); ?> "></i> <?php } ?>
<img class="media-object profile-size-sm img-rounded" data-src="holder.js/32x32" alt="32x32" src="<?php echo $originator->getProfileImage()->getUrl(); ?> "> <div class="profile-overlay-img profile-overlay-img-sm"></div> </span> <?php } ?> <!-- Show space image, if you are outside from a space --> <?php if (!Yii::$app->controller instanceof \humhub\modules\content\components\ContentContainerController && $record->content->space !== null) { ?> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $record->content->space, 'width' => 20, 'htmlOptions' => ['class' => 'img-space pull-left']]); ?> <?php } ?> <div class="media-body"> <!-- Show content --> <?php echo $content; ?> <br/> <!-- show time --> <?php
<?php use yii\helpers\Html; use humhub\modules\space\widgets\Image; $this->registerJsFile('@web/resources/space/spacepicker.js', ['position' => \yii\web\View::POS_END]); ?> <?php // Resolve guids to space tags $selectedSpaces = ""; foreach ($spaces as $space) { $name = Html::encode($space->name); $selectedSpaces .= '<li class="spaceInput" id="' . $space->guid . '">' . Image::widget(["space" => $space, "width" => 24]) . ' ' . addslashes($name) . '<i class="fa fa-times-circle"></i></li>'; } ?> <script type="text/javascript"> $(function () { $('#<?php echo $inputId; ?> ').spacepicker({ inputId: '#<?php echo $inputId; ?> ', maxSpaces: '<?php echo $maxSpaces; ?> ', searchUrl: '<?php
<!-- Display panel menu widget --> <?php echo humhub\widgets\PanelMenu::widget(array('id' => 'new-spaces-panel')); ?> <div class="panel-heading"> <?php echo Yii::t('DirectoryModule.widgets_views_spaceStats', '<strong>New</strong> spaces'); ?> </div> <div class="panel-body"> <?php foreach ($newSpaces as $space) { ?> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $space, 'width' => 40, 'link' => true, 'htmlOptions' => ['style' => 'margin-bottom: 5px;'], 'linkOptions' => ['class' => 'tt', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Html::encode($space->name)]]); ?> <?php } ?> <?php if ($showMoreButton) { ?> <br/> <br/> <?php echo Html::a(Yii::t('DirectoryModule.widgets_views_newSpaces', 'See all'), array('/directory/directory/spaces'), array('class' => 'btn btn-xl btn-primary')); ?> <?php }
?> " alt="40x40" data-src="holder.js/40x40" style="width: 40px; height: 40px;" src="<?php echo $user->getProfileImage()->getUrl(); ?> " width="40" height="40"/> </a> <!-- Show space image, if you are outside from a space --> <?php if (!Yii::$app->controller instanceof ContentContainerController && $object->content->container instanceof Space) { ?> <?php echo \humhub\modules\space\widgets\Image::widget(['space' => $object->content->container, 'width' => 20, 'htmlOptions' => ['class' => 'img-space'], 'link' => 'true', 'linkOptions' => ['class' => 'pull-left']]); ?> <?php } ?> <div class="media-body"> <!-- show username with link and creation time--> <h4 class="media-heading"><a href="<?php echo $user->getUrl(); ?> "><?php