OSDN Git Service

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