code:
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\DetailView;
use yii\bootstrap\Tabs;
use app\modules\yboard\YBoard;
use app\modules\yboard\components\DateTimeCalculation;

use kartik\editable\Editable;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMember $model
 */

$this->title = YBoard::t('yboard', 'User CP - {name}', ['name'=>Html::encode($model->profile->fullname)]);
$this->params['breadcrumbs'][] = $this->title;

$this->params['breadcrumbs']=[
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
    ['label' => YBoard::t('yboard', 'Members List'), 'url' => ['index']],
    ['label' => Html::encode($model->profile->username), 'url' => ['view', 'id'=>$model->id]],
    $this->title
];

?>

<?php
    $birthday = $this->context->module->birthdateColumn;
    $gender = $this->context->module->genderColumn;
    $regdate = $this->context->module->regdateColumn;

    $timezone = isset($model->profile->timezone)? new DateTimeZone($model->profile->timezone) : new DateTimeZone() ;
?>

<?php $basicInfo = DetailView::widget([
    'model' => $model,
    'options'=>[
        'class' => 'table table-striped detail-view'
    ],
    'attributes' => [
        [
            'label'=>YBoard::t('yboard', 'Birthday'),
            'value'=>$birthday==null?YBoard::t('yboard', 'None'):$model->profile->{$birthday},
        ],

        [
            'label'=>YBoard::t('yboard', 'Gender'),
            'value'=>($model->profile->{$gender}==1?YBoard::t('yboard', 'Male'):YBoard::t('yboard', 'Female'))                        ],
        [
            'label'=>YBoard::t('yboard', 'Joined'),
            'value'=>$regdate==null?YBoard::t('yboard', 'None'): date_format(date_timezone_set(date_timestamp_set(date_create(), $model->profile->{$regdate}), $timezone), 'l, d-M-y H:i T'),
        ],
        [
            'attribute'=>'location',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'location',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'signature',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'signature',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        'status',
    ],
]); ?>

<?php $foroStatistics =  DetailView::widget([
    'model' => $model,
    'options'=>[
        'class' => 'table table-striped detail-view'
    ],
    'attributes' => [
        [
            'label'=>YBoard::t('yboard', 'Last Visit'),
            'value'=>date_format(date_timezone_set(date_create($model->last_visit), $timezone), 'l, d-M-y H:i T'),
        ],
        'appreciations',
        'startedTopics',
        'totalReplies',
        'recentTopics:html',
    ],
]); ?>

<?php $webInfo =  DetailView::widget([
    'model' => $model,
    'options'=>[
        'class' => 'table table-striped detail-view'
    ],
    'attributes' => [
        [
            'attribute'=>'blogger',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'blogger',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'contact_email',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'contact_email',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                'data'=>[1=>'Allow', 0=>'Forbid'],
                'displayValueConfig'=>[0=>YBoard::t('yboard','Forbidden'), 1=>YBoard::t('yboard','Allowed')],
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
                'pluginEvents' => [
                    "editableSuccess"=>"function(event, val) {
                        //console.log('Successful submission of value ' + val);
                    }",
                ],
            ])
        ],
        [
            'attribute'=>'contact_pm',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'contact_pm',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                'data'=>[1=>'Allow', 0=>'Forbid'],
                'displayValueConfig'=>[0=>YBoard::t('yboard','Forbidden'), 1=>YBoard::t('yboard','Allowed')],
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
                'pluginEvents' => [
                    "editableSuccess"=>"function(event, val) {
                        //console.log('Successful submission of value ' + val);
                    }",
                ],
            ])
        ],
        [
            'attribute'=>'facebook',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'facebook',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'skype',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'skype',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'google',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'google',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'linkedin',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'linkedin',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'metacafe',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'metacafe',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'github',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'github',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'orkut',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'orkut',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'tumblr',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'tumblr',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'twitter',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'twitter',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'website',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'website',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'wordpress',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'wordpress',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'yahoo',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'yahoo',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
        [
            'attribute'=>'youtube',
            'format'=>'raw',

            'value'=>Editable::widget([
                'model'=>$model,
                'attribute' => 'youtube',
                'type'=>'primary',
                'format' => Editable::FORMAT_BUTTON,
                'inputType' => Editable::INPUT_TEXT,
                'editableValueOptions'=>['class'=>'text-success pad15-right'],
                'formOptions'=>[
                    'action'=>url::to(['member/usercp', 'id'=>$model->id])
                ],
            ])
        ],
    ],
]); ?>

               <?= Html::img(isset($model->profile->image)? $model->profile->image:$this->context->module->getRegisteredImage("empty.jpeg"),['id'=>'user-avatar'])  ?>

<?= ucfirst($model->profile->{$this->context->module->userNameColumn}) ?>

                <?= Html::a(YBoard::t('yboard','Edit Basic Profile'), [$this->context->module->profile['edit'], 'id'=>$model->id], ['class'=>'btn btn-primary btn-md']) ?>

            <?= Tabs::widget([
                'items' => [
                    [
                        'label' => YBoard::t('yboard', 'Basic Information'),
                        'content' => $basicInfo,
                        'active' => true
                    ],
                    [
                        'label' => YBoard::t('yboard', 'Forum Statistics'),
                        'content' => $foroStatistics,
                    ],
                    [
                        'label' => YBoard::t('yboard', 'Web Information'),
                        'content' => $webInfo,
                    ],
                ],
            ]) ?>


code:
<?php

use yii\helpers\Html;
use app\modules\yboard\YBoard;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMember $model
 */

$this->title = YBoard::t('yboard', 'Update {modelClass}: ', [
  'modelClass' => 'YBoard Member',
]) . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => YBoard::t('yboard', 'YBoard Members'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = YBoard::t('yboard', 'Update');
?>

<?= Html::encode($this->title) ?>

    <?= $this->render('_form', [
        'model' => $model,
    ]) ?>

license: mit


code:
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\DetailView;
use yii\bootstrap\Tabs;
use app\modules\yboard\YBoard;
use app\modules\yboard\components\DateTimeCalculation;

use kartik\editable\Editable;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMember $model
 */

$this->title = YBoard::t('yboard', 'User CP - {name}', ['name'=>Html::encode($model->profile->fullname)]);
$this->params['breadcrumbs'][] = $this->title;

$this->params['breadcrumbs']=[
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
    ['label' => YBoard::t('yboard', 'Members List'), 'url' => ['index']],
    $this->title
];

?>

<?php
    $birthday = $this->context->module->birthdateColumn;
    $gender = $this->context->module->genderColumn;
    $regdate = $this->context->module->regdateColumn;

    $timezone = isset($model->profile->timezone)? new DateTimeZone($model->profile->timezone) : new DateTimeZone() ;
?>

<?php $basicInfo = DetailView::widget([
    'model' => $model,
    'options'=>[
        'class' => 'table table-striped detail-view'
    ],
    'attributes' => [
        [
            'label'=>YBoard::t('yboard', 'Birthday'),
            'value'=>$birthday==null?YBoard::t('yboard', 'None'):$model->profile->{$birthday},
        ],

        [
            'label'=>YBoard::t('yboard', 'Gender'),
            'value'=>($model->profile->{$gender}==1?YBoard::t('yboard', 'Male'):YBoard::t('yboard', 'Female'))                        ],
        [
            'label'=>YBoard::t('yboard', 'Joined'),
            'value'=>$regdate==null?YBoard::t('yboard', 'None'): date_format(date_timezone_set(date_timestamp_set(date_create(), $model->profile->{$regdate}), $timezone), 'l, d-M-y H:i T'),
        ],
        'location',
        'signature',
        'status',
    ],
]); ?>

<?php $foroStatistics =  DetailView::widget([
    'model' => $model,
    'options'=>[
        'class' => 'table table-striped detail-view'
    ],
    'attributes' => [
        [
            'label'=>YBoard::t('yboard', 'Last Visit'),
            'value'=>date_format(date_timezone_set(date_create($model->last_visit), $timezone), 'l, d-M-y H:i T'),
        ],
        'appreciations',
        'startedTopics',
        'totalReplies',
        'recentTopics:html',
    ],
]); ?>

<?php $webInfo =  DetailView::widget([
    'model' => $model,
    'options'=>[
        'class' => 'table table-striped detail-view'
    ],
    'attributes' => [
        [
            'attribute'=>'blogger',
            'visible'=>trim($model->blogger)!="",
        ],
        [
            'attribute'=>'contact_email',
            'value'=>$model->contact_email==0 ? YBoard::t('yboard','Forbidden') : YBoard::t('yboard','Allowed'),
        ],
        [
            'attribute'=>'contact_pm',
            'value'=>$model->contact_pm==0 ? YBoard::t('yboard','Forbidden') : YBoard::t('yboard','Allowed'),
        ],
        [
            'attribute'=>'facebook',
            'visible'=>trim($model->facebook)!="",
        ],
        [
            'attribute'=>'skype',
            'visible'=>trim($model->skype)!="",
        ],
        [
            'attribute'=>'google',
            'visible'=>trim($model->google)!="",
        ],
        [
            'attribute'=>'linkedin',
            'visible'=>trim($model->linkedin)!="",
        ],
        [
            'attribute'=>'metacafe',
            'visible'=>trim($model->metacafe)!="",
        ],
        [
            'attribute'=>'github',
            'visible'=>trim($model->github)!="",
        ],
        [
            'attribute'=>'orkut',
            'visible'=>trim($model->github)!="",
        ],
        [
            'attribute'=>'orkut',
            'visible'=>trim($model->orkut)!="",
        ],
        [
            'attribute'=>'tumblr',
            'visible'=>trim($model->tumblr)!="",
        ],
        [
            'attribute'=>'twitter',
            'visible'=>trim($model->twitter)!="",
        ],
        [
            'attribute'=>'website',
            'visible'=>trim($model->website)!="",
        ],
        [
            'attribute'=>'wordpress',
            'visible'=>trim($model->wordpress)!="",
        ],
        [
            'attribute'=>'yahoo',
            'visible'=>trim($model->yahoo)!="",
        ],
        [
            'attribute'=>'youtube',
            'visible'=>trim($model->youtube)!="",
        ],
    ],
]); ?>

               <?= Html::img(isset($model->profile->image)? $model->profile->image:$this->context->module->getRegisteredImage("empty.jpeg"),['id'=>'user-avatar'])  ?>

<?= ucfirst($model->profile->{$this->context->module->userNameColumn}) ?>

                <?= Html::a(YBoard::t('yboard','View Basic Profile'), [$this->context->module->profile['view'], 'id'=>$model->id], ['class'=>'btn btn-default btn-md']) ?>

            <?= Tabs::widget([
                'items' => [
                    [
                        'label' => YBoard::t('yboard', 'Basic Information'),
                        'content' => $basicInfo,
                        'active' => true
                    ],
                    [
                        'label' => YBoard::t('yboard', 'Forum Statistics'),
                        'content' => $foroStatistics,
                    ],
                    [
                        'label' => YBoard::t('yboard', 'Web Information'),
                        'content' => $webInfo,
                    ],
                ],
            ]) ?>


code:
<?php
use app\modules\yboard\models\YBoardMember;
use app\modules\yboard\models\YBoardSession;
use app\modules\yboard\models\YBoardTopic;
use app\modules\yboard\models\YBoardPost;
use yii\helpers\Html;

/* @var $this ForumController */
$guests =  YBoardSession::find()->where('user_id IS NULL')->count();
$members =  YBoardSession::find()->where('user_id IS NOT NULL')->count();

?>

				<?php echo YBoard::t('yboard','{{guests}} guest(s) and {{members}} active member(s)', ['{guests}'=>($guests), '{members}'=>$members]);?>
				<?php echo YBoard::t('yboard','(in the past 15 minutes)');?>

				<?php $members = YBoardMember::find()->presentScope()->all();
					foreach($members as $member) {
                        echo Html::a($member->profile->username, ['member/view', 'id'=>$member->id], ['style'=>'color:#'.($member->group==null?'':$member->group->color)]) . ' ';
					}
					$spiders = \app\modules\yboard\models\YBoardSpider::find()->all();//present()->findAll();
					foreach($spiders as $spider) {
						echo Html::a($spider->name, $spider->url, array('class'=>'spider','target'=>'_new')) . ' ';
					}
				?>
				<?php echo YBoard::t('yboard','({hidden} anonymous member(s))', array('hidden'=>YBoardMember::find()->hiddenScope()->presentScope()->count())); ?>

				<?php echo YBoard::t('yboard','Board Statistics'); ?>

<?php echo YBoard::t('yboard','Total topics'); ?>

<?php echo  YBoardTopic::find()->count(); ?>

<?php echo YBoard::t('yboard','Total posts'); ?>

<?php echo YBoardPost::find()->count(); ?>

<?php echo YBoard::t('yboard','Total members'); ?>

<?php echo  YBoardMember::find()->count(); ?>

<?php echo YBoard::t('yboard','Newest member'); ?>

 <?php $member = YBoardMember::find()->newestScope()->one();
                echo $member===null?' '.YBoard::t('yboard','No new member yet'):Html::a($member->profile->username, ['member/view', 'id'=>$member->id]); ?>

<?php echo YBoard::t('yboard','Visitors today'); ?>

<?php echo YBoardSession::find()->count(); ?>

<?= $this->render('_changeForum') ?>


code:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMessage $model
 * @var yii\widgets\ActiveForm $form
 */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'sendfrom')->textInput(['maxlength' => 10]) ?>

    <?= $form->field($model, 'sendto')->textInput(['maxlength' => 10]) ?>

    <?= $form->field($model, 'subject')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'content')->textarea(['rows' => 6]) ?>

    <?= $form->field($model, 'create_time')->textInput() ?>

    <?= $form->field($model, 'ip')->textInput(['maxlength' => 39]) ?>

    <?= $form->field($model, 'read_indicator')->textInput() ?>

    <?= $form->field($model, 'type')->textInput() ?>

    <?= $form->field($model, 'inbox')->textInput() ?>

    <?= $form->field($model, 'outbox')->textInput() ?>

    <?= $form->field($model, 'post_id')->textInput(['maxlength' => 10]) ?>

        <?= Html::submitButton($model->isNewRecord ? YBoard::t('yboard', 'Create') : YBoard::t('yboard', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


code:
<?php
/* @var $this MessageController */
/* @var $model YBoardMessage */
/* @var $form CActiveForm */
?>

<?php echo Yii::t('YBoardModule.yboard','Your web browser does not support JavaScript, or you have temporarily disabled scripting. This site needs JavaScript to function correct.'); ?>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'message-form',
	'enableAjaxValidation'=>false,
)); ?>

	<?php echo $form->errorSummary($model); ?>

	<?php if($this->action->id == 'create'): ?>
		<?php echo $form->labelEx($model,'sendto'); ?>
		<?php $this->widget('zii.widgets.jui.CJuiAutoComplete',array(
				'attribute'=>'search',
				'model'=>$model,
				'sourceUrl'=>array('member/members'),
				'theme'=>$this->module->juiTheme,
				'options'=>array(
					'minLength'=>2,
					'delay'=>200,
					'select'=>'js:function(event, ui) {
						$("#YBoardMessage_search").val(ui.item.label);
						$("#YBoardMessage_sendto").val(ui.item.value);
						return false;
					}',
				),
				'htmlOptions'=>array(
					'style'=>'height:20px;',
				),
			));
		?>
	<?php else: ?>
		<?php echo $form->label($model,'sendto'); ?>
		<?php echo CHtml::encode($model->search); ?>
	<?php endif; ?>
		<?php echo $form->hiddenField($model,'sendto'); ?>
		<?php echo $form->error($model,'sendto'); ?>

		<?php echo $form->labelEx($model,'subject'); ?>
		<?php echo $form->textField($model,'subject',array('size'=>100,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'subject'); ?>

		<?php $this->widget($this->module->id.'.extensions.editMe.widgets.ExtEditMe', array(
			'model'=>$model,
			'attribute'=>'content',
			'autoLanguage'=>false,
			'height'=>'300px',
			'toolbar'=>array(
				array(
					'Bold', 'Italic', 'Underline', 'RemoveFormat'
				),
				array(
						'TextColor', 'BGColor',
				),
				'-',
				array('Link', 'Unlink', 'Image'),
				'-',
				array('Blockquote'),
			),
			'skin'=>$this->module->editorSkin,
			'uiColor'=>$this->module->editorUIColor,
			'contentsCss'=>$this->module->editorContentsCss,
		)); ?>
		<?php echo $form->error($model,'content'); ?>

		<?php echo $form->hiddenField($model,'type'); ?>
		<?php echo CHtml::submitButton(Yii::t('YBoardModule.yboard', 'Send')); ?>

<?php $this->endWidget(); ?>


code:
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\jui\Dialog;
use yii\web\JsExpression;
use yii\jui\AutoComplete;

use app\modules\yboard\models\YBoardMessage;
use app\components\ckeditor\CKEditor;
use kartik\widgets\Select2;
use yii\helpers\ArrayHelper;

use hosanna\profile\models\User;
use app\modules\yboard\YBoard;

$model= new YBoardMessage(['sendfrom'=>Yii::$app->user->identity->id]);

$data = User::find()
->select(['username'])
->where('id<>'.Yii::$app->user->id)
->asArray()
->all();
//format them for Input Widget
$data = ArrayHelper::getColumn($data, 'username');

Dialog::begin([
    'id'=>'dlgPrivateMsg',
    'clientOptions' => [
        'modal' => true,
        'title'=>YBoard::t('yboard', 'Send Private Message'),
        'autoOpen'=>false,
        'height'=>'400',
        'width'=>'400',
        'buttons'=>[
            [
                'text'=>YBoard::t('yboard', 'Send'),
                'class'=>'btn btn-sm btn-success',
                'click'=>new \yii\web\JsExpression('function(){
                    for(instance in CKEDITOR.instances)
                    {
                        CKEDITOR.instances[instance].updateElement();
                    }
                    sendPMForm();
                }')
            ],
            [
                'text'=>YBoard::t('yboard', 'Cancel'),
                'class'=>'btn btn-sm btn-danger',
                'click'=>new \yii\web\JsExpression(' function() { $( this ).dialog( "close" ); }')
            ]
        ],
    ],
]);
?>

    <div class="yboard-message-form">

    <?php $form = ActiveForm::begin([
        'id'=>'pm-form',
    ]); ?>

    <?= $form->field($model, 'usernames')->widget(Select2::classname(), [
        'name' => 'usernames',
        'options' => [
            'placeholder' => 'Select User',
            'id' => 'YBoardMessage_pm_usernames',
        ],
        'pluginOptions' => [
            'tags' => $data,
            'maximumInputLength' => 10
        ],
    ]) ?>

    <?= $form->field($model, 'subject')->textInput(['maxlength' => 255]) ?>

    <?= CKEditor::widget([
        'model' => $model,
        'attribute'=>'content',
        'id'=>'pmEditor',
    ]) ?>

    <?= Html::hiddenInput('url', \Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id.'/message/create'), ['id'=>'pm-url']) ?>

    <?= Html::activeHiddenInput($model, 'sendfrom') ?>
    <?= Html::activeHiddenInput($model, 'sendto', ['id'=>'YBoardMessage_send_to']) ?>
    <?php ActiveForm::end(); ?>

</div>

<?php Dialog::end(); ?>


code:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMessageSearch $model
 * @var yii\widgets\ActiveForm $form
 */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'id') ?>

    <?= $form->field($model, 'sendfrom') ?>

    <?= $form->field($model, 'sendto') ?>

    <?= $form->field($model, 'subject') ?>

    <?= $form->field($model, 'content') ?>

    <?php // echo $form->field($model, 'create_time') ?>

    <?php // echo $form->field($model, 'read_indicator') ?>

    <?php // echo $form->field($model, 'type') ?>

    <?php // echo $form->field($model, 'inbox') ?>

    <?php // echo $form->field($model, 'outbox') ?>

    <?php // echo $form->field($model, 'ip') ?>

    <?php // echo $form->field($model, 'post_id') ?>

        <?= Html::submitButton(YBoard::t('yboard', 'Search'), ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton(YBoard::t('yboard', 'Reset'), ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


code:
<?php
/* @var $this MessageController */
/* @var $model YBoardMessage */

use yii\helpers\Html;
use app\modules\yboard\components\DateTimeCalculation;
use Yii;
?>

    <?= Html::activeLabel($model, 'sendfrom') ?>:
    <?= $model->sender->profile->username ?>
    (<?= DateTimeCalculation::short($model->create_time) ?>)

    <?= Html::activeLabel($model, 'subject') ?>:
    <?= Html::encode($model->subject) ?>

    <?= $model->content ?>


code:
<?php
/* @var $this MessageController */
/* @var $model YBoardMessage */
/* @var $count Array */

$this->yboard_breadcrumbs=array(
	Yii::t('YBoardModule.yboard', 'Forum')=>array('forum/index'),
	($this->action->id == 'create')?Yii::t('YBoardModule.yboard', 'New message'):Yii::t('YBoardModule.yboard', 'Reply'),
);

$item = array(
	array('label'=>Yii::t('YBoardModule.yboard', 'Inbox') .' ('. $count['inbox'] .')', 'url'=>array('message/inbox')),
	array('label'=>Yii::t('YBoardModule.yboard', 'Outbox') .' ('. $count['outbox'] .')', 'url'=>array('message/outbox')),
	array('label'=>Yii::t('YBoardModule.yboard', 'New message'), 'url'=>array('message/create'))
);
?>

	<?php echo $this->renderPartial('_header', array('item'=>$item)); ?>

<?php echo ($this->action->id == 'create')?Yii::t('YBoardModule.yboard', 'New message'):Yii::t('YBoardModule.yboard', 'Reply'); ?>

	<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>


code:
<?php
/* @var $this MessageController */
/* @var $model YBoardMessage */
/* @var $count Array */

use yii\helpers\Html;
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
use yii\web\JsExpression;
use app\modules\yboard\YBoard;
use app\modules\yboard\components\DateTimeCalculation;

$this->params['breadcrumbs']=[
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
	['label'=>YBoard::t('yboard', 'Outbox') .' ('. $count['outbox'] .')', 'url'=>['message/outbox', 'id'=>Yii::$app->user->id]],
    YBoard::t('yboard', 'Inbox'),
];

$this->title = YBoard::t('yboard', 'Messages - Inbox');

?>

	<?= $this->render('_pmDialog') ?>

<div class="progressbar" style="width:<?php echo ($count['inbox'] < 100)?$count['inbox']:100; ?>%">

<?= 	Html::button(YBoard::t('yboard', 'New message'), ['class'=>'btn btn-default btn-md', 'style'=>'cursor:pointer;', 'onclick'=>'sendPm('.Yii::$app->user->id.'); return false;']) ?>

    <?php \yii\widgets\Pjax::begin(); ?>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => null,
		'id'=>'inbox-grid-box',
        'rowOptions' => function ($model, $index, $widget, $grid){
            return ['class'=>$model->read_indicator?'':'unread', 'id'=>'msg_id_'.$model->id];
        },
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            [
				'attribute'=>'sendfrom',
				'value'=>function ($model, $key, $index, $column)
                {
                    return $model->sender->profile->username;
                }
            ],
            'subject',
            [
				'attribute'=>'create_time',
				'value'=>function ($model, $key, $index, $column)
                {
                    return DateTimeCalculation::short($model->create_time);
                }
            ],
            [
                'class' => 'yii\grid\ActionColumn',
				'template'=>'{view}{reply}{delete}',
                'buttons'=>[
                    'view'=>function ($url, $model) {
                        // return the button HTML code
                        $src = $this->context->module->getRegisteredImage('view.png');
                        return Html::a(Html::img($src, ['alt'=>'view']), '#' , [
                            'style'=>'margin-left:5px;',
                            'onclick'=>new JsExpression('
                                viewMessage("'.$model->id.'", "' . Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id.'/message/view', ['id'=>$model->id]) .'");
                                return false;
                                '
                            ),
                        ]);
                    },
                    'reply'=>function ($url, $model) {
                        // return the button HTML code
                        $src = $this->context->module->getRegisteredImage('reply.png');
                        return Html::a(Html::img($src, ['alt'=>'reply']), '#', [
                            'style'=>'margin-left:5px;',
                            'onclick'=>new JsExpression('
                                replyMessage('.$model->sendfrom.')
                                return false;
                                '
                            ),

                        ]).' ';
                    },
                    'delete'=>function ($url, $model) {
                        // return the button HTML code
                        $src = $this->context->module->getRegisteredImage('delete.png');
                        return Html::a(Html::img($src, ['alt'=>'view']), '#', [
                            'onclick'=>new \yii\web\JsExpression('
                                what = confirm("'.Yii::t('yii', 'Are you sure you want to delete this item?').'");
                                if(what)
                                {
                                    //delete with ajax
                                    $.ajax({
                                        type: "POST",
                                        url: "'.$url.'",
                                    }).done(function(data) {
                                        data = JSON.parse(data);
                                        if(data["success"])
                                            $.pjax.reload({container:"#inbox-grid-box"});
                                    });
                                }
                            '),
                        ]);
                    }
                ]
            ],
        ],
    ]); ?>
    <?php \yii\widgets\Pjax::end(); ?>


code:
<?php

use yii\helpers\Html;
use yii\widgets\ListView;

/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var app\modules\yboard\models\YBoardMessageSearch $searchModel
 */

$this->title = YBoard::t('yboard', 'YBoard Messages');
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

    <?php echo $this->render('_search', ['model' => $searchModel]); ?>

        <?= Html::a(YBoard::t('yboard', 'Create {modelClass}', [
  'modelClass' => 'YBoard Message',
]), ['create'], ['class' => 'btn btn-success']) ?>

    <?= ListView::widget([
        'dataProvider' => $dataProvider,
        'itemOptions' => ['class' => 'item'],
        'itemView' => function ($model, $key, $index, $widget) {
            return Html::a(Html::encode($model->id), ['view', 'id' => $model->id]);
        },
    ]) ?>


code:
<?php
/* @var $this MessageController */
/* @var $model YBoardMessage */
/* @var $count Array */

use yii\helpers\Html;
use app\modules\yboard\YBoard;
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
use yii\web\JsExpression;
use app\modules\yboard\components\DateTimeCalculation;

$this->params['breadcrumbs']=[
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
	['label'=>YBoard::t('yboard', 'Inbox') .' ('. $count['inbox'] .')', 'url'=>['message/inbox', 'id'=>Yii::$app->user->id]],
    YBoard::t('yboard', 'Outbox'),
];

$this->title = YBoard::t('yboard', 'Messages- Outbox');

?>

	<?= $this->render('_pmDialog') ?>

<div class="progressbar" style="width:<?php echo (2*$count['outbox']); ?>%">

<?php \yii\widgets\Pjax::begin(); ?>
<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => null,
		'id'=>'outbox-grid-box',
        'rowOptions' => function ($model, $index, $widget, $grid){
            return ['class'=>$model->read_indicator?'':'unread'];
        },
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            [
				'attribute'=>'sendto',
				'value'=>function ($model, $key, $index, $column)
                {
                    return $model->receiver==null ? YBoard::t('yboard', 'Management') : $model->receiver->profile->username;
                }
            ],
            'subject',
            [
				'attribute'=>'create_time',
				'value'=>function ($model, $key, $index, $column)
                {
                    return DateTimeCalculation::long($model->create_time);
                }
            ],
            [
				'attribute'=>'type',
				'value'=>function ($model, $key, $index, $column)
                {
                    return ($model->type)?Yii::t("app", "notification"):Yii::t("app", "message");
                }
            ],

            [
                'class' => 'yii\grid\ActionColumn',
				'template'=>'{view}{delete}',
                'buttons'=>[
                    'view'=>function ($url, $model) {
                        // return the button HTML code
                        $src = $this->context->module->getRegisteredImage('view.png');
                        return Html::a(Html::img($src, ['alt'=>'view']),$model->id , [
                            'style'=>'margin-left:5px;',
                            'onclick'=>new JsExpression('
                                viewMessage($(this).attr("href"), "' . Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id.'/message/view') .'");
                                return false;
                                '
                            ),
                        ]);
                    },
                    'delete'=>function ($url, $model) {
                        // return the button HTML code
                        $src = $this->context->module->getRegisteredImage('delete.png');
                        return Html::a(Html::img($src, ['alt'=>'view']), '#', [
                            'style'=>'margin-left:5px;',
                            'onclick'=>new \yii\web\JsExpression('
                                what = confirm("'.Yii::t('yii', 'Are you sure you want to delete this item?').'");
                                if(what)
                                {
                                    //delete with ajax
                                    $.ajax({
                                        type: "POST",
                                        url: "'.$url.'",
                                    }).done(function(data) {
                                        data = JSON.parse(data);
                                        if(data["success"])
                                            $.pjax.reload({container:"#outbox-grid-box"});
                                    });
                                }
                            '),
                        ]);
                    }
                ]
            ],
        ],
    ]); ?>
<?php \yii\widgets\Pjax::end(); ?>


code:
<?php

use yii\helpers\Html;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMessage $model
 */

$this->title = YBoard::t('yboard', 'Update {modelClass}: ', [
  'modelClass' => 'YBoard Message',
]) . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => YBoard::t('yboard', 'YBoard Messages'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = YBoard::t('yboard', 'Update');
?>

<?= Html::encode($this->title) ?>

    <?= $this->render('_form', [
        'model' => $model,
    ]) ?>


code:
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMessage $model
 */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => YBoard::t('yboard', 'YBoard Messages'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

        <?= Html::a(YBoard::t('yboard', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a(YBoard::t('yboard', 'Delete'), ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => YBoard::t('yboard', 'Are you sure you want to delete this item?'),
                'method' => 'post',
            ],
        ]) ?>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'sendfrom',
            'sendto',
            'subject',
            'content:ntext',
            'create_time',
            'read_indicator',
            'type',
            'inbox',
            'outbox',
            'ip',
            'post_id',
        ],
    ]) ?>


code:
<?php
/* @var $this ForumController */
/* @var $post YBoardPost */
/* @var $form ActiveForm */

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\components\ckeditor\CKEditor;
use app\modules\yboard\YBoard;
?>

<?= YBoard::t('yboard','Your web browser does not support JavaScript, or you have temporarily disabled scripting. This site needs JavaScript to function correct.') ?>

    <?php $form = ActiveForm::begin([
		'id'=>'create-topic-form',
		'enableAjaxValidation'=>false,
    ]) ?>

		<?= $form->errorSummary($post) ?>

        <?= isset($hide_title)?Html::activeHiddenInput($post,'subject') :$form->field($post,'subject')->textInput() ?>

		<?= CKEditor::widget([
            'model' => $post,
            'attribute'=>'content',
            'id'=>'ckeditor',
            'config'=>[
                /*'toolbar'=>[
                    'name'=>'basicstyles',
                    'items'=>[ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'  ],
                ],*/
            ],
        ]) ?>

        <?= Html::activeHiddenInput($post, 'forum_id') ?>
        <?= Html::activeHiddenInput($post, 'topic_id') ?>
        <?= Html::activeHiddenInput($post, 'id') ?>

    <?php ActiveForm::end(); ?>


code:
<?php
/* @var $this ForumController */
/* @var $model YBoardSetting */

use yii\jui\Dialog;
use yii\helpers\Html;
use yii\widgets\ListView;
use yii\web\JsExpression;
use app\modules\yboard\models\YBoardTopic;
use app\modules\yboard\models\YBoardSetting;
use app\modules\yboard\YBoard;

$this->title = YBoard::t('yboard', 'Approve Posts and Topics');

$this->params['breadcrumbs'][] = ['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']];
$this->params['breadcrumbs'][] = ['label'=>YBoard::t('yboard', 'Mod CP'), 'url'=>['moderator/index']];
$this->params['breadcrumbs'][] = $this->title;

?>

<?= YBoard::t('yboard', 'Pending Topics') ?>

                <?= ListView::widget([
                    'dataProvider' => $topicsProvider,
                    'layout' => '{items}{pager}',
                    'itemView' => function ($model, $key, $index, $widget){
                        return '
id.'">

'.$model->title.'
 '
                                .'
'
                                    .Html::button(YBoard::t('yboard', 'approve'), ['onclick'=>'YBoard.topicApprove("id_topic_'.$model->id.'", "'.Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id.'/moderator/approve-topic', 'id'=>$model->id]) .'")', 'class'=>'btn btn-success btn-sm'])
                                    .' '
                                    .Html::button(YBoard::t('yboard', 'edit'), ['class'=>'btn btn-info btn-sm', 'onclick'=>'YBoard.updateTopic(' . $model->id . ', "' . \Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id.'/moderator/topic') . '")'])

                                .'
'
                            .'

';
                    },
                    'itemOptions' => [
                    ],
                ]) ?>

<?= YBoard::t('yboard', 'Pending Posts') ?>

                <?= ListView::widget([
                    'dataProvider' => $postsProvider,
                    'layout' => '{items}{pager}',
                    'itemView' => function ($model, $key, $index, $widget){
                        return '
id.'">

'.$model->subject.'
 '
                                .'
'
                                    .Html::button(YBoard::t('yboard', 'view'), ['class'=>'btn btn-default btn-sm', 'onclick'=>'YBoard.viewPost('.json_encode(htmlspecialchars($model->content)).')'])
                                    .' '
                                    .Html::button(YBoard::t('yboard', 'approve'), ['onclick'=>'YBoard.postApprove("id_post_'.$model->id.'", "'.Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id.'/moderator/approve-post', 'id'=>$model->id]) .'")', 'class'=>'btn btn-success btn-sm'])
                                    .' '
                                    .Html::button(YBoard::t('yboard', 'edit'), ['class'=>'btn btn-info btn-sm', 'onclick'=>'YBoard.postUpdateDialog("'.Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id.'/moderator/get-post', 'id'=>$model->id]) .'")'])
                                    .' '
                                    .Html::button(YBoard::t('yboard', 'delete'), ['class'=>'btn btn-danger btn-sm', 'onclick'=>'if(confirm("' . YBoard::t('yboard','Do you really want to delete this post?') . '")) { deletePost("' . Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id.'/moderator/delete', 'id'=>$model->id]) . '"); return false; }'])
                                .'
'
                            .'

';
                    },
                    'itemOptions' => [
                    ],
                ]) ?>

<?php
Dialog::begin([
    'id'=>'dlgapproveMsg',
    'clientOptions' => [
        'modal' => true,
        'title'=>YBoard::t('yboard', 'Text Preview'),
        'autoOpen'=>false,
        'modal'=>true,
        'height'=>400,
        'width'=>450,
        'buttons'=> [
            [
                'text'=>YBoard::t('yboard', 'close'),
                'class'=>'btn btn-sm btn-danger',
                'click'=>new \yii\web\JsExpression(' function() { $( this ).dialog( "close" ); }')
            ]
        ],
    ],
]); ?>

<?php Dialog::end(); ?>

<?php
Dialog::begin([
    'id'=>'dlgTopicForm',
    'clientOptions' => [
        'modal' => true,
        'title'=>YBoard::t('yboard', 'Update topic'),
        'autoOpen'=>false,
        'modal'=>true,
        'height'=>400,
        'width'=>300,
        'buttons'=> [
            [
                'text'=>YBoard::t('yboard', 'Change'),
                'class'=>'btn btn-sm btn-success',
                'click'=>new JsExpression(' function() { YBoard.changeTopic("' . \Yii::$app->urlmanager->createAbsoluteUrl($this->context->module->id.'/moderator/change-topic') . '"); }')
            ],
            [
                'text'=>YBoard::t('yboard', 'Cancel'),
                'class'=>'btn btn-sm btn-danger',
                'click'=>new JsExpression(' function() { $( this ).dialog( "close" ); }')
            ]
        ],
    ],
]);

    echo $this->render('../forum/_topicForm', ['model'=>new YBoardTopic]);

Dialog::end();

//Update Post contents
Dialog::begin([
    'id'=>'dlgUpdatePostForm',
    'clientOptions' => [
        'modal' => true,
        'title'=>YBoard::t('yboard', 'Update topic'),
        'autoOpen'=>false,
        'modal'=>true,
        'height'=>400,
        'width'=>300,
        'buttons'=> [
            [
                'text'=>YBoard::t('yboard', 'Change'),
                'class'=>'btn btn-sm btn-success',
                'click'=>new JsExpression(' function() { YBoard.updateModPost("' . \Yii::$app->urlmanager->createAbsoluteUrl($this->context->module->id.'/moderator/change-post') . '"); }')
            ],
            [
                'text'=>YBoard::t('yboard', 'Cancel'),
                'class'=>'btn btn-sm btn-danger',
                'click'=>new JsExpression(' function() { $( this ).dialog( "close" ); }')
            ]
        ],
    ],
]);

    echo '

';

Dialog::end();


code:
<?php

use yii\jui\Dialog;
use yii\helpers\Url;
use yii\helpers\Html;
use yii\grid\GridView;
use app\modules\yboard\YBoard;
use app\modules\yboard\components\DateTimeCalculation;
use kartik\editable\Editable;

/* @var $this yii\web\View */
/* @var $searchModel app\modules\yboard\models\YBoardBanSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = YBoard::t('yboard', 'Manage Bans');

$this->params['breadcrumbs'][] = ['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']];
$this->params['breadcrumbs'][] = ['label'=>YBoard::t('yboard', 'Mod CP'), 'url'=>['moderator/index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'attribute' => 'user_id',
                'value' => function($model, $index, $dataColumn) {
                    return $model->member->profile->username;
                },
            ],
            [
                'attribute' => 'banned_by',
                'value' => function($model, $index, $dataColumn) {
                    return $model->banner->profile->username;
                },
            ],
            [
                'attribute'=>'expires',
                'format' => 'raw',
                'value'=>function($model, $index, $dataColumn){
                    return Editable::widget([
                        'value' => DateTimeCalculation::short($model->expires),
                        'name' => 'expires',
                        'options' => ['name' => 'expires'],  // unique input name
                        'format' => Editable::FORMAT_BUTTON,
                        'inputType' => Editable::INPUT_DATETIME,
                        'formOptions'=>[
                            'action'=>url::to(['moderator/change-ban-period', 'id'=>$model->id])
                        ],
                    ]);
                }
            ],

            'ip',
            'email:email',
            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{lift} {reason}',
                'buttons'=>[
                    'lift' => function ($url, $model, $key) {
                        return Html::a('', '#', [
                            'title'=>YBoard::t('yboard', 'Lift Ban'),
                                'onclick'=>'if(confirm("' . YBoard::t('yboard','Do you really Lift this Ban') . '")) { banLift("' . Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id.'/moderator/ban-lift', 'id'=>$model->id]) . '"); }return false; ',
                        ]);
                    },
                    'reason' => function ($url, $model, $key) {
                        return Html::a('', '#', [
                            'title'=>YBoard::t('yboard', 'Ban Reason'),
                            'onclick'=>'banMessage(\''.$model->message.'\')'
                        ]);
                    }
                ]
            ],
        ],
    ]); ?>

<?php
Dialog::begin([
    'id'=>'dlgBanMsg',
    'clientOptions' => [
        'modal' => true,
        'title'=>YBoard::t('yboard', 'Ban Reason'),
        'autoOpen'=>false,
        'modal'=>true,
        'height'=>'auto',
        'min-height'=>100,
        'width'=>200,
        'buttons'=> [
            [
                'text'=>YBoard::t('yboard', 'close'),
                'class'=>'btn btn-sm btn-danger',
                'click'=>new \yii\web\JsExpression(' function() { $( this ).dialog( "close" ); }')
            ]
        ],
    ],
]); ?>

<?php Dialog::end(); ?>


code:
<?php
/* @var $this ForumController */
/* @var $model YBoardSetting */

use yii\helpers\Html;
use yii\grid\GridView;
use yii\web\JsExpression;
use app\modules\yboard\models\YBoardSetting;
use app\modules\yboard\YBoard;

$this->params['breadcrumbs'] = [
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
	YBoard::t('yboard', 'Settings'),
];

$this->title = YBoard::t('yboard', 'Moderator CP');

$item = [
	['label'=>YBoard::t('yboard', 'Manage Forum'), 'url'=>['setting/forum']],
	['label'=>YBoard::t('yboard', 'Member groups'), 'url'=>['setting/group']],
	['label'=>YBoard::t('yboard', 'Moderators'), 'url'=>['setting/moderator']],
	['label'=>YBoard::t('yboard', 'Webspiders'), 'url'=>['setting/spider']],
];

$this->params['adminMenu'] ['title'] = YBoard::t('yboard', 'Moderator');

$this->params['adminMenu'] = [
	['label'=>YBoard::t('yboard', 'Manage Bans'), 'url'=>['moderator/bans']],
	['label'=>YBoard::t('yboard', 'Pending Posts '), 'url'=>['moderator/approve']],
	['label'=>YBoard::t('yboard', 'Reported Posts'), 'url'=>['moderator/reported']],
];
?>

<?= YBoard::t('yboard', 'Pending for Moderation') ?>

<?= YBoard::t('yboard', '{number} Pending Topics', ['number'=>$pendingTopics>0?$pendingTopics:YBoard::t('yboard', 'No')]) ?>

<?= YBoard::t('yboard', '{number} Pending Posts', ['number'=>$pendingPosts>0?$pendingPosts:YBoard::t('yboard', 'No')]) ?>

<?= YBoard::t('yboard', 'Bans Ending Soon') ?>

                    <?= YBoard::t('yboard', '{number} Banned Members', ['number'=>$bannedUsers>0?$bannedUsers:YBoard::t('yboard', 'No')]) ?>

                    <?= YBoard::t('yboard', '{number} Banned Emails', ['number'=>$bannedEmails>0?$bannedEmails:YBoard::t('yboard', 'No')]) ?>

                    <?= YBoard::t('yboard', '{number} Banned IPs', ['number'=>$bannedIps>0?$bannedIps:YBoard::t('yboard', 'No')]) ?>


code:
<?php
/* @var $this MessageController */
/* @var $model YBoardMessage */
/* @var $count Array */

use yii\helpers\Html;
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
use yii\web\JsExpression;
use app\modules\yboard\YBoard;
use app\modules\yboard\components\DateTimeCalculation;

$this->title = YBoard::t('yboard', 'Reported Posts');

$this->params['breadcrumbs']=[
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
	['label'=>YBoard::t('yboard', 'Mod CP'), 'url'=>['moderator/index']],
    $this->title,
];

?>

    <?php \yii\widgets\Pjax::begin(); ?>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => null,
		'id'=>'inbox-grid-box',
        'rowOptions' => function ($model, $index, $widget, $grid){
            return ['class'=>$model->read_indicator?'':'unread', 'id'=>'msg_id_'.$model->id];
        },
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            [
				'attribute'=>'sendfrom',
				'value'=>function ($model, $key, $index, $column)
                {
                    return $model->sender->profile->username;
                }
            ],
            'subject',
            [
				'attribute'=>'create_time',
				'value'=>function ($model, $key, $index, $column)
                {
                    return DateTimeCalculation::short($model->create_time);
                }
            ],
            [
                'class' => 'yii\grid\ActionColumn',
				'template'=>'{view} {delete}',
                'buttons'=>[
                    'view'=>function ($url, $model) {
                        // return the button HTML code
                        $src = $this->context->module->getRegisteredImage('view.png');
                        return Html::a(Html::img($src, ['alt'=>'view']), '#' , [
                            'style'=>'margin-left:5px;',
                            'onclick'=>new JsExpression('
                                viewMessage("'.$model->id.'", "' . Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id.'/message/view', ['id'=>$model->id]) .'");
                                return false;
                                '
                            ),
                        ]);
                    },
                    'delete'=>function ($url, $model) {
                        $url = Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id.'/message/delete', 'id'=>$model->id]);
                        // return the button HTML code
                        $src = $this->context->module->getRegisteredImage('delete.png');
                        return Html::a(Html::img($src, ['alt'=>'view']), '#', [
                            'onclick'=>new \yii\web\JsExpression('
                                what = confirm("'.Yii::t('yii', 'Are you sure you want to delete this item?').'");
                                if(what)
                                {
                                    //delete with ajax
                                    $.ajax({
                                        type: "POST",
                                        url: "'.$url.'",
                                    }).done(function(data) {
                                        data = JSON.parse(data);
                                        if(data["success"])
                                            $.pjax.reload({container:"#inbox-grid-box"});
                                    });
                                }
                            '),
                        ]);
                    }
                ]
            ],
        ],
    ]); ?>
    <?php \yii\widgets\Pjax::end(); ?>


code:
<?php
/* @var $this SettingController */
/* @var $data YBoardForum (category) */
/* @var $forum[] YBoardForum */

use yii\helpers\Html;
use yii\web\JsExpression;
use app\modules\yboard\YBoard;

$forumitems = array();
foreach($forum as $forumdata) {
	$forumitems['frm_'.$forumdata->id] = $this->render('_forum', array('forumdata'=>$forumdata), true);
}
?>

            <?php echo Html::encode($data->name); ?>

<?php echo Html::encode($data->subtitle); ?>

            <?php echo Html::button(YBoard::t('yboard','Edit Category'), ['class'=>'btn btn-warning btn-xs','onclick'=>'editCategory(' . $data->id . ',"' . YBoard::t('yboard','Edit category') . '", "' . \Yii::$app->urlmanager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/get-forum') .'")']); ?>

            <?php
                echo \yii\jui\Sortable::widget([
                    'id' => 'sortfrm' . $data->id,
                    'items' => $forumitems,
                    'options'=>['style'=>'list-style:none; margin-top:1px', 'class'=>'forum-item'],
                    'clientOptions'=>[
                        'delay'=>'100',
                        'update'=>new JsExpression('function(){Sort(this,"' . \Yii::$app->urlmanager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/ajax-sort') . '");}'),
                    ],
                ]);
            ?>


code:
<?php
/* @var $this SettingController */
/* @var $model YBoardForum */
/* @var $form CActiveForm */

use \app\modules\yboard\models\YBoardForum;
use \app\modules\yboard\models\YBoardMembergroup;
use app\modules\yboard\YBoard;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;

?>

<?php $form = \yii\widgets\ActiveForm::begin([
	'id'=>'edit-forum-form',
	'enableAjaxValidation'=>true,
	/*'clientOptions'=>array(
		'validateOnSubmit'=>true,
		'validateOnChange'=>false,
	) */
]); ?>

<?php echo YBoard::t('yboard', 'Fields with * are required.'); ?>

	<?php echo $form->errorSummary($model); ?>

    <?php echo $form->field($model,'name')->textInput(['id'=>'YBoardForum_name']); ?>

    <?php echo $form->field($model,'subtitle')->textArea(['id'=>'YBoardForum_subtitle']); ?>

    <?php echo $form->field($model,'sort')->textInput(['id'=>'YBoardForum_sort']); ?>

        <?php echo $form->field($model,'cat_id')->dropDownList(ArrayHelper::map(YBoardForum::find()->categoriesScope()->all(), 'id', 'name'),['prompt'=>YBoard::t('yboard', '-- Select Category --'), 'id'=>'YBoardForum_category']); ?>

        <?php echo $form->field($model,'public')->dropDownList(['0'=>YBoard::t('yboard', 'No'),'1'=>YBoard::t('yboard', 'Yes')], ['id'=>'YBoardForum_public']); ?>

        <?php echo $form->field($model,'locked')->dropDownList(['0'=>YBoard::t('yboard', 'No'),'1'=>YBoard::t('yboard', 'Yes')], ['id'=>'YBoardForum_locked']); ?>

        <?php echo $form->field($model,'moderated')->dropDownList(['0'=>YBoard::t('yboard', 'No'),'1'=>YBoard::t('yboard', 'Yes')], ['id'=>'YBoardForum_moderated']); ?>

    <?php echo $form->field($model,'membergroup_id')->dropDownList(array_merge([0=>'All Members'], ArrayHelper::map(YBoardMembergroup::find()->specificScope()->all(), 'id', 'name')), ['id'=>'YBoardForum_membergroup']); ?>

        <?php echo $form->field($model,'poll')->dropDownList(['0'=>YBoard::t('yboard', 'No polls'),'1'=>YBoard::t('yboard', 'Moderator polls'),'2'=>YBoard::t('yboard', 'User polls')], ['id'=>'YBoardForum_polls']); ?>

        <?php echo $form->field($model,'type')->dropDownList(['0'=>YBoard::t('yboard', 'Category'),'1'=>YBoard::t('yboard', 'Forum')], ['id'=>'YBoardForum_type']); ?>

    <?php echo Html::activeHiddenInput($model,'id', ['id'=>'YBoardForum_id']); ?>

<?php \yii\widgets\ActiveForm::end(); ?>


code:
<?php
/* @var $this SettingController */
/* @var $model YBoardMembergroup */
/* @var $form ActiveForm */

use  app\components\picker\ColorPicker;
use yii\web\JsExpression;
use yii\web\View;
use yii\helpers\Html;
use kartik\widgets\Select2;
use app\modules\yboard\YBoard;

$authMgr = Yii::$app->authManager;
$roles = $authMgr->getRoles();
//format roles title to be capitalized one
$data = [];
foreach($roles as $role)
{
    $data[$role->name] = ucfirst($role->name);
}

 $form = \yii\widgets\ActiveForm::begin([
    'id'=>'edit-membergroup-form',
    'enableAjaxValidation'=>true,
]); ?>

<?php echo YBoard::t('yboard', 'Fields with * are required.'); ?>

<?php echo $form->errorSummary($model); ?>

<?php echo $form->field($model,'name')->textInput(['id'=>'YBoardMembergroup_name']); ?>

<?php echo $form->field($model,'group_role')->dropDownList($data, ['id'=>'YBoardMembergroup_group_role']); ?>

<?php echo $form->field($model,'description')->textInput(['id'=>'YBoardMembergroup_description']); ?>

<?= ColorPicker::widget([
    'model'=>$model,
    'id'=>'YBoardMembergroup_color',
    'attribute'=>'color',
    'options'=>[
        'showInput'=>true,
        'showPalette'=>true,
        'color'=>'#ffffff',
        'preferredFormat'=>'hex',
    ]
]) ?>

<?php //echo $form->field($model,'image')->textInput(['id'=>'YBoardMembergroup_image']);
$url = \Yii::$app->controller->module->getRegisteredImage('/groups/');
$format = <<< SCRIPT
function format(image) {
    if (!image.id) return image.text; // optgroup
    src = '$url' + image.text.toLowerCase();
    return '' ;
}
SCRIPT;

    $escape = new JsExpression("function(m) { return m; }");
    $this->registerJs($format, View::POS_HEAD);

    echo $form->field($model,'image')->widget(Select2::classname(),[
        'data' =>  $this->context->module->getGroupImages(),
        'id'=>'YBoardMembergroup_image',
        'pluginOptions' => [
            'formatResult' => new JsExpression('format'),
            'formatSelection' => new JsExpression('format'),
            'escapeMarkup' => $escape,
            //'allowClear' => true
        ],
    ]);
?>

    <?php
        echo Html::activeHiddenInput($model,'id', ['id'=>'YBoardMembergroup_id']);
    ?>

<?php \yii\widgets\ActiveForm::end(); ?>


code:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\yboard\models\YBoardRank */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="yboard-rank-form">

    <?php $form = ActiveForm::begin([
        'id'=>'edit-rank-form',
    ]); ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => 255, 'id'=>'YBoardRank_title']) ?>

    <?= $form->field($model, 'min_posts')->textInput(['id'=>'YBoardRank_min_posts']) ?>

    <?= $form->field($model, 'stars')->textInput(['id'=>'YBoardRank_stars']) ?>

    <?= Html::activeHiddenInput($model,'id', ['id'=>'YBoardRank_id']) ?>

    <?php ActiveForm::end(); ?>

</div>


code:
<?php
/* @var $this SettingController */
/* @var $model YBoardSpider */
/* @var $form ActiveForm */

use yii\widgets\ActiveForm;
use yii\helpers\Html;
use app\modules\yboard\YBoard;
?>

<?php $form=ActiveForm::begin([
	'id'=>'edit-spider-form',
	'enableAjaxValidation'=>true,
]); ?>

<?php echo YBoard::t('yboard', 'Fields with * are required.'); ?>

	<?php echo $form->errorSummary($model); ?>
    <?php echo $form->field($model,'name')->textInput(['id'=>'YBoardSpider_name']); ?>
    <?php echo $form->field($model,'user_agent')->textInput(['id'=>'YBoardSpider_user_agent']); ?>
    <?php echo Html::activeHiddenInput($model,'id', ['id'=>'YBoardSpider_id']); ?>

<?php ActiveForm::end(); ?>


code:
<?php
/* @var $this SettingCondivoller */
/* @var $forumdata YBoardForum (forum) */

use yii\helpers\Html;
use app\modules\yboard\YBoard;
?>

			<?php echo Html::encode($forumdata->name); ?>
			<?php echo Html::button(YBoard::t('yboard','Edit Forum'), ['class'=>'btn btn-primary btn-xs','onclick'=>'editForum(' . $forumdata->id . ',"' . YBoard::t('yboard','Edit forum') . '", "' . \Yii::$app->urlmanager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/get-forum') .'")']); ?>

                <?php echo Html::encode($forumdata->subtitle); ?>

			<?php if(!$forumdata->public) echo Html::img( \Yii::$app->controller->module->getRegisteredImage('private.png'), ['alt'=>'private',  'style'=>'vertical-align:middle;', 'title'=>'Private']); ?>
			<?php if($forumdata->locked) echo Html::img( \Yii::$app->controller->module->getRegisteredImage('locked.png',  ['alt'=>'locked', 'style'=>'vertical-align:middle;', 'title'=>'Locked'])); ?>
			<?php if($forumdata->moderated) echo Html::img( \Yii::$app->controller->module->getRegisteredImage('moderated.png',  ['alt'=>'moderated', 'style'=>'vertical-align:middle;', 'title'=>'Moderated'])); ?>


code:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\modules\yboard\YBoard;

/**
 * @var yii\web\View $this
 * @var app\modules\yboard\models\YBoardMemberSearch $model
 * @var yii\widgets\ActiveForm $form
 */
?>

            <?php $form = ActiveForm::begin([
                'action' => ['users'],
                'method' => 'get',
            ]); ?>

                <?= $form->field($model, 'username')->label("")->hint(YBoard::t('yboard', 'search username')) ?>

            <?php ActiveForm::end(); ?>


code:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\yboard\models\YBoardSetting */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="yboard-setting-form-box">

    <?php $form = ActiveForm::begin([
        'id'=>'yboard-setting-form',
    ]); ?>

    <?= $form->field($model, 'key')->textInput(['maxlength' => 50, 'id'=>'yboard-setting-key']) ?>

    <?= $form->field($model, 'value')->textInput(['maxlength' => 100, 'id'=>'yboard-setting-value']) ?>

    <?php ActiveForm::end(); ?>

</div>


code:
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use app\modules\yboard\YBoard;
use yii\bootstrap\ButtonDropdown;
?>

                <?= Html::img(isset($model->profile->image)? $model->profile->image:$this->context->module->getRegisteredImage("empty.jpeg"),['id'=>'user-avatar'])  ?>

                <?= ButtonDropdown::widget([
                    'label' => YBoard::t('yboard', 'Options'),
                    'dropdown' => [
                        'items' => [
                            ['label' => 'View Profile', 'url' => ['member/view', 'id'=>$model->id]],

                            [
                                'label' => YBoard::t('yboard','Ban user'),
                                'url' => '',
                                'options'=>[
                                    //'class'=>'btn btn-danger btn-sm',
                                ],
                                'linkOptions'=>[
                                'title'=>YBoard::t('yboard', 'Ban this user'),
                                    'onclick'=>'if(confirm("' . YBoard::t('yboard','Do you really want to Ban this User?') . '")) { banUser('.Yii::$app->user->id.', "' . Yii::$app->urlManager->createAbsoluteUrl(['/'.$this->context->module->id.'/moderator/ban-user', 'id'=>$model->id]) . '");  }return false;',
                                ],
                            ],

                            ['label' => YBoard::t('yboard','Edit Profile'), 'url' => ['edit-profile', 'id'=>$model->id]],

                            [
                                'label' => YBoard::t('yboard','Delete user'),
                                'url' => '',
                                'options'=>[
                                    //'class'=>'btn btn-danger btn-sm',
                                ],
                                'linkOptions'=>[
                                'title'=>YBoard::t('yboard', 'Ban this user'),
                                    'onclick'=>'if(confirm("' . YBoard::t('yboard','Delete this User (cannot be undone)?') . '")) { deleteMember("'. Yii::$app->urlManager->createAbsoluteUrl(['/'.$this->context->module->id.'/setting/delete-user', 'id'=>$model->id]) . '");  }return false;',
                                ],
                            ],
                        ],
                    ],
                ]) ?>

                <?= Html::a(ucwords($model->profile->{$this->context->module->userNameColumn}), ['member/view', 'id'=>$model->id]) ?>

                <?php
                    $gender = $this->context->module->genderColumn;
                    $regdate = $this->context->module->regdateColumn;

                    $timezone = isset($model->profile->timezone)? new DateTimeZone($model->profile->timezone) : new DateTimeZone() ;
                ?>

                <?= DetailView::widget([
                    'model' => $model,
                    'options'=>[
                        'class' => 'table table-striped detail-view'
                    ],
                    'attributes' => [
                        [
                            'label'=>YBoard::t('yboard', 'Last Visit'),
                            'value'=>date_format(date_timezone_set(date_create($model->last_visit), $timezone), 'l, d-M-y H:i T'),
                        ],
                        [
                            'label'=>YBoard::t('yboard', 'Gender'),
                            'value'=>($model->profile->{$gender}==1?YBoard::t('yboard', 'Male'):YBoard::t('yboard', 'Female'))                        ],
                        [
                            'label'=>YBoard::t('yboard', 'Joined'),
                            'value'=>$regdate==null?YBoard::t('yboard', 'None'): date_format(date_timezone_set(date_timestamp_set(date_create(), $model->profile->{$regdate}), $timezone), 'l, d-M-y H:i T'),
                        ],
                        [
                            'label'=>YBoard::t('yboard', 'Group'),
                            'value'=> isset($model->group)? Html::encode($model->group->name) : Yiit('app', 'Member')
,
                        ],
                        'status',
                    ],
                ]) ?>


code:
<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\modules\yboard\models\YBoardBanSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = YBoard::t('yboard', 'Yboard Bans');
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

        <?= Html::a(YBoard::t('yboard', 'Create {modelClass}', [
    'modelClass' => 'Yboard Ban',
]), ['create'], ['class' => 'btn btn-success']) ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'user_id',
            'ip',
            'email:email',
            'message',
            // 'expires',
            // 'banned_by',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>


code:
<?php
/* @var $this SettingController */
/* @var $model YBoardForum */
/* @var $category[] YBoardForum  */

use app\modules\yboard\YBoard;
use \app\modules\yboard\models\YBoardForum;
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\jui\Sortable;
use yii\web\JsExpression;

$this->title = YBoard::t('yboard', 'Forum Settings');

$this->params['adminMenu'] = [
	['label'=>YBoard::t('yboard', 'Settings'), 'url'=>['setting/index']],
	['label'=>YBoard::t('yboard', 'Member groups'), 'url'=>['setting/group']],
	['label'=>YBoard::t('yboard', 'Moderators'), 'url'=>['setting/moderator']],
	['label'=>YBoard::t('yboard', 'Webspiders'), 'url'=>['setting/spider']],
];

$this->registerJs(\yii\web\View::POS_BEGIN, "
var confirmation = new Array();
confirmation[0] = '" . YBoard::t('yboard', 'Are you sure that you want to delete this category?') . "';
confirmation[1] = '" . YBoard::t('yboard', 'Are you sure that you want to delete this forum?') . "';
", 'confirmationjs');

$this->params['breadcrumbs'] = [
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
	['label'=>YBoard::t('yboard', 'settings'), 'url'=>['index']],
	YBoard::t('yboard', 'Manage Forums'),
];

?>

<?php echo YBoard::t('yboard', 'Add category or forum'); ?>

        <?php $form = \yii\widgets\ActiveForm::begin([
            'id'=>'yboard-forum-form',
            'enableAjaxValidation'=>false,
        ]); ?>

<?php echo YBoard::t('yboard', 'Fields with * are required.'); ?>

            <?php echo $form->errorSummary($model); ?>

                <?php echo $form->field($model,'name'); ?>

                <?php echo $form->field($model,'subtitle')->textArea(); ?>

                <?php echo $form->field($model,'type')->dropDownList(['0'=>YBoard::t('yboard', 'Category'),'1'=>YBoard::t('yboard', 'Forum')], ['id'=>'type']); ?>

                <?php echo $form->field($model,'cat_id')->dropDownList(ArrayHelper::map(YBoardForum::find()->categoriesScope()->all(), 'id', 'name'),['prompt'=>'']); ?>

                    <?php echo Html::submitButton(YBoard::t('yboard', 'Add'), ['class'=>'btn btn-primary btn-md'] ); ?>

        <?php \yii\widgets\ActiveForm::end(); ?>

            <?php
                $items = [];
                foreach($category as $data) {
                    $forum = YBoardForum::find()
                    ->sortedScope()
                    ->forumScope()
                    ->andWhere(['cat_id' => $data->id])
                    ->all();
                    if($data!==null)
                        $items['cat_'.$data->id] = $this->render('_category', ['data'=>$data, 'forum'=>$forum], true);
                }
                echo Sortable::widget([
                    'id' => 'sortcategory',
                    'items' => $items,
                    'options'=>['style'=>'list-style:none; margin-top:1px'],
                    'clientOptions'=>[
                        'delay'=>'100',
                        'update'=>new JsExpression('function(){Sort(this,"' . \Yii::$app->urlManager->createAbsoluteUrl('setting/ajax-sort') . '");}'),
                    ],
                ]);
            ?>

<?php
 \yii\jui\Dialog::begin([
    'id'=>'dlgEditForum',
    'clientOptions'=>[
        'title'=>'Edit',
        'autoOpen'=>false,
		'modal'=>true,
		'width'=>400,
		'height'=>400,
		'show'=>'fade',
		'buttons'=>[
			YBoard::t('yboard', 'Delete')=>new JsExpression('function(){ deleteForum("' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/delete-forum') .'"); }'),
			YBoard::t('yboard', 'Save')=>new JsExpression('function(){ saveForum("' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/save-forum') .'"); }'),
			YBoard::t('yboard', 'Cancel')=>new JsExpression('function(){ $(this).dialog("close"); }'),
		],
    ],
]);

    echo $this->render('_editForum', ['model'=>$model]);

\yii\jui\Dialog::end();;
?>


code:
<?php
use Yii;
use yii\helpers\Html;
use yii\web\JsExpression;
use app\modules\yboard\YBoard;

/* @var $this SettingController */
/* @var $model YBoardMembergroup */

$this->title = YBoard::t('yboard', 'Member Groups');

$this->params['breadcrumbs'] = [
    ['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
	['label'=>YBoard::t('yboard', 'settings'), 'url'=>['index']],
	YBoard::t('yboard', 'Member groups')
];

$this->params['adminMenu'] = [
	['label'=>YBoard::t('yboard', 'Settings'), 'url'=>['setting/index']],
	['label'=>YBoard::t('yboard', 'Manage forums'), 'url'=>['setting/forum']],
	['label'=>YBoard::t('yboard', 'Ranks'), 'url'=>['setting/rank']],
	['label'=>YBoard::t('yboard', 'Moderators'), 'url'=>['setting/moderator']],
	['label'=>YBoard::t('yboard', 'Webspiders'), 'url'=>['setting/spider']],
];

$this->registerJs("
var confirmation = '" . YBoard::t('yboard', 'Are you sure that you want to delete this member group?') . "'
", \yii\web\View::POS_BEGIN, 'confirmation');
?>

        <?php echo Html::button(YBoard::t('yboard', 'New Group').' ', ['onclick'=>'editMembergroup()', 'class'=>'btn btn-primary btn-sm']); ?>

	<?= \yii\grid\GridView::widget([
		'id'=>'membergroup-grid',
		'layout'=>'{items} {summary} {pager}',
		'dataProvider'=>$model->search(),
 		'columns'=>[
             ['class' => 'yii\grid\SerialColumn'],
 			//'id',
			'name',
			'description',
			[
				'attribute' => 'color',
				'format' => 'html',
				'value' => function ($data){
                    return Html::tag('p', $data->color);
                },
                'contentOptions' =>function ($model, $key, $index, $column){
                     return ['style'=>"font-weight:bold;color:".$model->color.";"];
                }
			],
			[
				'attribute' => 'image',
				'format' => 'html',
				'value' => function ($data){
                    return Html::img($this->context->module->getRegisteredImage('groups/'.$data->image), ['alt'=>$data->image]);
                },
                'contentOptions' =>function ($model, $key, $index, $column){
                     return ['style'=>"color:".$model->color.";"];
                }
			],
			'group_role',
			[
				'class' => 'yii\grid\ActionColumn',
				'template'=>'{update}',
				'buttons' => [
					'update' => function($url, $model) {
                        return Html::a('', '#', [
                            'title' => Yii::t('yii', 'Update'),
                            'data-pjax' => '0',
                            'onclick'=>'editMembergroup('.$model->id.', "' . Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id.'/setting/get-membergroup') .'"); return false;',
                        ]);

                    },
				]
			],
		],
	])  ?>

<?php
\yii\jui\Dialog::begin([
    'id'=>'dlgEditMembergroup',
    'clientOptions'=>[
        'title'=>'Member Group',
        'autoOpen'=>false,
		'modal'=>true,
		'width'=>400,
		'show'=>'fade',
		'buttons'=>[
			YBoard::t('yboard', 'Delete')=>new JsExpression('function(){ deleteMembergroup("' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/delete-membergroup') .'"); }'),
			YBoard::t('yboard', 'Save')=>new JsExpression('function(){ saveMembergroup("' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/save-membergroup') .'"); }'),
			YBoard::t('yboard', 'Cancel')=>new JsExpression('function(){ $(this).dialog("close"); }'),
		],
    ],
]);

    echo $this->render('_editMembergroup',['model'=>$model]);

\yii\jui\Dialog::end();;
?>


code:
<?php
/* @var $this ForumController */
/* @var $model YBoardSetting */

use yii\helpers\Html;
use yii\grid\GridView;
use yii\web\JsExpression;
use app\modules\yboard\YBoard;
use app\modules\yboard\models\YBoardSetting;

$this->params['breadcrumbs'] = [
	['label'=>YBoard::t('yboard', 'Forums'), 'url'=>['forum/index']],
	YBoard::t('yboard', 'Settings'),
];

$this->title = YBoard::t('yboard', 'Settings');

$this->params['adminMenu']  = [
	['label'=>YBoard::t('yboard', 'Manage Forum'), 'url'=>['setting/forum']],
	['label'=>YBoard::t('yboard', 'Member groups'), 'url'=>['setting/group']],
	['label'=>YBoard::t('yboard', 'Manage Member'), 'url'=>['setting/users']],
	['label'=>YBoard::t('yboard', 'Permissions'), 'url'=>['/admin']],
	['label'=>YBoard::t('yboard', 'Webspiders'), 'url'=>['setting/spider']],
];
?>

            <?= Html::button(YBoard::t('yboard', 'New').' ', ['class'=>'btn btn-primary btn-sm', 'onclick'=>'newSetting("'.Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/create').'");']) ?>

        <?= GridView::widget([
            'dataProvider' => $dataProvider,
            'layout'=>"\n{items}\n{pager}",
            'columns' => [
                ['class' => 'yii\grid\SerialColumn'],

                //'id',
                'key',
                'value',
                [
                    'class' => 'yii\grid\ActionColumn',
                    'template'=>'{update} {delete}',
                    'buttons'=>[
                        'update' => function ($url, $model, $key) {
                            return Html::a('', $url, [
                                'title' => Yii::t('yii', 'Update'),
                                'data-pjax' => '0',
                                'onclick'=>new JsExpression('updateSetting("'.$url.'","'.$model->key.'","'.$model->value.'"); return false;')
                            ]);
                        },

                    ]
                ],
            ],
        ]); ?>

<?php
 \yii\jui\Dialog::begin([
    'id'=>'dlgNewSetting',
    'clientOptions'=>[
        'title'=>YBoard::t('yboard', 'New Setting'),
        'autoOpen'=>false,
		'modal'=>true,
		'width'=>300,
		'height'=>300,
		'show'=>'fade',
		'buttons'=>[
			YBoard::t('yboard', 'Save')=>new JsExpression('function(){ saveSetting("' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id.'/setting/create') .'"); }'),
			YBoard::t('yboard', 'Cancel')=>new JsExpression('function(){ $(this).dialog("close"); }'),
		],
    ],
]);

    echo $this->render('_settings', ['model'=>new YBoardSetting]);

\yii\jui\Dialog::end();;
?>


code:
<?php
/* @var $this ForumController */
/* @var $model YBoardSetting */

$this->yboard_breadcrumbs=array(
	Yii::t('YBoardModule.yboard', 'Forum')=>array('forum/index'),
	Yii::t('YBoardModule.yboard', 'Settings')=>array('setting/index'),
	Yii::t('YBoardModule.yboard', 'Moderators')
);

$item = array(
	array('label'=>Yii::t('YBoardModule.yboard', 'Settings'), 'url'=>array('setting/index')),
	array('label'=>Yii::t('YBoardModule.yboard', 'Forum layout'), 'url'=>array('setting/forum')),
	array('label'=>Yii::t('YBoardModule.yboard', 'Member groups'), 'url'=>array('setting/group')),
	array('label'=>Yii::t('YBoardModule.yboard', 'Moderators'), 'url'=>array('setting/moderator')),
	array('label'=>Yii::t('YBoardModule.yboard', 'Webspiders'), 'url'=>array('setting/spider')),
);
?>
<div id="yboard-wrapper">
	<?php echo $this->renderPartial('_header', array('item'=>$item)); ?>

	<?php $this->widget('zii.widgets.grid.CGridView', array(
		'id'=>'yboard-member-grid',
		'dataProvider'=>$model->search(),
		'filter'=>$model,
		'rowCssClassExpression'=>'(Yii::app()->authManager && Yii::app()->authManager->checkAccess("moderator", $data->id))?"moderator":(($row % 2)?"even":"odd")',
		'columns'=>array(
			'member_name',
			array(
				'name'=>'group_id',
				'value'=>'$data->group->name',
				'filter'=>CHtml::listData(YBoardMembergroup::model()->findAll(), 'id', 'name'),
			),
			array(
				'name'=>'moderator',
				'value'=>'CHtml::checkBox("moderator", $data->moderator, array("onclick"=>"changeModeration(this,$data->id,\'' . $this->createAbsoluteUrl('setting/changeModerator') . '\')"))',
				'type'=>'raw',
				'filter'=>array('0'=>Yii::t('YBoardModule.yboard', 'No'), '1'=>Yii::t('YBoardModule.yboard', 'Yes')),
				'htmlOptions'=>array("style"=>"text-align:center"),
			),

		),
	)); ?>
</div>