Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['topic', 'content'], 'required'], [['receiversId', 'friendsId'], 'each', 'rule' => ['integer', 'min' => 1]], ['sender_status', 'in', 'range' => self::getStatuses()], ['topic', 'string', 'max' => 255], ['topic', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value);
     }], ['content', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value, Helper::podiumPurifierConfig('minimal'));
     }]];
 }
Beispiel #2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['topic', 'required', 'message' => Yii::t('podium/view', 'Topic can not be blank.'), 'on' => ['firstPost']], ['topic', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process(Html::encode($value));
     }, 'on' => ['firstPost']], ['subscribe', 'boolean'], ['content', 'required'], ['content', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value, Helper::podiumPurifierConfig('full'));
     }], ['content', 'string', 'min' => 10]];
 }
Beispiel #3
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['location', 'signature'], 'trim'], ['location', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process(Html::encode($value));
     }], ['gravatar', 'boolean'], ['image', 'image', 'mimeTypes' => 'image/png, image/jpeg, image/gif', 'maxWidth' => self::MAX_WIDTH, 'maxHeight' => self::MAX_HEIGHT, 'maxSize' => self::MAX_SIZE], ['signature', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value, Helper::podiumPurifierConfig('minimal'));
     }], ['signature', 'string', 'max' => 512]];
 }
Beispiel #4
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['content', 'topic'], 'required'], [['content', 'topic'], 'string', 'min' => 1], ['topic', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value);
     }], ['content', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value, Helper::podiumPurifierConfig('full'));
     }]];
 }
Beispiel #5
0
 /**
  * Renders the image.
  * Based on user settings the avatar can be uploaded image, Gravatar image or default one.
  * @return string
  */
 public function run()
 {
     if ($this->author instanceof User) {
         $avatar = Html::img(Helper::defaultAvatar(), ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Html::encode($this->author->podiumName)]);
         $meta = $this->author->meta;
         if ($meta) {
             if (!empty($meta->gravatar)) {
                 $avatar = Gravatar::widget(['email' => $this->author->email, 'defaultImage' => 'identicon', 'rating' => 'r', 'options' => ['alt' => Html::encode($this->author->podiumName), 'class' => 'podium-avatar img-circle img-responsive center-block']]);
             } elseif (!empty($meta->avatar)) {
                 $avatar = Html::img('/avatars/' . $meta->avatar, ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Html::encode($this->author->podiumName)]);
             }
         }
         $name = $this->showName ? $this->author->podiumTag : '';
     } else {
         $avatar = Html::img(Helper::defaultAvatar(), ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Yii::t('podium/view', 'User deleted')]);
         $name = $this->showName ? Helper::deletedUserTag(true) : '';
     }
     $name = $this->showName ? Html::tag('p', $name, ['class' => 'avatar-name']) : '';
     return $avatar . $name;
 }
Beispiel #6
0
 * Podium Module
 * Yii 2 Forum Module
 * @author Paweł Bizley Brzozowski <*****@*****.**>
 * @since 0.1
 */
use bizley\podium\components\Helper;
use kartik\sortable\Sortable;
use yii\helpers\Html;
use yii\helpers\Url;
$this->title = Yii::t('podium/view', 'Forums');
$this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Administration Dashboard'), 'url' => ['admin/index']];
$this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Categories List'), 'url' => ['admin/categories']];
$this->params['breadcrumbs'][] = $this->title;
$items = [];
foreach ($forums as $forum) {
    $items[] = ['content' => Helper::adminForumsPrepareContent($forum)];
}
if (!empty($items)) {
    $this->registerJs("\$('#podiumModalDelete').on('show.bs.modal', function(e) { var button = \$(e.relatedTarget); \$('#deleteUrl').attr('href', button.data('url')); });");
    $this->registerJs("\$('[data-toggle=\"tooltip\"]').tooltip();");
}
echo $this->render('/elements/admin/_navbar', ['active' => 'categories']);
?>
<br>
<div class="row">
    <div class="col-sm-3">
        <ul class="nav nav-pills nav-stacked">
            <li role="presentation"><a href="<?php 
echo Url::to(['admin/categories']);
?>
"><span class="glyphicon glyphicon-list"></span> <?php 
Beispiel #7
0
</h4>
        
        <?php 
    echo Html::beginForm();
    ?>
        
        <?php 
    Pjax::begin();
    ?>
        <?php 
    echo PageSizer::widget();
    ?>
        <?php 
    echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterSelector' => 'select#per-page', 'tableOptions' => ['class' => 'table table-striped table-hover'], 'columns' => [['class' => CheckboxColumn::className(), 'headerOptions' => ['class' => 'col-sm-1 text-center'], 'contentOptions' => ['class' => 'col-sm-1 text-center'], 'checkboxOptions' => function ($model) use($mod) {
        return ['value' => $model->id, 'checked' => $model->isMod($mod->id)];
    }], ['attribute' => 'id', 'label' => Yii::t('podium/view', 'ID') . Helper::sortOrder('id'), 'encodeLabel' => false, 'contentOptions' => ['class' => 'col-sm-1 text-center'], 'headerOptions' => ['class' => 'col-sm-1 text-center']], ['attribute' => 'name', 'label' => Yii::t('podium/view', 'Name') . Helper::sortOrder('name'), 'encodeLabel' => false, 'format' => 'raw', 'value' => function ($model) use($mod) {
        return Html::encode($model->name) . ($model->isMod($mod->id) ? Html::hiddenInput('pre[]', $model->id) : '');
    }], ['class' => ActionColumn::className(), 'header' => Yii::t('podium/view', 'Actions'), 'contentOptions' => ['class' => 'text-right'], 'headerOptions' => ['class' => 'text-right'], 'template' => '{mod}', 'urlCreator' => function ($action, $model) use($mod) {
        return Url::toRoute([$action, 'fid' => $model->id, 'uid' => $mod->id]);
    }, 'buttons' => ['mod' => function ($url, $model) use($mod) {
        if ($model->isMod($mod->id)) {
            return Html::a('<span class="glyphicon glyphicon-remove"></span> ' . Yii::t('podium/view', 'Remove'), $url, ['class' => 'btn btn-danger btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Remove from moderation list')]);
        } else {
            return Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('podium/view', 'Add'), $url, ['class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Add to moderation list')]);
        }
    }]]]]);
    ?>
        <?php 
    Pjax::end();
    ?>
        
 /**
  * Running the upgrade.
  * @return string
  * @since 0.2
  */
 public function actionLevelUp()
 {
     $error = '';
     $info = '';
     $mdVersion = $this->module->version;
     $dbVersion = (new Query())->from('{{%podium_config}}')->select('value')->where(['name' => 'version'])->limit(1)->one();
     if (!isset($dbVersion['value'])) {
         $error = Yii::t('podium/flash', 'Error while checking current database version! Please verify your database.');
     } else {
         $result = Helper::compareVersions(explode('.', $mdVersion), explode('.', $dbVersion['value']));
         if ($result == '=') {
             $info = Yii::t('podium/flash', 'Module and database versions are the same!');
         } elseif ($result == '<') {
             $error = Yii::t('podium/flash', 'Module version appears to be older than database! Please verify your database.');
         }
     }
     return $this->render('level-up', ['currentVersion' => $mdVersion, 'dbVersion' => $dbVersion['value'], 'error' => $error, 'info' => $info]);
 }
Beispiel #9
0
?>
</p></div>
                <div class="col-sm-9">
                    <?php 
echo $form->field($model, 'topic')->textInput(['placeholder' => Yii::t('podium/view', 'Message Topic')])->label(false);
?>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-3 text-right"><p class="form-control-static"><?php 
echo Yii::t('podium/view', 'Message Content');
?>
</p></div>
                <div class="col-sm-9">
                    <?php 
echo $form->field($model, 'content')->label(false)->widget(Summernote::className(), ['clientOptions' => ['height' => '100', 'lang' => Yii::$app->language != 'en-US' ? Yii::$app->language : null, 'codemirror' => null, 'toolbar' => Helper::summerNoteToolbars('full')]]);
?>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-9 col-sm-offset-3">
                    <?php 
echo Html::submitButton('<span class="glyphicon glyphicon-ok-sign"></span> ' . Yii::t('podium/view', 'Send Message'), ['class' => 'btn btn-block btn-primary', 'name' => 'send-button']);
?>
                </div>
            </div>
        <?php 
ActiveForm::end();
?>
    </div>
</div><br>
Beispiel #10
0
echo Url::to(['members/mods']);
?>
"><span class="glyphicon glyphicon-scissors"></span> <?php 
echo Yii::t('podium/view', 'Moderation Team');
?>
</a></li>
</ul>
<br>
<?php 
Pjax::begin();
echo PageSizer::widget();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterSelector' => 'select#per-page', 'tableOptions' => ['class' => 'table table-striped table-hover'], 'columns' => [['attribute' => 'username', 'label' => Yii::t('podium/view', 'Username') . Helper::sortOrder('username'), 'encodeLabel' => false, 'format' => 'raw', 'value' => function ($model) {
    return Html::a($model->podiumName, ['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug], ['data-pjax' => '0']);
}], ['attribute' => 'role', 'label' => Yii::t('podium/view', 'Role') . Helper::sortOrder('role'), 'encodeLabel' => false, 'format' => 'raw', 'filter' => User::getRoles(), 'value' => function ($model) {
    return Helper::roleLabel($model->role);
}], ['attribute' => 'created_at', 'label' => Yii::t('podium/view', 'Joined') . Helper::sortOrder('created_at'), 'encodeLabel' => false, 'value' => function ($model) {
    return Yii::$app->formatter->asDatetime($model->created_at);
}], ['attribute' => 'threads_count', 'label' => Yii::t('podium/view', 'Threads'), 'encodeLabel' => false, 'value' => function ($model) {
    return $model->threadsCount;
}], ['attribute' => 'posts_count', 'label' => Yii::t('podium/view', 'Posts'), 'encodeLabel' => false, 'value' => function ($model) {
    return $model->postsCount;
}], ['class' => ActionColumn::className(), 'header' => Yii::t('podium/view', 'Actions'), 'contentOptions' => ['class' => 'text-right'], 'headerOptions' => ['class' => 'text-right'], 'template' => '{view}' . (!Yii::$app->user->isGuest ? ' {pm}' : ''), 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug], ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'View Member')]);
}, 'pm' => function ($url, $model) {
    if ($model->id !== User::loggedId()) {
        return Html::a('<span class="glyphicon glyphicon-envelope"></span>', ['messages/new', 'user' => $model->id], ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Send Message')]);
    } else {
        return Html::a('<span class="glyphicon glyphicon-envelope"></span>', '#', ['class' => 'btn btn-xs disabled text-muted']);
    }
}]]]]);
Pjax::end();
Beispiel #11
0
">
<?php 
}
?>
                <h2>
                    <?php 
echo Html::encode($model->podiumName);
?>
 
                    <small>
                        <?php 
echo Html::encode($model->email);
?>
 
                        <?php 
echo Helper::roleLabel($model->role);
?>
                    </small>
                </h2>
                <p><?php 
echo Yii::t('podium/view', 'Member since {date}', ['date' => Yii::$app->formatter->asDatetime($model->created_at, 'long')]);
?>
 (<?php 
echo Yii::$app->formatter->asRelativeTime($model->created_at);
?>
)</p>
                <p>
                    <a href="" class="btn btn-default"><span class="glyphicon glyphicon-search"></span> <?php 
echo Yii::t('podium/view', 'Show all threads started by me');
?>
</a> 
 /**
  * Creating the post of given category ID, forum ID and thread ID.
  * This can be reply to selected post of given ID.
  * @param integer $cid category's ID
  * @param integer $fid forum's ID
  * @param integer $tid thread's ID
  * @param integer $pid ID of post to reply to
  * @return string|\yii\web\Response
  */
 public function actionPost($cid = null, $fid = null, $tid = null, $pid = null)
 {
     if (Yii::$app->user->isGuest) {
         $this->warning(Yii::t('podium/flash', 'Please sign in to update the thread.'));
         return $this->redirect(['account/login']);
     }
     $thread = Thread::find()->where(['id' => $tid, 'category_id' => $cid, 'forum_id' => $fid])->limit(1)->one();
     if (empty($thread)) {
         $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
         return $this->redirect(['default/index']);
     }
     if ($thread->locked == 1 && !User::can(Rbac::PERM_UPDATE_THREAD, ['item' => $thread])) {
         $this->info(Yii::t('podium/flash', 'This thread is locked.'));
         return $this->redirect(['default/thread', 'cid' => $thread->forum->category->id, 'fid' => $thread->forum->id, 'id' => $thread->id, 'slug' => $thread->slug]);
     }
     if (!User::can(Rbac::PERM_CREATE_POST)) {
         $this->error(Yii::t('podium/flash', 'Sorry! You do not have the required permission to perform this action.'));
         return $this->redirect(['default/index']);
     }
     $model = new Post();
     $model->subscribe = 1;
     $postData = Yii::$app->request->post();
     $replyFor = null;
     if (is_numeric($pid) && $pid > 0) {
         $replyFor = Post::find()->where(['id' => $pid])->limit(1)->one();
         if ($replyFor) {
             $model->content = Helper::prepareQuote($replyFor, Yii::$app->request->post('quote'));
         }
     }
     $preview = '';
     $previous = Post::find()->where(['thread_id' => $thread->id])->orderBy(['id' => SORT_DESC])->limit(1)->one();
     if ($model->load($postData)) {
         $model->thread_id = $thread->id;
         $model->forum_id = $thread->forum->id;
         $model->author_id = User::loggedId();
         if ($model->validate()) {
             if (isset($postData['preview-button'])) {
                 $preview = $model->content;
             } else {
                 if ($model->podiumNew($previous)) {
                     $this->success(Yii::t('podium/flash', 'New reply has been added.'));
                     if (!empty($previous) && $previous->author_id == User::loggedId()) {
                         return $this->redirect(['default/show', 'id' => $previous->id]);
                     }
                     return $this->redirect(['default/show', 'id' => $model->id]);
                 } else {
                     $this->error(Yii::t('podium/flash', 'Sorry! There was an error while adding the reply. Contact administrator about this problem.'));
                 }
             }
         }
     }
     return $this->render('post', ['replyFor' => $replyFor, 'preview' => $preview, 'model' => $model, 'thread' => $thread, 'previous' => $previous]);
 }
Beispiel #13
0
 /**
  * Returns Podium name tag.
  * @param boolean $simple
  * @return string
  */
 public function getPodiumTag($simple = false)
 {
     return Helper::podiumUserTag($this->getPodiumName(), $this->getPodiumRole(), $this->getPodiumId(), $this->getPodiumSlug(), $simple);
 }
Beispiel #14
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['name', 'required', 'message' => Yii::t('podium/view', 'Topic can not be blank.')], ['post', 'required', 'on' => ['new']], ['post', 'string', 'min' => 10, 'on' => ['new']], ['post', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value, Helper::podiumPurifierConfig('full'));
     }, 'on' => ['new']], ['pinned', 'boolean'], ['subscribe', 'boolean'], ['name', 'validateName']];
 }
Beispiel #15
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['current_password', 'required'], ['current_password', 'validateCurrentPassword'], ['location', 'trim'], ['location', 'validateLocation'], ['gravatar', 'boolean'], ['image', 'image', 'mimeTypes' => 'image/png, image/jpeg, image/gif', 'maxWidth' => 500, 'maxHeight' => 500, 'maxSize' => 500 * 1024], ['signature', 'filter', 'filter' => function ($value) {
         return HtmlPurifier::process($value, Helper::podiumPurifierConfig());
     }]];
 }
Beispiel #16
0
 /**
  * Returns receiver's name.
  * @return string
  */
 public function getReceiverName()
 {
     return !empty($this->receiverUser) ? $this->receiverUser->getTag() : Helper::deletedUserTag();
 }
 /**
  * Creating the post of given category ID, forum ID and thread ID.
  * This can be reply to selected post of given ID.
  * @param integer $cid
  * @param integer $fid
  * @param integer $tid
  * @param integer $pid
  * @return string|\yii\web\Response
  */
 public function actionPost($cid = null, $fid = null, $tid = null, $pid = null)
 {
     if (!User::can(Rbac::PERM_CREATE_POST)) {
         if (Yii::$app->user->isGuest) {
             $this->warning(Yii::t('podium/flash', 'Please sign in to post a reply.'));
             return $this->redirect(['account/login']);
         } else {
             $this->error(Yii::t('podium/flash', 'Sorry! You do not have the required permission to perform this action.'));
             return $this->redirect(['default/index']);
         }
     } else {
         if (!is_numeric($cid) || $cid < 1 || !is_numeric($fid) || $fid < 1 || !is_numeric($tid) || $tid < 1) {
             $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
             return $this->redirect(['default/index']);
         }
         $category = Category::findOne((int) $cid);
         if (!$category) {
             $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
             return $this->redirect(['default/index']);
         } else {
             $forum = Forum::find()->where(['id' => (int) $fid, 'category_id' => $category->id])->limit(1)->one();
             if (!$forum) {
                 $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
                 return $this->redirect(['default/index']);
             } else {
                 $thread = Thread::find()->where(['id' => (int) $tid, 'category_id' => $category->id, 'forum_id' => $forum->id])->limit(1)->one();
                 if (!$thread) {
                     $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
                     return $this->redirect(['default/index']);
                 } else {
                     if ($thread->locked == 0 || $thread->locked == 1 && User::can(Rbac::PERM_UPDATE_THREAD, ['item' => $thread])) {
                         $model = new Post();
                         $model->subscribe = 1;
                         $postData = Yii::$app->request->post();
                         $replyFor = null;
                         if (is_numeric($pid) && $pid > 0) {
                             $replyFor = Post::findOne((int) $pid);
                             if ($replyFor) {
                                 if (isset($postData['quote']) && !empty($postData['quote'])) {
                                     $model->content = Helper::prepareQuote($replyFor, $postData['quote']);
                                 } else {
                                     $model->content = Helper::prepareQuote($replyFor);
                                 }
                             }
                         }
                         $preview = '';
                         $previous = Post::find()->where(['thread_id' => $thread->id])->orderBy(['id' => SORT_DESC])->limit(1)->one();
                         if ($model->load($postData)) {
                             $model->thread_id = $thread->id;
                             $model->forum_id = $forum->id;
                             $model->author_id = User::loggedId();
                             if ($model->validate()) {
                                 if (isset($postData['preview-button'])) {
                                     $preview = $model->content;
                                 } else {
                                     $transaction = Post::getDb()->beginTransaction();
                                     try {
                                         $id = null;
                                         if ($previous->author_id == User::loggedId()) {
                                             $previous->content .= '<hr>' . $model->content;
                                             $previous->edited = 1;
                                             $previous->edited_at = time();
                                             if ($previous->save()) {
                                                 $previous->markSeen();
                                                 $thread->touch('edited_post_at');
                                                 $id = $previous->id;
                                             }
                                         } else {
                                             if ($model->save(false)) {
                                                 $model->markSeen();
                                                 $forum->updateCounters(['posts' => 1]);
                                                 $thread->updateCounters(['posts' => 1]);
                                                 $thread->touch('new_post_at');
                                                 $thread->touch('edited_post_at');
                                                 $id = $model->id;
                                             }
                                         }
                                         if ($id !== null) {
                                             Subscription::notify($thread->id);
                                             if ($model->subscribe && !$model->thread->subscription) {
                                                 $subscription = new Subscription();
                                                 $subscription->user_id = User::loggedId();
                                                 $subscription->thread_id = $model->thread->id;
                                                 $subscription->post_seen = Subscription::POST_SEEN;
                                                 $subscription->save();
                                             }
                                             $transaction->commit();
                                             Cache::getInstance()->delete('forum.postscount');
                                             Cache::getInstance()->deleteElement('user.postscount', User::loggedId());
                                             Cache::getInstance()->delete('forum.latestposts');
                                             Log::info('Post added', $model->id, __METHOD__);
                                             $this->success(Yii::t('podium/flash', 'New reply has been added.'));
                                             return $this->redirect(['default/show', 'id' => $id]);
                                         } else {
                                             throw new Exception('Saved Post ID missing.');
                                         }
                                     } catch (Exception $e) {
                                         $transaction->rollBack();
                                         Log::error($e->getMessage(), null, __METHOD__);
                                         $this->error(Yii::t('podium/flash', 'Sorry! There was an error while adding the reply. Contact administrator about this problem.'));
                                     }
                                 }
                             }
                         }
                         return $this->render('post', ['replyFor' => $replyFor, 'preview' => $preview, 'model' => $model, 'category' => $category, 'forum' => $forum, 'thread' => $thread, 'previous' => $previous]);
                     } else {
                         $this->info(Yii::t('podium/flash', 'This thread is locked.'));
                         return $this->redirect(['default/thread', 'cid' => $category->id, 'fid' => $forum->id, 'id' => $thread->id, 'slug' => $thread->slug]);
                     }
                 }
             }
         }
     }
 }
Beispiel #18
0
echo Yii::t('podium/view', '{n, plural, =1{# guest} other{# guests}}', ['n' => !empty($lastActive['guests']) ? $lastActive['guests'] : 0]);
?>
, 
            <?php 
echo Yii::t('podium/view', '{n, plural, =1{# anonymous user} other{# anonymous users}}', ['n' => !empty($lastActive['anonymous']) ? $lastActive['anonymous'] : 0]);
?>
        </p>
<?php 
if (!empty($lastActive['names'])) {
    ?>
        <p>
<?php 
    foreach ($lastActive['names'] as $id => $name) {
        ?>
            <?php 
        echo Helper::podiumUserTag($name['name'], $name['role'], $id, $name['slug']);
    }
    ?>
        </p>
<?php 
}
?>
    </div>
    <div class="panel-footer small">
        <ul class="list-inline">
            <li><?php 
echo Yii::t('podium/view', 'Members');
?>
 <span class="badge"><?php 
echo Activity::totalMembers();
?>
Beispiel #19
0
    var button = jQuery(e.relatedTarget);
    jQuery(\'#unbanUrl\').attr(\'href\', button.data(\'url\'));
});', View::POS_READY, 'bootstrap-modal-unban');
echo $this->render('/elements/admin/_navbar', ['active' => 'members']);
?>

<br>

<?php 
Pjax::begin();
echo PageSizer::widget();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterSelector' => 'select#per-page', 'tableOptions' => ['class' => 'table table-striped table-hover'], 'columns' => [['attribute' => 'id', 'label' => Yii::t('podium/view', 'ID') . Helper::sortOrder('id'), 'encodeLabel' => false, 'contentOptions' => ['class' => 'col-sm-1 text-right'], 'headerOptions' => ['class' => 'col-sm-1 text-right']], ['attribute' => 'username', 'label' => Yii::t('podium/view', 'Username') . Helper::sortOrder('username'), 'encodeLabel' => false], ['attribute' => 'email', 'label' => Yii::t('podium/view', 'E-mail') . Helper::sortOrder('email'), 'encodeLabel' => false, 'format' => 'raw', 'value' => function ($model) {
    return Html::mailto($model->email);
}], ['attribute' => 'role', 'label' => Yii::t('podium/view', 'Role') . Helper::sortOrder('role'), 'encodeLabel' => false, 'filter' => User::getRoles(), 'value' => function ($model) {
    return Yii::t('podium/view', ArrayHelper::getValue(User::getRoles(), $model->role));
}], ['attribute' => 'status', 'label' => Yii::t('podium/view', 'Status') . Helper::sortOrder('status'), 'encodeLabel' => false, 'filter' => User::getStatuses(), 'value' => function ($model) {
    return Yii::t('podium/view', ArrayHelper::getValue(User::getStatuses(), $model->status));
}], ['class' => ActionColumn::className(), 'header' => Yii::t('podium/view', 'Actions'), 'contentOptions' => ['class' => 'text-right'], 'headerOptions' => ['class' => 'text-right'], 'template' => '{view} {pm} {ban} {delete}', 'buttons' => ['view' => function ($url) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['class' => 'btn btn-default btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'View Member')]);
}, 'pm' => function ($url, $model) {
    if ($model->id !== Yii::$app->user->id) {
        return Html::a('<span class="glyphicon glyphicon-envelope"></span>', ['messages/new', 'user' => $model->id], ['class' => 'btn btn-default btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Send Message')]);
    } else {
        return Html::a('<span class="glyphicon glyphicon-envelope"></span>', '#', ['class' => 'btn btn-xs disabled text-muted']);
    }
}, 'ban' => function ($url, $model) {
    if ($model->id !== Yii::$app->user->id) {
        if ($model->status !== User::STATUS_BANNED) {
            return Html::tag('span', Html::tag('button', '<span class="glyphicon glyphicon-ban-circle"></span>', ['class' => 'btn btn-danger btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Ban Member')]), ['data-toggle' => 'modal', 'data-target' => '#podiumModalBan', 'data-url' => $url]);
        } else {
            return Html::tag('span', Html::tag('button', '<span class="glyphicon glyphicon-ok-circle"></span>', ['class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Unban Member')]), ['data-toggle' => 'modal', 'data-target' => '#podiumModalUnBan', 'data-url' => $url]);
Beispiel #20
0
        <?php 
    echo Gravatar::widget(['email' => $model->getEmail(), 'defaultImage' => 'identicon', 'rating' => 'r', 'options' => ['alt' => Yii::t('podium/view', 'Your Gravatar image'), 'class' => 'img-circle img-responsive']]);
} elseif (!empty($model->meta->avatar)) {
    ?>
        <img class="img-circle img-responsive" src="/avatars/<?php 
    echo $model->meta->avatar;
    ?>
" alt="<?php 
    echo Yii::t('podium/view', 'Your avatar');
    ?>
">
<?php 
} else {
    ?>
        <img class="img-circle img-responsive" src="<?php 
    echo Helper::defaultAvatar();
    ?>
" alt="<?php 
    echo Yii::t('podium/view', 'Default avatar');
    ?>
">
<?php 
}
?>
    </div>
</div>
<?php 
if (!Yii::$app->user->isGuest) {
    ?>
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="podiumModalIgnoreLabel" aria-hidden="true" id="podiumModalIgnore">
    <div class="modal-dialog">
Beispiel #21
0
<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
<head>
<meta charset="<?php 
echo Yii::$app->charset;
?>
">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php 
echo Html::csrfMetaTags();
?>
<title><?php 
echo Html::encode(Helper::title($this->title));
?>
</title>
<?php 
$this->head();
?>
</head>
<body>

<?php 
$this->beginBody();
?>
    <div class="container">
        <?php 
echo $this->render('/elements/installation/_navbar');
?>
Beispiel #22
0
?>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-8 col-sm-offset-3">
                    <?php 
echo Html::submitButton('<span class="glyphicon glyphicon-ok-sign"></span> ' . Yii::t('podium/view', 'Send Message'), ['class' => 'btn btn-block btn-primary', 'name' => 'send-button']);
?>
                </div>
            </div>
        <?php 
ActiveForm::end();
?>
        <br>
        <div <?php 
echo Helper::replyBgd();
?>
>
            <div class="row">
                <div class="col-sm-2 text-center">
                    <?php 
echo Avatar::widget(['author' => $reply->senderUser]);
?>
                </div>
                <div class="col-sm-10">
                    <div class="popover right podium">
                        <div class="arrow"></div>
                        <div class="popover-title">
                            <small class="pull-right"><span data-toggle="tooltip" data-placement="top" title="<?php 
echo Yii::$app->formatter->asDatetime($reply->created_at, 'long');
?>
Beispiel #23
0
">
<?php 
}
?>
                <h2>
                    <?php 
echo Html::encode($model->getName());
?>
 
                    <small>
                        <?php 
echo Html::encode($model->getEmail());
?>
 
                        <?php 
echo Helper::roleLabel($model->getRole());
?>
                    </small>
                </h2>
                <p><?php 
echo Yii::t('podium/view', 'Member since {DATE}', ['DATE' => Yii::$app->formatter->asDatetime($model->getCreatedAt(), 'long')]);
?>
 (<?php 
echo Yii::$app->formatter->asRelativeTime($model->getCreatedAt());
?>
)</p>
                <p>
                    <a href="" class="btn btn-default"><span class="glyphicon glyphicon-search"></span> <?php 
echo Yii::t('podium/view', 'Show all threads started by me');
?>
</a> 
Beispiel #24
0
 /**
  * Returns Podium name tag.
  * @param boolean $simple
  * @return string
  */
 public function getPodiumTag($simple = false)
 {
     return Helper::podiumUserTag($this->podiumName, $this->role, $this->id, $this->podiumSlug, $simple);
 }
Beispiel #25
0
            $class = '';
    }
    return ['class' => $class];
}, 'columns' => [['attribute' => 'id', 'label' => Yii::t('podium/view', 'ID') . Helper::sortOrder('id'), 'encodeLabel' => false], ['attribute' => 'level', 'label' => Yii::t('podium/view', 'Level') . Helper::sortOrder('level'), 'encodeLabel' => false, 'filter' => Log::getTypes(), 'format' => 'raw', 'value' => function ($model) {
    $name = ArrayHelper::getValue(Log::getTypes(), $model->level, 'other');
    switch ($model->level) {
        case 1:
            $class = 'danger';
            break;
        case 2:
            $class = 'warning';
            break;
        case 4:
            $class = 'info';
            break;
        default:
            $class = 'default';
    }
    return Html::tag('span', Yii::t('podium/view', $name), ['class' => 'label label-' . $class]);
}], ['attribute' => 'category', 'label' => Yii::t('podium/view', 'Category') . Helper::sortOrder('category'), 'encodeLabel' => false, 'value' => function ($model) {
    return str_replace('bizley\\podium', '', $model->category);
}], ['attribute' => 'log_time', 'label' => Yii::t('podium/view', 'Time') . Helper::sortOrder('log_time'), 'encodeLabel' => false, 'filter' => false, 'value' => function ($model) {
    return Yii::$app->formatter->asDatetime(floor($model->log_time), 'medium');
}], ['attribute' => 'prefix', 'label' => Yii::t('podium/view', 'Signature') . Helper::sortOrder('prefix'), 'encodeLabel' => false], ['attribute' => 'message', 'label' => Yii::t('podium/view', 'Message') . Helper::sortOrder('message'), 'encodeLabel' => false, 'format' => 'raw', 'value' => function ($model) {
    return nl2br(Html::encode($model->message));
}], ['attribute' => 'model', 'label' => Yii::t('podium/view', 'Model ID') . Helper::sortOrder('model'), 'encodeLabel' => false, 'value' => function ($model) {
    return $model->model !== null ? $model->model : '';
}], ['attribute' => 'blame', 'label' => Yii::t('podium/view', 'Who') . Helper::sortOrder('blame'), 'encodeLabel' => false, 'value' => function ($model) {
    return $model->blame !== null ? $model->blame : '';
}]]]);
Pjax::end();
Beispiel #26
0
/**
 * Podium Module
 * Yii 2 Forum Module
 * @author Paweł Bizley Brzozowski <*****@*****.**>
 * @since 0.1
 */
use bizley\podium\components\Helper;
use kartik\sortable\Sortable;
use yii\helpers\Url;
$this->title = Yii::t('podium/view', 'Forums');
$this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Administration Dashboard'), 'url' => ['admin/index']];
$this->params['breadcrumbs'][] = $this->title;
$items = [];
foreach ($dataProvider as $category) {
    $items[] = ['content' => Helper::adminCategoriesPrepareContent($category)];
}
if (!empty($items)) {
    $this->registerJs("\$('#podiumModalDelete').on('show.bs.modal', function(e) { var button = \$(e.relatedTarget); \$('#deleteUrl').attr('href', button.data('url')); });");
    $this->registerJs("\$('[data-toggle=\"tooltip\"]').tooltip();");
}
echo $this->render('/elements/admin/_navbar', ['active' => 'categories']);
?>
<br>
<div class="row">
    <div class="col-sm-12 text-right">
        <p class="pull-left" id="podiumSortInfo"></p>
        <a href="<?php 
echo Url::to(['admin/new-category']);
?>
" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> <?php 
Beispiel #27
0
 /**
  * Performs upgrade check.
  * @param array $warnings Flash warnings
  * @return boolean
  * @since 0.2
  */
 public function upgradeCheck($warnings)
 {
     if ($warnings) {
         foreach ($warnings as $warning) {
             if ($warning == Yii::t('podium/flash', 'It looks like there is a new version of Podium database! {link}', ['link' => Html::a(Yii::t('podium/view', 'Update Podium'), ['install/level-up'])])) {
                 return false;
             }
             if ($warning == Yii::t('podium/flash', 'Module version appears to be older than database! Please verify your database.')) {
                 return false;
             }
         }
     }
     $result = Helper::compareVersions(explode('.', $this->module->version), explode('.', Config::getInstance()->get('version')));
     if ($result == '>') {
         $this->warning(Yii::t('podium/flash', 'It looks like there is a new version of Podium database! {link}', ['link' => Html::a(Yii::t('podium/view', 'Update Podium'), ['install/level-up'])]), false);
     } elseif ($result == '<') {
         $this->warning(Yii::t('podium/flash', 'Module version appears to be older than database! Please verify your database.'), false);
     }
     return false;
 }