Esempio n. 1
0
    return implode(', ', ArrayHelper::map($model->roles, 'name', 'description'));
}, 'format' => 'raw', 'visible' => User::hasPermission('viewUserRoles'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'registration_ip', 'value' => function (User $model) {
    return Html::a($model->registration_ip, "http://ipinfo.io/" . $model->registration_ip, ["target" => "_blank"]);
}, 'format' => 'raw', 'visible' => User::hasPermission('viewRegistrationIp'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['value' => function (User $model) {
    return GhostHtml::a(UsersModule::t('back', 'Roles and permissions'), ['/user/user-permission/set', 'id' => $model->id], ['class' => 'btn btn-sm btn-primary', 'data-pjax' => 0, 'data-set-roles' => $model->id]);
}, 'format' => 'raw', 'visible' => User::canRoute('/user/permission/set'), 'options' => ['width' => '10px']], ['value' => function (User $model) {
    return GhostHtml::a(UsersModule::t('back', 'Change password'), ['change-password', 'id' => $model->id], ['class' => 'btn btn-sm btn-default', 'data-pjax' => 0, 'data-change-password' => $model->id]);
}, 'format' => 'raw', 'options' => ['width' => '10px']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'status', 'optionsArray' => [[User::STATUS_ACTIVE, UsersModule::t('back', 'Active'), 'success'], [User::STATUS_INACTIVE, UsersModule::t('back', 'Inactive'), 'warning'], [User::STATUS_BANNED, UsersModule::t('back', 'Banned'), 'danger']], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['class' => 'actions'], 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => '0', 'data-view' => $key]);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'data-update' => $key]);
}]]]]);
?>

    <?php 
echo MagnificPopup::widget(['id' => '', 'type' => 'ajax', 'target' => '#user-grid-create-button, a[data-update], a[data-view]', 'options' => ['removalDelay' => 300]]);
?>

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

<?php 
$js = <<<JS
jQuery(document).on('ajaxSubmitSuccess', '#user-form', function(data) {
    alert('Изменения сохранены!');
    \$('#user-grid-create-button').magnificPopup('close');
    \$.pjax.reload({container: '#user-grid-pjax'});
    return false;
})
JS;
Esempio n. 2
0
        <span>|</span>
        <?php 
echo Html::a(Yii::t('app', 'ukr'));
?>
    </div>-->
    
    <!-- User menu section -->
    <?php 
echo Menu::widget(['encodeLabels' => false, 'options' => ['id' => 'user-menu', 'class' => 'user-menu horisontal-menu clear'], 'items' => [['url' => Url::to(['/advert/create']), 'label' => '<span class="icon sm plus"></span>' . Yii::t('app', 'New advert'), 'visible' => !$isGuest], ['url' => Url::to(['/advert/published']), 'label' => '<span class="icon sm stack"></span>' . Yii::t('app', 'Published') . '(' . $dataInformer->get(DataInformer::ADVERT_COUNT_PUBLISHED, 0) . ')', 'visible' => !$isGuest], ['url' => Url::to(['/advert/bookmarks']), 'label' => '<span class="icon sm star"></span>' . Yii::t('app', 'Bookmarks') . '(<span id="bookmarks-count">' . $dataInformer->get(DataInformer::ADVERT_COUNT_BOOKMARKED, 0) . '</span>)'], ['url' => Url::to(['/profile/update']), 'label' => '<span class="icon sm gear"></span>' . Yii::t('app', 'Profile'), 'visible' => !$isGuest], ['url' => Url::to('@backendUrl'), 'label' => '<span class="icon sm admin"></span>' . Yii::t('app', 'Admin'), 'visible' => Yii::$app->user->isAdmin], ['url' => Url::to(['/users/auth/logout']), 'label' => '<span class="icon sm power-off"></span>' . Yii::t('app', 'Logout'), 'visible' => !$isGuest], ['url' => Url::to(['/users/auth/login']), 'label' => '<span class="icon sm key"></span>' . Yii::t('app', 'Login'), 'visible' => $isLoginMenuItemVisible, 'options' => ['id' => 'auth-container', 'class' => 'auth-container']]]]);
?>
    
    <?php 
if ($isLoginMenuItemVisible) {
    ?>
        <?php 
    echo \roman444uk\magnificPopup\MagnificPopup::widget(['id' => 'mfp-login', 'type' => 'ajax', 'target' => '#auth-container a', 'options' => ['prependTo' => '#auth-container', 'removalDelay' => 300, 'showCloseBtn' => true, 'closeMarkup' => '<a title="%title%" class="icon delete mfp-close"></a>', 'tLoading' => Yii::t('app', 'Loading') . '...']]);
    ?>
    <?php 
}
?>
    
    <!-- Main menu section -->
    <?php 
echo Menu::widget(['encodeLabels' => false, 'options' => ['id' => 'main-menu', 'class' => 'main-menu horisontal-menu clear'], 'items' => [['url' => Url::home(), 'label' => '<span class="icon sm bubble"></span>' . Yii::t('app', 'Adverts') . '(' . $dataInformer->get(DataInformer::ADVERT_COUNT_STATUS_ACTIVE, 0) . ')'], ['url' => Url::to(['/page/rules']), 'label' => '<span class="icon sm list"></span>' . Yii::t('app', 'Publish rules')], ['url' => Url::to(['/page/faq']), 'label' => '<span class="icon sm faq"></span>' . Yii::t('app', 'Questions and answers')], ['url' => Url::to(['/page/contacts']), 'label' => '<span class="icon sm web"></span>' . Yii::t('app', 'Contacts')]]]);
?>
    
    <!-- Search section -->
    <?php 
if (Yii::$app->controller->route == 'advert/list') {
    ?>
        <?php 
Esempio n. 3
0
            <?php 
    echo Html::a('<span class="icon sm quit"></span>Выйти', ['/users/auth/login'], ['id' => 'button-login']);
    ?>
            
            <?php 
    echo MagnificPopup::widget(['id' => 'mfp-login', 'type' => 'ajax', 'target' => '#button-login', 'options' => ['prependTo' => '#auth-login-container', 'removalDelay' => 300, 'showCloseBtn' => true]]);
    ?>
        </div>
        
        <!--<div id="auth-register-container" class="auth-button-container">
            <?php 
    echo Html::a('Регистрироваться', ['/users/auth/registration'], ['id' => 'button-register']);
    ?>
            
            <?php 
    echo MagnificPopup::widget(['id' => 'mfp-register', 'type' => 'ajax', 'target' => '#button-register', 'options' => ['prependTo' => '#auth-register-container', 'removalDelay' => 300, 'showCloseBtn' => true]]);
    ?>
        </div>-->
    <?php 
} else {
    ?>
        <?php 
    echo Html::a('quit', ['/users/auth/logout'], ['class' => 'icon']);
    ?>
    
        <?php 
    if ($identity->hasPermission('Admin')) {
        ?>
    
            <?php 
        echo Html::a('adm', Yii::getAlias('@backendUrl'), ['class' => 'icon']);
Esempio n. 4
0
                {pager}
            </div>
            <div class="col-sm-4 text-right" style="padding-top: 20px">
                ' . GridBulkActions::widget(['gridId' => 'user-grid']) . '
            </div>
        </div>', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'id', 'header' => '№', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'content', 'format' => 'raw', 'contentOptions' => ['style' => 'text-align: left'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'status', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Advert::getTranslatedStatusList()], 'filter' => Advert::getTranslatedStatusList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
    return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n                alert('error updating');\n            }")], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'category', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Category::getDropdownList()], 'filter' => Category::getDropdownList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
    return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n                alert('error updating');\n            }")], ['attribute' => 'city_id', 'header' => 'Город', 'value' => function ($model, $key, $index) {
    return $model->cityName;
}, 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'format' => 'raw'], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'created_at', 'header' => 'Добавлено', 'format' => 'datetime', 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'updated_at', 'header' => 'Обновлено', 'format' => 'datetime', 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'published', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'is_foreign', 'header' => 'Из сервиса', 'filter' => ['Да', 'Нет'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\ViewColumn', 'view' => '@backend/views/advert/_advert_grid_column', 'options' => ['style' => 'width:70px']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width:30px; text-align:center;'], 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span><br>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => 0, 'data-view' => $key]);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span><br>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => 0, 'data-update' => $key]);
}]]]]);
?>

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

<?php 
echo MagnificPopup::widget(['id' => '', 'type' => 'ajax', 'target' => '#advert-grid-create-button, a[data-update], a[data-view]', 'options' => ['removalDelay' => 300, 'callbacks' => ['parseAjax' => new JsExpression('function(mfpResponse) {
    console.log("Ajax content loaded:", mfpResponse);
    }'), 'ajaxContentAdded' => new JsExpression('function() {
    console.log(this.content);
    }')]]]);
?>

<div class="clear"></div>