41 | * @since 0.8
42 | */
43 |
44 | class PodiumSluggableBehavior extends SluggableBehavior
45 | {
46 |
47 | const CATEGORY = "category";
48 | const FORUM = "forum";
49 | const THREAD = "thread";
50 | const USER = "user";
51 |
52 | /**
53 | * @var string Use PodiumSluggableBehavior::CATEGORY,...
54 | */
55 | public $type;
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/traits/FlashTrait.php:
--------------------------------------------------------------------------------
1 |
13 | * @since 0.2
14 | */
15 | trait FlashTrait
16 | {
17 | /**
18 | * Alias for warning().
19 | * @param string $message the flash message to be translated.
20 | * @param bool $removeAfterAccess message removal after access only.
21 | */
22 | public function alert($message, $removeAfterAccess = true)
23 | {
24 | $this->warning($message, $removeAfterAccess);
25 | }
26 |
27 | /**
28 | * Adds flash message of 'danger' type.
29 | * @param string $message the flash message to be translated.
30 | * @param bool $removeAfterAccess message removal after access only.
31 | */
32 | public function danger($message, $removeAfterAccess = true)
33 | {
34 | Yii::$app->session->addFlash('danger', $message, $removeAfterAccess);
35 | }
36 |
37 | /**
38 | * Alias for danger().
39 | * @param string $message the flash message to be translated.
40 | * @param bool $removeAfterAccess message removal after access only.
41 | */
42 | public function error($message, $removeAfterAccess = true)
43 | {
44 | $this->danger($message, $removeAfterAccess);
45 | }
46 |
47 | /**
48 | * Adds flash message of 'info' type.
49 | * @param string $message the flash message to be translated.
50 | * @param bool $removeAfterAccess message removal after access only.
51 | */
52 | public function info($message, $removeAfterAccess = true)
53 | {
54 | Yii::$app->session->addFlash('info', $message, $removeAfterAccess);
55 | }
56 |
57 | /**
58 | * Alias for success().
59 | * @param string $message the flash message to be translated.
60 | * @param bool $removeAfterAccess message removal after access only.
61 | */
62 | public function ok($message, $removeAfterAccess = true)
63 | {
64 | $this->success($message, $removeAfterAccess);
65 | }
66 |
67 | /**
68 | * Adds flash message of 'success' type.
69 | * @param string $message the flash message to be translated.
70 | * @param bool $removeAfterAccess message removal after access only.
71 | */
72 | public function success($message, $removeAfterAccess = true)
73 | {
74 | Yii::$app->session->addFlash('success', $message, $removeAfterAccess);
75 | }
76 |
77 | /**
78 | * Adds flash message of 'warning' type.
79 | * @param string $message the flash message to be translated.
80 | * @param bool $removeAfterAccess message removal after access only.
81 | */
82 | public function warning($message, $removeAfterAccess = true)
83 | {
84 | Yii::$app->session->addFlash('warning', $message, $removeAfterAccess);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/views/account/login.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\bootstrap\ActiveForm;
11 | use yii\helpers\Html;
12 | use yii\helpers\Url;
13 |
14 | $this->title = Yii::t('podium/view', 'Sign in');
15 | $this->params['breadcrumbs'][] = $this->title;
16 |
17 | $this->registerJs("$('[data-toggle=\"tooltip\"]').tooltip();");
18 |
19 | ?>
20 |
21 |
22 | 'login-form']); ?>
23 |
24 | = $form->field($model, 'username')->textInput(['placeholder' => Yii::t('podium/view', 'Username or E-mail'), 'autofocus' => true])->label(false) ?>
25 |
26 |
27 | = $form->field($model, 'password')->passwordInput(['placeholder' => Yii::t('podium/view', 'Password')])->label(false) ?>
28 |
29 |
30 | = $form->field($model, 'rememberMe')->checkBox()->label(null, ['data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', "Don't use this option on public computers!")]) ?>
31 |
32 |
33 | = Html::submitButton(' ' . Yii::t('podium/view', 'Sign in'), ['class' => 'btn btn-block btn-primary', 'name' => 'login-button']) ?>
34 |
35 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/views/account/password.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 | use yii\bootstrap\ActiveForm;
12 |
13 | $this->title = Yii::t('podium/view', 'Change password');
14 | $this->params['breadcrumbs'][] = $this->title;
15 |
16 | ?>
17 |
18 |
19 |
20 | = Yii::t('podium/view', 'Enter new password for your account. Password must contain uppercase and lowercase letter, digit, and be at least {chars} characters long.', ['chars' => 6]) ?>
21 |
22 |
23 |
24 | 'password-form']); ?>
25 |
26 | = $form->field($model, 'password')->passwordInput(['placeholder' => Yii::t('podium/view', 'New password'), 'autofocus' => true])->label(false) ?>
27 |
28 |
29 | = $form->field($model, 'passwordRepeat')->passwordInput(['placeholder' => Yii::t('podium/view', 'Repeat new password')])->label(false) ?>
30 |
31 |
32 | = Html::submitButton(' ' . Yii::t('podium/view', 'Change password'), ['class' => 'btn btn-block btn-danger', 'name' => 'password-button']) ?>
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/views/account/reactivate.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 | use yii\bootstrap\ActiveForm;
12 |
13 | $this->title = Yii::t('podium/view', 'Account Activation');
14 | $this->params['breadcrumbs'][] = $this->title;
15 |
16 | ?>
17 |
18 |
19 |
20 | = Yii::t('podium/view', 'Enter your user name or e-mail address you have registered with and we will send you the account activation link again.') ?>
21 |
22 |
23 |
24 | 'reactivate-form']); ?>
25 |
26 | = $form->field($model, 'username')->textInput(['placeholder' => Yii::t('podium/view', 'User Name or E-mail'), 'autofocus' => true])->label(false) ?>
27 |
28 |
29 | = Html::submitButton(' ' . Yii::t('podium/view', 'Send me the account activation link'), ['class' => 'btn btn-block btn-success', 'name' => 'reactivate-button']) ?>
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/views/account/reset.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 | use yii\bootstrap\ActiveForm;
12 |
13 | $this->title = Yii::t('podium/view', 'Password Reset');
14 | $this->params['breadcrumbs'][] = $this->title;
15 |
16 | ?>
17 |
18 |
19 |
20 | = Yii::t('podium/view', 'Enter your user name or e-mail address you have registered with and we will send you the password reset link.') ?>
21 |
22 |
23 |
24 | 'reset-form']); ?>
25 |
26 | = $form->field($model, 'username')->textInput(['placeholder' => Yii::t('podium/view', 'User Name or E-mail'), 'autofocus' => true])->label(false) ?>
27 |
28 |
29 | = Html::submitButton(' ' . Yii::t('podium/view', 'Send me the password reset link'), ['class' => 'btn btn-block btn-danger', 'name' => 'reset-button']) ?>
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/views/admin/categories.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\helpers\Helper;
11 | use bizley\podium\widgets\Modal;
12 | use kartik\sortable\Sortable;
13 | use yii\helpers\Url;
14 |
15 | $this->title = Yii::t('podium/view', 'Forums');
16 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Administration Dashboard'), 'url' => ['admin/index']];
17 | $this->params['breadcrumbs'][] = $this->title;
18 |
19 | $items = [];
20 | foreach ($dataProvider as $category) {
21 | $items[] = ['content' => Helper::adminCategoriesPrepareContent($category)];
22 | }
23 |
24 | if (!empty($items)) {
25 | $this->registerJs("$('#podiumModalDelete').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); $('#deleteUrl').attr('href', button.data('url')); });");
26 | $this->registerJs("$('[data-toggle=\"tooltip\"]').tooltip();");
27 | }
28 |
29 | ?>
30 | = $this->render('/elements/admin/_navbar', ['active' => 'categories']); ?>
31 |
32 |
38 |
39 |
40 |
41 |
42 |
= Yii::t('podium/view', 'No categories have been added yet.') ?>
43 |
44 | = Sortable::widget([
45 | 'showHandle' => true,
46 | 'handleLabel' => ' ',
47 | 'items' => $items,
48 | 'pluginEvents' => [
49 | 'sortupdate' => 'function(e, ui) { $.post(\'' . Url::to(['admin/sort-category']) . '\', {id:ui.item.find(\'.podium-forum\').data(\'id\'), new:ui.item.index()}).done(function(data){ $(\'#podiumSortInfo\').html(data); }).fail(function(){ $(\'#podiumSortInfo\').html(\'' . Yii::t('podium/view', 'Sorry! There was some error while changing the order of the categories.') . ' \'); }); }',
50 | ]
51 | ]); ?>
52 |
53 |
54 |
55 |
56 |
57 | 'podiumModalDelete',
59 | 'header' => Yii::t('podium/view', 'Delete Category'),
60 | 'footer' => Yii::t('podium/view', 'Delete Category'),
61 | 'footerConfirmOptions' => ['class' => 'btn btn-danger', 'id' => 'deleteUrl']
62 | ]) ?>
63 | = Yii::t('podium/view', 'Are you sure you want to delete this category?') ?>
64 | = Yii::t('podium/view', "All category forums, forums' threads and posts will be deleted as well.") ?>
65 | = Yii::t('podium/view', 'This action can not be undone.') ?>
66 |
67 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Url;
11 |
12 | ?>
13 |
57 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_forum.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use yii\helpers\Html;
12 | use yii\helpers\Url;
13 |
14 | ?>
15 |
16 | = Html::encode($model->name) ?>
17 | sub)): ?>
18 | = Html::encode($model->sub) ?>
19 |
20 |
21 | = $model->threads ?>
22 | = $model->posts ?>
23 |
24 | latest) && !empty($model->latest->thread)): ?>
25 | = Html::encode($model->latest->thread->name) ?>
26 |
27 | = $model->latest->author->podiumTag ?>
28 | = Podium::getInstance()->formatter->asDatetime($model->latest->created_at, 'medium') ?>
29 | = Podium::getInstance()->formatter->asDatetime($model->latest->created_at, 'short') ?>
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_forum_header.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 | = Yii::t('podium/view', 'Forum') ?>
13 | = Yii::t('podium/view', 'Threads') ?>
14 | = Yii::t('podium/view', 'Posts') ?>
15 | = Yii::t('podium/view', 'Latest Post') ?>
16 |
17 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_forum_list.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\models\Forum;
11 | use yii\widgets\ListView;
12 |
13 | ?>
14 | = ListView::widget([
15 | 'dataProvider' => (new Forum())->search($category),
16 | 'itemView' => '/elements/forum/_forum',
17 | 'summary' => '',
18 | 'emptyText' => Yii::t('podium/view', 'No forums have been added yet.'),
19 | 'emptyTextOptions' => ['tag' => 'td', 'class' => 'text-muted', 'colspan' => 4],
20 | 'options' => ['tag' => 'tbody', 'class' => null],
21 | 'itemOptions' => ['tag' => 'tr']
22 | ]);
23 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_forum_section.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\widgets\Readers;
11 | use yii\helpers\Html;
12 | use yii\helpers\Url;
13 |
14 | ?>
15 |
16 |
17 |
20 | sub)): ?>
21 |
= Html::encode($model->sub) ?>
22 |
23 |
24 |
25 | = $this->render('/elements/forum/_threads', ['forum' => $model->id, 'category' => $model->category_id, 'slug' => $model->slug, 'filters' => $filters]) ?>
26 |
27 |
28 |
29 |
30 |
31 | = $this->render('/elements/forum/_icons') ?>
32 | = Readers::widget(['what' => 'forum']) ?>
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_forums.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 | = $this->render('/elements/forum/_forum_header') ?>
13 | = $this->render('/elements/forum/_forum_list', ['category' => $category]) ?>
14 |
15 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_icons.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 | = Yii::t('podium/view', 'No New Posts') ?>
13 | = Yii::t('podium/view', 'New Posts') ?>
14 | = Yii::t('podium/view', 'Hot Thread') ?>
15 | = Yii::t('podium/view', 'Locked Thread') ?>
16 | = Yii::t('podium/view', 'Pinned Thread') ?>
17 |
18 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_post_select.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use yii\helpers\Html;
12 |
13 | $this->registerJs("$('[data-toggle=\"tooltip\"]').tooltip();");
14 |
15 | ?>
16 |
17 |
18 | = Html::checkbox('post[]', false, ['value' => $model->id, 'label' => Yii::t('podium/view', 'Select this post')]) ?>
19 |
20 |
21 |
22 |
23 |
24 |
25 | = Podium::getInstance()->formatter->asRelativeTime($model->created_at) ?>
26 | edited && $model->edited_at): ?>
27 | (= Yii::t('podium/view', 'Edited') ?> = Podium::getInstance()->formatter->asRelativeTime($model->edited_at) ?>)
28 |
29 |
30 | = $model->author->podiumTag ?>
31 |
32 | = $model->author->postsCount ?>
33 |
34 |
35 |
36 | = $model->parsedContent ?>
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_section.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 | use yii\helpers\Url;
12 |
13 | ?>
14 |
15 |
23 |
24 | = $this->render('/elements/forum/_forums', ['category' => $model->id]) ?>
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_sections.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 | = \yii\widgets\ListView::widget([
13 | 'dataProvider' => $dataProvider,
14 | 'itemView' => '/elements/forum/_section',
15 | 'separator' => "\n \n",
16 | 'summary' => '',
17 | 'emptyText' => '
' . Yii::t('podium/view', 'No categories have been added yet.') . ' ',
18 | ]); ?>
19 |
20 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_thread.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use yii\helpers\Html;
12 | use yii\helpers\StringHelper;
13 | use yii\helpers\Url;
14 |
15 | $this->registerJs("$('[data-toggle=\"popover\"]').popover();");
16 | $firstToSee = $model->firstToSee();
17 | ?>
18 |
19 | parsedContent, 20, '...', true)) ?>= $firstToSee->author->podiumName ?> = Podium::getInstance()->formatter->asRelativeTime($firstToSee->updated_at) ?>" title="= Yii::t('podium/view', 'First New Post') ?>">
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | = $model->pinned ? '' : '' ?>= Html::encode($model->name) ?>= $model->pinned ? ' ' : '' ?>
30 |
31 |
32 | = $model->posts > 0 ? $model->posts - 1 : 0 ?>
33 | = $model->views ?>
34 |
35 | latest) && !empty($model->latest->author)): ?>
36 |
37 | = $model->latest->author->podiumTag ?>
38 | = Podium::getInstance()->formatter->asDatetime($model->latest->created_at, 'medium') ?>
39 | = Podium::getInstance()->formatter->asDatetime($model->latest->created_at, 'short') ?>
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_thread_list.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\models\Thread;
11 | use yii\widgets\ListView;
12 |
13 | $filtersOn = false;
14 | if (!isset($filters)) {
15 | $filters = null;
16 | }
17 | if (!empty($filters)) {
18 | foreach ($filters as $filter) {
19 | if ($filter) {
20 | $filtersOn = true;
21 | break;
22 | }
23 | }
24 | }
25 | ?>
26 | = ListView::widget([
27 | 'dataProvider' => (new Thread())->search($forum, $filters),
28 | 'itemView' => '/elements/forum/_thread',
29 | 'summary' => '',
30 | 'emptyText' => $filtersOn
31 | ? Yii::t('podium/view', 'No threads matching the filters can be found.')
32 | : Yii::t('podium/view', 'No threads have been added yet.'),
33 | 'emptyTextOptions' => ['tag' => 'td', 'class' => 'text-muted', 'colspan' => 4],
34 | 'options' => ['tag' => 'tbody'],
35 | 'itemOptions' => ['tag' => 'tr', 'class' => 'podium-thread-line']
36 | ]);
37 |
--------------------------------------------------------------------------------
/src/views/elements/forum/_threads.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\widgets\Pjax;
11 |
12 | ?>
13 |
14 |
15 | = $this->render('/elements/forum/_thread_header', ['forum' => $forum, 'category' => $category, 'slug' => $slug, 'filters' => $filters]) ?>
16 | = $this->render('/elements/forum/_thread_list', ['forum' => $forum, 'filters' => $filters]) ?>
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/views/elements/installation/_navbar.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\bootstrap\NavBar;
11 |
12 | ?>
13 | 'Podium',
15 | 'brandUrl' => ['forum/index'],
16 | 'options' => ['class' => 'navbar-inverse navbar-default',],
17 | 'innerContainerOptions' => ['class' => 'container-fluid',]
18 | ]);
19 | NavBar::end();
20 |
--------------------------------------------------------------------------------
/src/views/elements/main/_breadcrumbs.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 | use yii\helpers\Url;
12 | use yii\widgets\Breadcrumbs;
13 |
14 | ?>
15 |
16 |
17 | = Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?>
18 |
19 | params['no-search']) || $this->params['no-search'] !== true): ?>
20 |
21 | = Html::beginForm(['forum/search'], 'get'); ?>
22 |
33 | = Html::endForm(); ?>
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/views/elements/main/_footer.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 |
12 | ?>
13 |
19 |
--------------------------------------------------------------------------------
/src/views/elements/main/_members.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\helpers\Helper;
11 | use bizley\podium\models\Activity;
12 |
13 | $lastActive = Activity::lastActive();
14 |
15 | ?>
16 |
17 |
18 |
19 | = Yii::t('podium/view', '{n, plural, =1{# active user} other{# active users}} (in the past 15 minutes)', ['n' => !empty($lastActive['count']) ? $lastActive['count'] : 0]) ?>
20 | = Yii::t('podium/view', '{n, plural, =1{# member} other{# members}}', ['n' => !empty($lastActive['members']) ? $lastActive['members'] : 0]) ?>,
21 | = Yii::t('podium/view', '{n, plural, =1{# guest} other{# guests}}', ['n' => !empty($lastActive['guests']) ? $lastActive['guests'] : 0]) ?>,
22 | = Yii::t('podium/view', '{n, plural, =1{# anonymous user} other{# anonymous users}}', ['n' => !empty($lastActive['anonymous']) ? $lastActive['anonymous'] : 0]) ?>
23 |
24 |
25 |
26 | $name): ?>
27 | = Helper::podiumUserTag($name['name'], $name['role'], $id, $name['slug']) ?>
28 |
29 |
30 |
31 |
32 |
39 |
40 |
--------------------------------------------------------------------------------
/src/views/elements/members/_members_threads.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 |
13 |
14 | = Yii::t('podium/view', 'Threads started by {name}', ['name' => $user->podiumName]) ?>
15 |
16 |
17 |
18 | = $this->render('/elements/members/_threads', ['id' => $user->id]) ?>
19 |
20 |
21 |
22 |
23 |
24 | = $this->render('/elements/forum/_icons') ?>
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/views/elements/members/_thread_list.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\models\Thread;
11 | use yii\widgets\ListView;
12 |
13 | ?>
14 | = ListView::widget([
15 | 'dataProvider' => (new Thread())->searchByUser($id),
16 | 'itemView' => '/elements/forum/_thread',
17 | 'summary' => '',
18 | 'emptyText' => Yii::t('podium/view', 'No threads have been added yet.'),
19 | 'emptyTextOptions' => ['tag' => 'td', 'class' => 'text-muted', 'colspan' => 4],
20 | 'options' => ['tag' => 'tbody'],
21 | 'itemOptions' => ['tag' => 'tr', 'class' => 'podium-thread-line']
22 | ]);
23 |
--------------------------------------------------------------------------------
/src/views/elements/members/_threads.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 | = $this->render('/elements/forum/_thread_header') ?>
13 | = $this->render('/elements/members/_thread_list', ['id' => $id]) ?>
14 |
15 |
--------------------------------------------------------------------------------
/src/views/elements/messages/_navbar.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Url;
11 |
12 | ?>
13 |
21 |
--------------------------------------------------------------------------------
/src/views/elements/profile/_navbar.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\models\User;
11 | use yii\helpers\Url;
12 |
13 | $podiumUser = User::findMe();
14 | $messageCount = $podiumUser->getNewMessagesCount();
15 | $subscriptionCount = $podiumUser->getSubscriptionsCount();
16 |
17 | ?>
18 |
25 |
--------------------------------------------------------------------------------
/src/views/elements/search/_forum_search_posts.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 |
12 | $typeName = $type == 'topics' ? Yii::t('podium/view', 'threads') : Yii::t('podium/view', 'posts');
13 |
14 | ?>
15 |
16 |
17 |
18 |
19 | = Yii::t('podium/view', 'Search for {type} with "{query}" by "{author}"', ['query' => Html::encode($query), 'author' => Html::encode($author), 'type' => $typeName]) ?>
20 |
21 | = Yii::t('podium/view', 'Search for {type} with "{query}"', ['query' => Html::encode($query), 'type' => $typeName]) ?>
22 |
23 | = Yii::t('podium/view', 'Search for {type} by "{author}"', ['author' => Html::encode($author), 'type' => $typeName]) ?>
24 |
25 | = Yii::t('podium/view', 'Search for {type}', ['type' => $typeName]) ?>
26 |
27 |
28 |
29 |
30 | = $this->render('/elements/search/_threads_search_posts', ['dataProvider' => $dataProvider, 'type' => $type, 'query' => Html::encode($query)]) ?>
31 |
--------------------------------------------------------------------------------
/src/views/elements/search/_forum_search_topics.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 |
12 | $typeName = $type == 'topics' ? Yii::t('podium/view', 'threads') : Yii::t('podium/view', 'posts');
13 |
14 | ?>
15 |
16 |
17 |
18 |
19 | = Yii::t('podium/view', 'Search for {type} with "{query}" by "{author}"', ['query' => Html::encode($query), 'author' => Html::encode($author), 'type' => $typeName]) ?>
20 |
21 | = Yii::t('podium/view', 'Search for {type} with "{query}"', ['query' => Html::encode($query), 'type' => $typeName]) ?>
22 |
23 | = Yii::t('podium/view', 'Search for {type} by "{author}"', ['author' => Html::encode($author), 'type' => $typeName]) ?>
24 |
25 | = Yii::t('podium/view', 'Search for {type}', ['type' => $typeName]) ?>
26 |
27 |
28 |
29 |
30 | = $this->render('/elements/search/_threads_search_topics', ['dataProvider' => $dataProvider, 'type' => $type]) ?>
31 |
32 |
33 |
34 |
35 |
36 | = $this->render('/elements/forum/_icons') ?>
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/views/elements/search/_thread_header.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 | = Yii::t('podium/view', 'Thread') ?>
13 | = Yii::t('podium/view', 'Replies') ?>
14 | = Yii::t('podium/view', 'Views') ?>
15 | = Yii::t('podium/view', 'Post Author') ?>
16 |
17 |
--------------------------------------------------------------------------------
/src/views/elements/search/_thread_list.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\widgets\ListView;
11 |
12 | ?>
13 | = ListView::widget([
14 | 'dataProvider' => $dataProvider,
15 | 'itemView' => '/elements/search/_thread_' . $type,
16 | 'summary' => '',
17 | 'layout' => "{summary}\n{items}\n{pager}",
18 | 'pager' => ['options' => ['class' => 'pagination podium-pagination']],
19 | 'emptyText' => $type == 'topics' ? Yii::t('podium/view', 'No matching threads can be found.') : Yii::t('podium/view', 'No matching posts can be found.'),
20 | 'emptyTextOptions' => ['tag' => 'td', 'class' => 'text-muted', 'colspan' => 4],
21 | 'options' => ['tag' => 'tbody'],
22 | 'itemOptions' => ['tag' => 'tr', 'class' => 'podium-thread-line']
23 | ]);
24 |
--------------------------------------------------------------------------------
/src/views/elements/search/_thread_posts.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use yii\helpers\Html;
12 | use yii\helpers\Url;
13 |
14 | $this->registerJs("$('[data-toggle=\"popover\"]').popover();");
15 |
16 | $postModel = !empty($model->posts[0]) ? $model->posts[0] : $model->postData;
17 | ?>
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | = Html::encode($postModel->thread->name) ?>
27 |
28 |
29 |
30 | = $postModel->thread->posts > 0 ? $postModel->thread->posts - 1 : 0 ?>
31 |
32 |
33 | = $postModel->thread->views ?>
34 |
35 |
36 | = $postModel->author->podiumTag ?> = Podium::getInstance()->formatter->asDatetime($postModel->created_at) ?>
37 |
38 |
--------------------------------------------------------------------------------
/src/views/elements/search/_thread_topics.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use yii\helpers\Html;
12 | use yii\helpers\Url;
13 |
14 | $this->registerJs("$('[data-toggle=\"popover\"]').popover();");
15 |
16 | $firstToSee = $model->firstToSee();
17 |
18 | ?>
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | = Html::encode($model->name) ?>
28 |
29 |
30 | = $model->posts > 0 ? $model->posts - 1 : 0 ?>
31 | = $model->views ?>
32 |
33 | latest) && !empty($model->latest->author)): ?>
34 | = $model->latest->author->podiumTag ?> = Podium::getInstance()->formatter->asDatetime($model->latest->created_at) ?>
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/views/elements/search/_threads_search_posts.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\widgets\ListView;
11 | use yii\widgets\Pjax;
12 |
13 | $words = [];
14 | $query = preg_replace('/\s+/', ' ', trim($query));
15 | $tmp = explode(' ', $query);
16 | foreach ($tmp as $tmp) {
17 | if (mb_strlen($tmp, 'UTF-8') > 2) {
18 | $words[] = $tmp;
19 | }
20 | }
21 |
22 | ?>
23 |
24 | $dataProvider,
27 | 'itemView' => '/elements/search/_post',
28 | 'viewParams' => ['words' => $words, 'type' => $type],
29 | 'summary' => '',
30 | 'emptyText' => $type == 'topics' ? Yii::t('podium/view', 'No matching threads can be found.') : Yii::t('podium/view', 'No matching posts can be found.'),
31 | 'emptyTextOptions' => ['tag' => 'h3', 'class' => 'text-muted'],
32 | 'pager' => ['options' => ['class' => 'pagination pull-right']]
33 | ]);
34 | Pjax::end(); ?>
35 |
36 |
--------------------------------------------------------------------------------
/src/views/elements/search/_threads_search_topics.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | ?>
11 |
12 | = $this->render('/elements/search/_thread_header') ?>
13 | = $this->render('/elements/search/_thread_list', ['dataProvider' => $dataProvider, 'type' => $type]) ?>
14 |
15 |
--------------------------------------------------------------------------------
/src/views/forum/ban.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | $this->title = Yii::t('podium/view', 'You have been banned!');
11 |
12 | ?>
13 |
14 |
15 |
= $this->title ?>
16 |
= Yii::t('podium/view', 'Contact the administrator if you would like to get more details about your ban.') ?>
17 |
18 |
--------------------------------------------------------------------------------
/src/views/forum/category.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use yii\helpers\Url;
12 |
13 | $this->title = $model->name;
14 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
15 | $this->params['breadcrumbs'][] = $this->title;
16 |
17 | ?>
18 | user->isGuest): ?>
19 |
26 |
27 |
28 |
29 |
30 |
31 | = $this->render('/elements/forum/_section', ['model' => $model]) ?>
32 |
33 |
34 |
35 | = $this->render('/elements/main/_members');
36 |
--------------------------------------------------------------------------------
/src/views/forum/delete.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 |
12 | $this->title = Yii::t('podium/view', 'Delete Thread');
13 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
14 | $this->params['breadcrumbs'][] = ['label' => $model->forum->category->name, 'url' => ['forum/category', 'id' => $model->forum->category->id, 'slug' => $model->forum->category->slug]];
15 | $this->params['breadcrumbs'][] = ['label' => $model->forum->name, 'url' => ['forum/forum', 'cid' => $model->forum->category->id, 'id' => $model->forum->id, 'slug' => $model->forum->slug]];
16 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['forum/thread', 'cid' => $model->forum->category->id, 'fid' => $model->forum->id, 'id' => $model->id, 'slug' => $model->slug]];
17 | $this->params['breadcrumbs'][] = $this->title;
18 |
19 | ?>
20 |
21 |
22 |
23 | = Html::beginForm(); ?>
24 |
25 |
26 |
27 | = Html::hiddenInput('thread', $model->id) ?>
28 |
= Yii::t('podium/view', 'Are you sure you want to delete this thread?') ?>
29 |
= Yii::t('podium/view', 'All posts in this thread will be deleted as well. This can not be undone.') ?>
30 |
31 |
32 |
33 |
43 | = Html::endForm(); ?>
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/src/views/forum/deletepoll.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.5
8 | */
9 |
10 | use bizley\podium\widgets\poll\Poll;
11 | use yii\helpers\Html;
12 |
13 | $this->title = Yii::t('podium/view', 'Delete Poll');
14 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
15 | $this->params['breadcrumbs'][] = ['label' => $model->thread->forum->category->name, 'url' => ['forum/category', 'id' => $model->thread->forum->category->id, 'slug' => $model->thread->forum->category->slug]];
16 | $this->params['breadcrumbs'][] = ['label' => $model->thread->forum->name, 'url' => ['forum/forum', 'cid' => $model->thread->forum->category->id, 'id' => $model->thread->forum->id, 'slug' => $model->thread->forum->slug]];
17 | $this->params['breadcrumbs'][] = ['label' => $model->thread->name, 'url' => ['forum/thread', 'cid' => $model->thread->forum->category->id, 'fid' => $model->thread->forum->id, 'id' => $model->thread->id, 'slug' => $model->thread->slug]];
18 | $this->params['breadcrumbs'][] = $this->title;
19 |
20 | ?>
21 |
22 |
23 |
24 | = Html::beginForm(); ?>
25 |
26 |
27 |
28 | = Html::hiddenInput('poll', $model->id) ?>
29 |
= Yii::t('podium/view', 'Are you sure you want to delete this poll?') ?>
30 |
= Yii::t('podium/view', 'This action can not be undone.') ?>
31 |
32 |
33 |
34 |
44 | = Html::endForm(); ?>
45 |
46 |
47 |
48 |
49 | = Poll::widget(['model' => $model, 'display' => true]) ?>
50 |
51 |
--------------------------------------------------------------------------------
/src/views/forum/deletepost.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 |
12 | $this->title = Yii::t('podium/view', 'Delete Post');
13 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
14 | $this->params['breadcrumbs'][] = ['label' => $model->forum->category->name, 'url' => ['forum/category', 'id' => $model->forum->category->id, 'slug' => $model->forum->category->slug]];
15 | $this->params['breadcrumbs'][] = ['label' => $model->forum->name, 'url' => ['forum/forum', 'cid' => $model->forum->category->id, 'id' => $model->forum->id, 'slug' => $model->forum->slug]];
16 | $this->params['breadcrumbs'][] = ['label' => $model->thread->name, 'url' => ['forum/thread', 'cid' => $model->forum->category->id, 'fid' => $model->forum->id, 'id' => $model->thread->id, 'slug' => $model->thread->slug]];
17 | $this->params['breadcrumbs'][] = $this->title;
18 |
19 | ?>
20 |
21 |
22 |
23 | = Html::beginForm(); ?>
24 |
25 |
26 |
27 | = Html::hiddenInput('post', $model->id) ?>
28 |
= Yii::t('podium/view', 'Are you sure you want to delete this post?') ?>
29 |
= Yii::t('podium/view', 'This action can not be undone.') ?>
30 |
31 |
32 |
33 |
43 | = Html::endForm(); ?>
44 |
45 |
46 |
47 | = $this->render('/elements/forum/_post', ['model' => $model, 'category' => $model->forum->category->id, 'slug' => $model->thread->slug]) ?>
48 |
49 |
--------------------------------------------------------------------------------
/src/views/forum/deleteposts.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 | use yii\widgets\ListView;
12 | use yii\widgets\Pjax;
13 |
14 | $this->title = Yii::t('podium/view', 'Delete Posts');
15 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
16 | $this->params['breadcrumbs'][] = ['label' => $model->forum->category->name, 'url' => ['forum/category', 'id' => $model->forum->category->id, 'slug' => $model->forum->category->slug]];
17 | $this->params['breadcrumbs'][] = ['label' => $model->forum->name, 'url' => ['forum/forum', 'cid' => $model->forum->category->id, 'id' => $model->forum->id, 'slug' => $model->forum->slug]];
18 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['forum/thread', 'cid' => $model->forum->category->id, 'fid' => $model->forum->id, 'id' => $model->id, 'slug' => $model->slug]];
19 | $this->params['breadcrumbs'][] = $this->title;
20 |
21 | ?>
22 |
23 |
24 |
25 |
26 | = Yii::t('podium/view', 'Select posts to delete') ?> :
27 |
28 |
29 |
30 |
31 |
32 | = Html::beginForm(); ?>
33 |
34 | = ListView::widget([
35 | 'dataProvider' => $dataProvider,
36 | 'itemView' => '/elements/forum/_post_select',
37 | 'summary' => '',
38 | 'emptyText' => Yii::t('podium/view', 'No posts have been added yet.'),
39 | 'emptyTextOptions' => ['tag' => 'h3', 'class' => 'text-muted'],
40 | 'pager' => ['options' => ['class' => 'pagination pull-right']]
41 | ]); ?>
42 |
43 |
44 |
57 | = Html::endForm();
58 |
--------------------------------------------------------------------------------
/src/views/forum/editpoll.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.5
8 | */
9 |
10 | use bizley\podium\widgets\poll\Poll;
11 | use yii\bootstrap\ActiveForm;
12 | use yii\helpers\Html;
13 |
14 | $this->title = Yii::t('podium/view', 'Edit Poll');
15 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
16 | $this->params['breadcrumbs'][] = ['label' => $model->thread->forum->category->name, 'url' => ['forum/category', 'id' => $model->thread->forum->category->id, 'slug' => $model->thread->forum->category->slug]];
17 | $this->params['breadcrumbs'][] = ['label' => $model->thread->forum->name, 'url' => ['forum/forum', 'cid' => $model->thread->forum->category->id, 'id' => $model->thread->forum->id, 'slug' => $model->thread->forum->slug]];
18 | $this->params['breadcrumbs'][] = ['label' => $model->thread->name, 'url' => ['forum/thread', 'cid' => $model->thread->forum->category->id, 'fid' => $model->thread->forum->id, 'id' => $model->thread->id, 'slug' => $model->thread->slug]];
19 | $this->params['breadcrumbs'][] = $this->title;
20 |
21 | ?>
22 |
23 |
24 |
25 |
26 | 'edit-poll-form']); ?>
27 |
28 | = Poll::update($form, $model) ?>
29 |
30 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/views/forum/forum.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\models\User;
11 | use bizley\podium\Podium;
12 | use bizley\podium\rbac\Rbac;
13 | use yii\helpers\Url;
14 |
15 | $this->title = $model->name;
16 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
17 | $this->params['breadcrumbs'][] = ['label' => $model->category->name, 'url' => ['forum/category', 'id' => $model->category->id, 'slug' => $model->category->slug]];
18 | $this->params['breadcrumbs'][] = $this->title;
19 |
20 | ?>
21 | user->isGuest): ?>
22 |
32 |
33 |
34 |
35 |
36 |
37 | = $this->render('/elements/forum/_forum_section', ['model' => $model, 'filters' => $filters]) ?>
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/views/forum/index.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use bizley\podium\widgets\LatestPosts;
12 | use yii\helpers\Url;
13 |
14 | $this->title = Yii::t('podium/view', 'Main Forum');
15 | $this->params['breadcrumbs'][] = $this->title;
16 |
17 | ?>
18 |
19 |
20 | = $this->render('/elements/forum/_sections', ['dataProvider' => $dataProvider]) ?>
21 |
22 |
28 |
29 | = $this->render('/elements/main/_members');
30 |
--------------------------------------------------------------------------------
/src/views/forum/maintenance.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | $this->title = Yii::t('podium/view', 'Forum Maintenance');
11 |
12 | $this->registerJs("var deg = 0; var rotate = function () { $('#cog1').css({'-webkit-transform':'rotate(' + deg + 'deg)', '-moz-transform':'rotate(' + deg + 'deg)', '-ms-transform':'rotate(' + deg + 'deg)', '-o-transform':'rotate(' + deg + 'deg)'}); $('#cog2').css({'-webkit-transform':'rotate(-' + deg + 'deg)', '-moz-transform':'rotate(-' + deg + 'deg)', '-ms-transform':'rotate(-' + deg + 'deg)', '-o-transform':'rotate(-' + deg + 'deg)'}); deg += 10; if (deg == 360) deg = 0;} window.setInterval(rotate, 100, deg);");
13 | ?>
14 |
15 |
16 |
17 |
= $this->title ?>
18 |
= Yii::t('podium/view', 'We will get back to you shortly') ?>
19 |
20 |
--------------------------------------------------------------------------------
/src/views/forum/move.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 |
12 | $this->title = Yii::t('podium/view', 'Move Thread');
13 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
14 | $this->params['breadcrumbs'][] = ['label' => $model->forum->category->name, 'url' => ['forum/category', 'id' => $model->forum->category->id, 'slug' => $model->forum->category->slug]];
15 | $this->params['breadcrumbs'][] = ['label' => $model->forum->name, 'url' => ['forum/forum', 'cid' => $model->forum->category->id, 'id' => $model->forum->id, 'slug' => $model->forum->slug]];
16 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['forum/thread', 'cid' => $model->forum->category->id, 'fid' => $model->forum->id, 'id' => $model->id, 'slug' => $model->slug]];
17 | $this->params['breadcrumbs'][] = $this->title;
18 |
19 | ?>
20 |
21 |
22 |
23 | = Html::beginForm(); ?>
24 |
25 |
26 |
27 | = Html::label(Yii::t('podium/view', 'Select a forum for this thread to be moved to'), 'forum') ?>
28 |
* = Yii::t('podium/view', 'Forums you can moderate are marked with asterisk.') ?>
29 | = Html::dropDownList('forum', null, $list, ['id' => 'forum', 'class' => 'form-control', 'options' => $options, 'encode' => false]) ?>
30 |
31 |
32 |
33 |
40 | = Html::endForm(); ?>
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/views/forum/report.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\widgets\editor\EditorBasic;
11 | use yii\bootstrap\ActiveForm;
12 | use yii\helpers\Html;
13 |
14 | $this->title = Yii::t('podium/view', 'Report post');
15 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
16 | $this->params['breadcrumbs'][] = ['label' => $post->forum->category->name, 'url' => ['forum/category', 'id' => $post->forum->category->id, 'slug' => $post->forum->category->slug]];
17 | $this->params['breadcrumbs'][] = ['label' => $post->forum->name, 'url' => ['forum/forum', 'cid' => $post->forum->category->id, 'id' => $post->forum->id, 'slug' => $post->forum->slug]];
18 | $this->params['breadcrumbs'][] = ['label' => $post->thread->name, 'url' => ['forum/thread', 'cid' => $post->forum->category->id, 'fid' => $post->forum->id, 'id' => $post->thread->id, 'slug' => $post->thread->slug]];
19 | $this->params['breadcrumbs'][] = $this->title;
20 |
21 | ?>
22 | = $this->render('/elements/forum/_post', ['model' => $post, 'category' => $post->forum->category->id, 'slug' => $post->thread->slug]) ?>
23 |
24 |
25 |
26 |
27 | 'report-post-form']); ?>
28 |
29 |
30 |
31 | = $form->field($model, 'content')
32 | ->label(Yii::t('podium/view', 'Complaint'))
33 | ->widget(EditorBasic::className()) ?>
34 |
35 |
36 |
37 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/views/forum/search.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 |
12 | if (!isset($author)) {
13 | $author = '';
14 | }
15 | if (!isset($model)) {
16 | $type = 'posts';
17 | $display = 'topics';
18 | }
19 | else {
20 | $type = $model->type;
21 | $display = $model->display;
22 | }
23 | ?>
24 |
25 | title = Yii::t('podium/view', 'Search for {type} with "{query}" by "{author}"', ['query' => Html::encode($query), 'author' => Html::encode($author), 'type' => $typeName]);
29 | }
30 | elseif (!empty($query) && empty($author)) {
31 | $this->title = Yii::t('podium/view', 'Search for {type} with "{query}"', ['query' => Html::encode($query), 'type' => $typeName]);
32 | }
33 | elseif (empty($query) && !empty($author)) {
34 | $this->title = Yii::t('podium/view', 'Search for {type} by "{author}"', ['author' => Html::encode($author), 'type' => $typeName]);
35 | }
36 | else {
37 | $this->title = Yii::t('podium/view', 'Search for {type}', ['type' => $typeName]);
38 | }
39 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
40 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Search Forum'), 'url' => ['forum/search']];
41 | $this->params['breadcrumbs'][] = $this->title;
42 | ?>
43 |
44 |
45 |
46 |
47 |
48 | = $this->render('/elements/search/_forum_search_posts', ['dataProvider' => $dataProvider, 'query' => $query, 'author' => $author, 'type' => $type]) ?>
49 |
50 |
51 |
52 | = $this->render('/elements/search/_forum_search_topics', ['dataProvider' => $dataProvider, 'query' => $query, 'author' => $author, 'type' => $type]) ?>
53 |
54 |
55 |
56 |
57 |
58 | title = Yii::t('podium/view', 'Search Forum');
60 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
61 | $this->params['breadcrumbs'][] = $this->title;
62 | ?>
63 |
64 | = $this->render('/elements/search/_search', ['model' => $model, 'list' => $list]) ?>
65 |
66 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\models\ThreadView;
11 | use bizley\podium\widgets\Readers;
12 | use yii\helpers\Url;
13 | use yii\widgets\ListView;
14 |
15 | $this->title = Yii::t('podium/view', 'Unread posts');
16 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Main Forum'), 'url' => ['forum/index']];
17 | $this->params['breadcrumbs'][] = $this->title;
18 |
19 | ?>
20 |
27 |
28 |
29 |
= Yii::t('podium/view', 'Unread posts') ?>
30 |
31 |
32 |
33 | = $this->render('/elements/forum/_thread_header') ?>
34 | = ListView::widget([
35 | 'dataProvider' => (new ThreadView())->search(),
36 | 'itemView' => '/elements/forum/_thread',
37 | 'summary' => '',
38 | 'emptyText' => Yii::t('podium/view', 'No more unread posts at the moment.'),
39 | 'emptyTextOptions' => ['tag' => 'td', 'class' => 'text-muted', 'colspan' => 4],
40 | 'options' => ['tag' => 'tbody'],
41 | 'itemOptions' => ['tag' => 'tr', 'class' => 'podium-thread-line']
42 | ]); ?>
43 |
44 |
45 |
46 |
47 |
48 |
52 | = Readers::widget(['what' => 'unread']) ?>
53 |
54 |
--------------------------------------------------------------------------------
/src/views/layouts/installation.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\assets\PodiumAsset;
11 | use bizley\podium\helpers\Helper;
12 | use bizley\podium\widgets\Alert;
13 | use yii\helpers\Html;
14 |
15 | PodiumAsset::register($this);
16 | $this->beginPage() ?>
17 |
18 |
19 |
20 |
21 |
22 | = Html::csrfMetaTags() ?>
23 | = Html::encode(Helper::title($this->title)) ?>
24 | head() ?>
25 |
26 |
27 |
28 | beginBody() ?>
29 |
30 | = $this->render('/elements/installation/_navbar') ?>
31 | = $this->render('/elements/main/_breadcrumbs') ?>
32 | = Alert::widget() ?>
33 | = $content ?>
34 |
35 | = $this->render('/elements/main/_footer') ?>
36 | endBody() ?>
37 |
38 |
39 |
40 | endPage() ?>
41 |
--------------------------------------------------------------------------------
/src/views/layouts/main.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\assets\PodiumAsset;
11 | use bizley\podium\helpers\Helper;
12 | use bizley\podium\widgets\Alert;
13 | use yii\helpers\Html;
14 |
15 | PodiumAsset::register($this);
16 | $this->beginPage() ?>
17 |
18 |
19 |
20 |
21 |
22 | = Html::csrfMetaTags() ?>
23 | = Html::encode(Helper::title($this->title)) ?>
24 | head() ?>
25 |
26 |
27 |
28 | beginBody() ?>
29 |
30 | = $this->render('/elements/main/_navbar') ?>
31 | = $this->render('/elements/main/_breadcrumbs') ?>
32 | = Alert::widget() ?>
33 | = $content ?>
34 |
35 | = $this->render('/elements/main/_footer') ?>
36 | endBody() ?>
37 |
38 |
39 |
40 | endPage() ?>
41 |
--------------------------------------------------------------------------------
/src/views/layouts/maintenance.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Html;
11 | use bizley\podium\assets\PodiumAsset;
12 |
13 | PodiumAsset::register($this);
14 | $this->beginPage() ?>
15 |
16 |
17 |
18 |
19 |
20 | = Html::csrfMetaTags() ?>
21 | = Html::encode($this->title) ?>
22 | head() ?>
23 |
24 |
25 |
26 | beginBody() ?>
27 |
28 | = $content ?>
29 |
30 | endBody() ?>
31 |
32 |
33 |
34 | endPage() ?>
35 |
--------------------------------------------------------------------------------
/src/views/members/posts.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\models\Post;
11 | use yii\helpers\Url;
12 | use yii\widgets\ListView;
13 | use yii\widgets\Pjax;
14 |
15 | $this->title = Yii::t('podium/view', 'Posts created by {name}', ['name' => $user->podiumName]);
16 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Members List'), 'url' => ['members/index']];
17 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Member View'), 'url' => ['members/view', 'id' => $user->id, 'slug' => $user->podiumSlug]];
18 | $this->params['breadcrumbs'][] = $this->title;
19 |
20 | ?>
21 |
27 |
28 | (new Post())->searchByUser($user->id),
31 | 'itemView' => '/elements/forum/_post',
32 | 'viewParams' => ['parent' => true],
33 | 'summary' => '',
34 | 'emptyText' => Yii::t('podium/view', 'No posts have been added yet.'),
35 | 'emptyTextOptions' => ['tag' => 'h3', 'class' => 'text-muted'],
36 | 'pager' => ['options' => ['class' => 'pagination pull-right']]
37 | ]);
38 | Pjax::end(); ?>
39 |
40 |
--------------------------------------------------------------------------------
/src/views/members/threads.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use yii\helpers\Url;
11 |
12 | $this->title = Yii::t('podium/view', 'Threads started by {name}', ['name' => $user->podiumName]);
13 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Members List'), 'url' => ['members/index']];
14 | $this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'Member View'), 'url' => ['members/view', 'id' => $user->id, 'slug' => $user->podiumSlug]];
15 | $this->params['breadcrumbs'][] = $this->title;
16 |
17 | ?>
18 |
24 |
25 |
26 |
27 |
28 | = $this->render('/elements/members/_members_threads', ['user' => $user]) ?>
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/views/messages/load.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\Podium;
11 | use bizley\podium\widgets\Avatar;
12 | use yii\helpers\Html;
13 |
14 | ?>
15 |
16 |
17 | = Avatar::widget(['author' => $reply->reply->sender]) ?>
18 |
19 |
20 |
21 |
22 |
23 | = Podium::getInstance()->formatter->asRelativeTime($reply->reply->created_at) ?>
24 | = Html::encode($reply->reply->topic) ?>
25 |
26 |
27 | = $reply->reply->parsedContent ?>
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/views/profile/profile.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 0.1
8 | */
9 |
10 | use bizley\podium\helpers\Helper;
11 | use bizley\podium\Podium;
12 | use bizley\podium\widgets\Avatar;
13 | use yii\helpers\Html;
14 | use yii\helpers\Url;
15 |
16 | $this->title = Yii::t('podium/view', 'My Profile');
17 | $this->params['breadcrumbs'][] = $this->title;
18 |
19 | ?>
20 |
21 |
22 | = $this->render('/elements/profile/_navbar', ['active' => 'profile']) ?>
23 |
24 |
25 |
26 |
27 |
28 | = Html::encode($model->podiumName) ?>
29 |
30 | = Html::encode($model->email) ?>
31 | = Helper::roleLabel($model->role) ?>
32 |
33 |
34 |
= Yii::t('podium/view', 'Whereabouts') ?>: = !empty($model->meta) && !empty($model->meta->location) ? Html::encode($model->meta->location) : '-' ?>
35 |
= Yii::t('podium/view', 'Member since {date}', ['date' => Podium::getInstance()->formatter->asDatetime($model->created_at, 'long')]) ?> (= Podium::getInstance()->formatter->asRelativeTime($model->created_at) ?>)
36 |
37 | = Yii::t('podium/view', 'Show all threads started by me') ?>
38 | = Yii::t('podium/view', 'Show all posts created by me') ?>
39 |
40 |
41 |
47 |
48 |
49 |
50 | = Avatar::widget([
51 | 'author' => $model,
52 | 'showName' => false
53 | ]) ?>
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/web/User.php:
--------------------------------------------------------------------------------
1 |
13 | * @since 0.5
14 | */
15 | class User extends YiiUser
16 | {
17 | /**
18 | * Returns the access checker used for checking access.
19 | * @return CheckAccessInterface
20 | */
21 | protected function getAccessChecker()
22 | {
23 | return Podium::getInstance()->rbac;
24 | }
25 | }
--------------------------------------------------------------------------------
/src/widgets/Alert.php:
--------------------------------------------------------------------------------
1 | getSession()->setFlash('error', 'This is the message');
22 | * \Yii::$app->getSession()->setFlash('success', 'This is the message');
23 | * \Yii::$app->getSession()->setFlash('info', 'This is the message');
24 | * ```
25 | *
26 | * Multiple messages could be set as follows:
27 | *
28 | * ```php
29 | * \Yii::$app->getSession()->setFlash('error', ['Error 1', 'Error 2']);
30 | * ```
31 | *
32 | * @author Kartik Visweswaran
33 | * @author Alexander Makarov
34 | */
35 | class Alert extends \yii\bootstrap\Widget
36 | {
37 | /**
38 | * @var array the alert types configuration for the flash messages.
39 | * This array is setup as $key => $value, where:
40 | * - $key is the name of the session flash variable
41 | * - $value is the bootstrap alert type (i.e. danger, success, info, warning)
42 | */
43 | public $alertTypes = [
44 | 'error' => 'alert-danger',
45 | 'danger' => 'alert-danger',
46 | 'success' => 'alert-success',
47 | 'info' => 'alert-info',
48 | 'warning' => 'alert-warning'
49 | ];
50 |
51 | /**
52 | * @var array the options for rendering the close button tag.
53 | */
54 | public $closeButton = [];
55 |
56 | public function init()
57 | {
58 | parent::init();
59 |
60 | $session = \Yii::$app->getSession();
61 | $flashes = $session->getAllFlashes();
62 | $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : '';
63 |
64 | foreach ($flashes as $type => $data) {
65 | if (isset($this->alertTypes[$type])) {
66 | $data = (array) $data;
67 | foreach ($data as $i => $message) {
68 | /* initialize css class for each alert box */
69 | $this->options['class'] = $this->alertTypes[$type] . $appendCss;
70 |
71 | /* assign unique id to each alert box */
72 | $this->options['id'] = $this->getId() . '-' . $type . '-' . $i;
73 |
74 | echo \yii\bootstrap\Alert::widget([
75 | 'body' => $message,
76 | 'closeButton' => $this->closeButton,
77 | 'options' => $this->options,
78 | ]);
79 | }
80 |
81 | $session->removeFlash($type);
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/widgets/Avatar.php:
--------------------------------------------------------------------------------
1 |
17 | * @since 0.1
18 | */
19 | class Avatar extends Widget
20 | {
21 | /**
22 | * @var User|null Avatar owner.
23 | */
24 | public $author;
25 |
26 | /**
27 | * @var bool Whether user name should appear underneath the image.
28 | */
29 | public $showName = true;
30 |
31 | /**
32 | * Renders the image.
33 | * Based on user settings the avatar can be uploaded image, Gravatar image or default one.
34 | * @return string
35 | */
36 | public function run()
37 | {
38 | $avatar = Html::img(Helper::defaultAvatar(), [
39 | 'class' => 'podium-avatar img-circle img-responsive center-block',
40 | 'alt' => Yii::t('podium/view', 'user deleted')
41 | ]);
42 | $name = Helper::deletedUserTag(true);
43 | if ($this->author instanceof User) {
44 | $avatar = Html::img(Helper::defaultAvatar(), [
45 | 'class' => 'podium-avatar img-circle img-responsive center-block',
46 | 'alt' => Html::encode($this->author->podiumName)
47 | ]);
48 | $name = $this->author->podiumTag;
49 | $meta = $this->author->meta;
50 | if (!empty($meta)) {
51 | if (!empty($meta->gravatar)) {
52 | $avatar = Gravatar::widget([
53 | 'email' => $this->author->email,
54 | 'defaultImage' => 'identicon',
55 | 'rating' => 'r',
56 | 'options' => [
57 | 'alt' => Html::encode($this->author->podiumName),
58 | 'class' => 'podium-avatar img-circle img-responsive center-block',
59 | ]
60 | ]);
61 | } elseif (!empty($meta->avatar)) {
62 | $avatar = Html::img('@web/avatars/' . $meta->avatar, [
63 | 'class' => 'podium-avatar img-circle img-responsive center-block',
64 | 'alt' => Html::encode($this->author->podiumName)
65 | ]);
66 | }
67 | }
68 | }
69 | return $avatar . ($this->showName ? Html::tag('p', $name, ['class' => 'avatar-name']) : '');
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/widgets/LatestPosts.php:
--------------------------------------------------------------------------------
1 |
16 | * @since 0.1
17 | */
18 | class LatestPosts extends Widget
19 | {
20 | /**
21 | * @var int number of latest posts
22 | */
23 | public $posts = 5;
24 |
25 | /**
26 | * Renders the list of posts.
27 | * @return string
28 | */
29 | public function run()
30 | {
31 | $out = Html::beginTag('div', ['class' => 'panel panel-default']) . "\n";
32 | $out .= Html::tag('div', Yii::t('podium/view', 'Latest posts'), ['class' => 'panel-heading']) . "\n";
33 |
34 | $latest = Post::getLatest(is_numeric($this->posts) && $this->posts > 0 ? $this->posts : 5);
35 |
36 | if ($latest) {
37 | $out .= Html::beginTag('table', ['class' => 'table table-hover']) . "\n";
38 | foreach ($latest as $post) {
39 | $out .= Html::beginTag('tr');
40 | $out .= Html::beginTag('td');
41 | $out .= Html::a($post['title'], ['forum/show', 'id' => $post['id']], ['class' => 'center-block']) . "\n";
42 | $out .= Html::tag('small', Podium::getInstance()->formatter->asRelativeTime($post['created']) . "\n" . $post['author']) . "\n";
43 | $out .= Html::endTag('td');
44 | $out .= Html::endTag('tr');
45 | }
46 | $out .= Html::endTag('table') . "\n";
47 | } else {
48 | $out .= Html::beginTag('div', ['class' => 'panel-body']) . "\n";
49 | $out .= Html::tag('small', Yii::t('podium/view', 'No posts have been added yet.')) . "\n";
50 | $out .= Html::endTag('div') . "\n";
51 | }
52 |
53 | $out .= Html::endTag('div') . "\n";
54 |
55 | return $out;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/widgets/Modal.php:
--------------------------------------------------------------------------------
1 |
13 | * @since 0.2
14 | */
15 | class Modal extends YiiModal
16 | {
17 | /**
18 | * @var array the HTML attributes for the widget container tag.
19 | */
20 | public $options = ['aria-hidden' => 'true'];
21 | /**
22 | * @var array footer confirmation HTML options
23 | */
24 | public $footerConfirmOptions = [];
25 | /**
26 | * @var mixed footer confirmation URL
27 | */
28 | public $footerConfirmUrl = '#';
29 |
30 |
31 | /**
32 | * Initializes the widget.
33 | */
34 | public function init()
35 | {
36 | $this->header = Html::tag('h4', $this->header, ['class' => 'modal-title', 'id' => $this->id . 'Label']);
37 | $this->options['aria-labelledby'] = $this->id . 'Label';
38 | $this->footer = Html::button(Yii::t('podium/view', 'Cancel'), ['class' => 'btn btn-default', 'data-dismiss' => 'modal'])
39 | . "\n" . Html::a($this->footer, $this->footerConfirmUrl, $this->footerConfirmOptions);
40 |
41 | parent::init();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/widgets/PageSizer.php:
--------------------------------------------------------------------------------
1 |
14 | * @since 0.1
15 | */
16 | class PageSizer extends Widget
17 | {
18 | /**
19 | * @var array List of page sizes
20 | */
21 | public $pageSizes = [5 => 5, 10 => 10, 20 => 20, 50 => 50];
22 |
23 | /**
24 | * Rendering the widget dropdown.
25 | * Default page size is 20.
26 | * @return string
27 | */
28 | public function run()
29 | {
30 | $size = 20;
31 | $saved = Yii::$app->session->get('per-page');
32 | if (in_array($saved, $this->pageSizes)) {
33 | $size = $saved;
34 | }
35 | $selected = Yii::$app->request->get('per-page');
36 | if (in_array($selected, $this->pageSizes)) {
37 | $size = $selected;
38 | }
39 |
40 | Yii::$app->session->set('per-page', $size);
41 |
42 | return Html::tag('div', Html::tag('div',
43 | Html::label(Yii::t('podium/view', 'Results per page'), 'per-page')
44 | . ' '
45 | . Html::dropDownList('per-page', $size, $this->pageSizes, ['class' => 'form-control input-sm', 'id' => 'per-page']),
46 | ['class' => 'form-group']
47 | ), ['class' => 'pull-right form-inline']) . ' ';
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/CodeMirror.php:
--------------------------------------------------------------------------------
1 |
15 | * @since 0.6
16 | */
17 | class CodeMirror extends InputWidget
18 | {
19 | /**
20 | * @var string Editor type to display
21 | */
22 | public $type = 'basic';
23 |
24 | /**
25 | * @inheritdoc
26 | */
27 | public function run()
28 | {
29 | $this->registerClientScript();
30 | if ($this->hasModel()) {
31 | if (empty($this->model->{$this->attribute})) {
32 | $this->model->{$this->attribute} = "\n\n\n\n\n\n\n\n";
33 | }
34 | return Html::activeTextarea($this->model, $this->attribute, ['id' => 'codemirror']);
35 | }
36 | if (empty($this->value)) {
37 | $this->value = "\n\n\n\n\n\n\n\n";
38 | }
39 | return Html::textarea($this->name, $this->value, ['id' => 'codemirror']);
40 | }
41 |
42 | /**
43 | * Registers widget assets.
44 | * Note that CodeMirror works without jQuery.
45 | */
46 | public function registerClientScript()
47 | {
48 | $view = $this->view;
49 | CodeMirrorAsset::register($view);
50 | $js = 'var CodeMirrorLabels = {
51 | bold: "' . Yii::t('podium/view', 'Bold') . '",
52 | italic: "' . Yii::t('podium/view', 'Italic') . '",
53 | header: "' . Yii::t('podium/view', 'Header') . '",
54 | inlinecode: "' . Yii::t('podium/view', 'Inline code') . '",
55 | blockcode: "' . Yii::t('podium/view', 'Block code') . '",
56 | quote: "' . Yii::t('podium/view', 'Quote') . '",
57 | bulletedlist: "' . Yii::t('podium/view', 'Bulleted list') . '",
58 | orderedlist: "' . Yii::t('podium/view', 'Ordered list') . '",
59 | link: "' . Yii::t('podium/view', 'Link') . '",
60 | image: "' . Yii::t('podium/view', 'Image') . '",
61 | help: "' . Yii::t('podium/view', 'Help') . '",
62 | };var CodeMirrorSet = "' . $this->type . '";';
63 | $view->registerJs($js, View::POS_BEGIN);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/assets/CodeMirrorAsset.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.6
12 | */
13 | class CodeMirrorAsset extends AssetBundle
14 | {
15 | /**
16 | * @inheritdoc
17 | */
18 | public $depends = [
19 | 'bizley\podium\widgets\codemirror\assets\CodeMirrorLibAsset',
20 | 'bizley\podium\widgets\codemirror\assets\CodeMirrorExtraAsset',
21 | 'bizley\podium\widgets\codemirror\assets\CodeMirrorModesAsset',
22 | 'bizley\podium\widgets\codemirror\assets\CodeMirrorButtonsAsset',
23 | 'bizley\podium\widgets\codemirror\assets\CodeMirrorConfigAsset'
24 | ];
25 | }
26 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/assets/CodeMirrorButtonsAsset.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.6
12 | */
13 | class CodeMirrorButtonsAsset extends AssetBundle
14 | {
15 | /**
16 | * @inheritdoc
17 | */
18 | public $sourcePath = '@bower/codemirror-buttons';
19 |
20 | /**
21 | * @inheritdoc
22 | */
23 | public $js = ['buttons.js'];
24 | }
25 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/assets/CodeMirrorConfigAsset.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.6
12 | */
13 | class CodeMirrorConfigAsset extends AssetBundle
14 | {
15 | /**
16 | * @inheritdoc
17 | */
18 | public $sourcePath = '@podium/widgets/codemirror/podium';
19 |
20 | /**
21 | * @inheritdoc
22 | */
23 | public $js = ['podium-codemirror.js'];
24 |
25 | /**
26 | * @inheritdoc
27 | */
28 | public $css = ['podium-codemirror.css'];
29 | }
30 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/assets/CodeMirrorExtraAsset.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.6
12 | */
13 | class CodeMirrorExtraAsset extends AssetBundle
14 | {
15 | /**
16 | * @inheritdoc
17 | */
18 | public $sourcePath = '@bower/codemirror/addon';
19 |
20 | /**
21 | * @inheritdoc
22 | */
23 | public $js = [
24 | 'mode/overlay.js',
25 | 'edit/continuelist.js',
26 | 'fold/xml-fold.js',
27 | 'edit/matchbrackets.js',
28 | 'edit/closebrackets.js',
29 | 'edit/closetag.js',
30 | 'display/panel.js',
31 | ];
32 | }
33 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/assets/CodeMirrorLibAsset.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.6
12 | */
13 | class CodeMirrorLibAsset extends AssetBundle
14 | {
15 | /**
16 | * @inheritdoc
17 | */
18 | public $sourcePath = '@bower/codemirror/lib';
19 |
20 | /**
21 | * @inheritdoc
22 | */
23 | public $css = ['codemirror.css'];
24 |
25 | /**
26 | * @inheritdoc
27 | */
28 | public $js = ['codemirror.js'];
29 | }
30 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/assets/CodeMirrorModesAsset.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.6
12 | */
13 | class CodeMirrorModesAsset extends AssetBundle
14 | {
15 | /**
16 | * @inheritdoc
17 | */
18 | public $sourcePath = '@bower/codemirror/mode';
19 |
20 | /**
21 | * @inheritdoc
22 | */
23 | public $js = [
24 | 'xml/xml.js',
25 | 'javascript/javascript.js',
26 | 'css/css.js',
27 | 'htmlmixed/htmlmixed.js',
28 | 'clike/clike.js',
29 | 'php/php.js',
30 | 'sql/sql.js',
31 | 'meta.js',
32 | 'markdown/markdown.js',
33 | 'gfm/gfm.js',
34 | ];
35 | }
36 |
--------------------------------------------------------------------------------
/src/widgets/codemirror/podium/podium-codemirror.css:
--------------------------------------------------------------------------------
1 | .CodeMirror {
2 | border:1px solid #ccc;
3 | height:auto;
4 | padding:5px;
5 | }
6 | .CodeMirror-buttonsPanel {
7 | border-top:1px solid #ccc;
8 | border-left:1px solid #ccc;
9 | border-right:1px solid #ccc;
10 | padding:10px 12px;
11 | }
12 | .CodeMirror-buttonsPanel button {
13 | background-color:#fff;
14 | border:0;
15 | margin-right:3px;
16 | border-radius:5px;
17 | }
18 | .CodeMirror-buttonsPanel button:hover { background-color:#eee }
19 |
--------------------------------------------------------------------------------
/src/widgets/editor/EditorBasic.php:
--------------------------------------------------------------------------------
1 |
14 | * @since 0.6
15 | */
16 | class EditorBasic extends InputWidget
17 | {
18 | /**
19 | * @var InputWidget
20 | */
21 | public $editor;
22 |
23 | /**
24 | * @inheritdoc
25 | */
26 | public function init()
27 | {
28 | $config = [
29 | 'model' => $this->model,
30 | 'attribute' => $this->attribute,
31 | 'name' => $this->name,
32 | 'value' => $this->value,
33 | 'options' => $this->options
34 | ];
35 | if (Podium::getInstance()->podiumConfig->get('use_wysiwyg') == '0') {
36 | $this->editor = new CodeMirror($config);
37 | } else {
38 | if (empty($this->options)) {
39 | $config['options'] = ['style' => 'min-height:150px;'];
40 | }
41 | $this->editor = new QuillBasic($config);
42 | }
43 | }
44 |
45 | /**
46 | * @inheritdoc
47 | */
48 | public function run()
49 | {
50 | return $this->editor->run();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/widgets/editor/EditorFull.php:
--------------------------------------------------------------------------------
1 |
14 | * @since 0.6
15 | */
16 | class EditorFull extends InputWidget
17 | {
18 | /**
19 | * @var InputWidget
20 | */
21 | public $editor;
22 |
23 | /**
24 | * @inheritdoc
25 | */
26 | public function init()
27 | {
28 | $config = [
29 | 'model' => $this->model,
30 | 'attribute' => $this->attribute,
31 | 'name' => $this->name,
32 | 'value' => $this->value,
33 | 'options' => $this->options
34 | ];
35 | if (Podium::getInstance()->podiumConfig->get('use_wysiwyg') == '0') {
36 | $config['type'] = 'full';
37 | $this->editor = new CodeMirror($config);
38 | } else {
39 | if (empty($this->options)) {
40 | $config['options'] = ['style' => 'min-height:320px;'];
41 | }
42 | $this->editor = new QuillFull($config);
43 | }
44 | }
45 |
46 | /**
47 | * @inheritdoc
48 | */
49 | public function run()
50 | {
51 | return $this->editor->run();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/widgets/gridview/ActionColumn.php:
--------------------------------------------------------------------------------
1 |
13 | * @since 0.2
14 | */
15 | class ActionColumn extends YiiActionColumn
16 | {
17 | /**
18 | * @var array the HTML attributes for the header cell tag.
19 | */
20 | public $headerOptions = ['class' => 'text-right'];
21 | /**
22 | * @var array|\Closure the HTML attributes for the data cell tag. This can either be an array of
23 | * attributes or an anonymous function ([[Closure]]) that returns such an array.
24 | * The signature of the function should be the following: `function ($model, $key, $index, $column)`.
25 | * Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
26 | * and `$column` is a reference to the [[Column]] object.
27 | * A function may be used to assign different attributes to different rows based on the data in that row.
28 | */
29 | public $contentOptions = ['class' => 'text-right'];
30 | /**
31 | * @var array html options to be applied to the [[initDefaultButtons()|default buttons]].
32 | */
33 | public $buttonOptions = [
34 | 'class' => 'btn btn-default btn-xs',
35 | 'data-pjax' => '0',
36 | 'data-toggle' => 'tooltip',
37 | 'data-placement' => 'top',
38 | ];
39 |
40 | /**
41 | * @inheritdoc
42 | */
43 | public function init()
44 | {
45 | parent::init();
46 | $this->header = Yii::t('podium/view', 'Actions');
47 | $this->grid->view->registerJs("$('[data-toggle=\"tooltip\"]').tooltip();");
48 | }
49 |
50 | /**
51 | * Returns button options.
52 | * @param array $options override
53 | * @return array
54 | */
55 | public static function buttonOptions($options)
56 | {
57 | return array_merge(
58 | [
59 | 'class' => 'btn btn-default btn-xs',
60 | 'data-pjax' => '0',
61 | 'data-toggle' => 'tooltip',
62 | 'data-placement' => 'top',
63 | ],
64 | $options
65 | );
66 | }
67 |
68 | /**
69 | * Returns muted button HTML.
70 | * @param string $icon class
71 | * @return string
72 | */
73 | public static function mutedButton($icon)
74 | {
75 | return Html::a(Html::tag('span', '', ['class' => $icon]), '#', ['class' => 'btn btn-xs disabled text-muted']);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/widgets/gridview/DataColumn.php:
--------------------------------------------------------------------------------
1 |
12 | * @since 0.2
13 | */
14 | class DataColumn extends YiiDataColumn
15 | {
16 | /**
17 | * @var boolean whether the header label should be HTML-encoded.
18 | */
19 | public $encodeLabel = false;
20 |
21 | /**
22 | * @inheritdoc
23 | */
24 | protected function getHeaderCellLabel()
25 | {
26 | if (!empty($this->attribute)) {
27 | return parent::getHeaderCellLabel() . Helper::sortOrder($this->attribute);
28 | }
29 | return parent::getHeaderCellLabel();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/widgets/gridview/GridView.php:
--------------------------------------------------------------------------------
1 |
14 | * @since 0.2
15 | */
16 | class GridView extends YiiGridView
17 | {
18 | /**
19 | * @var array the HTML attributes for the container tag of the grid view.
20 | * The "tag" element specifies the tag name of the container element and defaults to "div".
21 | */
22 | public $options = ['class' => 'grid-view table-responsive'];
23 | /**
24 | * @var string the default data column class if the class name is not explicitly specified when configuring a data column.
25 | */
26 | public $dataColumnClass = 'bizley\podium\widgets\gridview\DataColumn';
27 | /**
28 | * @var array the HTML attributes for the grid table element.
29 | */
30 | public $tableOptions = ['class' => 'table table-striped table-hover'];
31 | /**
32 | * @var string additional jQuery selector for selecting filter input fields
33 | */
34 | public $filterSelector = 'select#per-page';
35 |
36 | /**
37 | * Sets formatter to use Podium component.
38 | * @since 0.5
39 | */
40 | public function init()
41 | {
42 | parent::init();
43 | $this->formatter = Podium::getInstance()->formatter;
44 | }
45 |
46 | /**
47 | * Runs the widget.
48 | */
49 | public function run()
50 | {
51 | Pjax::begin();
52 | echo PageSizer::widget();
53 | parent::run();
54 | Pjax::end();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/widgets/poll/Poll.php:
--------------------------------------------------------------------------------
1 |
16 | * @since 0.5
17 | */
18 | class Poll extends Widget
19 | {
20 | /**
21 | * @var PollModel
22 | */
23 | public $model;
24 |
25 | /**
26 | * @var bool Display only
27 | */
28 | public $display = false;
29 |
30 |
31 | /**
32 | * Rendering the poll.
33 | * @return string
34 | */
35 | public function run()
36 | {
37 | if (!$this->model) {
38 | return null;
39 | }
40 | $hidden = $this->model->hidden;
41 | if ($hidden && !empty($this->model->end_at) && $this->model->end_at < time()) {
42 | $hidden = 0;
43 | }
44 | return $this->render('view', [
45 | 'model' => $this->model,
46 | 'hidden' => $hidden,
47 | 'voted' => $this->display ? true : $this->model->getUserVoted(User::loggedId()),
48 | 'display' => $this->display
49 | ]);
50 | }
51 |
52 | /**
53 | * Renders poll create form.
54 | * @param ActiveForm $form
55 | * @param Thread $model
56 | * @return string
57 | */
58 | public static function create($form, $model)
59 | {
60 | return (new static)->render('create', ['form' => $form, 'model' => $model]);
61 | }
62 |
63 | /**
64 | * Renders poll update form.
65 | * @param ActiveForm $form
66 | * @param Poll $model
67 | * @return string
68 | */
69 | public static function update($form, $model)
70 | {
71 | return (new static)->render('update', ['form' => $form, 'model' => $model]);
72 | }
73 |
74 | /**
75 | * Returns rendered preview of the poll.
76 | * @param Thread $model
77 | * @return string
78 | */
79 | public static function preview($model)
80 | {
81 | if (!$model->pollAdded) {
82 | return null;
83 | }
84 | return (new static)->render('preview', ['model' => $model]);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/widgets/poll/views/_form.php:
--------------------------------------------------------------------------------
1 | Yii::t('podium/view', 'Leave empty to remove')];
9 | $opts['id'] = 'thread-poll_answers' . ($a > 1 ? '_' . $a : '');
10 | if (!empty($model->$pollAnswers[$a - 1])) {
11 | $opts['value'] = $model->$pollAnswers[$a - 1];
12 | $answers++;
13 | } else {
14 | $opts['value'] = null;
15 | }
16 | $options[$a] = $opts;
17 | }
18 | $answers = max([2, $answers]);
19 | $this->registerJs(<<= 10) { $(".podium-poll-plus").addClass("hide"); }});
21 | JS
22 | );
23 |
24 | $fieldLayoutLong = [
25 | 'labelOptions' => ['class' => 'control-label col-sm-3'],
26 | 'template' => "{label}\n{input}\n{hint}\n{error}
"
27 | ];
28 | $fieldLayoutShort = [
29 | 'labelOptions' => ['class' => 'control-label col-sm-3'],
30 | 'template' => "{label}\n{input}\n{hint}\n{error}
"
31 | ];
32 |
33 | ?>
34 |
35 | = $form->field($model, $pollQuestion, $fieldLayoutLong); ?>
36 |
37 |
38 | = $form->field($model, $pollVotes, $fieldLayoutShort); ?>
39 |
40 |
41 | = $form->field($model, $pollHidden, [
42 | 'checkboxTemplate' => "
\n{beginLabel}\n{input}\n{labelTitle}\n{endLabel}\n{error}\n{hint}\n
"
43 | ])->checkbox(); ?>
44 |
45 |
46 | = $form->field($model, $pollEnd, $fieldLayoutShort)->widget(DatePicker::classname(), [
47 | 'removeButton' => false, 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']
48 | ]); ?>
49 |
50 | $option): ?>
51 |
52 | = $form->field($model, $pollAnswers .'[]', $fieldLayoutLong)
53 | ->label(Yii::t('podium/view', 'Option #{n}', ['n' => $index]), ['for' => $option['id']])
54 | ->textInput($option); ?>
55 |
56 |
57 |
58 |
59 | = Yii::t('podium/view', 'One more'); ?>
60 |
61 |
--------------------------------------------------------------------------------
/src/widgets/poll/views/create.php:
--------------------------------------------------------------------------------
1 | registerJs(<< 'poll_added']);
12 | ?>
13 |
14 | = Yii::t('podium/view', 'Add poll to this thread'); ?>
15 |
16 |
17 |
18 |
19 |
20 | = Yii::t('podium/view', 'Discard poll'); ?>
21 | = Yii::t('podium/view', 'New poll'); ?>
22 |
23 |
24 | = $this->render('_form', [
25 | 'form' => $form,
26 | 'model' => $model,
27 | 'pollQuestion' => 'pollQuestion',
28 | 'pollVotes' => 'pollVotes',
29 | 'pollHidden' => 'pollHidden',
30 | 'pollEnd' => 'pollEnd',
31 | 'pollAnswers' => 'pollAnswers',
32 | ]) ?>
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/widgets/poll/views/preview.php:
--------------------------------------------------------------------------------
1 |
6 |
7 | = Yii::t('podium/view', 'Poll'); ?>: = Html::encode($model->pollQuestion) ?>
8 |
9 | = Yii::t('podium/view', 'Number of votes'); ?>: = Html::encode($model->pollVotes) ?>
10 | pollHidden): ?>
11 | = Yii::t('podium/view', 'Results hidden before voting'); ?>
12 |
13 | = Yii::t('podium/view', 'Results visible before voting'); ?>
14 |
15 |
16 |
17 | = Yii::t('podium/view', 'Poll ends at'); ?>:
18 | = empty($model->pollEnd) ? '-' : Html::encode($model->pollEnd) . ' 23:59' ?>
19 |
20 |
21 |
22 | pollAnswers as $answer): ?>
23 |
24 | = Html::encode($answer) ?>
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/widgets/poll/views/update.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | = Yii::t('podium/view', 'Edit Poll'); ?>
4 |
5 |
6 | = $this->render('_form', [
7 | 'form' => $form,
8 | 'model' => $model,
9 | 'pollQuestion' => 'question',
10 | 'pollVotes' => 'votes',
11 | 'pollHidden' => 'hidden',
12 | 'pollEnd' => 'end',
13 | 'pollAnswers' => 'editAnswers',
14 | ]) ?>
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/widgets/quill/QuillBasic.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.2
12 | */
13 | class QuillBasic extends Quill
14 | {
15 | /**
16 | * @var bool|string|array Toolbar buttons.
17 | */
18 | public $toolbarOptions = [
19 | ['bold', 'italic', 'underline', 'strike'],
20 | [['list' => 'ordered'], ['list' => 'bullet']],
21 | [['align' => []]],
22 | ['link']
23 | ];
24 | }
25 |
--------------------------------------------------------------------------------
/src/widgets/quill/QuillFull.php:
--------------------------------------------------------------------------------
1 |
11 | * @since 0.2
12 | */
13 | class QuillFull extends Quill
14 | {
15 | /**
16 | * @var bool|string|array Toolbar buttons.
17 | */
18 | public $toolbarOptions = [
19 | [['align' => []], ['size' => ['small', false, 'large', 'huge']], 'bold', 'italic', 'underline', 'strike'],
20 | [['color' => []], ['background' => []]],
21 | [['header' => [1, 2, 3, 4, 5, 6, false]], ['script' => 'sub'], ['script' => 'super']],
22 | ['blockquote', 'code-block'],
23 | [['list' => 'ordered'], ['list' => 'bullet']],
24 | ['link', 'image', 'video'],
25 | ['clean']
26 | ];
27 |
28 | /**
29 | * @var array Collection of modules to include and respective options.
30 | */
31 | public $modules = ['syntax' => true];
32 |
33 | /**
34 | * @var string Highlight.js stylesheet to fetch from https://cdnjs.cloudflare.com
35 | */
36 | public $highlightStyle = 'github-gist.min.css';
37 |
38 | /**
39 | * @var string Additional JS code to be called with the editor.
40 | * @since 0.3
41 | */
42 | public $js = "{quill}.getModule('toolbar').addHandler('image',imageHandler);function imageHandler(){var range=this.quill.getSelection();var value=prompt('URL:');this.quill.insertEmbed(range.index,'image',value,Quill.sources.USER);};";
43 | }
44 |
--------------------------------------------------------------------------------
/tests/_bootstrap.php:
--------------------------------------------------------------------------------
1 | amOnRoute('podium/install/run');
10 | }
11 |
12 | public function openInstallPage(FunctionalTester $I)
13 | {
14 | $I->seeElement('#drop');
15 | $I->seeElement('#installPodium');
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/functional/_bootstrap.php:
--------------------------------------------------------------------------------
1 |