Exemplo n.º 1
0
<?php

use kartik\grid\GridView;
use backend\modules\config\Config;
/* @var $this yii\web\View */
/* @var $searchModel common\models\ConfigSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Config::t('configuration', 'Configuration');
$this->params['breadcrumbs'][] = $this->title;
$gridId = 'config-grid';
?>
<div class="<?php 
echo $gridId;
?>
">
    <div class="box box-default table-responsive">
        <div class="box-body">

            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'id' => $gridId, 'filterModel' => $searchModel, 'export' => false, 'columns' => [['attribute' => 'label', 'contentOptions' => ['style' => 'min-width: 320px;']], ['attribute' => 'value', 'filter' => false, 'enableSorting' => false, 'format' => 'html', 'class' => 'kartik\\grid\\EditableColumn', 'editableOptions' => function ($model, $key, $index) {
    $arrayData = unserialize($model->data);
    $options = ['inputType' => constant('kartik\\editable\\Editable::' . $model->type), 'type' => 'post', 'format' => 'button', 'size' => 'md', 'placement' => 'left', 'formOptions' => ['action' => yii\helpers\Url::toRoute('edit'), 'id' => 'config-form']];
    if (is_array($arrayData)) {
        $options['displayValueConfig'] = $arrayData;
        $options['data'] = $arrayData;
    }
    return $options;
}], ['attribute' => 'default', 'filter' => false, 'format' => 'html', 'enableSorting' => false, 'value' => function ($model) {
    $array = unserialize($model->data);
    return !empty($array[$model->default]) ? $array[$model->default] : $model->default;
}]]]);
use backend\modules\timetable\Module as Timetable;
use backend\modules\employment\Employment;
use backend\modules\pay\Pay;
use backend\modules\ticket\Ticket;
use backend\modules\statistics\Statistics;
if (!isset(Yii::$app->i18n->translations['rbac-admin'])) {
    Yii::$app->i18n->translations['rbac-admin'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en', 'basePath' => '@mdm/admin/messages'];
}
$controllerPath = '';
$moduleId = '';
if (Yii::$app->controller->module->id) {
    $controllerPath = '/' . Yii::$app->controller->module->id;
    $moduleId = Yii::$app->controller->module->id;
}
$controllerPath .= '/' . Yii::$app->controller->id;
?>
<aside class="main-sidebar">

    <section class="sidebar">
        <?php 
echo Nav::widget(['id' => 'adminlte-sidebar-menu', 'encodeLabels' => false, 'options' => ['class' => 'sidebar-menu'], 'activateItems' => true, 'activateParents' => true, 'items' => [['label' => Config::t('configuration', 'Configuration'), 'url' => ['/config/default/index'], 'visible' => Yii::$app->user->can('/config/*'), 'icon' => Config::getIcon()], ['label' => User::t('user-admin', 'Users'), 'url' => ['/user/default/index'], 'visible' => Yii::$app->user->can('/user/*'), 'icon' => User::getIcon()], ['label' => Group::t('group-admin', 'Groups'), 'url' => ['/group/default/index'], 'visible' => Yii::$app->user->can('/group/*'), 'icon' => Group::getIcon()], ['label' => Timetable::t('timetable-admin', 'Timetable'), 'url' => ['/timetable/default/index'], 'visible' => Yii::$app->user->can('/timetable/*'), 'icon' => Timetable::getIcon()], ['label' => Ticket::t('ticket', 'Tickets'), 'url' => ['/ticket/default/index'], 'visible' => Yii::$app->user->can('/ticket/*'), 'icon' => Ticket::getIcon()], ['label' => Pay::t('pay-admin', 'Pays'), 'url' => ['/pay/default/index'], 'visible' => Yii::$app->user->can('/pay/*'), 'icon' => Pay::getIcon()], ['label' => Employment::t('employment', 'Paid employments'), 'url' => ['/employment/default/index'], 'visible' => Yii::$app->user->can('/employment/*'), 'icon' => Employment::getIcon()], ['label' => News::t('eugenekei-news', 'News'), 'url' => ['/news/admin/index'], 'visible' => Yii::$app->user->can('/news/admin/*'), 'icon' => News::getIcon(), 'active' => $moduleId === 'news'], ['label' => Statistics::t('statistics', 'Statistics'), 'url' => ['/statistics/default/index'], 'visible' => Yii::$app->user->can('/statistics/*'), 'icon' => Statistics::getIcon()], ['label' => Yii::t('rbac-admin', 'Assignments'), 'url' => ['/rbac'], 'icon' => 'fa-legal', 'visible' => Yii::$app->user->can('/rbac/*'), 'active' => $moduleId === 'rbac', 'items' => [['label' => Yii::t('rbac-admin', 'Assignments'), 'url' => ['/rbac/assignment/index'], 'active' => $controllerPath === '/rbac/assignment'], ['label' => Yii::t('rbac-admin', 'Permissions'), 'url' => ['/rbac/permission/index'], 'active' => $controllerPath === '/rbac/permission'], ['label' => Yii::t('rbac-admin', 'Roles'), 'url' => ['/rbac/role/index'], 'active' => $controllerPath === '/rbac/role'], ['label' => Yii::t('rbac-admin', 'Routes'), 'url' => ['/rbac/route/index'], 'active' => $controllerPath === '/rbac/route'], ['label' => Yii::t('rbac-admin', 'Rules'), 'url' => ['/rbac/rule/index'], 'active' => $controllerPath === '/rbac/rule']]]]]);
?>



    </section>

</aside>

<?php 
//print_r(Yii::$app->i18n->translations);
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('configuration', 'ID'), 'param' => Module::t('configuration', 'Param'), 'value' => Module::t('configuration', 'Value'), 'default' => Module::t('configuration', 'Default value'), 'label' => Module::t('configuration', 'Parameter name'), 'type' => Module::t('configuration', 'Type')];
 }