OSDN Git Service

Введена локализация всплывающих подсказок пагинатора.
[invent/invent.git] / config / web.php
1 <?php
2
3 use yii\helpers\Html;
4 use kartik\mpdf\Pdf;
5 //use yii\rbac\Role;
6
7 $params = require __DIR__ . '/params.php';
8 $db = require __DIR__ . '/db.php';
9
10 require_once __DIR__ . '/myfunctions.php';
11
12 $config = [
13     'version' => '1.31',
14     'name' => 'Inventory',
15     'id' => 'basic',
16     'basePath' => dirname(__DIR__),
17     'language' => 'ru-RU',
18     'bootstrap' => ['log'],
19     'aliases' => [
20         '@bower' => '@vendor/bower-asset',
21         '@npm'   => '@vendor/npm-asset',
22     ],
23     'components' => [
24         'request' => [
25             // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
26             'cookieValidationKey' => '4u6WczdipA-FIzbuf8PYgjoiid_6zdNy',
27         ],
28         'pdf' => [                                 // Формирование PDF по умолчанию
29             'mode' => Pdf::MODE_UTF8,              // Кодировка
30             'class' => Pdf::className(),
31             'format' => Pdf::FORMAT_A4,            // Лист А4
32             'orientation' => Pdf::ORIENT_PORTRAIT, // Напраление - по вертикали большая сторона
33             'destination' => Pdf::DEST_BROWSER,    // Результат показать в браузере
34             'cssFile' => '@vendor/kartik-v/yii2-mpdf/src/assets/kv-mpdf-bootstrap.min.css',
35             'cssInline' => '.kv-heading-1{font-size:18px}',
36             'methods' => [
37                 'SetHeader' => [Yii::t('app', Yii::$app->name)], // Верхний колонтитул
38                 'SetFooter' => ['{PAGENO}'],                     // Нижний колонтитул
39             ],
40             // refer settings section for all configuration options
41         ],
42
43         'cache' => [
44             'class' => 'yii\caching\FileCache',
45         ],
46
47         'user' => [
48             'identityClass' => 'app\models\User',
49             'enableAutoLogin' => true,
50         ],
51         // Авторизация пользователей из БД
52         'authManager' => [
53             'class' => 'yii\rbac\DbManager',
54             'defaultRoles' => [ 'admin', 'woker' ],
55         ], // */
56
57         'errorHandler' => [
58             'errorAction' => 'site/error',
59         ],
60
61         'mailer' => [
62             'class' => 'yii\swiftmailer\Mailer',
63             // send all mails to a file by default. You have to set
64             // 'useFileTransport' to false and configure a transport
65             // for the mailer to send real emails.
66             'useFileTransport' => false,
67         ],
68
69         'log' => [
70             'traceLevel' => YII_DEBUG ? 3 : 0,
71             'targets' => [
72                 [
73                     'class' => 'yii\log\FileTarget',
74                     'levels' => ['error', 'warning'],
75                 ],
76             ],
77         ],
78
79         'i18n' => [ // Переводы сообщений
80             'translations' => [
81                 '*' => [
82                     'class' => 'yii\i18n\PhpMessageSource',
83                     'sourceLanguage' => 'en-US',            // Исходный текст на английском
84                     'basePath' => '@app/messages',
85                     'fileMap' => [
86                         'app'       => 'app.php',           // Для приложения
87                         'app/error' => 'error.php',         // Для ошибок
88                         'contact'   => 'contact.php',       // Для обратной связи
89                         'import'    => 'import.php',        // Для импорта. Обозначение полей таблицы
90                         'items'     => 'items.php',         // Для предметов/оборудования
91                         'locations' => 'locations.php',     // Для мета расположения
92                         'models'    => 'models.php',        // Для моделей предметов/оборудования
93                         'moving'    => 'moving.php',        // Для перемещений
94                         'regions'   => 'regions.php',       // Для регионов/подразделений
95                         'status'    => 'status.php',        // Для состояний предметов/оборудования
96                         'types'     => 'types.php',         // Для типов предметов/оборудования
97                         'users'     => 'users.php',         // Для пользователей
98                     ],
99                 ],
100             ],
101         ],
102         'db' => $db,
103         /*
104         'urlManager' => [
105             'enablePrettyUrl' => true,
106             'showScriptName' => false,
107             'rules' => [
108             ],
109         ],
110         */
111     ],
112     'container' => [
113         'definitions' => [
114             'yii\widgets\LinkPager' => [
115                 'firstPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-fast-backward', 'title' => 'Первая страница', ]),
116                 'prevPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-backward', 'title' => 'Предыдущая страница', ]),
117                 'nextPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-forward', 'title' => 'Следующая страница', ]),
118                 'lastPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-fast-forward', 'title' => 'Последняя страница', ]),
119 //                'firstPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-fast-backward', 'title' => Yii::t('app', 'First page'), ]),
120 //                'prevPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-backward', 'title' => Yii::t('app', 'Previous page'), ]),
121 //                'nextPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-forward', 'title' => Yii::t('app', 'Next page'), ]),
122 //                'lastPageLabel' => Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-fast-forward', 'title' => Yii::t('app', 'Last page'), ]),
123             ],
124         ],
125     ],
126     'params' => $params,
127 ];
128
129 if (YII_ENV_DEV) {
130     // configuration adjustments for 'dev' environment
131     $config['bootstrap'][] = 'debug';
132     $config['modules']['debug'] = [
133         'class' => 'yii\debug\Module',
134         // uncomment the following to add your IP if you are not connecting from localhost.
135         'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.68', ],
136     ];
137
138     $config['bootstrap'][] = 'gii';
139     $config['modules']['gii'] = [
140         'class' => 'yii\gii\Module',
141         // uncomment the following to add your IP if you are not connecting from localhost.
142         'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.68'],
143     ];
144 }
145
146 return $config;