OSDN Git Service

075f5ee59fec883325fcad2ba594e0f395f95bae
[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.29',
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     'params' => $params,
113 ];
114
115 if (YII_ENV_DEV) {
116     // configuration adjustments for 'dev' environment
117     $config['bootstrap'][] = 'debug';
118     $config['modules']['debug'] = [
119         'class' => 'yii\debug\Module',
120         // uncomment the following to add your IP if you are not connecting from localhost.
121         'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.68', ],
122     ];
123
124     $config['bootstrap'][] = 'gii';
125     $config['modules']['gii'] = [
126         'class' => 'yii\gii\Module',
127         // uncomment the following to add your IP if you are not connecting from localhost.
128         'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.68'],
129     ];
130 }
131
132 return $config;