-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathModule.php
executable file
·119 lines (104 loc) · 2.88 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
namespace pceuropa\forms;
use Yii;
use yii\base\BootstrapInterface;
use yii\web\GroupUrlRule;
/**
* Module Yii2-forms
* FormBuilder module. All controllers and views in one place.
* @author Rafal Marguzewicz <[email protected]>
* @version 3.0.2
* @license MIT
* https://github.com/pceuropa/yii2-forum
* Please report all issues at GitHub
* https://github.com/pceuropa/yii2-forum/issues
*
*/
class Module extends \yii\base\Module{
/**
* @ingeritdoc
*/
public $controllerNamespace = 'pceuropa\forms\controllers';
/**
* @ingeritdoc
*/
public $defaultRoute = 'module';
/**
* @var string Default db connection
*/
public $db = 'db';
/**
* @var string The database table storing the forms
*/
public $formTable = '{{%forms}}';
/**
* @var string The database table storing the data from forms
*/
public $formDataTable = 'form_';
/**
* @var array the list of rights that are allowed to access this module.
* If you modify, you also need to enable authManager.
* http://www.yiiframework.com/doc-2.0/guide-security-authorization.html
* $rules = [
* [
* 'actions' => [ 'update', 'delete', 'clone' ],
* 'allow' => true,
* 'roles' => ['updateOwnForm'],
* ],
* [
* 'actions' => ['user', 'create'],
* 'allow' => true,
* 'roles' => ['user'],
* ]
* ];
*/
public $rules = [
[
'allow' => true,
'actions' => [],
'roles' => ['?'],
],[
'allow' => true,
'actions' => [],
'roles' => ['@'],
]
];
/**
* @var boolean If true after completing the form the message is sent
*/
public $sendEmail = false;
/**
* @var boolean If true turn on anty bot and check had human sent
*/
public $humanSendOnlyOne = false;
/**
* @var string The sender's address
*/
public $emailSender = null;
/**
* @var Boolean If true, you can see action buttons on index action
*/
public $buttonsEditOnIndex = false;
/**
* @var boolean if true, only necesaire options
*/
public $easyMode = true;
/**
* @var boolean if true, example form
*/
public $testMode = false;
public function init()
{
parent::init();
$this->registerTranslations();
}
public function registerTranslations()
{
Yii::$app->i18n->translations['builder'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => '@pceuropa/forms/messages',
'fileMap' => [ 'builder' => 'builder.php', ]
];
}
}